mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 06:45:42 +00:00
Bug 836517 - Lightweight theme support for distributions. r=mfinkle
This commit is contained in:
parent
ce0533c704
commit
792957b808
@ -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) {
|
||||
|
@ -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;
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user