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 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
| 13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 14 #include "base/prefs/pref_member.h" | 14 #include "base/prefs/pref_member.h" |
| 15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
| 16 #include "chrome/browser/password_manager/password_form_manager.h" | 16 #include "chrome/browser/password_manager/password_form_manager.h" |
| 17 #include "chrome/browser/password_manager/password_store_consumer.h" | |
| 17 #include "chrome/browser/ui/login/login_model.h" | 18 #include "chrome/browser/ui/login/login_model.h" |
| 18 #include "components/autofill/core/common/password_form.h" | 19 #include "components/autofill/core/common/password_form.h" |
| 19 #include "components/autofill/core/common/password_form_fill_data.h" | 20 #include "components/autofill/core/common/password_form_fill_data.h" |
| 20 #include "content/public/browser/web_contents_observer.h" | 21 #include "content/public/browser/web_contents_observer.h" |
| 21 #include "content/public/browser/web_contents_user_data.h" | 22 #include "content/public/browser/web_contents_user_data.h" |
| 22 | 23 |
| 23 class PasswordManagerDelegate; | 24 class PasswordManagerDelegate; |
| 24 class PasswordManagerTest; | 25 class PasswordManagerTest; |
| 25 class PasswordFormManager; | 26 class PasswordFormManager; |
| 26 class PrefRegistrySimple; | 27 class PrefRegistrySimple; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 const content::FrameNavigateParams& params) OVERRIDE; | 87 const content::FrameNavigateParams& params) OVERRIDE; |
| 87 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 88 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 88 | 89 |
| 89 // TODO(isherman): This should not be public, but is currently being used by | 90 // TODO(isherman): This should not be public, but is currently being used by |
| 90 // the LoginPrompt code. | 91 // the LoginPrompt code. |
| 91 void OnPasswordFormsParsed( | 92 void OnPasswordFormsParsed( |
| 92 const std::vector<autofill::PasswordForm>& forms); | 93 const std::vector<autofill::PasswordForm>& forms); |
| 93 void OnPasswordFormsRendered( | 94 void OnPasswordFormsRendered( |
| 94 const std::vector<autofill::PasswordForm>& visible_forms); | 95 const std::vector<autofill::PasswordForm>& visible_forms); |
| 95 | 96 |
| 97 void OnRemovePasswordSuggestion( | |
| 98 const autofill::PasswordForm& password_form, | |
| 99 std::vector<autofill::PasswordForm> updated_password_forms); | |
| 100 | |
| 101 | |
| 96 protected: | 102 protected: |
| 97 // Subclassed for unit tests. | 103 // Subclassed for unit tests. |
| 98 PasswordManager(content::WebContents* web_contents, | 104 PasswordManager(content::WebContents* web_contents, |
| 99 PasswordManagerDelegate* delegate); | 105 PasswordManagerDelegate* delegate); |
| 100 | 106 |
| 101 // Handle notification that a password form was submitted. | 107 // Handle notification that a password form was submitted. |
| 102 virtual void OnPasswordFormSubmitted( | 108 virtual void OnPasswordFormSubmitted( |
| 103 const autofill::PasswordForm& password_form); | 109 const autofill::PasswordForm& password_form); |
| 104 | 110 |
| 105 private: | 111 private: |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 // | 148 // |
| 143 // 1. form "seen" | 149 // 1. form "seen" |
| 144 // | new | 150 // | new |
| 145 // | ___ Infobar | 151 // | ___ Infobar |
| 146 // pending_login -- form submit --> provisional_save ___/ | 152 // pending_login -- form submit --> provisional_save ___/ |
| 147 // ^ | \___ (update DB) | 153 // ^ | \___ (update DB) |
| 148 // | fail | 154 // | fail |
| 149 // |-----------<------<---------| !new | 155 // |-----------<------<---------| !new |
| 150 // | 156 // |
| 151 // When a form is "seen" on a page, a PasswordFormManager is created | 157 // When a form is "seen" on a page, a PasswordFormManager is created |
| 152 // and stored in this collection until user navigates away from page. | 158 // and stored in this collection until user navigates away from page |
|
vabr (Chromium)
2014/03/07 23:43:36
Please return the removed full-stop at the end of
riadh.chtara
2014/03/14 17:16:08
Done.
| |
| 153 | 159 |
| 154 ScopedVector<PasswordFormManager> pending_login_managers_; | 160 ScopedVector<PasswordFormManager> pending_login_managers_; |
| 155 | 161 |
| 156 // When the user submits a password/credential, this contains the | 162 // When the user submits a password/credential, this contains the |
| 157 // PasswordFormManager for the form in question until we deem the login | 163 // PasswordFormManager for the form in question until we deem the login |
| 158 // attempt to have succeeded (as in valid credentials). If it fails, we | 164 // attempt to have succeeded (as in valid credentials). If it fails, we |
| 159 // send the PasswordFormManager back to the pending_login_managers_ set. | 165 // send the PasswordFormManager back to the pending_login_managers_ set. |
| 160 // Scoped in case PasswordManager gets deleted (e.g tab closes) between the | 166 // Scoped in case PasswordManager gets deleted (e.g tab closes) between the |
| 161 // time a user submits a login form and gets to the next page. | 167 // time a user submits a login form and gets to the next page. |
| 162 scoped_ptr<PasswordFormManager> provisional_save_manager_; | 168 scoped_ptr<PasswordFormManager> provisional_save_manager_; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 173 // notification in const member functions. | 179 // notification in const member functions. |
| 174 mutable ObserverList<LoginModelObserver> observers_; | 180 mutable ObserverList<LoginModelObserver> observers_; |
| 175 | 181 |
| 176 // Callbacks to be notified when a password form has been submitted. | 182 // Callbacks to be notified when a password form has been submitted. |
| 177 std::vector<PasswordSubmittedCallback> submission_callbacks_; | 183 std::vector<PasswordSubmittedCallback> submission_callbacks_; |
| 178 | 184 |
| 179 DISALLOW_COPY_AND_ASSIGN(PasswordManager); | 185 DISALLOW_COPY_AND_ASSIGN(PasswordManager); |
| 180 }; | 186 }; |
| 181 | 187 |
| 182 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_H_ | 188 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_H_ |
| OLD | NEW |