| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_UI_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_UI_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_UI_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_UI_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "components/password_manager/core/browser/password_form_manager.h" | 8 #include "components/password_manager/core/browser/password_form_manager.h" |
| 9 #include "components/password_manager/core/browser/password_store.h" | 9 #include "components/password_manager/core/browser/password_store.h" |
| 10 #include "components/password_manager/core/browser/password_store_change.h" | 10 #include "components/password_manager/core/browser/password_store_change.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // This stores the provided object in form_manager_ and triggers the UI to | 31 // This stores the provided object in form_manager_ and triggers the UI to |
| 32 // prompt the user about whether they would like to save the password. | 32 // prompt the user about whether they would like to save the password. |
| 33 void OnPasswordSubmitted(password_manager::PasswordFormManager* form_manager); | 33 void OnPasswordSubmitted(password_manager::PasswordFormManager* form_manager); |
| 34 | 34 |
| 35 // Called when a form is autofilled with login information, so we can manage | 35 // Called when a form is autofilled with login information, so we can manage |
| 36 // password credentials for the current site which are stored in | 36 // password credentials for the current site which are stored in |
| 37 // |password_form_map|. This stores a copy of |password_form_map| and shows | 37 // |password_form_map|. This stores a copy of |password_form_map| and shows |
| 38 // the manage password icon. | 38 // the manage password icon. |
| 39 void OnPasswordAutofilled(const autofill::PasswordFormMap& password_form_map); | 39 void OnPasswordAutofilled(const autofill::PasswordFormMap& password_form_map); |
| 40 | 40 |
| 41 // Called when a form is _not_ autofilled due to user blacklisting. | 41 // Called when a form is _not_ autofilled due to user blacklisting. This |
| 42 void OnBlacklistBlockedAutofill(); | 42 // stores a copy of |password_form_map| so that we can offer the user the |
| 43 // ability to reenable the manager for this form. |
| 44 void OnBlacklistBlockedAutofill( |
| 45 const autofill::PasswordFormMap& password_form_map); |
| 43 | 46 |
| 44 // PasswordStore::Observer implementation. | 47 // PasswordStore::Observer implementation. |
| 45 virtual void OnLoginsChanged( | 48 virtual void OnLoginsChanged( |
| 46 const password_manager::PasswordStoreChangeList& changes) OVERRIDE; | 49 const password_manager::PasswordStoreChangeList& changes) OVERRIDE; |
| 47 | 50 |
| 48 // Called from the model when the user chooses to save a password; passes the | 51 // Called from the model when the user chooses to save a password; passes the |
| 49 // action off to the FormManager. | 52 // action off to the FormManager. |
| 50 virtual void SavePassword(); | 53 virtual void SavePassword(); |
| 51 | 54 |
| 52 // Called from the model when the user chooses to never save passwords; passes | 55 // Called from the model when the user chooses to never save passwords; passes |
| 53 // the action off to the FormManager. | 56 // the action off to the FormManager. |
| 54 virtual void NeverSavePassword(); | 57 virtual void NeverSavePassword(); |
| 55 | 58 |
| 59 // Called from the model when the user chooses to unblacklist the site. |
| 60 virtual void UnblacklistSite(); |
| 61 |
| 56 // Open a new tab, pointing to the password manager settings page. | 62 // Open a new tab, pointing to the password manager settings page. |
| 57 virtual void NavigateToPasswordManagerSettingsPage(); | 63 virtual void NavigateToPasswordManagerSettingsPage(); |
| 58 | 64 |
| 59 virtual const autofill::PasswordForm& PendingCredentials() const; | 65 virtual const autofill::PasswordForm& PendingCredentials() const; |
| 60 | 66 |
| 61 // Set the state of the Omnibox icon, and possibly show the associated bubble | 67 // Set the state of the Omnibox icon, and possibly show the associated bubble |
| 62 // without user interaction. | 68 // without user interaction. |
| 63 virtual void UpdateIconAndBubbleState(ManagePasswordsIcon* icon); | 69 virtual void UpdateIconAndBubbleState(ManagePasswordsIcon* icon); |
| 64 | 70 |
| 65 bool manage_passwords_icon_to_be_shown() const { | 71 bool manage_passwords_icon_to_be_shown() const { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 86 void set_autofill_blocked(bool autofill_blocked) { | 92 void set_autofill_blocked(bool autofill_blocked) { |
| 87 autofill_blocked_ = autofill_blocked; | 93 autofill_blocked_ = autofill_blocked; |
| 88 } | 94 } |
| 89 | 95 |
| 90 const GURL& origin() const { return origin_; } | 96 const GURL& origin() const { return origin_; } |
| 91 | 97 |
| 92 protected: | 98 protected: |
| 93 explicit ManagePasswordsBubbleUIController( | 99 explicit ManagePasswordsBubbleUIController( |
| 94 content::WebContents* web_contents); | 100 content::WebContents* web_contents); |
| 95 | 101 |
| 102 // All previously stored credentials for a specific site. Set by |
| 103 // OnPasswordSubmitted(), OnPasswordAutofilled(), or |
| 104 // OnBlacklistBlockedAutofill(). Protected, not private, so we can mess with |
| 105 // the value in ManagePasswordsBubbleUIControllerMock. |
| 106 autofill::PasswordFormMap password_form_map_; |
| 107 |
| 96 private: | 108 private: |
| 97 friend class content::WebContentsUserData<ManagePasswordsBubbleUIController>; | 109 friend class content::WebContentsUserData<ManagePasswordsBubbleUIController>; |
| 98 | 110 |
| 99 // Called when a passwordform is autofilled, when a new passwordform is | 111 // Called when a passwordform is autofilled, when a new passwordform is |
| 100 // submitted, or when a navigation occurs to update the visibility of the | 112 // submitted, or when a navigation occurs to update the visibility of the |
| 101 // manage passwords icon and bubble. | 113 // manage passwords icon and bubble. |
| 102 void UpdateBubbleAndIconVisibility(); | 114 void UpdateBubbleAndIconVisibility(); |
| 103 | 115 |
| 104 // content::WebContentsObserver: | 116 // content::WebContentsObserver: |
| 105 virtual void DidNavigateMainFrame( | 117 virtual void DidNavigateMainFrame( |
| 106 const content::LoadCommittedDetails& details, | 118 const content::LoadCommittedDetails& details, |
| 107 const content::FrameNavigateParams& params) OVERRIDE; | 119 const content::FrameNavigateParams& params) OVERRIDE; |
| 108 virtual void WebContentsDestroyed( | 120 virtual void WebContentsDestroyed( |
| 109 content::WebContents* web_contents) OVERRIDE; | 121 content::WebContents* web_contents) OVERRIDE; |
| 110 | 122 |
| 111 // Set by OnPasswordSubmitted() when the user submits a form containing login | 123 // Set by OnPasswordSubmitted() when the user submits a form containing login |
| 112 // information. If the user responds to a subsequent "Do you want to save | 124 // information. If the user responds to a subsequent "Do you want to save |
| 113 // this password?" prompt, we ask this object to save or blacklist the | 125 // this password?" prompt, we ask this object to save or blacklist the |
| 114 // associated login information in Chrome's password store. | 126 // associated login information in Chrome's password store. |
| 115 scoped_ptr<password_manager::PasswordFormManager> form_manager_; | 127 scoped_ptr<password_manager::PasswordFormManager> form_manager_; |
| 116 | 128 |
| 117 // All previously stored credentials for a specific site. Set by | |
| 118 // OnPasswordSubmitted() or OnPasswordAutofilled(). | |
| 119 autofill::PasswordFormMap password_form_map_; | |
| 120 | |
| 121 bool manage_passwords_icon_to_be_shown_; | 129 bool manage_passwords_icon_to_be_shown_; |
| 122 bool password_to_be_saved_; | 130 bool password_to_be_saved_; |
| 123 bool manage_passwords_bubble_needs_showing_; | 131 bool manage_passwords_bubble_needs_showing_; |
| 124 | 132 |
| 125 // Stores whether autofill was blocked due to a user's decision to blacklist | 133 // Stores whether autofill was blocked due to a user's decision to blacklist |
| 126 // the current site ("Never save passwords for this site"). | 134 // the current site ("Never save passwords for this site"). |
| 127 bool autofill_blocked_; | 135 bool autofill_blocked_; |
| 128 | 136 |
| 129 // The origin of the form we're currently dealing with; we'll use this to | 137 // The origin of the form we're currently dealing with; we'll use this to |
| 130 // determine which PasswordStore changes we should care about when updating | 138 // determine which PasswordStore changes we should care about when updating |
| 131 // |password_form_map_|. | 139 // |password_form_map_|. |
| 132 GURL origin_; | 140 GURL origin_; |
| 133 | 141 |
| 134 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleUIController); | 142 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleUIController); |
| 135 }; | 143 }; |
| 136 | 144 |
| 137 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_UI_CONTROLLER_H_ | 145 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_UI_CONTROLLER_H_ |
| OLD | NEW |