Bug 529769 - notify observers when lightweight theme is selected. r=dtownsend
--- a/toolkit/content/LightweightThemeConsumer.jsm
+++ b/toolkit/content/LightweightThemeConsumer.jsm
@@ -37,35 +37,35 @@
let EXPORTED_SYMBOLS = ["LightweightThemeConsumer"];
function LightweightThemeConsumer(aDocument) {
this._doc = aDocument;
this._footerId = aDocument.documentElement.getAttribute("lightweightthemesfooter");
Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService)
- .addObserver(this, "lightweight-theme-changed", false);
+ .addObserver(this, "lightweight-theme-styling-update", false);
var temp = {};
Components.utils.import("resource://gre/modules/LightweightThemeManager.jsm", temp);
this._update(temp.LightweightThemeManager.currentThemeForDisplay);
}
LightweightThemeConsumer.prototype = {
observe: function (aSubject, aTopic, aData) {
- if (aTopic != "lightweight-theme-changed")
+ if (aTopic != "lightweight-theme-styling-update")
return;
this._update(JSON.parse(aData));
},
destroy: function () {
Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService)
- .removeObserver(this, "lightweight-theme-changed");
+ .removeObserver(this, "lightweight-theme-styling-update");
this._doc = null;
},
_update: function (aData) {
if (!aData)
aData = { headerURL: "", footerURL: "", textcolor: "", accentcolor: "" };
--- a/toolkit/mozapps/extensions/src/LightweightThemeManager.jsm
+++ b/toolkit/mozapps/extensions/src/LightweightThemeManager.jsm
@@ -128,16 +128,17 @@ var LightweightThemeManager = {
if (_previewTimer) {
_previewTimer.cancel();
_previewTimer = null;
}
_prefs.setBoolPref("isThemeSelected", aData != null);
_notifyWindows(aData);
+ _observerService.notifyObservers(null, "lightweight-theme-changed", null);
if (PERSIST_ENABLED && aData)
_persistImages(aData);
return aData;
},
getUsedTheme: function (aId) {
@@ -277,17 +278,17 @@ function _updateUsedThemes(aList) {
aList.length = MAX_USED_THEMES_COUNT;
_prefs.setCharPref("usedThemes", JSON.stringify(aList));
_observerService.notifyObservers(null, "lightweight-theme-list-changed", null);
}
function _notifyWindows(aThemeData) {
- _observerService.notifyObservers(null, "lightweight-theme-changed",
+ _observerService.notifyObservers(null, "lightweight-theme-styling-update",
JSON.stringify(aThemeData));
}
var _previewTimer;
var _previewTimerCallback = {
notify: function () {
LightweightThemeManager.resetPreview();
}