Bug 941292 - Move charms controller in with flyout code. r=sfoster
authorJim Mathies <jmathies@mozilla.com>
Tue, 03 Dec 2013 10:19:46 -0600
changeset 174418 bf8935bf584724365aac0414b079375c2c83e4fd
parent 174417 77c68153184c8ad19e72c097269828c9841dd850
child 174419 d8c647479ec112ed7fa290ebf5e94ed98a5614d6
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfoster
bugs941292
milestone28.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 941292 - Move charms controller in with flyout code. r=sfoster
browser/metro/base/content/browser-scripts.js
browser/metro/base/content/browser-ui.js
browser/metro/base/content/flyoutpanels/SettingsCharm.js
browser/metro/base/jar.mn
--- a/browser/metro/base/content/browser-scripts.js
+++ b/browser/metro/base/content/browser-scripts.js
@@ -111,16 +111,17 @@ let ScriptContexts = {};
   ["TopSites", "chrome://browser/content/TopSites.js"],
   ["Sanitizer", "chrome://browser/content/sanitize.js"],
   ["SanitizeUI", "chrome://browser/content/sanitizeUI.js"],
   ["SSLExceptions", "chrome://browser/content/exceptions.js"],
   ["ItemPinHelper", "chrome://browser/content/helperui/ItemPinHelper.js"],
   ["NavButtonSlider", "chrome://browser/content/NavButtonSlider.js"],
   ["ContextUI", "chrome://browser/content/ContextUI.js"],
   ["FlyoutPanelsUI", "chrome://browser/content/flyoutpanels/FlyoutPanelsUI.js"],
