Bug 836517 - Lightweight theme support for distributions. r=mfinkle

This commit is contained in:
Margaret Leibovic 2013-02-01 15:45:33 -08:00
parent ce0533c704
commit 792957b808
2 changed files with 10 additions and 4 deletions

View File

@ -8232,6 +8232,10 @@ var Distribution = {
} catch (e) { /* ignore bad prefs and move on */ }
}
// Apply a lightweight theme if necessary
if (prefs["lightweightThemes.isThemeSelected"])
Services.obs.notifyObservers(null, "lightweight-theme-apply", "");
let localizedString = Cc["@mozilla.org/pref-localizedstring;1"].createInstance(Ci.nsIPrefLocalizedString);
let localizeablePrefs = aData["LocalizablePreferences"];
for (let key in localizeablePrefs) {

View File

@ -12,20 +12,22 @@ Components.utils.import("resource://gre/modules/LightweightThemeManager.jsm");
function LightweightThemeConsumer(aDocument) {
this._doc = aDocument;
Services.obs.addObserver(this, "lightweight-theme-styling-update", false);
Services.obs.addObserver(this, "lightweight-theme-apply", false);
this._update(LightweightThemeManager.currentThemeForDisplay);
}
LightweightThemeConsumer.prototype = {
observe: function (aSubject, aTopic, aData) {
if (aTopic != "lightweight-theme-styling-update")
return;
this._update(JSON.parse(aData));
if (aTopic == "lightweight-theme-styling-update")
this._update(JSON.parse(aData));
else if (aTopic == "lightweight-theme-apply")
this._update(LightweightThemeManager.currentThemeForDisplay);
},
destroy: function () {
Services.obs.removeObserver(this, "lightweight-theme-styling-update");
Services.obs.removeObserver(this, "lightweight-theme-apply");
this._doc = null;
},