Bug 1070957 - Show deprecation notice in App Manager. r=paul
authorJ. Ryan Stinnett <jryans@gmail.com>
Thu, 02 Oct 2014 08:30:00 -0400
changeset 208725 313954ccec641545aba109fab543d358a704f5fa
parent 208724 cd771a5cdfde6ba37fda34df970040cd9f765feb
child 208726 c3c65a614602e639dd82155d59e4f5a8bd54bbd1
push id27591
push userryanvm@gmail.com
push dateFri, 03 Oct 2014 20:25:10 +0000
treeherdermozilla-central@229801d17f7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspaul
bugs1070957
milestone35.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 1070957 - Show deprecation notice in App Manager. r=paul
browser/devtools/app-manager/content/index.js
browser/locales/en-US/chrome/browser/devtools/app-manager.properties
--- a/browser/devtools/app-manager/content/index.js
+++ b/browser/devtools/app-manager/content/index.js
@@ -1,20 +1,21 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-const Cu = Components.utils;
+const {utils: Cu, interfaces: Ci} = Components;
 Cu.import("resource:///modules/devtools/gDevTools.jsm");
 const {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
 const {require} = devtools;
 const {ConnectionManager, Connection} = require("devtools/client/connection-manager");
 const promise = require("devtools/toolkit/deprecated-sync-thenables");
-const prefs = require('sdk/preferences/service');
-
+const prefs = require("sdk/preferences/service");
+const Services = require("Services");
+const Strings = Services.strings.createBundle("chrome://browser/locale/devtools/app-manager.properties");
 
 let UI = {
   _toolboxTabCursor: 0,
   _handledTargets: new Map(),
 
   connection: null,
 
   init: function() {
@@ -29,16 +30,17 @@ let UI = {
     window.addEventListener("message", this.onMessage);
   },
 
   onLoad: function() {
     window.removeEventListener("load", this.onLoad);
     let defaultPanel = prefs.get("devtools.appmanager.lastTab");
     let panelExists = !!document.querySelector("." + defaultPanel  + "-panel");
     this.selectTab(panelExists ? defaultPanel : "projects");
+    this.showDeprecationNotice();
   },
 
   onUnload: function() {
     for (let [target, toolbox] of this._handledTargets) {
       toolbox.destroy();
     }
 
     window.removeEventListener("unload", this.onUnload);
@@ -173,12 +175,38 @@ let UI = {
         this._handledTargets.set(target, toolbox);
         toolbox.once("destroyed", () => {
           this._handledTargets.delete(target)
         });
       });
     } else {
       return gDevTools.showToolbox(target, null, host);
     }
+  },
+
+  showDeprecationNotice: function() {
+    let message = Strings.GetStringFromName("index.deprecationNotice");
+
+    let buttons = [
+      {
+        label: Strings.GetStringFromName("index.launchWebIDE"),
+        callback: gDevToolsBrowser.openWebIDE
+      },
+      {
+        label: Strings.GetStringFromName("index.readMoreAboutWebIDE"),
+        callback: () => {
+          window.open("https://developer.mozilla.org/docs/Tools/WebIDE");
+        }
+      }
+    ];
+
+    let docShell = window.QueryInterface(Ci.nsIInterfaceRequestor)
+                   .getInterface(Ci.nsIWebNavigation)
+                   .QueryInterface(Ci.nsIDocShell);
+    let browser = docShell.chromeEventHandler;
+    let nbox = browser.ownerDocument.defaultView.gBrowser
+               .getNotificationBox(browser);
+    nbox.appendNotification(message, "app-manager-deprecation", null,
+                            nbox.PRIORITY_WARNING_LOW, buttons);
   }
-}
+};
 
 UI.init();
--- a/browser/locales/en-US/chrome/browser/devtools/app-manager.properties
+++ b/browser/locales/en-US/chrome/browser/devtools/app-manager.properties
@@ -1,12 +1,15 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+index.deprecationNotice=The App Manager will be removed in a future release.  Your projects have been migrated to WebIDE.
+index.launchWebIDE=Launch WebIDE
+index.readMoreAboutWebIDE=Read More
 # LOCALIZATION NOTE (device.deviceSize): %1$S is the device's width, %2$S is
 # the device's height, %3$S is the device's pixel density.
 # Example: 800x480 (86 DPI).
 device.deviceSize=Device size: %1$Sx%2$S (%3$S DPI)
 # LOCALIZATION NOTE (connection.connectedToDevice, connection.connectTo):
 # %1$S is the host name, %2$S is the port number.
 connection.connectedToDevice=Connected to %1$S
 connection.connectTo=Connect to %1$S:%2$S