diff --git a/mobile/android/base/locales/en-US/android_strings.dtd b/mobile/android/base/locales/en-US/android_strings.dtd index 3b84a12d685b..c9e7f8c62f99 100644 --- a/mobile/android/base/locales/en-US/android_strings.dtd +++ b/mobile/android/base/locales/en-US/android_strings.dtd @@ -452,7 +452,6 @@ size. --> - diff --git a/mobile/android/base/strings.xml.in b/mobile/android/base/strings.xml.in index be015f70a74e..8767f724a81d 100644 --- a/mobile/android/base/strings.xml.in +++ b/mobile/android/base/strings.xml.in @@ -385,7 +385,6 @@ &button_clear; &button_yes; &button_no; - &button_remember; &button_copy; &firstrun_panel_title_welcome; diff --git a/mobile/android/base/widget/LoginDoorHanger.java b/mobile/android/base/widget/LoginDoorHanger.java index 96d3ac2f12ef..b79f2ffb02ec 100644 --- a/mobile/android/base/widget/LoginDoorHanger.java +++ b/mobile/android/base/widget/LoginDoorHanger.java @@ -38,7 +38,7 @@ public class LoginDoorHanger extends DoorHanger { private final TextView mTitle; private final TextView mMessage; private final TextView mLink; - private int mCallbackID; + private final DoorhangerConfig.ButtonConfig mButtonConfig; public LoginDoorHanger(Context context, DoorhangerConfig config) { super(context, config, Type.LOGIN); @@ -49,6 +49,8 @@ public class LoginDoorHanger extends DoorHanger { mIcon.setImageResource(R.drawable.icon_key); mIcon.setVisibility(View.VISIBLE); + mButtonConfig = config.getPositiveButtonConfig(); + loadConfig(config); } @@ -62,7 +64,6 @@ public class LoginDoorHanger extends DoorHanger { setOptions(config.getOptions()); setMessage(config.getMessage()); // Store the positive callback id for nested dialogs that need the same callback id. - mCallbackID = config.getPositiveButtonConfig().callback; addButtonsToLayout(config); } @@ -160,12 +161,12 @@ public class LoginDoorHanger extends DoorHanger { }); builder.setView(view); - builder.setPositiveButton(R.string.button_remember, new DialogInterface.OnClickListener() { + builder.setPositiveButton(mButtonConfig.label, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { JSONObject response = new JSONObject(); try { - response.put("callback", mCallbackID); + response.put("callback", mButtonConfig.callback); final JSONObject inputs = new JSONObject(); inputs.put("username", username.getText()); inputs.put("password", password.getText()); @@ -214,7 +215,7 @@ public class LoginDoorHanger extends DoorHanger { public void onClick(DialogInterface dialog, int which) { final JSONObject response = new JSONObject(); try { - response.put("callback", mCallbackID); + response.put("callback", mButtonConfig.callback); response.put("password", passwords[which]); } catch (JSONException e) { Log.e(LOGTAG, "Error making login select dialog JSON", e); diff --git a/mobile/android/components/LoginManagerPrompter.js b/mobile/android/components/LoginManagerPrompter.js index 64cb2c0b8cc6..0106d667a3c8 100644 --- a/mobile/android/components/LoginManagerPrompter.js +++ b/mobile/android/components/LoginManagerPrompter.js @@ -146,16 +146,24 @@ LoginManagerPrompter.prototype = { * String message to be displayed in the doorhanger * @param aButtons * Buttons to display with the doorhanger - * @param aActionText - * Object with text to be displayed as clickable, along with a bundle to create an action - * + * @param aUsername + * Username string used in creating a doorhanger action + * @param aPassword + * Password string used in creating a doorhanger action */ - _showLoginNotification : function (aTitle, aBody, aButtons, aActionText) { + _showLoginNotification : function (aTitle, aBody, aButtons, aUsername, aPassword) { let notifyWin = this._window.top; let chromeWin = this._getChromeWindow(notifyWin).wrappedJSObject; let browser = chromeWin.BrowserApp.getBrowserForWindow(notifyWin); let tabID = chromeWin.BrowserApp.getTabForBrowser(browser).id; + let actionText = { + text: aUsername, + type: "EDIT", + bundle: { username: aUsername, + password: aPassword } + }; + // The page we're going to hasn't loaded yet, so we want to persist // across the first location change. @@ -163,12 +171,11 @@ LoginManagerPrompter.prototype = { // at the post-authentication page. I don't see a good way to // heuristically determine when to ignore such location changes, so // we'll try ignoring location changes based on a time interval. - let options = { persistWhileVisible: true, timeout: Date.now() + 10000, title: aTitle, - actionText: aActionText + actionText: actionText } var nativeWindow = this._getNativeWindow(); @@ -194,13 +201,6 @@ LoginManagerPrompter.prototype = { let username = aLogin.username ? this._sanitizeUsername(aLogin.username) : ""; - let actionText = { - text: username, - type: "EDIT", - bundle: { username: username, - password: aLogin.password } - }; - // The callbacks in |buttons| have a closure to access the variables // in scope here; set one to |this._pwmgr| so we can get back to pwmgr // without a getService() call. @@ -230,7 +230,7 @@ LoginManagerPrompter.prototype = { } ]; - this._showLoginNotification(title, notificationText, buttons, actionText); + this._showLoginNotification(title, notificationText, buttons, aLogin.username, aLogin.password); }, /* @@ -280,15 +280,17 @@ LoginManagerPrompter.prototype = { }, { label: this._getLocalizedString("updateButton"), - callback: function() { - self._updateLogin(aOldLogin, aNewPassword); - promptHistogram.add(PROMPT_UPDATE); + callback: function(checked, response) { + let password = response ? response["password"] : aNewPassword; + self._updateLogin(aOldLogin, password); + + promptHistogram.add(PROMPT_UPDATE); }, positive: true } ]; - this._showLoginNotification(title, notificationText, buttons); + this._showLoginNotification(title, notificationText, buttons, aOldLogin.username, aNewPassword); },