Bug 920090 - Remove unused ActivityObserver code from Metro [r=jimm]
authorMatt Brubeck <mbrubeck@mozilla.com>
Tue, 24 Sep 2013 13:17:03 -0700
changeset 148535 8cf288b533fc
parent 148534 eec73668438e
child 148536 7c168df15f31
push id25345
push userkwierso@gmail.com
push dateWed, 25 Sep 2013 03:07:11 +0000
treeherdermozilla-central@68d279364a8b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm
bugs920090
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 920090 - Remove unused ActivityObserver code from Metro [r=jimm]
browser/metro/base/content/browser.js
--- a/browser/metro/base/content/browser.js
+++ b/browser/metro/base/content/browser.js
@@ -125,24 +125,17 @@ var Browser = {
     }
     window.addEventListener("mozfullscreenchange", fullscreenHandler, true);
 
     BrowserUI.init();
 
     window.controllers.appendController(this);
     window.controllers.appendController(BrowserUI);
 
-    let os = Services.obs;
-    os.addObserver(SessionHistoryObserver, "browser:purge-session-history", false);
-    os.addObserver(ActivityObserver, "application-background", false);
-    os.addObserver(ActivityObserver, "application-foreground", false);
-    os.addObserver(ActivityObserver, "system-active", false);
-    os.addObserver(ActivityObserver, "system-idle", false);
-    os.addObserver(ActivityObserver, "system-display-on", false);
-    os.addObserver(ActivityObserver, "system-display-off", false);
+    Services.obs.addObserver(SessionHistoryObserver, "browser:purge-session-history", false);
 
     window.QueryInterface(Ci.nsIDOMChromeWindow).browserDOMWindow = new nsBrowserAccess();
 
     Elements.browsers.addEventListener("DOMUpdatePageReport", PopupBlockerObserver.onUpdatePageReport, false);
 
     // Make sure we're online before attempting to load
     Util.forceOnline();
 
@@ -242,24 +235,17 @@ var Browser = {
     messageManager.removeMessageListener("Browser:ZoomToPoint:Return", this);
     messageManager.removeMessageListener("scroll", this);
     messageManager.removeMessageListener("Browser:CertException", this);
     messageManager.removeMessageListener("Browser:BlockedSite", this);
     messageManager.removeMessageListener("Browser:ErrorPage", this);
     messageManager.removeMessageListener("Browser:PluginClickToPlayClicked", this);
     messageManager.removeMessageListener("Browser:TapOnSelection", this);
 
-    var os = Services.obs;
-    os.removeObserver(SessionHistoryObserver, "browser:purge-session-history");
-    os.removeObserver(ActivityObserver, "application-background");
-    os.removeObserver(ActivityObserver, "application-foreground");
-    os.removeObserver(ActivityObserver, "system-active");
-    os.removeObserver(ActivityObserver, "system-idle");
-    os.removeObserver(ActivityObserver, "system-display-on");
-    os.removeObserver(ActivityObserver, "system-display-off");
+    Services.obs.removeObserver(SessionHistoryObserver, "browser:purge-session-history");
 
     window.controllers.removeController(this);
     window.controllers.removeController(BrowserUI);
   },
 
   getHomePage: function getHomePage(aOptions) {
     aOptions = aOptions || { useDefault: false };
 
@@ -1389,47 +1375,16 @@ var SessionHistoryObserver = {
     let urlbar = document.getElementById("urlbar-edit");
     if (urlbar) {
       // Clear undo history of the URL bar
       urlbar.editor.transactionManager.clear();
     }
   }
 };
 
-var ActivityObserver = {
-  _inBackground : false,
-  _notActive : false,
-  _isDisplayOff : false,
-  _timeoutID: 0,
-  observe: function ao_observe(aSubject, aTopic, aData) {
-    if (aTopic == "application-background") {
-      this._inBackground = true;
-    } else if (aTopic == "application-foreground") {
-      this._inBackground = false;
-    } else if (aTopic == "system-idle") {
-      this._notActive = true;
-    } else if (aTopic == "system-active") {
-      this._notActive = false;
-    } else if (aTopic == "system-display-on") {
-      this._isDisplayOff = false;
-    } else if (aTopic == "system-display-off") {
-      this._isDisplayOff = true;
-    }
-    let activeTabState = !this._inBackground && !this._notActive && !this._isDisplayOff;
-    if (this._timeoutID)
-      clearTimeout(this._timeoutID);
-    if (Browser.selectedTab.active != activeTabState) {
-      // On Maemo all backgrounded applications getting portrait orientation
-      // so if browser had landscape mode then we need timeout in order
-      // to finish last rotate/paint operation and have nice lookine browser in TS
-      this._timeoutID = setTimeout(function() { Browser.selectedTab.active = activeTabState; }, activeTabState ? 0 : kSetInactiveStateTimeout);
-    }
-  }
-};
-
 function getNotificationBox(aBrowser) {
   return Browser.getNotificationBox(aBrowser);
 }
 
 function showDownloadManager(aWindowContext, aID, aReason) {
   // TODO: Bug 883962: Toggle the downloads infobar as our current "download manager".
 }