Merge bug 246014 from the aviary branch, splitting nsIXULChromeRegistry into a separate piece for seamonkey-only methods. Original Firefox patch r=bryner sr=ben seamonkey merge r+sr=jst

This commit is contained in:
bsmedberg%covad.net 2004-09-21 20:19:48 +00:00
Родитель de7ab69751
Коммит 9b824e5486
29 изменённых файлов: 656 добавлений и 1526 удалений

Просмотреть файл

@ -59,9 +59,6 @@ default: $(SUBMAKEFILES)
$(MAKE) tier_1
$(MAKE) tier_2
$(MAKE) tier_9
ifdef MOZ_PSM
$(MAKE) tier_40
endif
$(MAKE) tier_50
ifdef MOZ_JSDEBUGGER
$(MAKE) tier_93
@ -83,7 +80,6 @@ DIRS = \
$(tier_1_dirs) \
$(tier_2_dirs) \
$(tier_9_dirs) \
$(tier_40_dirs) \
$(tier_50_dirs) \
$(NULL)
@ -206,7 +202,6 @@ tier_9_dirs += \
xpfe/components/shistory \
docshell \
webshell \
profile \
embedding \
editor \
$(NULL)
@ -227,12 +222,8 @@ tier_9_dirs += other-licenses/branding/firefox
endif
endif
tier_9_dirs += \
xpfe/appshell \
xpfe/browser/public \
xpfe/components/sidebar/public \
xpfe/components/xremote/public \
$(NULL)
# profile and chrome should be in tier 50, but are required by xpfe/appshell
# This is a temporary hack until the app-startup patch lands.
ifdef MOZ_XUL
ifdef MOZ_XUL_APP
@ -242,6 +233,15 @@ tier_9_dirs += rdf/chrome
endif
endif
tier_9_dirs += profile
tier_9_dirs += \
xpfe/appshell \
xpfe/browser/public \
xpfe/components/sidebar/public \
xpfe/components/xremote/public \
$(NULL)
ifdef ACCESSIBILITY
tier_9_dirs += accessible
endif
@ -260,17 +260,14 @@ tier_9_dirs += toolkit/components/gnome
endif
endif
#
# tier 40 - security
#
ifdef MOZ_PSM
tier_40_dirs += security/manager
endif
#
# tier 50 - xpfe & toolkit
#
ifdef MOZ_PSM
tier_50_dirs += security/manager
endif
# This must preceed xpfe
ifdef MOZ_JPROF
tier_50_dirs += tools/jprof

Просмотреть файл

@ -479,6 +479,7 @@ rdf/base/idl/Makefile
rdf/base/public/Makefile
rdf/base/src/Makefile
rdf/chrome/Makefile
rdf/chrome/public/Makefile
rdf/chrome/build/Makefile
rdf/chrome/src/Makefile
rdf/chrome/tools/Makefile

Просмотреть файл

@ -63,6 +63,8 @@ REQUIRES = \
CPPSRCS = nsBrowserApp.cpp
LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
ifdef BUILD_STATIC_LIBS
STATIC_COMPONENTS_LINKER_PATH = -L$(DIST)/lib/components
endif

Просмотреть файл

