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_FORM_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_FORM_MANAGER_H_ |
6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_FORM_MANAGER_H_ | 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_FORM_MANAGER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 | 13 |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "chrome/browser/password_manager/password_store_consumer.h" | 15 #include "chrome/browser/password_manager/password_store_consumer.h" |
16 #include "webkit/forms/password_form.h" | 16 #include "webkit/forms/password_form.h" |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 class RenderViewHost; | 19 class WebContents; |
20 } // namespace content | 20 } // namespace content |
21 | 21 |
22 class PasswordManager; | 22 class PasswordManager; |
23 class PasswordStore; | 23 class PasswordStore; |
24 class Profile; | 24 class Profile; |
25 | 25 |
26 // Per-password-form-{on-page, dialog} class responsible for interactions | 26 // Per-password-form-{on-page, dialog} class responsible for interactions |
27 // between a given form, the per-tab PasswordManager, and the PasswordStore. | 27 // between a given form, the per-tab PasswordManager, and the PasswordStore. |
28 class PasswordFormManager : public PasswordStoreConsumer { | 28 class PasswordFormManager : public PasswordStoreConsumer { |
29 public: | 29 public: |
30 // profile contains the link to the PasswordStore and whether we're off | 30 // profile contains the link to the PasswordStore and whether we're off |
31 // the record | 31 // the record |
32 // password_manager owns this object | 32 // password_manager owns this object |
33 // form_on_page is the form that may be submitted and could need login data. | 33 // form_on_page is the form that may be submitted and could need login data. |
34 // ssl_valid represents the security of the page containing observed_form, | 34 // ssl_valid represents the security of the page containing observed_form, |
35 // used to filter login results from database. | 35 // used to filter login results from database. |
36 PasswordFormManager(Profile* profile, | 36 PasswordFormManager(Profile* profile, |
37 PasswordManager* password_manager, | 37 PasswordManager* password_manager, |
38 content::RenderViewHost* host, | 38 content::WebContents* web_contents, |
39 const webkit::forms::PasswordForm& observed_form, | 39 const webkit::forms::PasswordForm& observed_form, |
40 bool ssl_valid); | 40 bool ssl_valid); |
41 virtual ~PasswordFormManager(); | 41 virtual ~PasswordFormManager(); |
42 | 42 |
43 // Compare basic data of observed_form_ with argument. | 43 // Compare basic data of observed_form_ with argument. |
44 bool DoesManage(const webkit::forms::PasswordForm& form) const; | 44 bool DoesManage(const webkit::forms::PasswordForm& form) const; |
45 | 45 |
46 // Retrieves potential matching logins from the database. | 46 // Retrieves potential matching logins from the database. |
47 void FetchMatchingLoginsFromPasswordStore(); | 47 void FetchMatchingLoginsFromPasswordStore(); |
48 | 48 |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 } PasswordFormManagerState; | 236 } PasswordFormManagerState; |
237 | 237 |
238 // State of matching process, used to verify that we don't call methods | 238 // State of matching process, used to verify that we don't call methods |
239 // assuming we've already processed the request for matching logins, | 239 // assuming we've already processed the request for matching logins, |
240 // when we actually haven't. | 240 // when we actually haven't. |
241 PasswordFormManagerState state_; | 241 PasswordFormManagerState state_; |
242 | 242 |
243 // The profile from which we get the PasswordStore. | 243 // The profile from which we get the PasswordStore. |
244 Profile* profile_; | 244 Profile* profile_; |
245 | 245 |
246 // Render view host for sending messages to the corresponding renderer. | 246 // Web contents from which we get the RenderViewHost for sending messages to |
247 content::RenderViewHost* host_; | 247 // the corresponding renderer. |
| 248 content::WebContents* web_contents_; |
248 | 249 |
249 // These three fields record the "ActionsTaken" by the browser and | 250 // These three fields record the "ActionsTaken" by the browser and |
250 // the user with this form, and the result. They are combined and | 251 // the user with this form, and the result. They are combined and |
251 // recorded in UMA when the manager is destroyed. | 252 // recorded in UMA when the manager is destroyed. |
252 ManagerAction manager_action_; | 253 ManagerAction manager_action_; |
253 UserAction user_action_; | 254 UserAction user_action_; |
254 SubmitResult submit_result_; | 255 SubmitResult submit_result_; |
255 | 256 |
256 DISALLOW_COPY_AND_ASSIGN(PasswordFormManager); | 257 DISALLOW_COPY_AND_ASSIGN(PasswordFormManager); |
257 }; | 258 }; |
258 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_FORM_MANAGER_H_ | 259 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_FORM_MANAGER_H_ |
OLD | NEW |