more prep for bug 119923 - use chrome registry ContractID rather than CID, so that we can drop in a new embedding-only chrome registry

r=bnesse, sr=dveditz, a=asa
This commit is contained in:
alecf%netscape.com 2002-07-23 23:30:04 +00:00
Родитель 64aeed153c
Коммит eb04da966b
15 изменённых файлов: 57 добавлений и 44 удалений

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

@ -157,9 +157,6 @@ interface nsIXULChromeRegistry : nsIChromeRegistry {
%{ C++
// for component registration
// {D8C7D8A2-E84C-11d2-BF87-00105A1B0627}
#define NS_CHROMEREGISTRY_CID \
{ 0xd8c7d8a2, 0xe84c, 0x11d2, { 0xbf, 0x87, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27 } }
#define NS_CHROMEREGISTRY_CONTRACTID \
"@mozilla.org/chrome/chrome-registry;1"
%}

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

@ -54,7 +54,7 @@ static const nsModuleComponentInfo components[] =
{
{ "Chrome Registry",
NS_CHROMEREGISTRY_CID,
"@mozilla.org/chrome/chrome-registry;1",
NS_CHROMEREGISTRY_CONTRACTID,
nsChromeRegistryConstructor
},

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

@ -72,7 +72,6 @@
//----------------------------------------------------------------------
static NS_DEFINE_CID(kChromeRegistryCID, NS_CHROMEREGISTRY_CID);
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
static NS_DEFINE_CID(kStandardURLCID, NS_STANDARDURL_CID);
@ -593,7 +592,7 @@ nsChromeProtocolHandler::NewChannel(nsIURI* aURI,
// Canonify the "chrome:" URL; e.g., so that we collapse
// "chrome://navigator/content/navigator.xul" and "chrome://navigator/content"
// and "chrome://navigator/content/navigator.xul".
nsCOMPtr<nsIChromeRegistry> reg(do_GetService(kChromeRegistryCID, &rv));
nsCOMPtr<nsIChromeRegistry> reg(do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv));
if (NS_FAILED(rv)) return rv;
rv = reg->Canonify(aURI);

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

@ -54,6 +54,12 @@ class nsIDocument;
#include "nsWeakReference.h"
#include "nsString.h"
// for component registration
// {D8C7D8A2-E84C-11d2-BF87-00105A1B0627}
#define NS_CHROMEREGISTRY_CID \
{ 0xd8c7d8a2, 0xe84c, 0x11d2, { 0xbf, 0x87, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27 } }
class nsChromeRegistry : public nsIXULChromeRegistry,
public nsIObserver,
public nsSupportsWeakReference

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

@ -355,8 +355,6 @@ static PRBool IsChromeOrResourceURI(nsIURI* aURI)
/* Implementation file */
NS_IMPL_ISUPPORTS3(nsXBLDocumentInfo, nsIXBLDocumentInfo, nsIScriptGlobalObjectOwner, nsISupportsWeakReference)
static NS_DEFINE_CID(kChromeRegistryCID, NS_CHROMEREGISTRY_CID);
nsXBLDocumentInfo::nsXBLDocumentInfo(const char* aDocURI, nsIDocument* aDocument)
{
NS_INIT_ISUPPORTS();
@ -370,7 +368,7 @@ nsXBLDocumentInfo::nsXBLDocumentInfo(const char* aDocURI, nsIDocument* aDocument
mDocument->GetDocumentURL(getter_AddRefs(uri));
if (IsChromeOrResourceURI(uri)) {
// Cache whether or not this chrome XBL can execute scripts.
nsCOMPtr<nsIXULChromeRegistry> reg(do_GetService(kChromeRegistryCID));
nsCOMPtr<nsIXULChromeRegistry> reg(do_GetService(NS_CHROMEREGISTRY_CONTRACTID));
if (reg) {
PRBool allow = PR_TRUE;
reg->AllowScriptsForSkin(uri, &allow);

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

@ -168,7 +168,6 @@
//
static NS_DEFINE_CID(kCSSLoaderCID, NS_CSS_LOADER_CID);
static NS_DEFINE_CID(kChromeRegistryCID, NS_CHROMEREGISTRY_CID);
static NS_DEFINE_CID(kEventListenerManagerCID, NS_EVENTLISTENERMANAGER_CID);
static NS_DEFINE_CID(kHTMLCSSStyleSheetCID, NS_HTML_CSS_STYLESHEET_CID);
static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID);
@ -1752,7 +1751,8 @@ nsXULDocument::EndLoad()
IsChromeURI(uri))
gXULCache->WritePrototype(mCurrentPrototype);
nsCOMPtr<nsIXULChromeRegistry> reg(do_GetService(kChromeRegistryCID, &rv));
nsCOMPtr<nsIXULChromeRegistry> reg =
do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsISupportsArray> sheets;
@ -5380,7 +5380,7 @@ nsresult
nsXULDocument::AddChromeOverlays()
{
nsresult rv;
nsCOMPtr<nsIXULChromeRegistry> reg(do_GetService(kChromeRegistryCID, &rv));
nsCOMPtr<nsIXULChromeRegistry> reg(do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv));
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;

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

@ -132,7 +132,6 @@ static NS_DEFINE_CID(kHTMLEditorCID, NS_HTMLEDITOR_CID);
static NS_DEFINE_CID(kCTextServicesDocumentCID, NS_TEXTSERVICESDOCUMENT_CID);
static NS_DEFINE_CID(kCStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
static NS_DEFINE_CID(kChromeRegistryCID, NS_CHROMEREGISTRY_CID);
#define APP_DEBUG 0
@ -3798,7 +3797,7 @@ nsEditorShell::InitSpellChecker()
}
nsCOMPtr<nsIXULChromeRegistry> packageRegistry =
do_GetService(kChromeRegistryCID, &result);
do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &result);
if (NS_SUCCEEDED(result) && packageRegistry)
result = packageRegistry->GetSelectedLocale(NS_LITERAL_STRING("navigator").get(), &dictName);

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

@ -79,6 +79,7 @@
#include "nsIObserverService.h"
#include "nsISupportsPrimitives.h"
#include "nsHashtable.h"
#include "nsIAtom.h"
// Interfaces Needed
#include "nsIDocShell.h"
@ -183,7 +184,6 @@ static NS_DEFINE_CID(kPrefMigrationCID, NS_PREFMIGRATION_CID);
static NS_DEFINE_CID(kPrefConverterCID, NS_PREFCONVERTER_CID);
static NS_DEFINE_IID(kCookieServiceCID, NS_COOKIESERVICE_CID);
static NS_DEFINE_CID(kChromeRegistryCID, NS_CHROMEREGISTRY_CID);
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
@ -457,7 +457,8 @@ nsProfile::StartupWithArgs(nsICmdLineService *cmdLineArgs, PRBool canInteract)
}
gLocaleProfiles->Remove(&key);
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService(kChromeRegistryCID, &rv);
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry =
do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
// Install to the profile
@ -1621,7 +1622,8 @@ 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 = do_GetService(kChromeRegistryCID, &rv);
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry =
do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv)) {
const PRUnichar* uiLocale = aUILocale;
@ -2123,7 +2125,7 @@ nsProfile::DefineLocaleDefaultsDir()
if (NS_SUCCEEDED(rv))
{
nsCOMPtr<nsIXULChromeRegistry> packageRegistry =
do_GetService(kChromeRegistryCID, &rv);
do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv))
{
nsXPIDLString localeName;

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

@ -54,7 +54,7 @@ static const nsModuleComponentInfo components[] =
{
{ "Chrome Registry",
NS_CHROMEREGISTRY_CID,
"@mozilla.org/chrome/chrome-registry;1",
NS_CHROMEREGISTRY_CONTRACTID,
nsChromeRegistryConstructor
},

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

@ -157,9 +157,6 @@ interface nsIXULChromeRegistry : nsIChromeRegistry {
%{ C++
// for component registration
// {D8C7D8A2-E84C-11d2-BF87-00105A1B0627}
#define NS_CHROMEREGISTRY_CID \
{ 0xd8c7d8a2, 0xe84c, 0x11d2, { 0xbf, 0x87, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27 } }
#define NS_CHROMEREGISTRY_CONTRACTID \
"@mozilla.org/chrome/chrome-registry;1"
%}

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

@ -72,7 +72,6 @@
//----------------------------------------------------------------------
static NS_DEFINE_CID(kChromeRegistryCID, NS_CHROMEREGISTRY_CID);
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
static NS_DEFINE_CID(kStandardURLCID, NS_STANDARDURL_CID);
@ -593,7 +592,7 @@ nsChromeProtocolHandler::NewChannel(nsIURI* aURI,
// Canonify the "chrome:" URL; e.g., so that we collapse
// "chrome://navigator/content/navigator.xul" and "chrome://navigator/content"
// and "chrome://navigator/content/navigator.xul".
nsCOMPtr<nsIChromeRegistry> reg(do_GetService(kChromeRegistryCID, &rv));
nsCOMPtr<nsIChromeRegistry> reg(do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv));
if (NS_FAILED(rv)) return rv;
rv = reg->Canonify(aURI);

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

@ -54,6 +54,12 @@ class nsIDocument;
#include "nsWeakReference.h"
#include "nsString.h"
// for component registration
// {D8C7D8A2-E84C-11d2-BF87-00105A1B0627}
#define NS_CHROMEREGISTRY_CID \
{ 0xd8c7d8a2, 0xe84c, 0x11d2, { 0xbf, 0x87, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27 } }
class nsChromeRegistry : public nsIXULChromeRegistry,
public nsIObserver,
public nsSupportsWeakReference

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

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3 -*- */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
@ -99,13 +99,27 @@ class nsProxiedService
nsProxiedService(const nsCID &aClass, const nsIID &aIID,
nsIEventQueue* pIProxyQueue, PRBool always, nsresult*rv)
{
static NS_DEFINE_CID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID);
*rv = nsServiceManager::GetService(aClass,
aIID,
getter_AddRefs(mService));
if (NS_FAILED(*rv)) return;
InitProxy(aIID, pIProxyQueue, always, rv);
}
nsProxiedService(const char* aContractID, const nsIID &aIID,
nsIEventQueue* pIProxyQueue, PRBool always, nsresult*rv)
{
*rv = nsServiceManager::GetService(aContractID,
aIID,
getter_AddRefs(mService));
if (NS_FAILED(*rv)) return;
InitProxy(aIID, pIProxyQueue, always, rv);
}
void InitProxy(const nsIID &aIID, nsIEventQueue* pIProxyQueue,
PRBool always, nsresult*rv)
{
static NS_DEFINE_CID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID);
nsCOMPtr<nsIProxyObjectManager> pIProxyObjectManager =
do_GetService(kProxyObjectManagerCID, rv);
@ -119,8 +133,7 @@ class nsProxiedService
proxyType,
getter_AddRefs(mProxiedService));
}
~nsProxiedService()
{
}

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

