Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3596)

Unified Diff: chrome/browser/ui/passwords/manage_passwords_ui_controller.h

Issue 733463003: Show user credentials chooser bubble. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge with trunk Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/passwords/manage_passwords_ui_controller.h
diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller.h b/chrome/browser/ui/passwords/manage_passwords_ui_controller.h
index 772d5dc77b6b2561f4503c5ab99cc0858299e842..87c52dc6d2828e576e19cdd481db82ec70bd438e 100644
--- a/chrome/browser/ui/passwords/manage_passwords_ui_controller.h
+++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller.h
@@ -18,6 +18,7 @@ class WebContents;
}
namespace password_manager {
+struct CredentialInfo;
class PasswordFormManager;
}
@@ -38,6 +39,12 @@ class ManagePasswordsUIController
void OnPasswordSubmitted(
scoped_ptr<password_manager::PasswordFormManager> form_manager);
+ // Called when the site asks user to choose from credentials. This triggers
+ // the UI to prompt the user. |credentials| shouldn't be empty.
+ bool OnChooseCredentials(
+ ScopedVector<autofill::PasswordForm> credentials,
+ base::Callback<void(const password_manager::CredentialInfo&)> callback);
+
// Called when the password will be saved automatically, but we still wish to
// visually inform the user that the save has occured.
void OnAutomaticPasswordSave(
@@ -64,6 +71,11 @@ class ManagePasswordsUIController
// and WILL be in MANAGE_STATE after this method executes.
virtual void SavePassword();
+ // Called from the model when the user chooses a credential.
+ // The controller MUST be in a pending credentials state.
+ virtual void ChooseCredential(bool was_chosen,
+ const autofill::PasswordForm& form);
+
// Called from the model when the user chooses to never save passwords; passes
// the action off to the FormManager. The controller MUST be in a pending
// state, and WILL be in BLACKLIST_STATE after this method executes.
@@ -77,14 +89,21 @@ class ManagePasswordsUIController
// Open a new tab, pointing to the password manager settings page.
virtual void NavigateToPasswordManagerSettingsPage();
- virtual const autofill::PasswordForm& PendingCredentials() const;
+ virtual const autofill::PasswordForm& PendingPassword() const;
// Set the state of the Omnibox icon, and possibly show the associated bubble
// without user interaction.
virtual void UpdateIconAndBubbleState(ManagePasswordsIcon* icon);
+ // Called from the model when the bubble is displayed.
+ void OnBubbleShown();
+
password_manager::ui::State state() const { return state_; }
+ ScopedVector<autofill::PasswordForm>& new_password_forms() {
+ return new_password_forms_;
+ }
+
// True if a password is sitting around, waiting for a user to decide whether
// or not to save it.
bool PasswordPendingUserDecision() const;
@@ -104,6 +123,11 @@ class ManagePasswordsUIController
virtual void SavePasswordInternal();
virtual void NeverSavePasswordInternal();
+ // Called when a passwordform is autofilled, when a new passwordform is
+ // submitted, or when a navigation occurs to update the visibility of the
+ // manage passwords icon and bubble.
+ virtual void UpdateBubbleAndIconVisibility();
+
// content::WebContentsObserver:
void DidNavigateMainFrame(
const content::LoadCommittedDetails& details,
@@ -137,11 +161,6 @@ class ManagePasswordsUIController
// be in PENDING_PASSWORD_AND_BUBBLE_STATE.
void ShowBubbleWithoutUserInteraction();
- // Called when a passwordform is autofilled, when a new passwordform is
- // submitted, or when a navigation occurs to update the visibility of the
- // manage passwords icon and bubble.
- void UpdateBubbleAndIconVisibility();
-
// content::WebContentsObserver:
void WebContentsDestroyed() override;
@@ -151,9 +170,13 @@ class ManagePasswordsUIController
// associated login information in Chrome's password store.
scoped_ptr<password_manager::PasswordFormManager> form_manager_;
- // Stores whether autofill was blocked due to a user's decision to blacklist
- // the current site ("Never save passwords for this site").
- bool autofill_blocked_;
+ // A callback to be invoked when user selects a credential.
+ base::Callback<void(const password_manager::CredentialInfo&)>
+ credentials_callback_;
+
+ // Contains true is the bubble's appeared during the last call to
+ // UpdateBubbleAndIconVisibility().
+ bool bubble_shown_;
// The origin of the form we're currently dealing with; we'll use this to
// determine which PasswordStore changes we should care about when updating

Powered by Google App Engine
This is Rietveld 408576698