Bug 653141 - Changing locales should be instant. r=bsmedberg

This commit is contained in:
Vivien Nicolas 2011-06-07 12:11:35 -07:00
parent 9ef30f9708
commit eb33c0c63b
5 changed files with 13 additions and 13 deletions

View File

@ -116,7 +116,7 @@ protected:
// Update the selected locale used by the chrome registry, and fire a
// notification about this change
virtual void UpdateSelectedLocale() = 0;
virtual nsresult UpdateSelectedLocale() = 0;
static void LogMessage(const char* aMsg, ...);
static void LogMessageWithContext(nsIURI* aURL, PRUint32 aLineNumber, PRUint32 flags,

View File

@ -368,12 +368,9 @@ nsChromeRegistryChrome::Observe(nsISupports *aSubject, const char *aTopic,
if (pref.EqualsLiteral(MATCH_OS_LOCALE_PREF) ||
pref.EqualsLiteral(SELECTED_LOCALE_PREF)) {
if (!mProfileLoaded) {
rv = SelectLocaleFromPref(prefs);
if (NS_FAILED(rv))
return rv;
}
FlushAllCaches();
rv = UpdateSelectedLocale();
if (NS_SUCCEEDED(rv) && mProfileLoaded)
FlushAllCaches();
}
else if (pref.EqualsLiteral(SELECTED_SKIN_PREF)) {
nsXPIDLCString provider;
@ -426,11 +423,12 @@ nsChromeRegistryChrome::CheckForNewChrome()
return NS_OK;
}
void nsChromeRegistryChrome::UpdateSelectedLocale()
nsresult nsChromeRegistryChrome::UpdateSelectedLocale()
{
nsresult rv = NS_OK;
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefs) {
nsresult rv = SelectLocaleFromPref(prefs);
rv = SelectLocaleFromPref(prefs);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIObserverService> obsSvc =
mozilla::services::GetObserverService();
@ -439,6 +437,8 @@ void nsChromeRegistryChrome::UpdateSelectedLocale()
"selected-locale-has-changed", nsnull);
}
}
return rv;
}
static void

View File

@ -83,7 +83,7 @@ class nsChromeRegistryChrome : public nsChromeRegistry
PRUint32 number, void *arg);
nsresult SelectLocaleFromPref(nsIPrefBranch* prefs);
NS_OVERRIDE void UpdateSelectedLocale();
NS_OVERRIDE nsresult UpdateSelectedLocale();
NS_OVERRIDE nsIURI* GetBaseURIFromPackage(const nsCString& aPackage,
const nsCString& aProvider,
const nsCString& aPath);

View File

@ -278,9 +278,9 @@ nsChromeRegistryContent::GetXULOverlays(nsIURI *aChromeURL,
CONTENT_NOT_IMPLEMENTED();
}
void nsChromeRegistryContent::UpdateSelectedLocale()
nsresult nsChromeRegistryContent::UpdateSelectedLocale()
{
CONTENT_NOTREACHED();
CONTENT_NOT_IMPLEMENTED();
}
void

View File

@ -89,7 +89,7 @@ class nsChromeRegistryContent : public nsChromeRegistry
void RegisterResource(const ResourceMapping& aResource);
void RegisterOverride(const OverrideMapping& aOverride);
NS_OVERRIDE void UpdateSelectedLocale();
NS_OVERRIDE nsresult UpdateSelectedLocale();
NS_OVERRIDE nsIURI* GetBaseURIFromPackage(const nsCString& aPackage,
const nsCString& aProvider,
const nsCString& aPath);