Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PASSWORD_MANAGER_PASSWORD_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_H_ |
| 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_H_ | 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 class PasswordManager : public LoginModel, | 30 class PasswordManager : public LoginModel, |
| 31 public content::WebContentsObserver { | 31 public content::WebContentsObserver { |
| 32 public: | 32 public: |
| 33 static void RegisterUserPrefs(PrefService* prefs); | 33 static void RegisterUserPrefs(PrefService* prefs); |
| 34 | 34 |
| 35 // The delegate passed in is required to outlive the PasswordManager. | 35 // The delegate passed in is required to outlive the PasswordManager. |
| 36 PasswordManager(content::WebContents* web_contents, | 36 PasswordManager(content::WebContents* web_contents, |
| 37 PasswordManagerDelegate* delegate); | 37 PasswordManagerDelegate* delegate); |
| 38 virtual ~PasswordManager(); | 38 virtual ~PasswordManager(); |
| 39 | 39 |
| 40 // Is password autofill enabled for the current profile? | |
| 41 bool IsEnabled() const; | |
|
Ilya Sherman
2012/04/24 00:46:54
nit: Please move this function's definition within
Garrett Casto
2012/04/24 18:49:56
Done.
| |
| 42 | |
| 40 // Called by a PasswordFormManager when it decides a form can be autofilled | 43 // Called by a PasswordFormManager when it decides a form can be autofilled |
| 41 // on the page. | 44 // on the page. |
| 42 void Autofill(const webkit::forms::PasswordForm& form_for_autofill, | 45 void Autofill(const webkit::forms::PasswordForm& form_for_autofill, |
| 43 const webkit::forms::PasswordFormMap& best_matches, | 46 const webkit::forms::PasswordFormMap& best_matches, |
| 44 const webkit::forms::PasswordForm& preferred_match, | 47 const webkit::forms::PasswordForm& preferred_match, |
| 45 bool wait_for_username) const; | 48 bool wait_for_username) const; |
| 46 | 49 |
| 47 // LoginModel implementation. | 50 // LoginModel implementation. |
| 48 virtual void SetObserver(LoginModelObserver* observer) OVERRIDE; | 51 virtual void SetObserver(LoginModelObserver* observer) OVERRIDE; |
| 49 | 52 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 75 // | new | 78 // | new |
| 76 // | ___ Infobar | 79 // | ___ Infobar |
| 77 // pending_login -- form submit --> provisional_save ___/ | 80 // pending_login -- form submit --> provisional_save ___/ |
| 78 // ^ | \___ (update DB) | 81 // ^ | \___ (update DB) |
| 79 // | fail | 82 // | fail |
| 80 // |-----------<------<---------| !new | 83 // |-----------<------<---------| !new |
| 81 // | 84 // |
| 82 // When a form is "seen" on a page, a PasswordFormManager is created | 85 // When a form is "seen" on a page, a PasswordFormManager is created |
| 83 // and stored in this collection until user navigates away from page. | 86 // and stored in this collection until user navigates away from page. |
| 84 | 87 |
| 85 // Is password autofill enabled for the current profile? | |
| 86 bool IsEnabled() const; | |
| 87 | |
| 88 ScopedVector<PasswordFormManager> pending_login_managers_; | 88 ScopedVector<PasswordFormManager> pending_login_managers_; |
| 89 | 89 |
| 90 // When the user submits a password/credential, this contains the | 90 // When the user submits a password/credential, this contains the |
| 91 // PasswordFormManager for the form in question until we deem the login | 91 // PasswordFormManager for the form in question until we deem the login |
| 92 // attempt to have succeeded (as in valid credentials). If it fails, we | 92 // attempt to have succeeded (as in valid credentials). If it fails, we |
| 93 // send the PasswordFormManager back to the pending_login_managers_ set. | 93 // send the PasswordFormManager back to the pending_login_managers_ set. |
| 94 // Scoped in case PasswordManager gets deleted (e.g tab closes) between the | 94 // Scoped in case PasswordManager gets deleted (e.g tab closes) between the |
| 95 // time a user submits a login form and gets to the next page. | 95 // time a user submits a login form and gets to the next page. |
| 96 scoped_ptr<PasswordFormManager> provisional_save_manager_; | 96 scoped_ptr<PasswordFormManager> provisional_save_manager_; |
| 97 | 97 |
| 98 // Our delegate for carrying out external operations. This is typically the | 98 // Our delegate for carrying out external operations. This is typically the |
| 99 // containing WebContents. | 99 // containing WebContents. |
| 100 PasswordManagerDelegate* const delegate_; | 100 PasswordManagerDelegate* const delegate_; |
| 101 | 101 |
| 102 // The LoginModelObserver (i.e LoginView) requiring autofill. | 102 // The LoginModelObserver (i.e LoginView) requiring autofill. |
| 103 LoginModelObserver* observer_; | 103 LoginModelObserver* observer_; |
| 104 | 104 |
| 105 // Set to false to disable the password manager (will no longer fill | 105 // Set to false to disable the password manager (will no longer fill |
| 106 // passwords or ask you if you want to save passwords). | 106 // passwords or ask you if you want to save passwords). |
| 107 BooleanPrefMember password_manager_enabled_; | 107 BooleanPrefMember password_manager_enabled_; |
| 108 | 108 |
| 109 DISALLOW_COPY_AND_ASSIGN(PasswordManager); | 109 DISALLOW_COPY_AND_ASSIGN(PasswordManager); |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_H_ | 112 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_H_ |
| OLD | NEW |