@ -104,8 +104,8 @@ pref("update.extensions.count", 0);
pref("keyword.enabled", true);
pref("keyword.URL", "http://www.google.com/search?btnI=I%27m+Feeling+Lucky&ie=UTF-8&oe=UTF-8&q=");
pref("general.useragent.locale", "chrome://global/locale/intl.properties");
pref("general.useragent.contentlocale", "chrome://browser-region/locale/region.properties");
#expand pref("general.useragent.locale", "@AB_CD@");
pref("general.skins.selectedSkin", "classic/1.0");
pref("general.useragent.vendor", "Firefox");
pref("general.useragent.vendorSub",
#expand __APP_VERSION__

Просмотреть файл

@ -43,6 +43,7 @@ REQUIRES = xpcom \
gfx \
layout \
content \
locale \
necko \
dom \
widget \

Просмотреть файл

@ -591,8 +591,14 @@ nsChromeProtocolHandler::NewChannel(nsIURI* aURI,
}
nsCAutoString spec;
reg->ConvertChromeURL(aURI, spec);
if (NS_FAILED(rv)) return rv;
rv = reg->ConvertChromeURL(aURI, spec);
if (NS_FAILED(rv)) {
#ifdef DEBUG
aURI->GetSpec(spec);
printf("Couldn't convert chrome URL: %s\n", spec.get());
#endif
return rv;
}
nsCOMPtr<nsIIOService> ioServ(do_GetIOService(&rv));
if (NS_FAILED(rv)) return rv;
@ -605,15 +611,30 @@ nsChromeProtocolHandler::NewChannel(nsIURI* aURI,
if (NS_FAILED(rv)) return rv;
// XXX Will be removed someday when we handle remote chrome.
nsCOMPtr<nsIFileChannel> fileChan;
nsCOMPtr<nsIJARChannel> jarChan;
fileChan = do_QueryInterface(result);
if (!fileChan)
jarChan = do_QueryInterface(result);
if (!fileChan && !jarChan) {
NS_WARNING("Remote chrome not allowed! Only file:, resource:, and jar: are valid.\n");
result = nsnull;
return NS_ERROR_FAILURE;
nsCOMPtr<nsIFileChannel> fileChan
(do_QueryInterface(result));
if (fileChan) {
#ifdef DEBUG
nsCOMPtr<nsIFile> file;
fileChan->GetFile(getter_AddRefs(file));
PRBool exists = PR_FALSE;
file->Exists(&exists);
if (!exists) {
nsCAutoString path;
file->GetNativePath(path);
printf("Chrome file doesn't exist: %s\n", path.get());
}
#endif
}
else {
nsCOMPtr<nsIJARChannel> jarChan
(do_QueryInterface(result));
if (!jarChan) {
NS_WARNING("Remote chrome not allowed! Only file:, resource:, and jar: are valid.\n");
result = nsnull;
return NS_ERROR_FAILURE;
}
}
// Make sure that the channel remembers where it was

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -59,6 +59,7 @@ class nsIProperties;
#include "nsString.h"
#include "nsIZipReader.h"
#include "nsCOMArray.h"
#include "nsInterfaceHashtable.h"
// for component registration
// {47049e42-1d87-482a-984d-56ae185e367a}
@ -146,74 +147,18 @@ private:
const nsACString& aProvider,
nsACString& aBaseURL);
nsresult InitOverrideJAR();
nsresult GetOverrideURL(const nsACString& aPackage,
const nsACString& aProvider,
const nsACString& aPath,
nsACString& aResult);
nsresult VerifyCompatibleProvider(nsIRDFResource* aPackageResource,
nsIRDFResource* aProviderResource,
nsIRDFResource* aArc,
PRBool *aAcceptable);
nsresult FindProvider(const nsACString& aPackage,
const nsACString& aProvider,
nsIRDFResource *aArc,
nsIRDFNode **aSelectedProvider);
nsCOMPtr<nsIRDFResource> &aProviderResource,
nsCOMPtr<nsIRDFResource> &aPackageResource);
nsresult SelectPackageInProvider(nsIRDFResource *aPackageList,
const nsACString& aPackage,
const nsACString& aProvider,
const nsACString& aProviderName,
nsIRDFResource *aArc,
nsIRDFNode **aSelectedProvider);
nsresult TrySubProvider(const nsACString& aPackage, PRBool aIsLocale,
nsIRDFResource* aProviderResource,
nsCOMPtr<nsIRDFResource> &aSelectedProvider);
nsresult SetProvider(const nsACString& aProvider,
nsIRDFResource* aSelectionArc,
const nsACString& aProviderName,
PRBool aAllUsers,
const char *aProfilePath,
PRBool aIsAdding);
nsresult SetProviderForPackage(const nsACString& aProvider,
nsIRDFResource* aPackageResource,
nsIRDFResource* aProviderPackageResource,
nsIRDFResource* aSelectionArc,
PRBool aAllUsers, const char *aProfilePath,
PRBool aIsAdding);
nsresult SelectProviderForPackage(const nsACString& aProviderType,
const nsACString& aProviderName,
const PRUnichar *aPackageName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRBool aIsAdding);
nsresult GetSelectedProvider(const nsACString& aPackage,
const nsACString& aProviderName,
nsIRDFResource* aSelectionArc,
nsACString& aResult);
nsresult CheckProviderVersion (const nsACString& aProviderType,
const nsACString& aProviderName,
nsIRDFResource* aSelectionArc,
PRBool *aCompatible);
nsresult IsProviderSelected(const nsACString& aProvider,
const nsACString& aProviderName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRInt32* aResult);
nsresult IsProviderSelectedForPackage(const nsACString& aProviderType,
const nsACString& aProviderName,
const PRUnichar *aPackageName,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRBool* aResult);
nsresult IsProviderSetForPackage(const nsACString& aProvider,
nsIRDFResource* aPackageResource,
nsIRDFResource* aProviderPackageResource,
nsIRDFResource* aSelectionArc,
PRBool aUseProfile, PRBool* aResult);
nsresult FindSubProvider(const nsACString& aPackage,
const nsACString& aProvider,
nsCOMPtr<nsIRDFResource> &aSelectedProvider);
nsresult InstallProvider(const nsACString& aProviderType,
const nsACString& aBaseURL,
@ -239,9 +184,13 @@ protected:
nsIRDFService* mRDFService;
nsIRDFContainerUtils* mRDFContainerUtils;
nsCString mSelectedLocale;
nsCString mSelectedSkin;
nsInterfaceHashtable<nsCStringHashKey, nsIRDFResource> mSelectedLocales;
nsInterfaceHashtable<nsCStringHashKey, nsIRDFResource> mSelectedSkins;
// Resources
nsCOMPtr<nsIRDFResource> mSelectedSkin;
nsCOMPtr<nsIRDFResource> mSelectedLocale;
nsCOMPtr<nsIRDFResource> mBaseURL;
nsCOMPtr<nsIRDFResource> mPackages;
nsCOMPtr<nsIRDFResource> mPackage;
@ -251,26 +200,16 @@ protected:
nsCOMPtr<nsIRDFResource> mAllowScripts;
nsCOMPtr<nsIRDFResource> mHasOverlays;
nsCOMPtr<nsIRDFResource> mHasStylesheets;
nsCOMPtr<nsIRDFResource> mSkinVersion;
nsCOMPtr<nsIRDFResource> mLocaleVersion;
nsCOMPtr<nsIRDFResource> mPackageVersion;
nsCOMPtr<nsIRDFResource> mDisabled;
nsCOMPtr<nsIRDFResource> mPlatformPackage;
nsCOMPtr<nsIZipReader> mOverrideJAR;
nsCString mOverrideJARURL;
// useful atoms - these are static atoms, so don't use nsCOMPtr
static nsIAtom* sCPrefix; // "c"
PRPackedBool mInstallInitialized;
PRPackedBool mProfileInitialized;
PRPackedBool mRuntimeProvider;
// Boolean that indicates we should batch flushes of the main
// chrome.rdf file.
PRPackedBool mBatchInstallFlushes;
// make sure we only look once for the JAR override
PRPackedBool mSearchedForOverride;
};

Просмотреть файл

@ -23,6 +23,7 @@
* Contributor(s):
* pav
* Blake Ross (blaker@netscape.com)
* Benjamin Smedberg <bsmedberg@covad.net>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -39,10 +40,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
#include "nsIURL.idl"
#include "nsISimpleEnumerator.idl"
#include "nsISupportsArray.idl"
interface nsIDocShell;
interface nsIURI;
[scriptable, uuid(68389281-f6d0-4533-841d-344a2018140c)]
interface nsIChromeRegistry : nsISupports
@ -85,57 +83,13 @@ interface nsIChromeRegistry : nsISupports
void checkForNewChrome();
};
[scriptable, uuid(fd1ee2f8-0238-40b0-9b54-27cf810d9c86)]
interface nsIXULChromeRegistry : nsIChromeRegistry {
/* Applies a skin or locale to all possible packages */
void selectSkin(in ACString skinName, in boolean useProfile);
void selectLocale(in ACString localeName, in boolean useProfile);
void deselectSkin(in ACString skinName, in boolean useProfile);
void deselectLocale(in ACString localeName, in boolean useProfile);
PRInt32 isSkinSelected(in ACString skinName, in boolean useProfile);
PRInt32 isLocaleSelected(in ACString localeName, in boolean useProfile);
//Special additional APIs for locales and skin.
void selectLocaleForProfile(in ACString localeName, in wstring profilePath);
void selectSkinForProfile(in ACString skinName, in wstring profilePath);
[scriptable, uuid(a1208469-47cf-4776-9062-f8b431afb6fa)]
interface nsIXULChromeRegistry : nsIChromeRegistry
{
/* Should be called when locales change to reload all chrome (including XUL). */
void reloadChrome();
/* runtimeProvider == true: don't assert the runtime change */
void setRuntimeProvider(in boolean runtimeProvider);
boolean checkThemeVersion(in ACString skinName);
boolean checkLocaleVersion(in ACString localeName);
/* Apply skin/locale to a specific package */
void selectSkinForPackage(in ACString skinName,
in wstring packageName,
in boolean useProfile);
void selectLocaleForPackage(in ACString localeName,
in wstring packageName,
in boolean useProfile);
void deselectSkinForPackage(in ACString skinName,
in wstring packageName,
in boolean useProfile);
void deselectLocaleForPackage(in ACString localeName,
in wstring packageName,
in boolean useProfile);
boolean isSkinSelectedForPackage(in ACString skinName,
in wstring packageName,
in boolean useProfile);
boolean isLocaleSelectedForPackage(in ACString localeName,
in wstring packageName,
in boolean useProfile);
ACString getSelectedLocale(in ACString packageName);
ACString getSelectedSkin(in ACString packageName);
/* Should be called when skins change. Reloads only stylesheets. */
void refreshSkins();

Просмотреть файл

@ -39,6 +39,8 @@ pref("general.useragent.vendor", "Thunderbird");
pref("general.useragent.vendorSub",
#expand __APP_VERSION__
);
pref("general.useragent.locale", "en-US");
pref("general.skins.selectedSkin", "classic/1.0");
// This is this application's unique identifier used by the Extension System to identify
// this application as an extension target, and by the SmartUpdate system to identify
@ -145,7 +147,6 @@ pref("mail.checkDefaultNews", false);
/////////////////////////////////////////////////////////////////
// l12n and i18n
pref("general.useragent.locale", "chrome://global/locale/intl.properties");
pref("intl.charsetmenu.mailedit", "chrome://global/locale/intl.properties");
pref("intl.accept_languages", "chrome://global/locale/intl.properties");
// collationOption is only set on linux for japanese. see bug 18338 and 62015

Просмотреть файл

@ -60,6 +60,7 @@ REQUIRES = xpcom \
pref \
prefmigr \
appshell \
chrome \
uconv \
windowwatcher \
profdirserviceprovider \

Просмотреть файл

@ -76,7 +76,7 @@
#include "nsIDirectoryService.h"
#include "nsDirectoryServiceDefs.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsIChromeRegistry.h" // chromeReg
#include "nsIChromeRegistrySea.h"
#include "nsIStringBundle.h"
#include "nsIObserverService.h"
#include "nsHashtable.h"
@ -396,7 +396,7 @@ nsProfile::StartupWithArgs(nsICmdLineService *cmdLineArgs, PRBool canInteract)
}
gLocaleProfiles->Remove(&key);
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry =
nsCOMPtr<nsIChromeRegistrySea> chromeRegistry =
do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
@ -1674,7 +1674,7 @@ nsProfile::CreateNewProfileWithLocales(const PRUnichar* profileName,
rv = NS_GetSpecialDirectory(NS_APP_PROFILE_DEFAULTS_NLOC_50_DIR, getter_AddRefs(profDefaultsDir));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry =
nsCOMPtr<nsIChromeRegistrySea> chromeRegistry =
do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv)) {
@ -1695,7 +1695,7 @@ nsProfile::CreateNewProfileWithLocales(const PRUnichar* profileName,
// -UILocale and -contentLocale) by GetSelectedLocale() which
// is done in nsAppRunner.cpp::InstallGlobalLocale()
nsCOMPtr<nsIXULChromeRegistry> packageRegistry = do_QueryInterface(chromeRegistry);
nsCOMPtr<nsIChromeRegistrySea> packageRegistry = do_QueryInterface(chromeRegistry);
if ((!aUILocale || !aUILocale[0]) && packageRegistry) {
nsCAutoString currentUILocaleName;
rv = packageRegistry->GetSelectedLocale(NS_LITERAL_CSTRING("global"),
@ -2120,7 +2120,7 @@ nsProfile::DefineLocaleDefaultsDir()
rv = directoryService->Get(NS_APP_PROFILE_DEFAULTS_NLOC_50_DIR, NS_GET_IID(nsIFile), getter_AddRefs(localeDefaults));
if (NS_SUCCEEDED(rv))
{
nsCOMPtr<nsIXULChromeRegistry> packageRegistry =
nsCOMPtr<nsIChromeRegistrySea> packageRegistry =
do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv))
{

Просмотреть файл

@ -1,4 +1,3 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
@ -42,7 +41,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = src build tools
DIRS = public src build tools
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -0,0 +1,48 @@
# ***** 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 of 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
MODULE = chrome
XPIDLSRCS = nsIChromeRegistrySea.idl
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -0,0 +1,92 @@
/* -*- Mode: C++; tab-width: 2; 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 the Mozilla browser.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1999
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* pav
* Blake Ross (blaker@netscape.com)
* Benjamin Smedberg <bsmedberg@covad.net>
*
* Alternatively, the contents of this file may be used under the terms of
* either of 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 "nsISupports.idl"
#include "nsIChromeRegistry.idl"
[scriptable, uuid(ed47f6b3-8b7e-4dba-8cbd-d0560274ba4a)]
interface nsIChromeRegistrySea : nsIXULChromeRegistry
{
/* Applies a skin or locale to all possible packages */
void selectSkin(in ACString skinName, in boolean useProfile);
void selectLocale(in ACString localeName, in boolean useProfile);
void deselectSkin(in ACString skinName, in boolean useProfile);
void deselectLocale(in ACString localeName, in boolean useProfile);
PRInt32 isSkinSelected(in ACString skinName, in boolean useProfile);
PRInt32 isLocaleSelected(in ACString localeName, in boolean useProfile);
//Special additional APIs for locales and skin.
void selectLocaleForProfile(in ACString localeName, in wstring profilePath);
void selectSkinForProfile(in ACString skinName, in wstring profilePath);
/* runtimeProvider == true: don't assert the runtime change */
void setRuntimeProvider(in boolean runtimeProvider);
boolean checkThemeVersion(in ACString skinName);
boolean checkLocaleVersion(in ACString localeName);
/* Apply skin/locale to a specific package */
void selectSkinForPackage(in ACString skinName,
in wstring packageName,
in boolean useProfile);
void selectLocaleForPackage(in ACString localeName,
in wstring packageName,
in boolean useProfile);
void deselectSkinForPackage(in ACString skinName,
in wstring packageName,
in boolean useProfile);
void deselectLocaleForPackage(in ACString localeName,
in wstring packageName,
in boolean useProfile);
boolean isSkinSelectedForPackage(in ACString skinName,
in wstring packageName,
in boolean useProfile);
boolean isLocaleSelectedForPackage(in ACString localeName,
in wstring packageName,
in boolean useProfile);
ACString getSelectedSkin(in ACString packageName);
};

Просмотреть файл

@ -188,9 +188,10 @@ nsChromeRegistry::~nsChromeRegistry()
}
NS_IMPL_THREADSAFE_ISUPPORTS5(nsChromeRegistry,
NS_IMPL_THREADSAFE_ISUPPORTS6(nsChromeRegistry,
nsIChromeRegistry,
nsIXULChromeRegistry,
nsIChromeRegistrySea,
nsIXULOverlayProvider,
nsIObserver,
nsISupportsWeakReference)

Просмотреть файл

@ -50,6 +50,7 @@ class nsIDOMWindowInternal;
class nsIDocument;
#include "nsIChromeRegistry.h"
#include "nsIChromeRegistrySea.h"
#include "nsIXULOverlayProvider.h"
#include "nsIRDFCompositeDataSource.h"
#include "nsIObserver.h"
@ -63,7 +64,7 @@ class nsIDocument;
#define NS_CHROMEREGISTRY_CID \
{ 0xd8c7d8a2, 0xe84c, 0x11d2, { 0xbf, 0x87, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27 } }
class nsChromeRegistry : public nsIXULChromeRegistry,
class nsChromeRegistry : public nsIChromeRegistrySea,
public nsIXULOverlayProvider,
public nsIObserver,
public nsSupportsWeakReference
@ -75,6 +76,7 @@ public:
NS_DECL_NSICHROMEREGISTRY
NS_DECL_NSIXULCHROMEREGISTRY
NS_DECL_NSIXULOVERLAYPROVIDER
NS_DECL_NSICHROMEREGISTRYSEA
NS_DECL_NSIOBSERVER

Просмотреть файл

@ -93,9 +93,8 @@ function Startup()
.getService(Components.interfaces.nsIPrefBranch);
if (!isExtensions) {
gExtensionsView.addEventListener("richview-select", onThemeSelect, false);
var cr = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
.getService(Components.interfaces.nsIXULChromeRegistry);
gCurrentTheme = cr.getSelectedSkin("global");
gCurrentTheme = pref.getCharPref(PREF_GENERAL_SKINS_SELECTEDSKIN);
var useThemeButton = document.getElementById("useThemeButton");
useThemeButton.hidden = false;
@ -634,23 +633,14 @@ var gExtensionsViewController = {
cmd_useTheme: function (aSelectedItem)
{
var cr = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
.getService(Components.interfaces.nsIXULChromeRegistry);
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
gCurrentTheme = aSelectedItem.getAttribute("internalName");
var inUse = cr.isSkinSelected(gCurrentTheme , true);
if (inUse == Components.interfaces.nsIChromeRegistry.FULL)
return;
pref.setCharPref(PREF_GENERAL_SKINS_SELECTEDSKIN, gCurrentTheme);
// Set this pref so the user can reset the theme in safe mode
pref.setCharPref(PREF_EM_LAST_SELECTED_SKIN, gCurrentTheme);
cr.selectSkin(gCurrentTheme, true);
cr.refreshSkins();
pref.setCharPref(PREF_GENERAL_SKINS_SELECTEDSKIN, gCurrentTheme);
// disable the useThemeButton
gExtensionsViewController.onCommandUpdate();
},

Просмотреть файл

@ -70,8 +70,6 @@
#include "nsIEventQueueService.h"
#include "nsIExtensionManager.h"
#include "nsIIOService.h"
#include "nsILocaleService.h"
#include "nsILookAndFeel.h"
#include "nsIObserverService.h"
#include "nsINativeAppSupport.h"
#include "nsIPref.h"
@ -89,7 +87,6 @@
#include "nsCRT.h"
#include "nsCOMPtr.h"
#include "nsNetUtil.h"
#include "nsWidgetsCID.h"
#include "nsXPCOM.h"
#include "nsXPIDLString.h"
@ -145,9 +142,6 @@
#define DEBUG_CMD_LINE
#endif
#define UILOCALE_CMD_LINE_ARG "-UILocale"
#define CONTENTLOCALE_CMD_LINE_ARG "-contentLocale"
extern "C" void ShowOSAlert(const char* aMessage);
#define HELP_SPACER_1 "\t"
@ -769,100 +763,6 @@ DoCommandLines(nsICmdLineService* cmdLineArgs, PRBool heedGeneralStartupPrefs, P
return NS_OK;
}
// match OS locale
static char kMatchOSLocalePref[] = "intl.locale.matchOS";
nsresult
getCountry(const nsAString& lc_name, nsAString& aCountry)
{
nsresult result = NS_OK;
PRInt32 dash = lc_name.FindChar('-');
if (dash > 0)
aCountry = Substring(lc_name, dash+1, lc_name.Length()-dash);
else
result = NS_ERROR_FAILURE;
return result;
}
static nsresult
getUILangCountry(nsAString& aUILang, nsAString& aCountry)
{
nsresult result;
// get a locale service
nsCOMPtr<nsILocaleService> localeService = do_GetService(NS_LOCALESERVICE_CONTRACTID, &result);
NS_ASSERTION(NS_SUCCEEDED(result),"getUILangCountry: get locale service failed");
result = localeService->GetLocaleComponentForUserAgent(aUILang);
NS_ASSERTION(NS_SUCCEEDED(result),
"getUILangCountry: get locale componet for user agent failed");
result = getCountry(aUILang, aCountry);
return result;
}
// update global locale if possible (in case when user-*.rdf can be updated)
// so that any apps after this can be invoked in the UILocale and contentLocale
static nsresult InstallGlobalLocale(nsICmdLineService *cmdLineArgs)
{
nsresult rv = NS_OK;
// check the pref first
nsCOMPtr<nsIPref> prefService(do_GetService(NS_PREF_CONTRACTID));
PRBool matchOS = PR_FALSE;
if (prefService)
prefService->GetBoolPref(kMatchOSLocalePref, &matchOS);
// match os locale
nsAutoString uiLang;
nsAutoString country;
if (matchOS) {
// compute lang and region code only when needed!
rv = getUILangCountry(uiLang, country);
}
nsXPIDLCString cmdUI;
rv = cmdLineArgs->GetCmdLineValue(UILOCALE_CMD_LINE_ARG, getter_Copies(cmdUI));
if (NS_SUCCEEDED(rv)){
if (cmdUI) {
nsCAutoString UILocaleName(cmdUI);
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
if (chromeRegistry)
rv = chromeRegistry->SelectLocale(UILocaleName, PR_FALSE);
}
}
// match OS when no cmdline override
if (!cmdUI && matchOS) {
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
if (chromeRegistry) {
chromeRegistry->SetRuntimeProvider(PR_TRUE);
rv = chromeRegistry->SelectLocale(NS_ConvertUCS2toUTF8(uiLang), PR_FALSE);
}
}
nsXPIDLCString cmdContent;
rv = cmdLineArgs->GetCmdLineValue(CONTENTLOCALE_CMD_LINE_ARG, getter_Copies(cmdContent));
if (NS_SUCCEEDED(rv)){
if (cmdContent) {
nsCAutoString contentLocaleName(cmdContent);
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
if(chromeRegistry)
rv = chromeRegistry->SelectLocale(contentLocaleName, PR_FALSE);
}
}
// match OS when no cmdline override
if (!cmdContent && matchOS) {
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
if (chromeRegistry) {
chromeRegistry->SetRuntimeProvider(PR_TRUE);
rv = chromeRegistry->SelectLocale(NS_ConvertUCS2toUTF8(country), PR_FALSE);
}
}
return NS_OK;
}
// English text needs to go into a dtd file.
// But when this is called we have no components etc. These strings must either be
// here, or in a native resource file.
@ -958,7 +858,6 @@ public:
nsresult RegisterProfileService(nsIToolkitProfileService* aProfileService);
nsresult InitEventQueue();
nsresult SetWindowCreator(nsINativeAppSupport* native);
void CheckAccessibleSkin();
private:
nsIServiceManager* mServiceManager;
@ -1086,33 +985,6 @@ ScopedXPCOMStartup::SetWindowCreator(nsINativeAppSupport* native)
return wwatch->SetWindowCreator(creator);
}
NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
void
ScopedXPCOMStartup::CheckAccessibleSkin()
{
nsCOMPtr<nsILookAndFeel> lookAndFeel (do_GetService(kLookAndFeelCID));
if (lookAndFeel) {
PRInt32 useAccessibilityTheme = 0;
lookAndFeel->GetMetric(nsILookAndFeel::eMetric_UseAccessibilityTheme,
useAccessibilityTheme);
if (useAccessibilityTheme) {
// If OS accessibility is active, use the classic skin, which obeys the
// system accessibility colors.
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry
(do_GetService(NS_CHROMEREGISTRY_CONTRACTID));
if (chromeRegistry) {
// Make change this session only
chromeRegistry->SetRuntimeProvider(PR_TRUE);
chromeRegistry->SelectSkin(NS_LITERAL_CSTRING("classic/1.0"), PR_TRUE);
}
}
}
}
// don't modify aAppDir directly... clone it first
static int
VerifyInstallation(nsIFile* aAppDir)
@ -1429,8 +1301,6 @@ ShowProfileManager(nsIToolkitProfileService* aProfileSvc,
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
{ //extra scoping is needed so we release these components before xpcom shutdown
xpcom.CheckAccessibleSkin();
nsCOMPtr<nsIWindowWatcher> windowWatcher
(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
nsCOMPtr<nsIDialogParamBlock> ioParamBlock
@ -2036,8 +1906,6 @@ int xre_main(int argc, char* argv[], const nsXREAppData* aAppData)
io->SetOffline(PR_TRUE);
}
xpcom.CheckAccessibleSkin();
{
NS_TIMELINE_ENTER("startupNotifier");
nsCOMPtr<nsIObserver> startupNotifier
@ -2118,10 +1986,6 @@ int xre_main(int argc, char* argv[], const nsXREAppData* aAppData)
(do_GetService("@mozilla.org/appshell/commandLineService;1"));
NS_ENSURE_TRUE(cmdLineArgs, 1);
NS_TIMELINE_ENTER("InstallGlobalLocale");
InstallGlobalLocale(cmdLineArgs);
NS_TIMELINE_LEAVE("InstallGlobalLocale");
// This will go away once Components are handling there own commandlines
// if we have no command line arguments, we need to heed the
// "general.startup.*" prefs

Просмотреть файл

@ -87,6 +87,7 @@ REQUIRES = xpcom \
docshell \
locale \
profile \
chrome \
$(NULL)
# for jprof
REQUIRES += jprof

Просмотреть файл

@ -76,7 +76,7 @@
#include "nsICategoryManager.h"
#include "nsXPIDLString.h"
#include "nsIXULWindow.h"
#include "nsIChromeRegistry.h"
#include "nsIChromeRegistrySea.h"
#include "nsIEventQueueService.h"
#include "nsDirectoryServiceDefs.h"
#include "nsBuildID.h"
@ -868,14 +868,14 @@ static nsresult InstallGlobalLocale(nsICmdLineService *cmdLineArgs)
if (NS_SUCCEEDED(rv)){
if (cmdUI) {
nsCAutoString UILocaleName(cmdUI);
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
nsCOMPtr<nsIChromeRegistrySea> chromeRegistry = do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
if (chromeRegistry)
rv = chromeRegistry->SelectLocale(UILocaleName, PR_FALSE);
}
}
// match OS when no cmdline override
if (!cmdUI && matchOS) {
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
nsCOMPtr<nsIChromeRegistrySea> chromeRegistry = do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
if (chromeRegistry) {
chromeRegistry->SetRuntimeProvider(PR_TRUE);
rv = chromeRegistry->SelectLocale(NS_ConvertUCS2toUTF8(uiLang), PR_FALSE);
@ -887,14 +887,14 @@ static nsresult InstallGlobalLocale(nsICmdLineService *cmdLineArgs)
if (NS_SUCCEEDED(rv)){
if (cmdContent) {
nsCAutoString contentLocaleName(cmdContent);
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
nsCOMPtr<nsIChromeRegistrySea> chromeRegistry = do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
if(chromeRegistry)
rv = chromeRegistry->SelectLocale(contentLocaleName, PR_FALSE);
}
}
// match OS when no cmdline override
if (!cmdContent && matchOS) {
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
nsCOMPtr<nsIChromeRegistrySea> chromeRegistry = do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
if (chromeRegistry) {
chromeRegistry->SetRuntimeProvider(PR_TRUE);
rv = chromeRegistry->SelectLocale(NS_ConvertUCS2toUTF8(country), PR_FALSE);
@ -918,7 +918,7 @@ static void CheckUseAccessibleSkin()
if (useAccessibilityTheme) {
// Use classic skin, it obeys the system's accessibility theme
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService(NS_CHROMEREGISTRY_CONTRACTID);
nsCOMPtr<nsIChromeRegistrySea> chromeRegistry = do_GetService(NS_CHROMEREGISTRY_CONTRACTID);
if (chromeRegistry) {
chromeRegistry->SetRuntimeProvider(PR_TRUE); // The skin change isn't permanent
chromeRegistry->SelectSkin(NS_LITERAL_CSTRING("classic/1.0"), PR_TRUE);

Просмотреть файл

@ -1875,7 +1875,7 @@ function applyTheme(themeName)
return;
var chromeRegistry = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
.getService(Components.interfaces.nsIXULChromeRegistry);
.getService(Components.interfaces.nsIChromeRegistrySea);
var oldTheme = false;
try {
@ -2342,7 +2342,7 @@ function checkTheme()
{
var theSkinKids = document.getElementById("theme");
var chromeRegistry = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
.getService(Components.interfaces.nsIXULChromeRegistry);
.getService(Components.interfaces.nsIChromeRegistrySea);
for (var i = 0; i < theSkinKids.childNodes.length; ++i) {
var child = theSkinKids.childNodes[i];
var id=child.getAttribute("id");

Просмотреть файл

@ -98,7 +98,7 @@ nsPrefWindow.prototype =
try
{
this.pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch(null);
this.chromeRegistry = Components.classes["@mozilla.org/chrome/chrome-registry;1"].getService(Components.interfaces.nsIXULChromeRegistry);
this.chromeRegistry = Components.classes["@mozilla.org/chrome/chrome-registry;1"].getService(Components.interfaces.nsIChromeRegistrySea);
this.observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
}
catch(e)

Просмотреть файл

@ -44,9 +44,8 @@ var gShowDescription = true;
var gData;
try {
var chromeRegistry = Components.classes["@mozilla.org/chrome/chrome-registry;1"].getService();
if (chromeRegistry)
chromeRegistry = chromeRegistry.QueryInterface(Components.interfaces.nsIXULChromeRegistry);
var chromeRegistry = Components.classes["@mozilla.org/chrome/chrome-registry;1"].
getService(Components.interfaces.nsIChromeRegistrySea);
}
catch(e) {}
@ -108,9 +107,8 @@ function applySkin()
if (theme == data.name) return;
try {
var reg = Components.classes["@mozilla.org/chrome/chrome-registry;1"].getService();
if (reg)
reg = reg.QueryInterface(Components.interfaces.nsIXULChromeRegistry);
var reg = Components.classes["@mozilla.org/chrome/chrome-registry;1"].
getService(Components.interfaces.nsIChromeRegistrySea);
}
catch(e) {}

Просмотреть файл

@ -88,6 +88,7 @@ bin/components/appshell.dll
bin/components/appcomps.dll
bin/components/autocomplete.xpt
bin/components/bookmarks.xpt
bin/components/chrome.xpt
bin/components/directory.xpt
bin/components/downloadmanager.xpt
;bin/components/embedcomponents.dll

Просмотреть файл

@ -96,6 +96,7 @@ bin/components/search.xpt
bin/components/autocomplete.xpt
bin/components/appshell.xpt
bin/components/caps.xpt
bin/components/chrome.xpt
bin/components/cookie.xpt
bin/components/libjsd.so
bin/components/jsdservice.xpt

Просмотреть файл

@ -79,6 +79,7 @@ bin\components\autocomplete.xpt
bin\components\bookmarks.xpt
bin\components\directory.xpt
bin\components\downloadmanager.xpt
bin\components\chrome.xpt
; These 3 files need to be in browser.xpi as well as xpcom.xpi (listed in xpcom-win.pkg)
bin\nspr4.dll

Просмотреть файл

@ -79,6 +79,7 @@ REQUIRES = xpcom \
docshell \
cookie \
layout \
chrome \
$(ZLIB_REQUIRES) \
$(NULL)

Просмотреть файл

@ -71,6 +71,10 @@
#include "nsIJAR.h"
#include "nsIPrincipal.h"
#ifndef MOZ_XUL_APP
#include "nsIChromeRegistrySea.h"
#endif
static NS_DEFINE_CID(kSoftwareUpdateCID, NS_SoftwareUpdate_CID);
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
@ -606,6 +610,9 @@ extern "C" void RunChromeInstallOnThread(void *data)
// make sure we've got a chrome registry -- can't proceed if not
nsIXULChromeRegistry* reg = info->GetChromeRegistry();
#ifndef MOZ_XUL_APP
nsCOMPtr<nsIChromeRegistrySea> cr = do_QueryInterface(reg);
#endif
if (reg)
{
// build up jar: URL
@ -636,21 +643,27 @@ extern "C" void RunChromeInstallOnThread(void *data)
if ( isSkin )
{
rv = reg->InstallSkin(spec.get(), PR_TRUE, PR_FALSE);
if (NS_SUCCEEDED(rv) && selected)
{
NS_ConvertUCS2toUTF8 utf8Args(info->GetArguments());
rv = reg->SelectSkin(utf8Args, PR_TRUE);
}
#ifndef MOZ_XUL_APP
if (NS_SUCCEEDED(rv) && selected && cr)
{
NS_ConvertUCS2toUTF8 utf8Args(info->GetArguments());
cr->SelectSkin(utf8Args, PR_TRUE);
}
#endif
}
if ( isLocale )
{
rv = reg->InstallLocale(spec.get(), PR_TRUE);
if (NS_SUCCEEDED(rv) && selected)
#ifndef MOZ_XUL_APP
if (NS_SUCCEEDED(rv) && selected && cr)
{
NS_ConvertUCS2toUTF8 utf8Args(info->GetArguments());
rv = reg->SelectLocale(utf8Args, PR_TRUE);
cr->SelectLocale(utf8Args, PR_TRUE);
}
#endif
}
// now that all types are registered try to activate