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

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

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

Powered by Google App Engine
This is Rietveld 408576698