Bug 966933 - [Australis] UITour: Add a UI tour link in the Help menu. r=Gijs a=sylvestre
authorBlair McBride <bmcbride@mozilla.com>
Thu, 06 Mar 2014 14:41:43 +1300
changeset 183201 bcda1e3e802b66560d482544ebbb3a5f0822920e
parent 183200 12450a1263bd9b4b52a361aeb7698acecd962bbe
child 183202 602a86a948f650a8e60f19d9b5f02b6b20af6473
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs, sylvestre
bugs966933
milestone29.0a2
Bug 966933 - [Australis] UITour: Add a UI tour link in the Help menu. r=Gijs a=sylvestre
browser/app/profile/firefox.js
browser/base/content/baseMenuOverlay.xul
browser/base/content/utilityOverlay.js
browser/modules/UITour.jsm
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -245,16 +245,17 @@ pref("xpinstall.whitelist.add.180", "mar
 
 pref("lightweightThemes.update.enabled", true);
 
 // UI tour experience.
 pref("browser.uitour.enabled", true);
 pref("browser.uitour.requireSecure", true);
 pref("browser.uitour.themeOrigin", "https://addons.mozilla.org/%LOCALE%/firefox/themes/");
 pref("browser.uitour.pinnedTabUrl", "https://support.mozilla.org/%LOCALE%/kb/pinned-tabs-keep-favorite-websites-open");
+pref("browser.uitour.url", "https://www.mozilla.org/%LOCALE%/firefox/%VERSION%/tour/");
 pref("browser.uitour.whitelist.add.260", "www.mozilla.org,support.mozilla.org");
 
 pref("keyword.enabled", true);
 
 pref("general.useragent.locale", "@AB_CD@");
 pref("general.skins.selectedSkin", "classic/1.0");
 
 pref("general.smoothScroll", true);
--- a/browser/base/content/baseMenuOverlay.xul
+++ b/browser/base/content/baseMenuOverlay.xul
@@ -47,16 +47,20 @@
                   onclick="checkForMiddleClick(this, event);"
                   label="&productHelp.label;"
                   accesskey="&productHelp.accesskey;"
 #ifdef XP_MACOSX
                   key="key_openHelpMac"/>
 #else
                   />
 #endif
+        <menuitem id="menu_openTour"
+                  oncommand="openTourPage();"
+                  label="&helpShowTour.label;"
+                  accesskey="&helpShowTour.accesskey;"/>
         <menuitem id="menu_keyboardShortcuts"
                   oncommand="openHelpLink('keyboard-shortcuts')"
                   onclick="checkForMiddleClick(this, event);"
                   label="&helpKeyboardShortcuts.label;"
                   accesskey="&helpKeyboardShortcuts.accesskey;"/>
 #ifdef MOZ_SERVICES_HEALTHREPORT
         <menuitem id="healthReport"
                   label="&healthReport.label;"
--- a/browser/base/content/utilityOverlay.js
+++ b/browser/base/content/utilityOverlay.js
@@ -557,16 +557,23 @@ function openHealthReport()
 /**
  * Opens the feedback page for this version of the application.
  */
 function openFeedbackPage()
 {
   openUILinkIn("https://input.mozilla.org/feedback", "tab");
 }
 
+function openTourPage()
+{
+  let scope = {}
+  Components.utils.import("resource:///modules/UITour.jsm", scope);
+  openUILinkIn(scope.UITour.url, "tab");
+}
+
 function buildHelpMenu()
 {
   // Enable/disable the "Report Web Forgery" menu item.
   if (typeof gSafeBrowsing != "undefined")
     gSafeBrowsing.setReportPhishingMenu();
 }
 
 function isElementVisible(aElement)
--- a/browser/modules/UITour.jsm
+++ b/browser/modules/UITour.jsm
@@ -37,16 +37,17 @@ const BUCKET_TIMESTEPS    = [
   60 * 60 * 1000, // Until 1 hour after tab is closed/inactive.
 ];
 
 // Time after which seen Page IDs expire.
 const SEENPAGEID_EXPIRY  = 2 * 7 * 24 * 60 * 60 * 1000; // 2 weeks.
 
 
 this.UITour = {
+  url: null,
   seenPageIDs: null,
   pageIDSourceTabs: new WeakMap(),
   pageIDSourceWindows: new WeakMap(),
   /* Map from browser windows to a set of tabs in which a tour is open */
   originTabs: new WeakMap(),
   /* Map from browser windows to a set of pinned tabs opened by (a) tour(s) */
   pinnedTabs: new WeakMap(),
   urlbarCapture: new WeakMap(),
@@ -122,16 +123,21 @@ this.UITour = {
     // Lazy getter is initialized here so it can be replicated any time
     // in a test.
     delete this.seenPageIDs;
     Object.defineProperty(this, "seenPageIDs", {
       get: this.restoreSeenPageIDs.bind(this),
       configurable: true,
     });
 
+    delete this.url;
+    XPCOMUtils.defineLazyGetter(this, "url", function () {
+      return Services.urlFormatter.formatURLPref("browser.uitour.url");
+    });
+
     UITelemetry.addSimpleMeasureFunction("UITour",
                                          this.getTelemetry.bind(this));
 
     // Clear the availableTargetsCache on widget changes.
     let listenerMethods = [
       "onWidgetAdded",
       "onWidgetMoved",
       "onWidgetRemoved",