+  ["SettingsCharm", "chrome://browser/content/flyoutpanels/SettingsCharm.js"],
   ["APZCObserver", "chrome://browser/content/apzc.js"],
 ].forEach(function (aScript) {
   let [name, script] = aScript;
   XPCOMUtils.defineLazyGetter(window, name, function() {
     let sandbox;
     if (script in ScriptContexts) {
       sandbox = ScriptContexts[script];
     } else {
--- a/browser/metro/base/content/browser-ui.js
+++ b/browser/metro/base/content/browser-ui.js
@@ -1271,75 +1271,8 @@ var DialogUI = {
       if (targetNode instanceof Element && targetNode.hasAttribute("for"))
         targetNode = document.getElementById(targetNode.getAttribute("for"));
       else
         targetNode = targetNode.parentNode;
     }
     return targetNode ? true : false;
   }
 };
-
-/**
- * Manage the contents of the Windows 8 "Settings" charm.
- */
-var SettingsCharm = {
-  _entries: new Map(),
-  _nextId: 0,
-
-  /**
-   * Add a new item to the "Settings" menu in the Windows 8 charms.
-   * @param aEntry Object with a "label" property (string that will appear in the UI)
-   *    and an "onselected" property (function to be called when the user chooses this entry)
-   */
-  addEntry: function addEntry(aEntry) {
-    try {
-      let id = Services.metro.addSettingsPanelEntry(aEntry.label);
-      this._entries.set(id, aEntry);
-    } catch (e) {
-      // addSettingsPanelEntry does not work on non-Metro platforms
-      Cu.reportError(e);
-    }
-  },
-
-  init: function SettingsCharm_init() {
-    Services.obs.addObserver(this, "metro-settings-entry-selected", false);
-
-    // Options
-    this.addEntry({
-        label: Strings.browser.GetStringFromName("optionsCharm"),
-        onselected: function() FlyoutPanelsUI.show('PrefsFlyoutPanel')
-    });
-/*
- * Temporarily disabled until we can have sync prefs together with the
- * Desktop browser's sync prefs.
-    // Sync
-    this.addEntry({
-        label: Strings.brand.GetStringFromName("syncBrandShortName"),
-        onselected: function() FlyoutPanelsUI.show('SyncFlyoutPanel')
-    });
-*/
-    // About
-    this.addEntry({
-        label: Strings.browser.GetStringFromName("aboutCharm1"),
-        onselected: function() FlyoutPanelsUI.show('AboutFlyoutPanel')
-    });
-    // Help
-    this.addEntry({
-        label: Strings.browser.GetStringFromName("helpOnlineCharm"),
-        onselected: function() {
-          let url = Services.urlFormatter.formatURLPref("app.support.baseURL");
-          BrowserUI.addAndShowTab(url, Browser.selectedTab);
-        }
-    });
-  },
-
-  observe: function SettingsCharm_observe(aSubject, aTopic, aData) {
-    if (aTopic == "metro-settings-entry-selected") {
-      let entry = this._entries.get(parseInt(aData, 10));
-      if (entry)
-        entry.onselected();
-    }
-  },
-
-  uninit: function SettingsCharm_uninit() {
-    Services.obs.removeObserver(this, "metro-settings-entry-selected");
-  }
-};
new file mode 100644
--- /dev/null
+++ b/browser/metro/base/content/flyoutpanels/SettingsCharm.js
@@ -0,0 +1,67 @@
+
+/**
+ * Manage the contents of the Windows 8 "Settings" charm.
+ */
+var SettingsCharm = {
+  _entries: new Map(),
+  _nextId: 0,
+
+  /**
+   * Add a new item to the "Settings" menu in the Windows 8 charms.
+   * @param aEntry Object with a "label" property (string that will appear in the UI)
+   *    and an "onselected" property (function to be called when the user chooses this entry)
+   */
+  addEntry: function addEntry(aEntry) {
+    try {
+      let id = Services.metro.addSettingsPanelEntry(aEntry.label);
+      this._entries.set(id, aEntry);
+    } catch (e) {
+      // addSettingsPanelEntry does not work on non-Metro platforms
+      Cu.reportError(e);
+    }
+  },
+
+  init: function SettingsCharm_init() {
+    Services.obs.addObserver(this, "metro-settings-entry-selected", false);
+
+    // Options
+    this.addEntry({
+        label: Strings.browser.GetStringFromName("optionsCharm"),
+        onselected: function() FlyoutPanelsUI.show('PrefsFlyoutPanel')
+    });
+/*
+ * Temporarily disabled until we can have sync prefs together with the
+ * Desktop browser's sync prefs.
+    // Sync
+    this.addEntry({
+        label: Strings.brand.GetStringFromName("syncBrandShortName"),
+        onselected: function() FlyoutPanelsUI.show('SyncFlyoutPanel')
+    });
+*/
+    // About
+    this.addEntry({
+        label: Strings.browser.GetStringFromName("aboutCharm1"),
+        onselected: function() FlyoutPanelsUI.show('AboutFlyoutPanel')
+    });
+    // Help
+    this.addEntry({
+        label: Strings.browser.GetStringFromName("helpOnlineCharm"),
+        onselected: function() {
+          let url = Services.urlFormatter.formatURLPref("app.support.baseURL");
+          BrowserUI.addAndShowTab(url, Browser.selectedTab);
+        }
+    });
+  },
+
+  observe: function SettingsCharm_observe(aSubject, aTopic, aData) {
+    if (aTopic == "metro-settings-entry-selected") {
+      let entry = this._entries.get(parseInt(aData, 10));
+      if (entry)
+        entry.onselected();
+    }
+  },
+
+  uninit: function SettingsCharm_uninit() {
+    Services.obs.removeObserver(this, "metro-settings-entry-selected");
+  }
+};
--- a/browser/metro/base/jar.mn
+++ b/browser/metro/base/jar.mn
@@ -25,19 +25,23 @@ chrome.jar:
   content/bindings/flyoutpanel.xml             (content/bindings/flyoutpanel.xml)
   content/bindings/selectionoverlay.xml        (content/bindings/selectionoverlay.xml)
   content/bindings/cssthrobber.xml             (content/bindings/cssthrobber.xml)
   content/bindings/popup.xml                   (content/bindings/popup.xml)
   content/bindings/circularprogress.xml        (content/bindings/circularprogress.xml)
   content/bindings/notification.xml            (content/bindings/notification.xml)
   content/bindings/tabprompts.xml              (content/bindings/tabprompts.xml)
 
+  content/flyoutpanels/SettingsCharm.js        (content/flyoutpanels/SettingsCharm.js)
 * content/flyoutpanels/FlyoutPanelsUI.js       (content/flyoutpanels/FlyoutPanelsUI.js)
 * content/flyoutpanels/AboutFlyoutPanel.js     (content/flyoutpanels/AboutFlyoutPanel.js)
   content/flyoutpanels/PrefsFlyoutPanel.js     (content/flyoutpanels/PrefsFlyoutPanel.js)
+#ifdef MOZ_SERVICES_SYNC
+  content/flyoutpanels/SyncFlyoutPanel.js      (content/flyoutpanels/SyncFlyoutPanel.js)
+#endif
 
   content/helperui/AlertsHelper.js             (content/helperui/AlertsHelper.js)
   content/helperui/IndexedDB.js                (content/helperui/IndexedDB.js)
   content/helperui/MenuUI.js                   (content/helperui/MenuUI.js)
   content/helperui/OfflineApps.js              (content/helperui/OfflineApps.js)
   content/helperui/SelectHelperUI.js           (content/helperui/SelectHelperUI.js)
   content/helperui/SelectionHelperUI.js        (content/helperui/SelectionHelperUI.js)
   content/helperui/ChromeSelectionHandler.js   (content/helperui/ChromeSelectionHandler.js)
@@ -76,19 +80,16 @@ chrome.jar:
   content/Util.js                              (content/Util.js)
   content/bookmarks.js                         (content/bookmarks.js)
   content/exceptions.js                        (content/exceptions.js)
   content/downloads.js                         (content/downloads.js)
   content/Site.js                              (content/Site.js)
   content/TopSites.js                          (content/TopSites.js)
   content/console.js                           (content/console.js)
   content/dbg-metro-actors.js                  (content/dbg-metro-actors.js)
-#ifdef MOZ_SERVICES_SYNC
-  content/flyoutpanels/SyncFlyoutPanel.js      (content/flyoutpanels/SyncFlyoutPanel.js)
-#endif
   content/NavButtonSlider.js                   (content/NavButtonSlider.js)
   content/ContextUI.js                         (content/ContextUI.js)
   content/apzc.js                              (content/apzc.js)
 
 * content/Start.xul                            (content/startui/Start.xul)
 * content/startui-scripts.js                   (content/startui/startui-scripts.js)
   content/StartUI.js                           (content/startui/StartUI.js)
   content/BookmarksView.js                     (content/startui/BookmarksView.js)