Chromium Code Reviews| 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 7482d5ad00ec461e67bb5e8583355090110d29cb..30b82612f853e25963e7d8fe71457cd315972fe8 100644 |
| --- a/chrome/browser/ui/passwords/manage_passwords_ui_controller.h |
| +++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller.h |
| @@ -21,6 +21,11 @@ namespace content { |
| class WebContents; |
| } |
| +namespace password_manager { |
| +struct CredentialInfo; |
| +} |
| + |
| +class ManagePasswordsBubbleModel; |
| class ManagePasswordsIcon; |
| // Per-tab class to control the Omnibox password icon and bubble. |
| @@ -38,6 +43,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 +75,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,12 +93,15 @@ 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_; } |
| // True if a password is sitting around, waiting for a user to decide whether |
| @@ -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, |
| @@ -132,16 +156,14 @@ class ManagePasswordsUIController |
| private: |
| friend class content::WebContentsUserData<ManagePasswordsUIController>; |
| + friend void InitPasswordsModelFromController( |
|
Mike West
2014/11/20 08:19:32
Why `friend`?
vasilii
2014/11/20 15:08:06
We steal ScopedVector<autofill::PasswordForm> from
|
| + ManagePasswordsUIController* controller, |
| + ManagePasswordsBubbleModel* model); |
| // Shows the password bubble without user interaction. The controller MUST |
| // 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 +173,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_; |
|
Mike West
2014/11/20 08:19:32
This was unused? Weird.
vasilii
2014/11/20 15:08:05
Yes.
|
| + // 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 |