OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_UI_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_ |
7 | 7 |
8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
9 #include "base/timer/elapsed_timer.h" | 9 #include "base/timer/elapsed_timer.h" |
10 #include "chrome/browser/ui/passwords/manage_passwords_state.h" | 10 #include "chrome/browser/ui/passwords/manage_passwords_state.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 public: | 34 public: |
35 ~ManagePasswordsUIController() override; | 35 ~ManagePasswordsUIController() override; |
36 | 36 |
37 // Called when the user submits a form containing login information, so we | 37 // Called when the user submits a form containing login information, so we |
38 // can handle later requests to save or blacklist that login information. | 38 // can handle later requests to save or blacklist that login information. |
39 // This stores the provided object and triggers the UI to prompt the user | 39 // This stores the provided object and triggers the UI to prompt the user |
40 // about whether they would like to save the password. | 40 // about whether they would like to save the password. |
41 void OnPasswordSubmitted( | 41 void OnPasswordSubmitted( |
42 scoped_ptr<password_manager::PasswordFormManager> form_manager); | 42 scoped_ptr<password_manager::PasswordFormManager> form_manager); |
43 | 43 |
| 44 // Called when the user submits a change password form, so we can handle |
| 45 // later requests to update stored credentials in the PasswordManager. |
| 46 // This stores the provided object and triggers the UI to prompt the user |
| 47 // about whether they would like to update the password. |
| 48 void OnUpdatePasswordSubmitted( |
| 49 scoped_ptr<password_manager::PasswordFormManager> form_manager); |
| 50 |
44 // Called when the site asks user to choose from credentials. This triggers | 51 // Called when the site asks user to choose from credentials. This triggers |
45 // the UI to prompt the user. |local_credentials| and |federated_credentials| | 52 // the UI to prompt the user. |local_credentials| and |federated_credentials| |
46 // shouldn't both be empty. | 53 // shouldn't both be empty. |
47 bool OnChooseCredentials( | 54 bool OnChooseCredentials( |
48 ScopedVector<autofill::PasswordForm> local_credentials, | 55 ScopedVector<autofill::PasswordForm> local_credentials, |
49 ScopedVector<autofill::PasswordForm> federated_credentials, | 56 ScopedVector<autofill::PasswordForm> federated_credentials, |
50 const GURL& origin, | 57 const GURL& origin, |
51 base::Callback<void(const password_manager::CredentialInfo&)> callback); | 58 base::Callback<void(const password_manager::CredentialInfo&)> callback); |
52 | 59 |
53 // Called when user is auto signed in to the site. |local_forms[0]| contains | 60 // Called when user is auto signed in to the site. |local_forms[0]| contains |
(...skipping 15 matching lines...) Expand all Loading... |
69 // stores a copy of |password_form_map| so that we can offer the user the | 76 // stores a copy of |password_form_map| so that we can offer the user the |
70 // ability to reenable the manager for this form. | 77 // ability to reenable the manager for this form. |
71 void OnBlacklistBlockedAutofill( | 78 void OnBlacklistBlockedAutofill( |
72 const autofill::PasswordFormMap& password_form_map); | 79 const autofill::PasswordFormMap& password_form_map); |
73 | 80 |
74 // PasswordStore::Observer implementation. | 81 // PasswordStore::Observer implementation. |
75 void OnLoginsChanged( | 82 void OnLoginsChanged( |
76 const password_manager::PasswordStoreChangeList& changes) override; | 83 const password_manager::PasswordStoreChangeList& changes) override; |
77 | 84 |
78 // Called from the model when the user chooses to save a password; passes the | 85 // Called from the model when the user chooses to save a password; passes the |
79 // action off to the FormManager. The controller MUST be in a pending state, | 86 // action to the |form_manager|. The controller must be in a pending state, |
80 // and WILL be in MANAGE_STATE after this method executes. | 87 // and will be in MANAGE_STATE after this method executes. |
81 virtual void SavePassword(); | 88 virtual void SavePassword(); |
82 | 89 |
| 90 // Called from the model when the user chooses to update a password; passes |
| 91 // the action to the |form_manager|. The controller must be in a pending |
| 92 // state, and will be in MANAGE_STATE after this method executes. |
| 93 virtual void UpdatePassword(const autofill::PasswordForm& password_form); |
| 94 |
83 // Called from the model when the user chooses a credential. | 95 // Called from the model when the user chooses a credential. |
84 // The controller MUST be in a pending credentials state. | 96 // The controller MUST be in a pending credentials state. |
85 virtual void ChooseCredential( | 97 virtual void ChooseCredential( |
86 const autofill::PasswordForm& form, | 98 const autofill::PasswordForm& form, |
87 password_manager::CredentialType credential_type); | 99 password_manager::CredentialType credential_type); |
88 | 100 |
89 // Called from the model when the user chooses to never save passwords; passes | 101 // Called from the model when the user chooses to never save passwords; passes |
90 // the action off to the FormManager. The controller MUST be in a pending | 102 // the action off to the FormManager. The controller MUST be in a pending |
91 // state, and WILL be in BLACKLIST_STATE after this method executes. | 103 // state, and WILL be in BLACKLIST_STATE after this method executes. |
92 virtual void NeverSavePassword(); | 104 virtual void NeverSavePassword(); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 return passwords_data_.federated_credentials_forms(); | 156 return passwords_data_.federated_credentials_forms(); |
145 } | 157 } |
146 | 158 |
147 protected: | 159 protected: |
148 explicit ManagePasswordsUIController( | 160 explicit ManagePasswordsUIController( |
149 content::WebContents* web_contents); | 161 content::WebContents* web_contents); |
150 | 162 |
151 // The pieces of saving and blacklisting passwords that interact with | 163 // The pieces of saving and blacklisting passwords that interact with |
152 // FormManager, split off into internal functions for testing/mocking. | 164 // FormManager, split off into internal functions for testing/mocking. |
153 virtual void SavePasswordInternal(); | 165 virtual void SavePasswordInternal(); |
| 166 virtual void UpdatePasswordInternal( |
| 167 const autofill::PasswordForm& password_form); |
154 virtual void NeverSavePasswordInternal(); | 168 virtual void NeverSavePasswordInternal(); |
155 | 169 |
156 // Called when a PasswordForm is autofilled, when a new PasswordForm is | 170 // Called when a PasswordForm is autofilled, when a new PasswordForm is |
157 // submitted, or when a navigation occurs to update the visibility of the | 171 // submitted, or when a navigation occurs to update the visibility of the |
158 // manage passwords icon and bubble. | 172 // manage passwords icon and bubble. |
159 virtual void UpdateBubbleAndIconVisibility(); | 173 virtual void UpdateBubbleAndIconVisibility(); |
160 | 174 |
161 // Returns the time elapsed since |timer_| was initialized, | 175 // Returns the time elapsed since |timer_| was initialized, |
162 // or base::TimeDelta::Max() if |timer_| was not initialized. | 176 // or base::TimeDelta::Max() if |timer_| was not initialized. |
163 virtual base::TimeDelta Elapsed() const; | 177 virtual base::TimeDelta Elapsed() const; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 scoped_ptr<base::ElapsedTimer> timer_; | 209 scoped_ptr<base::ElapsedTimer> timer_; |
196 | 210 |
197 // Contains true if the bubble is to be popped up in the next call to | 211 // Contains true if the bubble is to be popped up in the next call to |
198 // UpdateBubbleAndIconVisibility(). | 212 // UpdateBubbleAndIconVisibility(). |
199 bool should_pop_up_bubble_; | 213 bool should_pop_up_bubble_; |
200 | 214 |
201 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsUIController); | 215 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsUIController); |
202 }; | 216 }; |
203 | 217 |
204 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_ | 218 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_ |
OLD | NEW |