From 8b1e01966a2a93258729f8d7080eb386009a0077 Mon Sep 17 00:00:00 2001 From: "dougt%meer.net" Date: Fri, 5 Aug 2005 00:02:24 +0000 Subject: [PATCH] Moving (without cvs history) of Minimo to mozilla/minimo. CVS history, if required, can be found in mozilla/embedding/minimo/. Creation of top level directory approved by brendan. MINIMO isn't part of default build git-svn-id: svn://10.0.0.236/trunk@177145 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/minimo/Makefile.in | 46 ++ mozilla/minimo/base/Makefile.in | 130 +++++ mozilla/minimo/base/Minimo.cpp | 405 ++++++++++++++++ mozilla/minimo/base/MinimoPrivate.h | 94 ++++ mozilla/minimo/base/SplashScreen.cpp | 144 ++++++ mozilla/minimo/base/WindowCreator.cpp | 102 ++++ mozilla/minimo/base/WindowCreator.h | 57 +++ mozilla/minimo/base/minimo-link-comps | 32 ++ mozilla/minimo/base/minimo-link-libs | 4 + mozilla/minimo/base/minimo-link-names | 32 ++ mozilla/minimo/base/nsConsoleWriter.cpp | 118 +++++ mozilla/minimo/base/version.txt | 1 + mozilla/minimo/base/wince/SplashScreen.rc | 13 + mozilla/minimo/base/wince/newres.h | 41 ++ mozilla/minimo/base/wince/resource.h | 41 ++ mozilla/minimo/base/wince/splashscreen.bmp | Bin 0 -> 47446 bytes mozilla/minimo/chrome/Makefile.in | 47 ++ mozilla/minimo/chrome/content/contents.rdf | 17 + mozilla/minimo/chrome/content/minimo.js | 292 +++++++++++ mozilla/minimo/chrome/content/minimo.xul | 96 ++++ mozilla/minimo/chrome/jar.mn | 14 + .../minimo/chrome/locale/en-US/contents.rdf | 23 + mozilla/minimo/chrome/locale/en-US/jar.mn | 0 mozilla/minimo/chrome/locale/en-US/minimo.dtd | 21 + mozilla/minimo/chrome/manifest.rdf | 48 ++ mozilla/minimo/chrome/skin/back.gif | Bin 0 -> 868 bytes mozilla/minimo/chrome/skin/contents.rdf | 22 + mozilla/minimo/chrome/skin/forward.gif | Bin 0 -> 845 bytes mozilla/minimo/chrome/skin/m.jpg | Bin 0 -> 2594 bytes mozilla/minimo/chrome/skin/minimo.css | 104 ++++ mozilla/minimo/chrome/skin/reload.gif | Bin 0 -> 844 bytes mozilla/minimo/chrome/skin/stop.gif | Bin 0 -> 843 bytes mozilla/minimo/chrome/skin/transfer.gif | Bin 0 -> 124 bytes mozilla/minimo/components/Makefile.in | 46 ++ mozilla/minimo/components/phone/Makefile.in | 69 +++ .../components/phone/nsIPhoneSupport.idl | 61 +++ .../components/phone/nsPhoneSupport.cpp | 229 +++++++++ mozilla/minimo/components/softkb/Makefile.in | 76 +++ .../components/softkb/nsSoftKeyBoard.cpp | 452 ++++++++++++++++++ mozilla/minimo/components/ssr/Makefile.in | 45 ++ mozilla/minimo/components/ssr/smallScreen.css | 84 ++++ mozilla/minimo/config/mozconfig/linux_x86 | 22 + mozilla/minimo/config/mozconfig/ppc2003arm | 35 ++ mozilla/minimo/config/mozconfig/ppc2003emu | 36 ++ mozilla/minimo/config/wince_package.sh | 129 +++++ mozilla/minimo/customization/Makefile.in | 44 ++ mozilla/minimo/customization/all.js | 156 ++++++ 47 files changed, 3428 insertions(+) create mode 100755 mozilla/minimo/Makefile.in create mode 100755 mozilla/minimo/base/Makefile.in create mode 100755 mozilla/minimo/base/Minimo.cpp create mode 100755 mozilla/minimo/base/MinimoPrivate.h create mode 100755 mozilla/minimo/base/SplashScreen.cpp create mode 100755 mozilla/minimo/base/WindowCreator.cpp create mode 100755 mozilla/minimo/base/WindowCreator.h create mode 100755 mozilla/minimo/base/minimo-link-comps create mode 100755 mozilla/minimo/base/minimo-link-libs create mode 100755 mozilla/minimo/base/minimo-link-names create mode 100755 mozilla/minimo/base/nsConsoleWriter.cpp create mode 100755 mozilla/minimo/base/version.txt create mode 100755 mozilla/minimo/base/wince/SplashScreen.rc create mode 100755 mozilla/minimo/base/wince/newres.h create mode 100755 mozilla/minimo/base/wince/resource.h create mode 100755 mozilla/minimo/base/wince/splashscreen.bmp create mode 100755 mozilla/minimo/chrome/Makefile.in create mode 100755 mozilla/minimo/chrome/content/contents.rdf create mode 100755 mozilla/minimo/chrome/content/minimo.js create mode 100755 mozilla/minimo/chrome/content/minimo.xul create mode 100755 mozilla/minimo/chrome/jar.mn create mode 100755 mozilla/minimo/chrome/locale/en-US/contents.rdf create mode 100755 mozilla/minimo/chrome/locale/en-US/jar.mn create mode 100755 mozilla/minimo/chrome/locale/en-US/minimo.dtd create mode 100755 mozilla/minimo/chrome/manifest.rdf create mode 100755 mozilla/minimo/chrome/skin/back.gif create mode 100755 mozilla/minimo/chrome/skin/contents.rdf create mode 100755 mozilla/minimo/chrome/skin/forward.gif create mode 100755 mozilla/minimo/chrome/skin/m.jpg create mode 100755 mozilla/minimo/chrome/skin/minimo.css create mode 100755 mozilla/minimo/chrome/skin/reload.gif create mode 100755 mozilla/minimo/chrome/skin/stop.gif create mode 100755 mozilla/minimo/chrome/skin/transfer.gif create mode 100755 mozilla/minimo/components/Makefile.in create mode 100755 mozilla/minimo/components/phone/Makefile.in create mode 100755 mozilla/minimo/components/phone/nsIPhoneSupport.idl create mode 100755 mozilla/minimo/components/phone/nsPhoneSupport.cpp create mode 100755 mozilla/minimo/components/softkb/Makefile.in create mode 100755 mozilla/minimo/components/softkb/nsSoftKeyBoard.cpp create mode 100755 mozilla/minimo/components/ssr/Makefile.in create mode 100755 mozilla/minimo/components/ssr/smallScreen.css create mode 100755 mozilla/minimo/config/mozconfig/linux_x86 create mode 100755 mozilla/minimo/config/mozconfig/ppc2003arm create mode 100755 mozilla/minimo/config/mozconfig/ppc2003emu create mode 100755 mozilla/minimo/config/wince_package.sh create mode 100755 mozilla/minimo/customization/Makefile.in create mode 100755 mozilla/minimo/customization/all.js diff --git a/mozilla/minimo/Makefile.in b/mozilla/minimo/Makefile.in new file mode 100755 index 00000000000..7736a6f4820 --- /dev/null +++ b/mozilla/minimo/Makefile.in @@ -0,0 +1,46 @@ +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is Minimo. +# +# The Initial Developer of the Original Code is +# Doug Turner . +# Portions created by the Initial Developer are Copyright (C) 2005 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = .. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +DIRS = components chrome customization base + +include $(topsrcdir)/config/rules.mk diff --git a/mozilla/minimo/base/Makefile.in b/mozilla/minimo/base/Makefile.in new file mode 100755 index 00000000000..0cec039e1b0 --- /dev/null +++ b/mozilla/minimo/base/Makefile.in @@ -0,0 +1,130 @@ +# ***** BEGIN LICENSE BLOCK ***** +# Version: Mozilla-sample-code 1.0 +# +# Copyright (c) 2002 Netscape Communications Corporation and +# other contributors +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this Mozilla sample software and associated documentation files +# (the "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to permit +# persons to whom the Software is furnished to do so, subject to the +# following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +# Contributor(s): +# +# ***** END LICENSE BLOCK ***** + +DEPTH = ../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MOZILLA_INTERNAL_API = 1 + +PROGRAM = minimo$(BIN_SUFFIX) + +MODULE = minimo + +REQUIRES = xpcom \ + appshell \ + string \ + embed_base \ + webbrwsr \ + webshell \ + windowwatcher \ + profile \ + necko \ + docshell \ + dom \ + widget \ + uriloader \ + shistory \ + webbrowserpersist \ + gfx \ + layout \ + content \ + profdirserviceprovider \ + pref \ + embedcomponents \ + appcomps \ + phone \ + $(NULL) + +CPPSRCS = \ + winEmbed.cpp \ + WindowCreator.cpp \ + SplashScreen.cpp \ + nsConsoleWriter.cpp \ + $(NULL) + + +# this should move into the toolkit! +CPPSRCS += nsBrowserStatusFilter.cpp + +RCINCLUDE = SplashScreen.rc + +EXTRA_DSO_LIBS = embed_base_s profdirserviceprovider_s + +LIBS = \ + $(EXTRA_DSO_LIBS) \ + $(MOZ_UNICHARUTIL_LIBS) \ + $(XPCOM_LIBS) \ + $(NSPR_LIBS) \ + $(MOZ_JS_LIBS) \ + $(NULL) + +LOCAL_INCLUDES = -I$(srcdir) -I$(topsrcdir)/xpfe/browser/src/ + +include $(topsrcdir)/config/config.mk + +ifdef WINCE +OS_LIBS += $(call EXPAND_LIBNAME, aygshell cellcore) +endif + +ifdef BUILD_STATIC_LIBS + +FINAL_LINK_COMPS=$(topsrcdir)/embedding/minimo/wince/minimo-link-comps +FINAL_LINK_COMP_NAMES=$(topsrcdir)/embedding/minimo/wince/minimo-link-names +FINAL_LINK_LIBS=$(topsrcdir)/embedding/minimo/wince/minimo-link-libs + +include $(topsrcdir)/config/static-config.mk + +EXTRA_DEPS += $(STATIC_EXTRA_DEPS) +EXTRA_DSO_LIBS += $(STATIC_EXTRA_DSO_LIBS) +EXTRA_LIBS += $(EXTRA_DSO_LIBS) $(STATIC_EXTRA_LIBS) +DEFINES += $(STATIC_DEFINES) +CPPSRCS += $(STATIC_CPPSRCS) + +endif # BUILD_STATIC_LIBS + + +include $(topsrcdir)/config/rules.mk + +ifdef BUILD_STATIC_LIBS + +include $(topsrcdir)/config/static-rules.mk + +endif # BUILD_STATIC_LIBS + +export:: + $(NSINSTALL) $(topsrcdir)/xpfe/browser/src/nsBrowserStatusFilter.cpp . + +GARBAGE += nsBrowserStatusFilter.cpp + +installer:: + bash $(srcdir)/package.sh $(MOZ_BUILD_ROOT) $(srcdir) diff --git a/mozilla/minimo/base/Minimo.cpp b/mozilla/minimo/base/Minimo.cpp new file mode 100755 index 00000000000..1d99120f47b --- /dev/null +++ b/mozilla/minimo/base/Minimo.cpp @@ -0,0 +1,405 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Minimo. + * + * The Initial Developer of the Original Code is + * Doug Turner . + * Portions created by the Initial Developer are Copyright (C) 2005 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "MinimoPrivate.h" + +#ifdef _BUILD_STATIC_BIN +#include "nsStaticComponents.h" +#endif + +// Global variables +const static char* start_url = "chrome://minimo/content/minimo.xul"; +//const static char* start_url = "http://www.meer.net/~dougt/test.html"; +//const static char* start_url = "resource://gre/res/start.html"; + +PRBool gDumpJSConsole = PR_FALSE; + +static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); +static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID); + + +class nsBrowserStatusFilterFactory : public nsIFactory +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_NSIFACTORY + + nsBrowserStatusFilterFactory(); + ~nsBrowserStatusFilterFactory() { } +}; + +nsBrowserStatusFilterFactory::nsBrowserStatusFilterFactory() +{ +} + +NS_IMPL_ISUPPORTS1(nsBrowserStatusFilterFactory, nsIFactory) + +NS_IMETHODIMP +nsBrowserStatusFilterFactory::CreateInstance(nsISupports* aOuter, + const nsIID& aIID, + void* *aResult) +{ + NS_ENSURE_NO_AGGREGATION(aOuter); + + nsBrowserStatusFilter* filter = new nsBrowserStatusFilter(); + if (!filter) + return NS_ERROR_OUT_OF_MEMORY; + + nsresult rv = filter->QueryInterface(aIID, aResult); + + if (NS_FAILED(rv)) + delete filter; + + return rv; +} + +NS_IMETHODIMP +nsBrowserStatusFilterFactory::LockFactory(PRBool) +{ + return NS_OK; +} + +class ApplicationObserver: public nsIObserver +{ +public: + ApplicationObserver(nsIAppShell* aAppShell); + ~ApplicationObserver(); + + NS_DECL_ISUPPORTS + NS_DECL_NSIOBSERVER + + nsCOMPtr mAppShell; + int mWindowCount; +}; + + +ApplicationObserver::ApplicationObserver(nsIAppShell* aAppShell) +{ + mAppShell = aAppShell; + mWindowCount = 0; + + nsCOMPtr os = do_GetService("@mozilla.org/observer-service;1"); + + + os->AddObserver(this, "nsIEventQueueActivated", PR_FALSE); + os->AddObserver(this, "nsIEventQueueDestroyed", PR_FALSE); + + os->AddObserver(this, "xul-window-registered", PR_FALSE); + os->AddObserver(this, "xul-window-destroyed", PR_FALSE); + os->AddObserver(this, "xul-window-visible", PR_FALSE); +} + +ApplicationObserver::~ApplicationObserver() +{ +} + +NS_IMPL_ISUPPORTS1(ApplicationObserver, nsIObserver) + +NS_IMETHODIMP +ApplicationObserver::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData) +{ + if (!strcmp(aTopic, "nsIEventQueueActivated")) + { + nsCOMPtr eq(do_QueryInterface(aSubject)); + if (eq) + { + PRBool isNative = PR_TRUE; + // we only add native event queues to the appshell + eq->IsQueueNative(&isNative); + if (isNative) + mAppShell->ListenToEventQueue(eq, PR_TRUE); + } + } + else if (!strcmp(aTopic, "nsIEventQueueDestroyed")) + { + nsCOMPtr eq(do_QueryInterface(aSubject)); + if (eq) + { + PRBool isNative = PR_TRUE; + // we only remove native event queues from the appshell + eq->IsQueueNative(&isNative); + if (isNative) + mAppShell->ListenToEventQueue(eq, PR_FALSE); + } + } + else if (!strcmp(aTopic, "xul-window-visible")) + { + KillSplashScreen(); + } + + else if (!strcmp(aTopic, "xul-window-registered")) + { + mWindowCount++; + } + else if (!strcmp(aTopic, "xul-window-destroyed")) + { + mWindowCount--; + if (mWindowCount == 0) + mAppShell->Exit(); + } + + return NS_OK; +} + +nsresult StartupProfile() +{ + NS_TIMELINE_MARK_FUNCTION("Profile Startup"); + + nsCOMPtr appDataDir; + nsresult rv = NS_GetSpecialDirectory(NS_APP_APPLICATION_REGISTRY_DIR, getter_AddRefs(appDataDir)); + if (NS_FAILED(rv)) + return rv; + + rv = appDataDir->Append(NS_LITERAL_STRING("minimo")); + if (NS_FAILED(rv)) + return rv; + + nsCOMPtr localAppDataDir(do_QueryInterface(appDataDir)); + + nsCOMPtr locProvider; + NS_NewProfileDirServiceProvider(PR_TRUE, getter_AddRefs(locProvider)); + if (!locProvider) + return NS_ERROR_FAILURE; + + rv = locProvider->Register(); + if (NS_FAILED(rv)) + return rv; + + return locProvider->SetProfileDir(localAppDataDir); +} + +void DoPreferences() +{ + nsCOMPtr prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID); + if (!prefBranch) + return; + + prefBranch->SetIntPref("snav.keyCode.modifier", 0); + prefBranch->GetBoolPref("config.wince.dumpJSConsole", &gDumpJSConsole); +} + +void OverrideComponents() +{ + static NS_DEFINE_CID(kBrowserStatusFilter, NS_BROWSERSTATUSFILTER_CID); + + nsCOMPtr registrar; + NS_GetComponentRegistrar(getter_AddRefs(registrar)); + + nsBrowserStatusFilterFactory* factory = new nsBrowserStatusFilterFactory(); + + if (!factory) + return; + + if (registrar) + registrar->RegisterFactory(kBrowserStatusFilter, + NS_BROWSERSTATUSFILTER_CLASSNAME, + NS_BROWSERSTATUSFILTER_CONTRACTID, + factory); +} + +#ifdef WINCE +typedef struct FindAppStruct +{ + HWND hwnd; +} FindAppStruct; + +BOOL CALLBACK FindApplicationWindowProc(HWND hwnd, LPARAM lParam) +{ + FindAppStruct* findApp = (FindAppStruct*) lParam; + + unsigned short windowName[MAX_PATH]; + GetWindowTextW(hwnd, windowName, MAX_PATH); + + if (wcsstr(windowName, L"Minimo")) + { + findApp->hwnd = hwnd; + return FALSE; + } + return TRUE; +} + +PRBool DoesProcessAlreadyExist() +{ + const HANDLE hMutex = CreateMutexW(0, 0, L"_MINIMO_EXE_MUTEX_"); + + if(hMutex) + { + if(ERROR_ALREADY_EXISTS == GetLastError()) + { + FindAppStruct findApp; + findApp.hwnd = NULL; + + EnumWindows(FindApplicationWindowProc, (LPARAM)&findApp); + + if (findApp.hwnd) + { + SetForegroundWindow(findApp.hwnd); + return TRUE; + } + + MessageBox(0, "Minimo is running, but can't be switched to.", "Unexpected Error", 0); + return TRUE; + } + return FALSE; + } + MessageBox(0, "Can not start Minimo", "Unexpected Error", 0); + return TRUE; +} +#else +PRBool DoesProcessAlreadyExist() {return PR_FALSE;} +#endif + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Complete hack below. We to ensure that the layout of all + * of the shared libaries are at tightly packed as possible. + * We do this by explictly loading all of the modules we + * know about at compile time. This seams to work for our + * purposes. Ultimately, we should statically link all of + * these libraries. + * + * If you are building this to put on a ROM where XIP exists. + * + * For more information: + * 1) http://msdn.microsoft.com/library/default.asp?url=/ \ + library/en-us/dncenet/html/advmemmgmt.asp + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#ifdef WINCE +#define HACKY_PRE_LOAD_LIBRARY 1 +#endif + +#ifdef HACKY_PRE_LOAD_LIBRARY +typedef struct _library +{ + const unsigned short* name; + HMODULE module; +} _library; + +_library Libraries[] = +{ + { L"js3250.dll", NULL }, + { L"nspr4.dll", NULL }, + { L"nss3.dll", NULL }, + { L"nssckbi.dll", NULL }, + { L"plc4.dll", NULL }, + { L"plds4.dll", NULL }, + { L"shunt.dll", NULL }, + { L"smime3.dll", NULL }, + { L"softokn3.dll", NULL }, + { L"ssl3.dll", NULL }, + { L"xpcom.dll", NULL }, + { L"xpcom_core.dll", NULL }, + { NULL, NULL }, +}; + +void LoadKnownLibs() +{ + for (int i=0; Libraries[i].name; i++) + Libraries[i].module = LoadLibraryW(Libraries[i].name); +} + +void UnloadKnownLibs() +{ + for (int i=0; Libraries[i].name; i++) + if (Libraries[i].module) + FreeLibrary(Libraries[i].module); +} +#endif // HACKY_PRE_LOAD_LIBRARY + +int main(int argc, char *argv[]) +{ + if (DoesProcessAlreadyExist()) + return 0; + + CreateSplashScreen(); + +#ifdef HACKY_PRE_LOAD_LIBRARY + LoadKnownLibs(); +#endif + +#ifdef _BUILD_STATIC_BIN + NS_InitEmbedding(nsnull, nsnull, kPStaticModules, kStaticModuleCount); +#else + NS_InitEmbedding(nsnull, nsnull); +#endif + // Choose the new profile + if (NS_FAILED(StartupProfile())) + return 1; + + DoPreferences(); + OverrideComponents(); + + NS_TIMELINE_ENTER("appStartup"); + nsCOMPtr appShell = do_CreateInstance(kAppShellCID); + appShell->Create(nsnull, nsnull); + + ApplicationObserver *appObserver = new ApplicationObserver(appShell); + if (!appObserver) + return 1; + NS_ADDREF(appObserver); + + WindowCreator *creatorCallback = new WindowCreator(appShell); + if (!creatorCallback) + return 1; + + nsCOMPtr wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID)); + wwatch->SetWindowCreator(creatorCallback); + + nsCOMPtr newWindow; + wwatch->OpenWindow(nsnull, start_url, "_blank", "chrome,dialog=no,all", nsnull, getter_AddRefs(newWindow)); + + appShell->Run(); + + appShell = nsnull; + wwatch = nsnull; + newWindow = nsnull; + + delete appObserver; + delete creatorCallback; + + if (gDumpJSConsole) + WriteConsoleLog(); + + // Close down Embedding APIs + NS_TermEmbedding(); + +#ifdef HACKY_PRE_LOAD_LIBRARY + UnloadKnownLibs(); +#endif + return NS_OK; +} diff --git a/mozilla/minimo/base/MinimoPrivate.h b/mozilla/minimo/base/MinimoPrivate.h new file mode 100755 index 00000000000..7b3b4bd67a0 --- /dev/null +++ b/mozilla/minimo/base/MinimoPrivate.h @@ -0,0 +1,94 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Minimo. + * + * The Initial Developer of the Original Code is + * Doug Turner . + * Portions created by the Initial Developer are Copyright (C) 2005 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef MINIMO_PRIVATE_H +#define MINIMO_PRIVATE_H + +// C RunTime Header Files +#include +#include +#include +#include + +// Mozilla header files +#include "nsAppDirectoryServiceDefs.h" +#include "nsAppShellCID.h" +#include "nsDirectoryService.h" +#include "nsDirectoryServiceDefs.h" +#include "nsEmbedAPI.h" +#include "nsEmbedCID.h" +#include "nsIAppShell.h" +#include "nsIAppShellService.h" +#include "nsIAppStartupNotifier.h" +#include "nsIClipboardCommands.h" +#include "nsIComponentRegistrar.h" +#include "nsIDOMWindow.h" +#include "nsIEventQueueService.h" +#include "nsIInterfaceRequestor.h" +#include "nsIInterfaceRequestorUtils.h" +#include "nsIObserver.h" +#include "nsIObserverService.h" +#include "nsIPrefBranch.h" +#include "nsIPrefService.h" +#include "nsIPromptService.h" +#include "nsITimelineService.h" +#include "nsIURI.h" +#include "nsIWebBrowserChrome.h" +#include "nsIWebBrowserFocus.h" +#include "nsIWebBrowserPersist.h" +#include "nsIWidget.h" +#include "nsIWindowCreator.h" +#include "nsIWindowCreator2.h" +#include "nsIWindowWatcher.h" +#include "nsIXULWindow.h" +#include "nsProfileDirServiceProvider.h" +#include "nsWidgetsCID.h" +#include "nsXPIDLString.h" +#include "plstr.h" + +// Local header files +#include "WindowCreator.h" + +void CreateSplashScreen(); +void KillSplashScreen(); +void GetScreenSize(unsigned long* x, unsigned long* y); + +void WriteConsoleLog(); + + +#include "nsBrowserStatusFilter.h" + +#endif // MINIMO_PRIVATE_H diff --git a/mozilla/minimo/base/SplashScreen.cpp b/mozilla/minimo/base/SplashScreen.cpp new file mode 100755 index 00000000000..0fb01c02d86 --- /dev/null +++ b/mozilla/minimo/base/SplashScreen.cpp @@ -0,0 +1,144 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Minimo. + * + * The Initial Developer of the Original Code is + * Doug Turner . + * Portions created by the Initial Developer are Copyright (C) 2005 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "MinimoPrivate.h" + +#ifdef WINCE +#include "resource.h" + +static HWND gSplashScreenDialog = NULL; + +BOOL CALLBACK +SplashScreenDialogProc( HWND dlg, UINT msg, WPARAM wp, LPARAM lp ) +{ + if ( msg == WM_INITDIALOG ) + { + SetWindowText(dlg, "Minimo"); + + gSplashScreenDialog = dlg; + + HWND bitmapControl = GetDlgItem( dlg, IDC_SPLASHBMP ); + if ( bitmapControl ) + { + HBITMAP hbitmap = (HBITMAP)SendMessage( bitmapControl, + STM_GETIMAGE, + IMAGE_BITMAP, + 0 ); + if ( hbitmap ) + { + BITMAP bitmap; + if ( GetObject( hbitmap, sizeof bitmap, &bitmap ) ) + { + SetWindowPos( dlg, + NULL, + GetSystemMetrics(SM_CXSCREEN)/2 - bitmap.bmWidth/2, + GetSystemMetrics(SM_CYSCREEN)/2 - bitmap.bmHeight/2, + bitmap.bmWidth, + bitmap.bmHeight, + SWP_NOZORDER ); + ShowWindow( dlg, SW_SHOW ); + } + } + } + return 1; + } + else if (msg == WM_CLOSE) + { + NS_TIMELINE_MARK_FUNCTION("SplashScreenDialogProc Close"); + + EndDialog(dlg, 0); + gSplashScreenDialog = NULL; + } + return 0; +} + +DWORD WINAPI SplashScreenThreadProc(LPVOID notused) +{ + DialogBoxParamW( GetModuleHandle( 0 ), + MAKEINTRESOURCE( IDD_SPLASHSCREEN ), + HWND_DESKTOP, + (DLGPROC)SplashScreenDialogProc, + NULL ); + + return 0; +} + +void KillSplashScreen() +{ + NS_TIMELINE_MARK_FUNCTION("KillSplashScreen"); + + if (gSplashScreenDialog) + { + EndDialog((HWND)gSplashScreenDialog, 0); + gSplashScreenDialog = NULL; + } +} + +void CreateSplashScreen() +{ + NS_TIMELINE_MARK_FUNCTION("CreateSplashScreen"); + + DWORD threadID; + HANDLE handle = CreateThread( 0, + 0, + (LPTHREAD_START_ROUTINE)SplashScreenThreadProc, + 0, + 0, + &threadID ); + CloseHandle(handle); +} + + +void GetScreenSize(unsigned long* x, unsigned long* y) +{ + RECT workarea; + SystemParametersInfo(SPI_GETWORKAREA, 0, &workarea, 0); + + *x = workarea.right - workarea.left; + *y = workarea.bottom - workarea.top; +} + +#else + +void CreateSplashScreen() {} +void KillSplashScreen() {} +void GetScreenSize(unsigned long* x, unsigned long* y) +{ + *x = *y = 0; +} + + +#endif // WINCE diff --git a/mozilla/minimo/base/WindowCreator.cpp b/mozilla/minimo/base/WindowCreator.cpp new file mode 100755 index 00000000000..987c789d378 --- /dev/null +++ b/mozilla/minimo/base/WindowCreator.cpp @@ -0,0 +1,102 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Minimo. + * + * The Initial Developer of the Original Code is + * Doug Turner . + * Portions created by the Initial Developer are Copyright (C) 2005 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + + +#include "MinimoPrivate.h" + +NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID); + +WindowCreator::WindowCreator(nsIAppShell* aAppShell) +{ + mAppShell = aAppShell; +} + +WindowCreator::~WindowCreator() +{ +} + +NS_IMPL_ISUPPORTS2(WindowCreator, nsIWindowCreator, nsIWindowCreator2) +NS_IMETHODIMP +WindowCreator::CreateChromeWindow(nsIWebBrowserChrome *aParent, + PRUint32 aChromeFlags, + nsIWebBrowserChrome **_retval) +{ + PRBool cancel; + return CreateChromeWindow2(aParent, aChromeFlags, 0, 0, &cancel, _retval); +} + +NS_IMETHODIMP +WindowCreator::CreateChromeWindow2(nsIWebBrowserChrome *aParent, + PRUint32 aChromeFlags, + PRUint32 aContextFlags, + nsIURI *aURI, + PRBool *aCancel, + nsIWebBrowserChrome **aNewWindow) +{ + *aCancel = PR_FALSE; + + if (!mAppShell) + return NS_ERROR_NOT_INITIALIZED; + + nsCOMPtr newWindow; + + nsCOMPtr appShell(do_GetService(NS_APPSHELLSERVICE_CONTRACTID)); + if (!appShell) + return NS_ERROR_FAILURE; + + nsCOMPtr xulParent(do_GetInterface(aParent)); + + unsigned long x, y; + GetScreenSize(&x, &y); + + appShell->CreateTopLevelWindow(xulParent, + 0, + aChromeFlags, + x, + y, + mAppShell, + getter_AddRefs(newWindow)); + + // if anybody gave us anything to work with, use it + if (newWindow) { + newWindow->SetContextFlags(aContextFlags); + nsCOMPtr thing(do_QueryInterface(newWindow)); + if (thing) + CallGetInterface(thing.get(), aNewWindow); + } + + return *aNewWindow ? NS_OK : NS_ERROR_FAILURE; +} diff --git a/mozilla/minimo/base/WindowCreator.h b/mozilla/minimo/base/WindowCreator.h new file mode 100755 index 00000000000..e5a20f0619e --- /dev/null +++ b/mozilla/minimo/base/WindowCreator.h @@ -0,0 +1,57 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Minimo. + * + * The Initial Developer of the Original Code is + * Doug Turner . + * Portions created by the Initial Developer are Copyright (C) 2005 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef __WindowCreator_h_ +#define __WindowCreator_h_ + +#include "MinimoPrivate.h" + +class WindowCreator : public nsIWindowCreator2 +{ +public: + WindowCreator(nsIAppShell* aAppShell); + virtual ~WindowCreator(); + + NS_DECL_ISUPPORTS + NS_DECL_NSIWINDOWCREATOR + NS_DECL_NSIWINDOWCREATOR2 + + nsCOMPtr mAppShell; + +}; + +#endif + diff --git a/mozilla/minimo/base/minimo-link-comps b/mozilla/minimo/base/minimo-link-comps new file mode 100755 index 00000000000..7b3b1ccf7d3 --- /dev/null +++ b/mozilla/minimo/base/minimo-link-comps @@ -0,0 +1,32 @@ +xpconect +mozuconv +i18n +necko +jar50 +rdf +pref +caps +gkparser +gkgfxwin +imglib2 +gkwidget +gklayout +docshell +embedcmp +webbrwsr +texteditor +txmgr +appshell +chrome +mork +tkitcmps +xmlextra +t8iix +websrvcs +gkplugin +softkey +pipboot +pipnss +pippki +phone +snav diff --git a/mozilla/minimo/base/minimo-link-libs b/mozilla/minimo/base/minimo-link-libs new file mode 100755 index 00000000000..e50c7885cd9 --- /dev/null +++ b/mozilla/minimo/base/minimo-link-libs @@ -0,0 +1,4 @@ +unicharutil_s +ucvutil_s +gfxshared_s +gkgfx diff --git a/mozilla/minimo/base/minimo-link-names b/mozilla/minimo/base/minimo-link-names new file mode 100755 index 00000000000..729e39ccdd7 --- /dev/null +++ b/mozilla/minimo/base/minimo-link-names @@ -0,0 +1,32 @@ +xpconnect +nsUConvModule +nsI18nModule +necko_core_and_primary_protocols +nsJarModule +nsPrefModule +nsSecurityManagerModule +nsRDFModule +nsParserModule +nsGfxModule +nsImageLib2Module +nsPluginModule +nsWidgetModule +nsLayoutModule +docshell_provider +embedcomponents +Browser_Embedding_Module +nsEditorModule +nsTransactionManagerModule +appshell +nsChromeModule +nsMorkModule +nsToolkitCompsModule +nsXMLExtrasModule +TransformiixModule +nsWebServicesModule +SoftKeyBoardModule +BOOT +NSS +PKI +nsPhoneSupportModule +SpatialNavigationModule diff --git a/mozilla/minimo/base/nsConsoleWriter.cpp b/mozilla/minimo/base/nsConsoleWriter.cpp new file mode 100755 index 00000000000..89c666677c2 --- /dev/null +++ b/mozilla/minimo/base/nsConsoleWriter.cpp @@ -0,0 +1,118 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Mozilla Toolkit. + * + * The Initial Developer of the Original Code is + * Benjamin Smedberg + * Portions created by the Initial Developer are Copyright (C) 2005 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "prio.h" +#include "prprf.h" +#include "prtime.h" +#include "prenv.h" + +#include "nsCOMPtr.h" +#include "nsCRT.h" +#include "nsNativeCharsetUtils.h" +#include "nsString.h" +#include "nsILocalFile.h" +#include "nsIConsoleService.h" +#include "nsIConsoleMessage.h" + +#include "nsDirectoryServiceDefs.h" +#include "nsDirectoryServiceUtils.h" + +void +WriteConsoleLog() +{ + nsresult rv; + + nsCOMPtr file; + NS_GetSpecialDirectory(NS_OS_CURRENT_PROCESS_DIR, getter_AddRefs(file)); + + if (!file) + return; + + file->Append(NS_LITERAL_STRING("jsconsole.log")); + + nsCOMPtr lfile = do_QueryInterface(file); + + PRFileDesc *fdesc; + rv = lfile->OpenNSPRFileDesc(PR_WRONLY | PR_APPEND | PR_CREATE_FILE, 0660, &fdesc); + if (NS_FAILED(rv)) + return; + + nsCOMPtr csrv + (do_GetService(NS_CONSOLESERVICE_CONTRACTID)); + if (!csrv) { + PR_Close(fdesc); + return; + } + + nsIConsoleMessage** messages; + PRUint32 mcount; + + rv = csrv->GetMessageArray(&messages, &mcount); + if (NS_FAILED(rv)) { + PR_Close(fdesc); + return; + } + + if (mcount) { + PRExplodedTime etime; + PR_ExplodeTime(PR_Now(), PR_LocalTimeParameters, &etime); + char datetime[512]; + PR_FormatTimeUSEnglish(datetime, sizeof(datetime), + "%Y-%m-%d %H:%M:%S", &etime); + + PR_fprintf(fdesc, NS_LINEBREAK + "*** Console log: %s ***" NS_LINEBREAK, + datetime); + } + + // From this point on, we have to release all the messages, and free + // the memory allocated for the messages array. XPCOM arrays suck. + + nsXPIDLString msg; + nsCAutoString nativemsg; + + for (PRUint32 i = 0; i < mcount; ++i) { + rv = messages[i]->GetMessage(getter_Copies(msg)); + if (NS_SUCCEEDED(rv)) { + NS_CopyUnicodeToNative(msg, nativemsg); + PR_fprintf(fdesc, "%s" NS_LINEBREAK, nativemsg.get()); + } + NS_IF_RELEASE(messages[i]); + } + + PR_Close(fdesc); + NS_Free(messages); +} diff --git a/mozilla/minimo/base/version.txt b/mozilla/minimo/base/version.txt new file mode 100755 index 00000000000..072ae17b27c --- /dev/null +++ b/mozilla/minimo/base/version.txt @@ -0,0 +1 @@ +0.007 diff --git a/mozilla/minimo/base/wince/SplashScreen.rc b/mozilla/minimo/base/wince/SplashScreen.rc new file mode 100755 index 00000000000..daa69d37a5c --- /dev/null +++ b/mozilla/minimo/base/wince/SplashScreen.rc @@ -0,0 +1,13 @@ + +#include "resource.h" +#include "newres.h" + +IDD_SPLASHSCREEN DIALOG DISCARDABLE 0, 0, 31, 27 +STYLE DS_MODALFRAME | WS_POPUP +FONT 8, "System" +BEGIN + CONTROL 104,IDC_SPLASHBMP,"Static",SS_BITMAP,7,7,15,13 +END + + +IDB_BITMAP1 BITMAP DISCARDABLE "splashscreen.bmp" diff --git a/mozilla/minimo/base/wince/newres.h b/mozilla/minimo/base/wince/newres.h new file mode 100755 index 00000000000..8289ebe2d12 --- /dev/null +++ b/mozilla/minimo/base/wince/newres.h @@ -0,0 +1,41 @@ +#ifndef __NEWRES_H__ +#define __NEWRES_H__ + +#if !defined(UNDER_CE) +#define UNDER_CE _WIN32_WCE +#endif + +#if defined(_WIN32_WCE) + #if !defined(WCEOLE_ENABLE_DIALOGEX) + #define DIALOGEX DIALOG DISCARDABLE + #endif + #include + #define SHMENUBAR RCDATA + #if defined(WIN32_PLATFORM_PSPC) && (_WIN32_WCE >= 300) + #include + #define AFXCE_IDR_SCRATCH_SHMENU 28700 + #else + #define I_IMAGENONE (-2) + #define NOMENU 0xFFFF + #define IDS_SHNEW 1 + + #define IDM_SHAREDNEW 10 + #define IDM_SHAREDNEWDEFAULT 11 + #endif // _WIN32_WCE_PSPC + #define AFXCE_IDD_SAVEMODIFIEDDLG 28701 +#endif // _WIN32_WCE + +#ifdef RC_INVOKED +#ifndef _INC_WINDOWS +#define _INC_WINDOWS + #include "winuser.h" // extract from windows header + #include "winver.h" +#endif +#endif + +#ifdef IDC_STATIC +#undef IDC_STATIC +#endif +#define IDC_STATIC (-1) + +#endif //__NEWRES_H__ diff --git a/mozilla/minimo/base/wince/resource.h b/mozilla/minimo/base/wince/resource.h new file mode 100755 index 00000000000..aceff79f745 --- /dev/null +++ b/mozilla/minimo/base/wince/resource.h @@ -0,0 +1,41 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Minimo. + * + * The Initial Developer of the Original Code is + * Doug Turner . + * Portions created by the Initial Developer are Copyright (C) 2005 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + + +#define IDD_SPLASHSCREEN 101 +#define IDB_BITMAP1 104 +#define IDC_SPLASHBMP 1001 + diff --git a/mozilla/minimo/base/wince/splashscreen.bmp b/mozilla/minimo/base/wince/splashscreen.bmp new file mode 100755 index 0000000000000000000000000000000000000000..11f51712c10b184648e33271874eda525729c595 GIT binary patch literal 47446 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 literal 0 HcmV?d00001 diff --git a/mozilla/minimo/chrome/Makefile.in b/mozilla/minimo/chrome/Makefile.in new file mode 100755 index 00000000000..60f1294f9df --- /dev/null +++ b/mozilla/minimo/chrome/Makefile.in @@ -0,0 +1,47 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the Mozilla browser. +# +# The Initial Developer of the Original Code is +# Doug Turner +# Portions created by the Initial Developer are Copyright (C) 2005 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Doug Turner +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = ../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +include $(topsrcdir)/config/rules.mk + diff --git a/mozilla/minimo/chrome/content/contents.rdf b/mozilla/minimo/chrome/content/contents.rdf new file mode 100755 index 00000000000..01f5ae4a5ba --- /dev/null +++ b/mozilla/minimo/chrome/content/contents.rdf @@ -0,0 +1,17 @@ + + + + + + + + + + + + + diff --git a/mozilla/minimo/chrome/content/minimo.js b/mozilla/minimo/chrome/content/minimo.js new file mode 100755 index 00000000000..86ebe044a3d --- /dev/null +++ b/mozilla/minimo/chrome/content/minimo.js @@ -0,0 +1,292 @@ +/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +const nsIWebNavigation = Components.interfaces.nsIWebNavigation; +const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener; + +var gURLBar = null; +var gBrowserStatusHandlerArray=new Array(); +var gtabCounter=0; +var gBrowserStatusHandler; +var gSelectedTab=null; + +function nsBrowserStatusHandler() +{ +} + +nsBrowserStatusHandler.prototype = +{ + QueryInterface : function(aIID) + { + if (aIID.equals(Components.interfaces.nsIWebProgressListener) || + aIID.equals(Components.interfaces.nsISupportsWeakReference) || + aIID.equals(Components.interfaces.nsISupports)) + { + return this; + } + throw Components.results.NS_NOINTERFACE; + }, + + init : function() + { + this.urlBar = document.getElementById("urlbar"); + this.statusbarText = document.getElementById("statusbar-text"); + this.stopreloadButton = document.getElementById("reload-stop-button"); + this.statusbar = document.getElementById("statusbar"); + }, + + destroy : function() + { + this.urlBar = null; + this.statusbarText = null; + this.stopreloadButton = null; + this.statusbar = null; + }, + + onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus) + { + + if (aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) + { + + if (aStateFlags & nsIWebProgressListener.STATE_START) + { + this.stopreloadButton.className = "stop-button"; + this.stopreloadButton.onClick = "BrowserStop()"; + this.statusbar.hidden = false; + return; + } + + if (aStateFlags & nsIWebProgressListener.STATE_STOP) + { + /* To be fixed. We dont want to directly access sytle from here */ + document.styleSheets[1].cssRules[0].style.backgroundPosition="1000px 100%"; + + this.stopreloadButton.className = "reload-button"; + this.stopreloadButton.onClick = "BrowserReload()"; + + this.statusbar.hidden = true; + this.statusbarText.label = ""; + return; + } + return; + } + + if (aStateFlags & nsIWebProgressListener.STATE_IS_DOCUMENT) + { + if (aStateFlags & nsIWebProgressListener.STATE_START) + { + return; + } + + if (aStateFlags & nsIWebProgressListener.STATE_STOP) + { + return; + } + return; + } + }, + + onProgressChange : function(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress) + { + var percentage = parseInt((aCurTotalProgress * 100) / aMaxTotalProgress); + document.styleSheets[1].cssRules[0].style.backgroundPosition=percentage+"px 100%"; + + }, + onLocationChange : function(aWebProgress, aRequest, aLocation) + { + domWindow = aWebProgress.DOMWindow; + // Update urlbar only if there was a load on the root docshell + if (domWindow == domWindow.top) { + this.urlBar.value = aLocation.spec; + } + this.refTab.setAttribute("lastLocation",aLocation.spec); + }, + + onStatusChange : function(aWebProgress, aRequest, aStatus, aMessage) + { + this.statusbarText.label = aMessage; + }, + + onSecurityChange : function(aWebProgress, aRequest, aState) + { + } +} + +/** + * Initial Minimo Startup + * + **/ + +/* moved this as global */ + + +function MiniNavStartup() +{ + + gURLBar = document.getElementById("urlbar"); + var currentTab=getBrowser().selectedTab; + browserInit(currentTab); + gSelectedTab=currentTab; + loadURI("http://www.google.com"); + +} + +/** + * Init stuff + * + **/ +function browserInit(refTab) +{ + + var BrowserStatusHandler = new nsBrowserStatusHandler(); + + BrowserStatusHandler.init(); + BrowserStatusHandler.refTab=refTab; // WARNING (was refTab); + + try { + + getBrowser().addProgressListener(BrowserStatusHandler, Components.interfaces.nsIWebProgress.NOTIFY_ALL); + gBrowserStatusHandlerArray.push(BrowserStatusHandler); + var refBrowser=getBrowser().getBrowserForTab(refTab); + var webNavigation=refBrowser.webNavigation; + webNavigation.sessionHistory = Components.classes["@mozilla.org/browser/shistory;1"].createInstance(Components.interfaces.nsISHistory); + } catch (e) { + alert("Error trying to startup browser. Please report this as a bug:\n" + e); + } + + try { + refBrowser.markupDocumentViewer.textZoom = .75; + } catch (e) {} + gURLBar = document.getElementById("urlbar"); + +} + +function MiniNavShutdown() +{ + if (gBrowserStatusHandler) gBrowserStatusHandler.destroy(); +} + +function getBrowser() +{ + return document.getElementById("content"); +} + +function getWebNavigation() +{ + return getBrowser().webNavigation; +} + +function loadURI(uri) +{ + getWebNavigation().loadURI(uri, nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null); +} + +function BrowserLoadURL() +{ + try { + loadURI(gURLBar.value); + } + catch(e) { + } +} + +function BrowserBack() +{ + getWebNavigation().goBack(); +} + +function BrowserForward() +{ + getWebNavigation().goForward(); +} + +function BrowserStop() +{ + getWebNavigation().stop(nsIWebNavigation.STOP_ALL); +} + +function BrowserReload() +{ + getWebNavigation().reload(nsIWebNavigation.LOAD_FLAGS_NONE); +} + +function BrowserAddTab() { + + + var thisTab=getBrowser().addTab("http://taboca.com"); + + browserInit(thisTab); +} + +function BrowserOpenTab() +{ + try { + getBrowser().selectedTab = getBrowser().addTab('about:blank'); + browserInit(getBrowser().selectedTab); + } catch (e) { + alert(e); + } + // if (gURLBar) setTimeout(function() { gURLBar.focus(); }, 0); + +} + +/** + * Work-in-progress, this handler is 100% generic and gets all the clicks for the entire tabbed + * content area. Need to fix with the approach where we handler only clicks for the actual tab. + * Need to fix to also handle the key action case. + **/ +function tabbrowserAreaClick(e) { + + // When the click happens, + // updates the location bar with the lastLocation for the given selectedTab. + // Note that currently the lastLocation is stored in the DOM for the selectedTab. + + gSelectedTab=getBrowser().selectedTab; + gURLBar.value=gSelectedTab.getAttribute("lastLocation"); + document.styleSheets[1].cssRules[0].style.backgroundPosition="1000px 100%"; + +} + + +/** + * urlbar indentity, style, progress indicator. + **/ +function urlbar() { + + +} diff --git a/mozilla/minimo/chrome/content/minimo.xul b/mozilla/minimo/chrome/content/minimo.xul new file mode 100755 index 00000000000..c0e282f807d --- /dev/null +++ b/mozilla/minimo/chrome/content/minimo.xul @@ -0,0 +1,96 @@ + + + + + + + + + +%brandDTD; + +%minimoDTD; +]> + + + +