Bug 1022748 - Part 1: Pass extras through Accounts.launchSetup. r=rnewman
authorNick Alexander <nalexander@mozilla.com>
Sun, 22 Jun 2014 12:01:15 -0700
changeset 189829 9da481fd4b5d72d0ef5c09ed8c1aeec3fc2d109e
parent 189828 61c817d378b211c811cb920f0f2225506bd825d2
child 189830 e1f0b5ef74dc75e45b39def9efe13a1dbfe600ce
push id7390
push usernalexander@mozilla.com
push dateSun, 22 Jun 2014 19:04:16 +0000
treeherderfx-team@3908f68f7590 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman
bugs1022748
milestone33.0a1
Bug 1022748 - Part 1: Pass extras through Accounts.launchSetup. r=rnewman
mobile/android/base/BrowserApp.java
mobile/android/modules/Accounts.jsm
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -1125,16 +1125,20 @@ abstract public class BrowserApp extends
 
     @Override
     public void handleMessage(final String event, final NativeJSObject message,
                               final EventCallback callback) {
         if ("Accounts:Create".equals(event)) {
             // Do exactly the same thing as if you tapped 'Sync' in Settings.
             final Intent intent = new Intent(getContext(), FxAccountGetStartedActivity.class);
             intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+            final NativeJSObject extras = message.optObject("extras", null);
+            if (extras != null) {
+                intent.putExtra("extras", extras.toString());
+            }
             getContext().startActivity(intent);
 
         } else if ("CharEncoding:Data".equals(event)) {
             final NativeJSObject[] charsets = message.getObjectArray("charsets");
             final int selected = message.getInt("selected");
 
             final String[] titleArray = new String[charsets.length];
             final String[] codeArray = new String[charsets.length];
--- a/mobile/android/modules/Accounts.jsm
+++ b/mobile/android/modules/Accounts.jsm
@@ -60,17 +60,21 @@ let Accounts = Object.freeze({
   anySyncAccountsExist: function () {
     return this._accountsExist("any");
   },
 
   /**
    * Fire-and-forget: open the Firefox accounts activity, which
    * will be the Getting Started screen if FxA isn't yet set up.
    *
+   * Optional extras are passed, as a JSON string, to the Firefox
+   * Account Getting Started activity in the extras bundle of the
+   * activity launch intent, under the key "extras".
+   *
    * There is no return value from this method.
    */
-  launchSetup: function () {
+  launchSetup: function (extras) {
     sendMessageToJava({
       type: "Accounts:Create",
+      extras: extras,
     });
   },
 });
-