--- a/toolkit/components/reader/AboutReader.jsm
+++ b/toolkit/components/reader/AboutReader.jsm
@@ -11,18 +11,16 @@ this.EXPORTED_SYMBOLS = [ "AboutReader"
Cu.import("resource://gre/modules/ReaderMode.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Rect", "resource://gre/modules/Geometry.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Task", "resource://gre/modules/Task.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "UITelemetry", "resource://gre/modules/UITelemetry.jsm");
-const READINGLIST_COMMAND_ID = "readingListSidebar";
-
var gStrings = Services.strings.createBundle("chrome://global/locale/aboutReader.properties");
var AboutReader = function(mm, win, articlePromise) {
let url = this._getOriginalUrl(win);
if (!(url.startsWith("http://") || url.startsWith("https://"))) {
let errorMsg = "Only http:// and https:// URLs can be loaded in about:reader.";
if (Services.prefs.getBoolPref("reader.errors.includeURLs"))
errorMsg += " Tried to load: " + url + ".";
@@ -31,18 +29,16 @@ var AboutReader = function(mm, win, arti
return;
}
let doc = win.document;
this._mm = mm;
this._mm.addMessageListener("Reader:Added", this);
this._mm.addMessageListener("Reader:Removed", this);
- this._mm.addMessageListener("Sidebar:VisibilityChange", this);
- this._mm.addMessageListener("ReadingList:VisibilityStatus", this);
this._mm.addMessageListener("Reader:CloseDropdown", this);
this._mm.addMessageListener("Reader:AddButton", this);
this._mm.addMessageListener("Reader:RemoveButton", this);
this._docRef = Cu.getWeakReference(doc);
this._winRef = Cu.getWeakReference(win);
this._article = null;
@@ -70,17 +66,16 @@ var AboutReader = function(mm, win, arti
doc.addEventListener("visibilitychange", this, false);
this._setupStyleDropdown();
this._setupButton("close-button", this._onReaderClose.bind(this), "aboutReader.toolbar.close");
try {
if (Services.prefs.getBoolPref("browser.readinglist.enabled")) {
this._setupButton("toggle-button", this._onReaderToggle.bind(this, "button"), "aboutReader.toolbar.addToReadingList");
- this._setupButton("list-button", this._onList.bind(this), "aboutReader.toolbar.openReadingList");
}
} catch (e) {
// Pref doesn't exist.
}
const gIsFirefoxDesktop = Services.appinfo.ID == "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
if (gIsFirefoxDesktop) {
// we're ready for any external setup, send a signal for that.
@@ -116,19 +111,16 @@ var AboutReader = function(mm, win, arti
this._setFontType(fontType);
this._setupFontSizeButtons();
// Track status of reader toolbar add/remove toggle button
this._isReadingListItem = -1;
this._updateToggleButton();
- // Setup initial ReadingList button styles.
- this._updateListButton();
-
this._loadArticle();
}
AboutReader.prototype = {
_BLOCK_IMAGES_SELECTOR: ".content p > img:only-child, " +
".content p > a:only-child > img:only-child, " +
".content .wp-caption img, " +
".content figure img",
@@ -234,30 +226,16 @@ AboutReader.prototype = {
}
case "Reader:RemoveButton": {
if (message.data.id) {
let btn = this._doc.getElementById(message.data.id);
btn.remove();
}
break;
}
-
- // Notifys us of Sidebar updates, user clicks X to close,
- // checks View -> Sidebar -> (Bookmarks, Histroy, Readinglist, etc).
- case "Sidebar:VisibilityChange": {
- let data = message.data;
- this._updateListButtonStyle(data.isOpen && data.commandID === READINGLIST_COMMAND_ID);
- break;
- }
-
- // Returns requested status of current ReadingList Sidebar.
- case "ReadingList:VisibilityStatus": {
- this._updateListButtonStyle(message.data.isOpen);
- break;
- }
}
},
handleEvent: function(aEvent) {
if (!aEvent.isTrusted)
return;
switch (aEvent.type) {
@@ -286,18 +264,16 @@ AboutReader.prototype = {
break;
case "unload":
// Close the Banners Font-dropdown, cleanup Android BackPressListener.
this._closeDropdown();
this._mm.removeMessageListener("Reader:Added", this);
this._mm.removeMessageListener("Reader:Removed", this);
- this._mm.removeMessageListener("Sidebar:VisibilityChange", this);
- this._mm.removeMessageListener("ReadingList:VisibilityStatus", this);
this._mm.removeMessageListener("Reader:CloseDropdown", this);
this._mm.removeMessageListener("Reader:AddButton", this);
this._mm.removeMessageListener("Reader:RemoveButton", this);
this._windowUnloaded = true;
break;
}
},
@@ -353,60 +329,16 @@ AboutReader.prototype = {
this._mm.sendAsyncMessage("Reader:AddToList", { article: this._article });
UITelemetry.addEvent("save.1", aMethod, null, "reading_list");
} else {
this._mm.sendAsyncMessage("Reader:RemoveFromList", { url: this._article.url });
UITelemetry.addEvent("unsave.1", aMethod, null, "reading_list");
}
},
- /**
- * To help introduce ReadingList, we want to automatically
- * open the Desktop sidebar the first time ReaderMode is used.
- */
- _showListIntro: function() {
- this._mm.sendAsyncMessage("ReadingList:ShowIntro");
- },
-
- /**
- * Toggle ReadingList Sidebar visibility. SidebarUI will trigger
- * _updateListButtonStyle().
- */
- _onList: function() {
- this._mm.sendAsyncMessage("ReadingList:ToggleVisibility");
- },
-
- /**
- * Request ReadingList Sidebar-button visibility status update.
- * Only desktop currently responds to this message.
- */
- _updateListButton: function() {
- this._mm.sendAsyncMessage("ReadingList:GetVisibility");
- },
-
- /**
- * Update ReadingList toggle button styles.
- * @param isVisible
- * What Sidebar ReadingList visibility style the List
- * toggle-button should be set to reflect, and what
- * button-action the tip will provide.
- */
- _updateListButtonStyle: function(isVisible) {
- let classes = this._doc.getElementById("list-button").classList;
- if (isVisible) {
- classes.add("on");
- // When on, action tip is "close".
- this._setButtonTip("list-button", "aboutReader.toolbar.closeReadingList");
- } else {
- classes.remove("on");
- // When off, action tip is "open".
- this._setButtonTip("list-button", "aboutReader.toolbar.openReadingList");
- }
- },
-
_setFontSize: function(newFontSize) {
let containerClasses = this._doc.getElementById("container").classList;
if (this._fontSize > 0)
containerClasses.remove("font-size" + this._fontSize);
this._fontSize = newFontSize;
containerClasses.add("font-size" + this._fontSize);
@@ -500,21 +432,16 @@ AboutReader.prototype = {
this._updateColorScheme(averageLuxValue);
// Pop the oldest value off the array.
let oldLux = this._luxValues.pop();
// Subtract oldLux since it has been discarded from the array.
this._totalLux -= oldLux;
},
_handleVisibilityChange: function() {
- // ReadingList / Sidebar state might change while we're not the selected tab.
- if (this._doc.visibilityState === "visible") {
- this._updateListButton();
- }
-
let colorScheme = Services.prefs.getCharPref("reader.color_scheme");
if (colorScheme != "auto") {
return;
}
// Turn off the ambient light sensor if the page is hidden
this._enableAmbientLighting(!this._doc.hidden);
},
@@ -782,17 +709,16 @@ AboutReader.prototype = {
this._contentElement.innerHTML = "";
this._contentElement.appendChild(contentFragment);
this._maybeSetTextDirection(article);
this._contentElement.style.display = "block";
this._updateImageMargins();
this._requestReadingListStatus();
- this._showListIntro();
this._requestFavicon();
this._doc.body.classList.add("loaded");
Services.obs.notifyObservers(null, "AboutReader:Ready", "");
},
_hideContent: function() {
this._headerElement.style.display = "none";