@ -73,7 +73,6 @@
#include "nsIXULWindow.h"
#include "nsIChromeRegistry.h"
#include "nsIContentHandler.h"
#include "nsIBrowserInstance.h"
#include "nsIEventQueueService.h"
#include "nsDirectoryServiceDefs.h"
#include "nsIHttpProtocolHandler.h"
@ -116,7 +115,6 @@
static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID);
static NS_DEFINE_CID(kIProcessCID, NS_PROCESS_CID);
static NS_DEFINE_CID(kChromeRegistryCID, NS_CHROMEREGISTRY_CID);
#define UILOCALE_CMD_LINE_ARG "-UILocale"
#define CONTENTLOCALE_CMD_LINE_ARG "-contentLocale"
@ -931,7 +929,7 @@ static nsresult ConvertToUnicode(nsString& aCharset, const char* inString, nsASt
static nsresult OpenBrowserWindow(PRInt32 height, PRInt32 width)
{
nsresult rv;
nsCOMPtr<nsICmdLineHandler> handler(do_GetService(NS_BROWSERSTARTUPHANDLER_CONTRACTID, &rv));
nsCOMPtr<nsICmdLineHandler> handler(do_GetService("@mozilla.org/commandlinehandler/general-startup;1?type=browser", &rv));
if (NS_FAILED(rv)) return rv;
nsXPIDLCString chromeUrlForTask;
@ -1116,14 +1114,14 @@ static nsresult InstallGlobalLocale(nsICmdLineService *cmdLineArgs)
if (cmdUI) {
nsAutoString UILocaleName;
UILocaleName.AssignWithConversion(cmdUI);
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService(kChromeRegistryCID, &rv);
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
if (chromeRegistry)
rv = chromeRegistry->SelectLocale(UILocaleName.get(), PR_FALSE);
}
}
// match OS when no cmdline override
if (!cmdUI && matchOS) {
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService(kChromeRegistryCID, &rv);
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
if (chromeRegistry) {
chromeRegistry->SetRuntimeProvider(PR_TRUE);
rv = chromeRegistry->SelectLocale(uiLang.get(), PR_FALSE);
@ -1136,14 +1134,14 @@ static nsresult InstallGlobalLocale(nsICmdLineService *cmdLineArgs)
if (cmdContent) {
nsAutoString ContentLocaleName;
ContentLocaleName.AssignWithConversion(cmdContent);
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService(kChromeRegistryCID, &rv);
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
if(chromeRegistry)
rv = chromeRegistry->SelectLocale(ContentLocaleName.get(), PR_FALSE);
}
}
// match OS when no cmdline override
if (!cmdContent && matchOS) {
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService(kChromeRegistryCID, &rv);
nsCOMPtr<nsIXULChromeRegistry> chromeRegistry = do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
if (chromeRegistry) {
chromeRegistry->SetRuntimeProvider(PR_TRUE);
rv = chromeRegistry->SelectLocale(country.get(), PR_FALSE);

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

@ -86,7 +86,6 @@ static NS_DEFINE_CID(kInstallTrigger_CID, NS_SoftwareUpdateInstallTrigger_CID);
static NS_DEFINE_CID(kInstallVersion_CID, NS_SoftwareUpdateInstallVersion_CID);
static NS_DEFINE_CID(kChromeRegistryCID, NS_CHROMEREGISTRY_CID);
static NS_DEFINE_CID(knsRegistryCID, NS_REGISTRY_CID);
static NS_DEFINE_CID(kIProcessCID, NS_PROCESS_CID);
@ -315,7 +314,7 @@ nsSoftwareUpdate::InstallJar( nsIFile* aLocalFile,
nsIXULChromeRegistry* chromeRegistry = nsnull;
NS_WITH_ALWAYS_PROXIED_SERVICE( nsIXULChromeRegistry,
tmpReg,
kChromeRegistryCID,
NS_CHROMEREGISTRY_CONTRACTID,
NS_UI_THREAD_EVENTQ, &rv);
if (NS_SUCCEEDED(rv))
chromeRegistry = tmpReg;
@ -347,7 +346,7 @@ nsSoftwareUpdate::InstallChrome( PRUint32 aType,
nsresult rv;
NS_WITH_ALWAYS_PROXIED_SERVICE( nsIXULChromeRegistry,
chromeRegistry,
kChromeRegistryCID,
NS_CHROMEREGISTRY_CONTRACTID,
NS_UI_THREAD_EVENTQ, &rv);
if (NS_FAILED(rv))
return rv;