Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: chrome/browser/password_manager/password_form_manager.h

Issue 114057: Re-land the password store work from bug 8205, with changes that should fix b... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/browser.vcproj ('k') | chrome/browser/password_manager/password_form_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_FORM_MANAGER_H__ 5 #ifndef CHROME_BROWSER_PASSWORD_FORM_MANAGER_H__
6 #define CHROME_BROWSER_PASSWORD_FORM_MANAGER_H__ 6 #define CHROME_BROWSER_PASSWORD_FORM_MANAGER_H__
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #include "base/stl_util-inl.h" 10 #include "base/stl_util-inl.h"
11 #include "chrome/browser/password_manager/password_store.h"
11 #include "chrome/browser/webdata/web_data_service.h" 12 #include "chrome/browser/webdata/web_data_service.h"
12 #include "webkit/glue/password_form.h" 13 #include "webkit/glue/password_form.h"
13 14
14 class PasswordManager; 15 class PasswordManager;
15 class Profile; 16 class Profile;
16 17
17 // Per-password-form-{on-page, dialog} class responsible for interactions 18 // Per-password-form-{on-page, dialog} class responsible for interactions
18 // between a given form, the per-tab PasswordManager, and the web database. 19 // between a given form, the per-tab PasswordManager, and the web database.
19 class PasswordFormManager : public WebDataServiceConsumer { 20 class PasswordFormManager : public PasswordStoreConsumer {
20 public: 21 public:
21 // web_data_service allows access to current profile's Web Data 22 // web_data_service allows access to current profile's Web Data
22 // password_manager owns this object 23 // password_manager owns this object
23 // form_on_page is the form that may be submitted and could need login data. 24 // form_on_page is the form that may be submitted and could need login data.
24 // ssl_valid represents the security of the page containing observed_form, 25 // ssl_valid represents the security of the page containing observed_form,
25 // used to filter login results from database. 26 // used to filter login results from database.
26 PasswordFormManager(Profile* profile, 27 PasswordFormManager(Profile* profile,
27 PasswordManager* password_manager, 28 PasswordManager* password_manager,
28 const PasswordForm& observed_form, 29 const PasswordForm& observed_form,
29 bool ssl_valid); 30 bool ssl_valid);
30 virtual ~PasswordFormManager(); 31 virtual ~PasswordFormManager();
31 32
32 // Compare basic data of observed_form_ with argument. 33 // Compare basic data of observed_form_ with argument.
33 bool DoesManage(const PasswordForm& form) const; 34 bool DoesManage(const PasswordForm& form) const;
34 35
35 // Retrieves potential matching logins from the database. 36 // Retrieves potential matching logins from the database.
36 void FetchMatchingLoginsFromWebDatabase(); 37 void FetchMatchingLoginsFromWebDatabase();
37 #if defined(OS_WIN)
38 void FetchMatchingIE7LoginFromWebDatabase();
39 #endif
40 38
41 // Simple state-check to verify whether this object as received a callback 39 // Simple state-check to verify whether this object as received a callback
42 // from the web database and completed its matching phase. Note that the 40 // from the web database and completed its matching phase. Note that the
43 // callback in question occurs on the same (and only) main thread from which 41 // callback in question occurs on the same (and only) main thread from which
44 // instances of this class are ever used, but it is required since it is 42 // instances of this class are ever used, but it is required since it is
45 // conceivable that a user (or ui test) could attempt to submit a login 43 // conceivable that a user (or ui test) could attempt to submit a login
46 // prompt before the callback has occured, which would InvokeLater a call to 44 // prompt before the callback has occured, which would InvokeLater a call to
47 // PasswordManager::ProvisionallySave, which would interact with this object 45 // PasswordManager::ProvisionallySave, which would interact with this object
48 // before the db has had time to answer with matching password entries. 46 // before the db has had time to answer with matching password entries.
49 // This is intended to be a one-time check; if the return value is false the 47 // This is intended to be a one-time check; if the return value is false the
50 // expectation is caller will give up. This clearly won't work if you put it 48 // expectation is caller will give up. This clearly won't work if you put it
51 // in a loop and wait for matching to complete; you're (supposed to be) on 49 // in a loop and wait for matching to complete; you're (supposed to be) on
52 // the same thread! 50 // the same thread!
53 bool HasCompletedMatching(); 51 bool HasCompletedMatching();
54 52
55 // Determines if the user opted to 'never remember' passwords for this form. 53 // Determines if the user opted to 'never remember' passwords for this form.
56 bool IsBlacklisted(); 54 bool IsBlacklisted();
57 55
58 // Used by PasswordManager to determine whether or not to display 56 // Used by PasswordManager to determine whether or not to display
59 // a SavePasswordBar when given the green light to save the PasswordForm 57 // a SavePasswordBar when given the green light to save the PasswordForm
60 // managed by this. 58 // managed by this.
61 bool IsNewLogin(); 59 bool IsNewLogin();
62 60
63 // WebDataServiceConsumer implementation. If matches were found 61 // Determines if we need to autofill given the results of the query.
64 // (in *result), this is where we determine we need to autofill. 62 void OnRequestDone(int handle, const std::vector<PasswordForm*>& result);
65 virtual void OnWebDataServiceRequestDone(WebDataService::Handle h,
66 const WDTypedResult* result);
67 63
68 // Determines if we need to autofill given the results of the query. 64 // PasswordStoreConsumer implementation.
69 void OnRequestDone(WebDataService::Handle h, const WDTypedResult* result); 65 virtual void OnPasswordStoreRequestDone(
70 66 int handle, const std::vector<PasswordForm*>& result);
71 #if defined(OS_WIN)
72 // Determines if we need to autofill given the results of the query in the
73 // ie7_password table.
74 void OnIE7RequestDone(WebDataService::Handle h, const WDTypedResult* result);
75 #endif
76 67
77 // A user opted to 'never remember' passwords for this form. 68 // A user opted to 'never remember' passwords for this form.
78 // Blacklist it so that from now on when it is seen we ignore it. 69 // Blacklist it so that from now on when it is seen we ignore it.
79 void PermanentlyBlacklist(); 70 void PermanentlyBlacklist();
80 71
81 // If the user has submitted observed_form_, provisionally hold on to 72 // If the user has submitted observed_form_, provisionally hold on to
82 // the submitted credentials until we are told by PasswordManager whether 73 // the submitted credentials until we are told by PasswordManager whether
83 // or not the login was successful. 74 // or not the login was successful.
84 void ProvisionallySave(const PasswordForm& credentials); 75 void ProvisionallySave(const PasswordForm& credentials);
85 76
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 PasswordForm pending_credentials_; 125 PasswordForm pending_credentials_;
135 126
136 // Whether pending_credentials_ stores a new login or is an update 127 // Whether pending_credentials_ stores a new login or is an update
137 // to an existing one. 128 // to an existing one.
138 bool is_new_login_; 129 bool is_new_login_;
139 130
140 // PasswordManager owning this. 131 // PasswordManager owning this.
141 const PasswordManager* const password_manager_; 132 const PasswordManager* const password_manager_;
142 133
143 // Handle to any pending WebDataService::GetLogins query. 134 // Handle to any pending WebDataService::GetLogins query.
144 WebDataService::Handle pending_login_query_; 135 int pending_login_query_;
145 136
146 // Convenience pointer to entry in best_matches_ that is marked 137 // Convenience pointer to entry in best_matches_ that is marked
147 // as preferred. This is only allowed to be null if there are no best matches 138 // as preferred. This is only allowed to be null if there are no best matches
148 // at all, since there will always be one preferred login when there are 139 // at all, since there will always be one preferred login when there are
149 // multiple matches (when first saved, a login is marked preferred). 140 // multiple matches (when first saved, a login is marked preferred).
150 const PasswordForm* preferred_match_; 141 const PasswordForm* preferred_match_;
151 142
152 typedef enum { 143 typedef enum {
153 PRE_MATCHING_PHASE, // Have not yet invoked a GetLogins query to find 144 PRE_MATCHING_PHASE, // Have not yet invoked a GetLogins query to find
154 // matching login information from DB. 145 // matching login information from DB.
155 MATCHING_PHASE, // We've made a GetLogins request, but 146 MATCHING_PHASE, // We've made a GetLogins request, but
156 // haven't received or finished processing result. 147 // haven't received or finished processing result.
157 POST_MATCHING_PHASE // We've queried the DB and processed matching 148 POST_MATCHING_PHASE // We've queried the DB and processed matching
158 // login results. 149 // login results.
159 } PasswordFormManagerState; 150 } PasswordFormManagerState;
160 151
161 // State of matching process, used to verify that we don't call methods 152 // State of matching process, used to verify that we don't call methods
162 // assuming we've already processed the web data request for matching logins, 153 // assuming we've already processed the web data request for matching logins,
163 // when we actually haven't. 154 // when we actually haven't.
164 PasswordFormManagerState state_; 155 PasswordFormManagerState state_;
165 156
166 // The profile from which we get the WebDataService. 157 // The profile from which we get the WebDataService.
167 Profile* profile_; 158 Profile* profile_;
168 159
169 DISALLOW_EVIL_CONSTRUCTORS(PasswordFormManager); 160 DISALLOW_EVIL_CONSTRUCTORS(PasswordFormManager);
170 }; 161 };
171 #endif // CHROME_BROWSER_PASSWORD_FORM_MANAGER_H__ 162 #endif // CHROME_BROWSER_PASSWORD_FORM_MANAGER_H__
OLDNEW
« no previous file with comments | « chrome/browser/browser.vcproj ('k') | chrome/browser/password_manager/password_form_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698