diff --git a/chrome/public/nsIChromeRegistry.idl b/chrome/public/nsIChromeRegistry.idl index fc5f4a30ee1..23ca18d3919 100644 --- a/chrome/public/nsIChromeRegistry.idl +++ b/chrome/public/nsIChromeRegistry.idl @@ -23,23 +23,28 @@ #include "nsISupports.idl" #include "nsIURL.idl" #include "nsIEnumerator.idl" +#include "nsISupportsArray.idl" [scriptable, uuid(D8C7D8A1-E84C-11d2-BF87-00105A1B0627)] interface nsIChromeRegistry : nsISupports { void convertChromeURL(in nsIURI aChromeURL); nsISimpleEnumerator getOverlays(in nsIURI aChromeURL); - + void reloadChrome(); void refreshSkins(); - void applyTheme(in wstring themeFileName); + void applyTheme(in wstring themeName); - void setSkin(in wstring skinFileName, in wstring packageName); - void setLocale(in wstring localeFileName, in wstring packageName); + void setSkin(in wstring skinName, in wstring packageName); + void setLocale(in wstring localeName, in wstring packageName); - void setDefaultSkin(in wstring skinFileName, in wstring packageName); - void setDefaultLocale(in wstring localeFileName, in wstring packageName); + void setDefaultSkin(in wstring skinName, in wstring packageName); + void setDefaultLocale(in wstring localeName, in wstring packageName); + + readonly attribute nsISupportsArray skins; + readonly attribute nsISupportsArray packages; + readonly attribute nsISupportsArray locales; }; diff --git a/chrome/src/nsChromeRegistry.cpp b/chrome/src/nsChromeRegistry.cpp index 5d4e1fb435e..ad9f6219497 100644 --- a/chrome/src/nsChromeRegistry.cpp +++ b/chrome/src/nsChromeRegistry.cpp @@ -42,7 +42,10 @@ #include "nsNetUtil.h" #include "nsFileLocations.h" #include "nsIFileLocator.h" +#include "nsPIDOMWindow.h" #include "nsIDOMWindow.h" +#include "nsIDOMWindowCollection.h" +#include "nsIDOMLocation.h" #include "nsIWindowMediator.h" #include "nsIDocument.h" #include "nsIDOMDocument.h" @@ -56,6 +59,8 @@ #include "nsISupportsArray.h" #include "nsICSSLoader.h" #include "nsIDocumentObserver.h" +#include "nsIXULDocument.h" +#include "nsINameSpaceManager.h" static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID); static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); @@ -199,8 +204,6 @@ protected: nsIRDFContainer *aContainer, nsIRDFDataSource *aDataSource); - static void RemoveStyleSheet(nsIStyleSheet* aSheet, nsIDocument* aDocument); - private: NS_IMETHOD ReallyRemoveOverlayFromDataSource(const PRUnichar *aDocURI, char *aOverlayURI); NS_IMETHOD LoadDataSource(const nsCAutoString &aFileName, nsIRDFDataSource **aResult, @@ -210,6 +213,9 @@ private: NS_IMETHOD GetProfileRoot(nsCAutoString& aFileURL); NS_IMETHOD RefreshWindow(nsIDOMWindow* aWindow); + + NS_IMETHOD ProcessStyleSheet(nsIURL* aURL, nsICSSLoader* aLoader, nsIDocument* aDocument); + }; PRUint32 nsChromeRegistry::gRefCnt ; @@ -777,8 +783,6 @@ void BreakProviderAndRemainingFromPath(const char* i_path, char** o_provider, ch NS_IMETHODIMP nsChromeRegistry::RefreshSkins() { - printf("Refreshing skins!\n"); - nsresult rv; // Flush the style sheet cache completely. @@ -788,21 +792,16 @@ NS_IMETHODIMP nsChromeRegistry::RefreshSkins() xulCache->Flush(); } - printf("Trying to obtain the window mediator.\n"); - // Get the window mediator NS_WITH_SERVICE(nsIWindowMediator, windowMediator, kWindowMediatorCID, &rv); if (NS_SUCCEEDED(rv)) { nsCOMPtr windowEnumerator; - printf("Trying to enumerate...\n"); - if (NS_SUCCEEDED(windowMediator->GetEnumerator(nsnull, getter_AddRefs(windowEnumerator)))) { // Get each dom window PRBool more; windowEnumerator->HasMoreElements(&more); while (more) { - printf("Have something that might be a window.\n"); nsCOMPtr protoWindow; rv = windowEnumerator->GetNext(getter_AddRefs(protoWindow)); if (NS_SUCCEEDED(rv) && protoWindow) { @@ -820,99 +819,106 @@ NS_IMETHODIMP nsChromeRegistry::RefreshSkins() NS_IMETHODIMP nsChromeRegistry::RefreshWindow(nsIDOMWindow* aWindow) { - printf("Refreshing Window!\n"); - - nsresult rv; - - // Get the XUL cache. - NS_WITH_SERVICE(nsIXULPrototypeCache, xulCache, "components://netscape/rdf/xul-prototype-cache", &rv); - // Get the DOM document. nsCOMPtr domDocument; aWindow->GetDocument(getter_AddRefs(domDocument)); if (!domDocument) return NS_OK; - nsCOMPtr document = do_QueryInterface(domDocument); - if (!document) - return NS_OK; + nsCOMPtr document = do_QueryInterface(domDocument); + if (!document) + return NS_OK; - nsCOMPtr container = do_QueryInterface(document); - nsCOMPtr cssLoader; - container->GetCSSLoader(*getter_AddRefs(cssLoader)); + nsCOMPtr xulDoc = do_QueryInterface(domDocument); + if (xulDoc) { + + nsCOMPtr container = do_QueryInterface(document); + nsCOMPtr cssLoader; + container->GetCSSLoader(*getter_AddRefs(cssLoader)); - // Build an array of nsIURIs of style sheets we need to load. - nsCOMPtr urls; - NS_NewISupportsArray(getter_AddRefs(urls)); + // Build an array of nsIURIs of style sheets we need to load. + nsCOMPtr urls; + NS_NewISupportsArray(getter_AddRefs(urls)); - PRInt32 count = document->GetNumberOfStyleSheets(); + PRInt32 count = document->GetNumberOfStyleSheets(); - // Iterate over the style sheets. - for (PRInt32 i = 0; i < count; i++) { - // Get the style sheet - nsCOMPtr styleSheet = getter_AddRefs(document->GetStyleSheetAt(i)); + // Iterate over the style sheets. + for (PRInt32 i = 0; i < count; i++) { + // Get the style sheet + nsCOMPtr styleSheet = getter_AddRefs(document->GetStyleSheetAt(i)); - // Make sure we aren't the special style sheets that never change. We - // want to skip those. - nsCOMPtr attrSheet; - container->GetAttributeStyleSheet(getter_AddRefs(attrSheet)); + // Make sure we aren't the special style sheets that never change. We + // want to skip those. + nsCOMPtr attrSheet; + container->GetAttributeStyleSheet(getter_AddRefs(attrSheet)); - nsCOMPtr inlineSheet; - container->GetInlineStyleSheet(getter_AddRefs(inlineSheet)); + nsCOMPtr inlineSheet; + container->GetInlineStyleSheet(getter_AddRefs(inlineSheet)); - nsCOMPtr attr = do_QueryInterface(attrSheet); - nsCOMPtr inl = do_QueryInterface(inlineSheet); - if ((attr.get() != styleSheet.get()) && - (inl.get() != styleSheet.get())) { - // Get the URI and add it to our array. - nsCOMPtr uri; - styleSheet->GetURL(*getter_AddRefs(uri)); - urls->AppendElement(uri); + nsCOMPtr attr = do_QueryInterface(attrSheet); + nsCOMPtr inl = do_QueryInterface(inlineSheet); + if ((attr.get() != styleSheet.get()) && + (inl.get() != styleSheet.get())) { + // Get the URI and add it to our array. + nsCOMPtr uri; + styleSheet->GetURL(*getter_AddRefs(uri)); + urls->AppendElement(uri); - // Remove the sheet. - count--; - i--; - RemoveStyleSheet(styleSheet, document); - } - } + // Remove the sheet. + count--; + i--; + document->RemoveStyleSheet(styleSheet); + } + } - // Iterate over the URL array and kick off an asynchronous load of the - // sheets for our doc. - PRUint32 urlCount; - urls->Count(&urlCount); - for (PRUint32 j = 0; j < urlCount; j++) { - nsCOMPtr supports = getter_AddRefs(urls->ElementAt(j)); - nsCOMPtr url = do_QueryInterface(supports); - - } + // Iterate over the URL array and kick off an asynchronous load of the + // sheets for our doc. + PRUint32 urlCount; + urls->Count(&urlCount); + for (PRUint32 j = 0; j < urlCount; j++) { + nsCOMPtr supports = getter_AddRefs(urls->ElementAt(j)); + nsCOMPtr url = do_QueryInterface(supports); + ProcessStyleSheet(url, cssLoader, document); + } + } // Get our frames object + nsCOMPtr frames; + aWindow->GetFrames(getter_AddRefs(frames)); + if (!frames) + return NS_OK; // Walk the frames - /*for ( ; ;) { + PRUint32 length; + frames->GetLength(&length); + for (PRUint32 i = 0; i < length; i++) { // For each frame, recur. - }*/ + nsCOMPtr childWindow; + frames->Item(i, getter_AddRefs(childWindow)); + if (childWindow) + RefreshWindow(childWindow); + } return NS_OK; } -void nsChromeRegistry::RemoveStyleSheet(nsIStyleSheet* aSheet, nsIDocument* aDocument) +NS_IMETHODIMP +nsChromeRegistry::ProcessStyleSheet(nsIURL* aURL, nsICSSLoader* aLoader, nsIDocument* aDocument) { - PRInt32 count = aDocument->GetNumberOfShells(); - for (PRInt32 i = 0; i < count; i++) { - nsCOMPtr shell = getter_AddRefs(aDocument->GetShellAt(i)); + PRBool doneLoading; + nsresult rv = aLoader->LoadStyleLink(nsnull, // anElement + aURL, + "", // aTitle + "", // aMedia + kNameSpaceID_Unknown, + aDocument->GetNumberOfStyleSheets(), + nsnull, + doneLoading); // Ignore doneLoading. Don't care. - nsCOMPtr set; - shell->GetStyleSet(getter_AddRefs(set)); - if (set) { - set->RemoveDocStyleSheet(aSheet); - nsCOMPtr obs = do_QueryInterface(shell); - if (obs) - obs->StyleSheetRemoved(aDocument, aSheet); - } - } + return rv; } + NS_IMETHODIMP nsChromeRegistry::ApplyTheme(const PRUnichar *themeFileName) { nsCAutoString chromeFile = "resource:/chrome/themes.rdf"; @@ -1219,5 +1225,60 @@ nsChromeRegistry::GetProfileRoot(nsCAutoString& aFileURL) NS_IMETHODIMP nsChromeRegistry::ReloadChrome() { + // Do a reload of all top level windows. + nsresult rv; + + // Flush the cache completely. + NS_WITH_SERVICE(nsIXULPrototypeCache, xulCache, "components://netscape/rdf/xul-prototype-cache", &rv); + if (NS_SUCCEEDED(rv) && xulCache) { + xulCache->Flush(); + } + + // Get the window mediator + NS_WITH_SERVICE(nsIWindowMediator, windowMediator, kWindowMediatorCID, &rv); + if (NS_SUCCEEDED(rv)) { + nsCOMPtr windowEnumerator; + + if (NS_SUCCEEDED(windowMediator->GetEnumerator(nsnull, getter_AddRefs(windowEnumerator)))) { + // Get each dom window + PRBool more; + windowEnumerator->HasMoreElements(&more); + while (more) { + nsCOMPtr protoWindow; + rv = windowEnumerator->GetNext(getter_AddRefs(protoWindow)); + if (NS_SUCCEEDED(rv) && protoWindow) { + nsCOMPtr domWindow = do_QueryInterface(protoWindow); + if (domWindow) { + nsCOMPtr location; + domWindow->GetLocation(getter_AddRefs(location)); + if (location) + location->Reload(PR_FALSE); + } + } + windowEnumerator->HasMoreElements(&more); + } + } + } + return NS_OK; +} + +NS_IMETHODIMP +nsChromeRegistry::GetSkins(nsISupportsArray** aResult) +{ + // XXX Fill in. + return NS_OK; +} + +NS_IMETHODIMP +nsChromeRegistry::GetPackages(nsISupportsArray** aResult) +{ + // XXX Fill in. + return NS_OK; +} + +NS_IMETHODIMP +nsChromeRegistry::GetLocales(nsISupportsArray** aResult) +{ + // XXX Fill in. return NS_OK; } diff --git a/dom/public/base/nsPIDOMWindow.h b/dom/public/base/nsPIDOMWindow.h index d5178acd029..d122d761139 100644 --- a/dom/public/base/nsPIDOMWindow.h +++ b/dom/public/base/nsPIDOMWindow.h @@ -27,7 +27,7 @@ #include "nsISupports.h" #include "nsString.h" #include "nsIScriptContext.h" - +#include "nsIDOMLocation.h" #define NS_PIDOMWINDOW_IID \ { 0x3aa80781, 0x7e6a, 0x11d3, { 0xbf, 0x87, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27 } } @@ -38,6 +38,8 @@ public: static const nsIID& GetIID() { static nsIID iid = NS_PIDOMWINDOW_IID; return iid; } NS_IMETHOD GetPrivateParent(nsPIDOMWindow** aResult)=0; + + NS_IMETHOD GetLocation(nsIDOMLocation** aLocation) = 0; }; #endif // nsPIDOMWindow_h__ diff --git a/rdf/chrome/public/nsIChromeRegistry.idl b/rdf/chrome/public/nsIChromeRegistry.idl index fc5f4a30ee1..23ca18d3919 100644 --- a/rdf/chrome/public/nsIChromeRegistry.idl +++ b/rdf/chrome/public/nsIChromeRegistry.idl @@ -23,23 +23,28 @@ #include "nsISupports.idl" #include "nsIURL.idl" #include "nsIEnumerator.idl" +#include "nsISupportsArray.idl" [scriptable, uuid(D8C7D8A1-E84C-11d2-BF87-00105A1B0627)] interface nsIChromeRegistry : nsISupports { void convertChromeURL(in nsIURI aChromeURL); nsISimpleEnumerator getOverlays(in nsIURI aChromeURL); - + void reloadChrome(); void refreshSkins(); - void applyTheme(in wstring themeFileName); + void applyTheme(in wstring themeName); - void setSkin(in wstring skinFileName, in wstring packageName); - void setLocale(in wstring localeFileName, in wstring packageName); + void setSkin(in wstring skinName, in wstring packageName); + void setLocale(in wstring localeName, in wstring packageName); - void setDefaultSkin(in wstring skinFileName, in wstring packageName); - void setDefaultLocale(in wstring localeFileName, in wstring packageName); + void setDefaultSkin(in wstring skinName, in wstring packageName); + void setDefaultLocale(in wstring localeName, in wstring packageName); + + readonly attribute nsISupportsArray skins; + readonly attribute nsISupportsArray packages; + readonly attribute nsISupportsArray locales; }; diff --git a/rdf/chrome/src/nsChromeRegistry.cpp b/rdf/chrome/src/nsChromeRegistry.cpp index 5d4e1fb435e..ad9f6219497 100644 --- a/rdf/chrome/src/nsChromeRegistry.cpp +++ b/rdf/chrome/src/nsChromeRegistry.cpp @@ -42,7 +42,10 @@ #include "nsNetUtil.h" #include "nsFileLocations.h" #include "nsIFileLocator.h" +#include "nsPIDOMWindow.h" #include "nsIDOMWindow.h" +#include "nsIDOMWindowCollection.h" +#include "nsIDOMLocation.h" #include "nsIWindowMediator.h" #include "nsIDocument.h" #include "nsIDOMDocument.h" @@ -56,6 +59,8 @@ #include "nsISupportsArray.h" #include "nsICSSLoader.h" #include "nsIDocumentObserver.h" +#include "nsIXULDocument.h" +#include "nsINameSpaceManager.h" static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID); static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); @@ -199,8 +204,6 @@ protected: nsIRDFContainer *aContainer, nsIRDFDataSource *aDataSource); - static void RemoveStyleSheet(nsIStyleSheet* aSheet, nsIDocument* aDocument); - private: NS_IMETHOD ReallyRemoveOverlayFromDataSource(const PRUnichar *aDocURI, char *aOverlayURI); NS_IMETHOD LoadDataSource(const nsCAutoString &aFileName, nsIRDFDataSource **aResult, @@ -210,6 +213,9 @@ private: NS_IMETHOD GetProfileRoot(nsCAutoString& aFileURL); NS_IMETHOD RefreshWindow(nsIDOMWindow* aWindow); + + NS_IMETHOD ProcessStyleSheet(nsIURL* aURL, nsICSSLoader* aLoader, nsIDocument* aDocument); + }; PRUint32 nsChromeRegistry::gRefCnt ; @@ -777,8 +783,6 @@ void BreakProviderAndRemainingFromPath(const char* i_path, char** o_provider, ch NS_IMETHODIMP nsChromeRegistry::RefreshSkins() { - printf("Refreshing skins!\n"); - nsresult rv; // Flush the style sheet cache completely. @@ -788,21 +792,16 @@ NS_IMETHODIMP nsChromeRegistry::RefreshSkins() xulCache->Flush(); } - printf("Trying to obtain the window mediator.\n"); - // Get the window mediator NS_WITH_SERVICE(nsIWindowMediator, windowMediator, kWindowMediatorCID, &rv); if (NS_SUCCEEDED(rv)) { nsCOMPtr windowEnumerator; - printf("Trying to enumerate...\n"); - if (NS_SUCCEEDED(windowMediator->GetEnumerator(nsnull, getter_AddRefs(windowEnumerator)))) { // Get each dom window PRBool more; windowEnumerator->HasMoreElements(&more); while (more) { - printf("Have something that might be a window.\n"); nsCOMPtr protoWindow; rv = windowEnumerator->GetNext(getter_AddRefs(protoWindow)); if (NS_SUCCEEDED(rv) && protoWindow) { @@ -820,99 +819,106 @@ NS_IMETHODIMP nsChromeRegistry::RefreshSkins() NS_IMETHODIMP nsChromeRegistry::RefreshWindow(nsIDOMWindow* aWindow) { - printf("Refreshing Window!\n"); - - nsresult rv; - - // Get the XUL cache. - NS_WITH_SERVICE(nsIXULPrototypeCache, xulCache, "components://netscape/rdf/xul-prototype-cache", &rv); - // Get the DOM document. nsCOMPtr domDocument; aWindow->GetDocument(getter_AddRefs(domDocument)); if (!domDocument) return NS_OK; - nsCOMPtr document = do_QueryInterface(domDocument); - if (!document) - return NS_OK; + nsCOMPtr document = do_QueryInterface(domDocument); + if (!document) + return NS_OK; - nsCOMPtr container = do_QueryInterface(document); - nsCOMPtr cssLoader; - container->GetCSSLoader(*getter_AddRefs(cssLoader)); + nsCOMPtr xulDoc = do_QueryInterface(domDocument); + if (xulDoc) { + + nsCOMPtr container = do_QueryInterface(document); + nsCOMPtr cssLoader; + container->GetCSSLoader(*getter_AddRefs(cssLoader)); - // Build an array of nsIURIs of style sheets we need to load. - nsCOMPtr urls; - NS_NewISupportsArray(getter_AddRefs(urls)); + // Build an array of nsIURIs of style sheets we need to load. + nsCOMPtr urls; + NS_NewISupportsArray(getter_AddRefs(urls)); - PRInt32 count = document->GetNumberOfStyleSheets(); + PRInt32 count = document->GetNumberOfStyleSheets(); - // Iterate over the style sheets. - for (PRInt32 i = 0; i < count; i++) { - // Get the style sheet - nsCOMPtr styleSheet = getter_AddRefs(document->GetStyleSheetAt(i)); + // Iterate over the style sheets. + for (PRInt32 i = 0; i < count; i++) { + // Get the style sheet + nsCOMPtr styleSheet = getter_AddRefs(document->GetStyleSheetAt(i)); - // Make sure we aren't the special style sheets that never change. We - // want to skip those. - nsCOMPtr attrSheet; - container->GetAttributeStyleSheet(getter_AddRefs(attrSheet)); + // Make sure we aren't the special style sheets that never change. We + // want to skip those. + nsCOMPtr attrSheet; + container->GetAttributeStyleSheet(getter_AddRefs(attrSheet)); - nsCOMPtr inlineSheet; - container->GetInlineStyleSheet(getter_AddRefs(inlineSheet)); + nsCOMPtr inlineSheet; + container->GetInlineStyleSheet(getter_AddRefs(inlineSheet)); - nsCOMPtr attr = do_QueryInterface(attrSheet); - nsCOMPtr inl = do_QueryInterface(inlineSheet); - if ((attr.get() != styleSheet.get()) && - (inl.get() != styleSheet.get())) { - // Get the URI and add it to our array. - nsCOMPtr uri; - styleSheet->GetURL(*getter_AddRefs(uri)); - urls->AppendElement(uri); + nsCOMPtr attr = do_QueryInterface(attrSheet); + nsCOMPtr inl = do_QueryInterface(inlineSheet); + if ((attr.get() != styleSheet.get()) && + (inl.get() != styleSheet.get())) { + // Get the URI and add it to our array. + nsCOMPtr uri; + styleSheet->GetURL(*getter_AddRefs(uri)); + urls->AppendElement(uri); - // Remove the sheet. - count--; - i--; - RemoveStyleSheet(styleSheet, document); - } - } + // Remove the sheet. + count--; + i--; + document->RemoveStyleSheet(styleSheet); + } + } - // Iterate over the URL array and kick off an asynchronous load of the - // sheets for our doc. - PRUint32 urlCount; - urls->Count(&urlCount); - for (PRUint32 j = 0; j < urlCount; j++) { - nsCOMPtr supports = getter_AddRefs(urls->ElementAt(j)); - nsCOMPtr url = do_QueryInterface(supports); - - } + // Iterate over the URL array and kick off an asynchronous load of the + // sheets for our doc. + PRUint32 urlCount; + urls->Count(&urlCount); + for (PRUint32 j = 0; j < urlCount; j++) { + nsCOMPtr supports = getter_AddRefs(urls->ElementAt(j)); + nsCOMPtr url = do_QueryInterface(supports); + ProcessStyleSheet(url, cssLoader, document); + } + } // Get our frames object + nsCOMPtr frames; + aWindow->GetFrames(getter_AddRefs(frames)); + if (!frames) + return NS_OK; // Walk the frames - /*for ( ; ;) { + PRUint32 length; + frames->GetLength(&length); + for (PRUint32 i = 0; i < length; i++) { // For each frame, recur. - }*/ + nsCOMPtr childWindow; + frames->Item(i, getter_AddRefs(childWindow)); + if (childWindow) + RefreshWindow(childWindow); + } return NS_OK; } -void nsChromeRegistry::RemoveStyleSheet(nsIStyleSheet* aSheet, nsIDocument* aDocument) +NS_IMETHODIMP +nsChromeRegistry::ProcessStyleSheet(nsIURL* aURL, nsICSSLoader* aLoader, nsIDocument* aDocument) { - PRInt32 count = aDocument->GetNumberOfShells(); - for (PRInt32 i = 0; i < count; i++) { - nsCOMPtr shell = getter_AddRefs(aDocument->GetShellAt(i)); + PRBool doneLoading; + nsresult rv = aLoader->LoadStyleLink(nsnull, // anElement + aURL, + "", // aTitle + "", // aMedia + kNameSpaceID_Unknown, + aDocument->GetNumberOfStyleSheets(), + nsnull, + doneLoading); // Ignore doneLoading. Don't care. - nsCOMPtr set; - shell->GetStyleSet(getter_AddRefs(set)); - if (set) { - set->RemoveDocStyleSheet(aSheet); - nsCOMPtr obs = do_QueryInterface(shell); - if (obs) - obs->StyleSheetRemoved(aDocument, aSheet); - } - } + return rv; } + NS_IMETHODIMP nsChromeRegistry::ApplyTheme(const PRUnichar *themeFileName) { nsCAutoString chromeFile = "resource:/chrome/themes.rdf"; @@ -1219,5 +1225,60 @@ nsChromeRegistry::GetProfileRoot(nsCAutoString& aFileURL) NS_IMETHODIMP nsChromeRegistry::ReloadChrome() { + // Do a reload of all top level windows. + nsresult rv; + + // Flush the cache completely. + NS_WITH_SERVICE(nsIXULPrototypeCache, xulCache, "components://netscape/rdf/xul-prototype-cache", &rv); + if (NS_SUCCEEDED(rv) && xulCache) { + xulCache->Flush(); + } + + // Get the window mediator + NS_WITH_SERVICE(nsIWindowMediator, windowMediator, kWindowMediatorCID, &rv); + if (NS_SUCCEEDED(rv)) { + nsCOMPtr windowEnumerator; + + if (NS_SUCCEEDED(windowMediator->GetEnumerator(nsnull, getter_AddRefs(windowEnumerator)))) { + // Get each dom window + PRBool more; + windowEnumerator->HasMoreElements(&more); + while (more) { + nsCOMPtr protoWindow; + rv = windowEnumerator->GetNext(getter_AddRefs(protoWindow)); + if (NS_SUCCEEDED(rv) && protoWindow) { + nsCOMPtr domWindow = do_QueryInterface(protoWindow); + if (domWindow) { + nsCOMPtr location; + domWindow->GetLocation(getter_AddRefs(location)); + if (location) + location->Reload(PR_FALSE); + } + } + windowEnumerator->HasMoreElements(&more); + } + } + } + return NS_OK; +} + +NS_IMETHODIMP +nsChromeRegistry::GetSkins(nsISupportsArray** aResult) +{ + // XXX Fill in. + return NS_OK; +} + +NS_IMETHODIMP +nsChromeRegistry::GetPackages(nsISupportsArray** aResult) +{ + // XXX Fill in. + return NS_OK; +} + +NS_IMETHODIMP +nsChromeRegistry::GetLocales(nsISupportsArray** aResult) +{ + // XXX Fill in. return NS_OK; }