Bug 699513 - Advertise Telemetry opt-in on mobile [r=mfinkle]
authorBrian Nicholson <bnicholson@mozilla.com>
Fri, 11 Nov 2011 12:31:16 -0800
changeset 83443 2e175acc56b9feea16dd5ada653285db50b30e6b
parent 83442 80e0c193d27fe7f3145dc9f53e817c4cee36fc72
child 83444 7c27d32e8c2f10776748625300525df4f7f9c4cd
push id519
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 00:38:35 +0000
treeherdermozilla-beta@788ea1ef610b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs699513
milestone10.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 699513 - Advertise Telemetry opt-in on mobile [r=mfinkle]
mobile/chrome/content/browser.js
mobile/locales/en-US/chrome/browser.properties
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -199,16 +199,46 @@ var BrowserApp = {
     window.dispatchEvent(event);
 
     // notify java that gecko has loaded
     sendMessageToJava({
       gecko: {
         type: "Gecko:Ready"
       }
     });
+
+    let telemetryPrompted = false;
+    try {
+      telemetryPrompted = Services.prefs.getBoolPref("toolkit.telemetry.prompted");
+    } catch (e) {
+      // optional
+    }
+
+    if (!telemetryPrompted) {
+      let buttons = [
+        {
+          label: Strings.browser.GetStringFromName("telemetry.optin.yes"),
+          callback: function () { 
+            Services.prefs.setBoolPref("toolkit.telemetry.prompted", true);
+            Services.prefs.setBoolPref("toolkit.telemetry.enabled", true);
+          }
+        },
+        {
+          label: Strings.browser.GetStringFromName("telemetry.optin.no"),
+          callback: function () { 
+            Services.prefs.setBoolPref("toolkit.telemetry.prompted", true);
+            Services.prefs.setBoolPref("toolkit.telemetry.enabled", false);
+          }
+        }
+      ];
+      let brandShortName = Strings.brand.GetStringFromName("brandShortName");
+      let message = Strings.browser.formatStringFromName("telemetry.optin.message", [brandShortName], 1);
+      NativeWindow.doorhanger.show(message, "telemetry-optin", buttons);
+    }
+
   },
 
   shutdown: function shutdown() {
     NativeWindow.uninit();
     OfflineApps.uninit();
 
     Services.obs.removeObserver(XPInstallObserver, "addon-install-blocked");
     Services.obs.removeObserver(XPInstallObserver, "addon-install-started");
--- a/mobile/locales/en-US/chrome/browser.properties
+++ b/mobile/locales/en-US/chrome/browser.properties
@@ -122,16 +122,21 @@ notificationRestart.button=Restart
 
 # Popup Blocker
 popupWarning=%S prevented this site from opening a pop-up window.
 popupWarningMultiple=%S prevented this site from opening %S pop-up windows.
 popupButtonAllowOnce=Show
 popupButtonAlwaysAllow2=Always Show
 popupButtonNeverWarn2=Never Show
 
+# Telemetry
+telemetry.optin.message=Help improve %S by sending anonymous usage information to Mozilla?
+telemetry.optin.yes=Yes
+telemetry.optin.no=No
+
 # XPInstall
 xpinstallPromptWarning2=%S prevented this site (%S) from asking you to install software on your device.
 xpinstallPromptAllowButton=Allow
 xpinstallDisabledMessageLocked=Software installation has been disabled by your system administrator.
 xpinstallDisabledMessage2=Software installation is currently disabled. Press Enable and try again.
 xpinstallDisabledButton=Enable
 
 # Site Identity