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

Side by Side Diff: components/password_manager/core/browser/password_form_manager.h

Issue 866983003: GetLoginsRequest: Use ScopedVector to express ownership of forms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@324291_scopedvector
Patch Set: Just rebased on mkwst's changes Created 5 years, 10 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) 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 COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FORM_MANAGER_H_ 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FORM_MANAGER_H_
6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FORM_MANAGER_H_ 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FORM_MANAGER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 bool HasGeneratedPassword() const; 116 bool HasGeneratedPassword() const;
117 void SetHasGeneratedPassword(); 117 void SetHasGeneratedPassword();
118 118
119 // Through |driver|, supply the associated frame with appropriate information 119 // Through |driver|, supply the associated frame with appropriate information
120 // (fill data, whether to allow password generation, etc.). If this is called 120 // (fill data, whether to allow password generation, etc.). If this is called
121 // before |this| has data from the PasswordStore, the execution will be 121 // before |this| has data from the PasswordStore, the execution will be
122 // delayed until the data arrives. 122 // delayed until the data arrives.
123 void ProcessFrame(const base::WeakPtr<PasswordManagerDriver>& driver); 123 void ProcessFrame(const base::WeakPtr<PasswordManagerDriver>& driver);
124 124
125 void OnGetPasswordStoreResults( 125 void OnGetPasswordStoreResults(
126 const std::vector<autofill::PasswordForm*>& results) override; 126 ScopedVector<autofill::PasswordForm> results) override;
127 127
128 // A user opted to 'never remember' passwords for this form. 128 // A user opted to 'never remember' passwords for this form.
129 // Blacklist it so that from now on when it is seen we ignore it. 129 // Blacklist it so that from now on when it is seen we ignore it.
130 // TODO: Make this private once we switch to the new UI. 130 // TODO: Make this private once we switch to the new UI.
131 void PermanentlyBlacklist(); 131 void PermanentlyBlacklist();
132 132
133 // If the user has submitted observed_form_, provisionally hold on to 133 // If the user has submitted observed_form_, provisionally hold on to
134 // the submitted credentials until we are told by PasswordManager whether 134 // the submitted credentials until we are told by PasswordManager whether
135 // or not the login was successful. |action| describes how we deal with 135 // or not the login was successful. |action| describes how we deal with
136 // possible usernames. If |action| is ALLOW_OTHER_POSSIBLE_USERNAMES we will 136 // possible usernames. If |action| is ALLOW_OTHER_POSSIBLE_USERNAMES we will
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 kSubmitResultMax 218 kSubmitResultMax
219 }; 219 };
220 220
221 // The maximum number of combinations of the three preceding enums. 221 // The maximum number of combinations of the three preceding enums.
222 // This is used when recording the actions taken by the form in UMA. 222 // This is used when recording the actions taken by the form in UMA.
223 static const int kMaxNumActionsTaken = 223 static const int kMaxNumActionsTaken =
224 kManagerActionMax * kUserActionMax * kSubmitResultMax; 224 kManagerActionMax * kUserActionMax * kSubmitResultMax;
225 225
226 // Determines if we need to autofill given the results of the query. 226 // Determines if we need to autofill given the results of the query.
227 // Takes ownership of the elements in |result|. 227 // Takes ownership of the elements in |result|.
228 void OnRequestDone(const std::vector<autofill::PasswordForm*>& result); 228 void OnRequestDone(ScopedVector<autofill::PasswordForm> result);
229 229
230 // Helper for OnGetPasswordStoreResults to determine whether or not 230 // Helper for OnGetPasswordStoreResults to determine whether or not
231 // the given result form is worth scoring. 231 // the given result form is worth scoring.
232 bool ShouldIgnoreResult(const autofill::PasswordForm& form) const; 232 bool ShouldIgnoreResult(const autofill::PasswordForm& form) const;
233 233
234 // Helper for Save in the case that best_matches.size() == 0, meaning 234 // Helper for Save in the case that best_matches.size() == 0, meaning
235 // we have no prior record of this form/username/password and the user 235 // we have no prior record of this form/username/password and the user
236 // has opted to 'Save Password'. If |reset_preferred_login| is set, 236 // has opted to 'Save Password'. If |reset_preferred_login| is set,
237 // the previously preferred login from |best_matches_| will be reset. 237 // the previously preferred login from |best_matches_| will be reset.
238 void SaveAsNewLogin(bool reset_preferred_login); 238 void SaveAsNewLogin(bool reset_preferred_login);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 void SanitizePossibleUsernames(autofill::PasswordForm* form); 278 void SanitizePossibleUsernames(autofill::PasswordForm* form);
279 279
280 // Helper function to delegate uploading to the AutofillManager. 280 // Helper function to delegate uploading to the AutofillManager.
281 virtual void UploadPasswordForm( 281 virtual void UploadPasswordForm(
282 const autofill::FormData& form_data, 282 const autofill::FormData& form_data,
283 const autofill::ServerFieldType& password_type); 283 const autofill::ServerFieldType& password_type);
284 284
285 // Set of PasswordForms from the DB that best match the form 285 // Set of PasswordForms from the DB that best match the form
286 // being managed by this. Use a map instead of vector, because we most 286 // being managed by this. Use a map instead of vector, because we most
287 // frequently require lookups by username value in IsNewLogin. 287 // frequently require lookups by username value in IsNewLogin.
288 // TODO(vabr): Consider using ScopedPtrHashMap instead of the deleter below.
288 autofill::PasswordFormMap best_matches_; 289 autofill::PasswordFormMap best_matches_;
289 290
290 // Cleans up when best_matches_ goes out of scope. 291 // Cleans up when best_matches_ goes out of scope.
291 STLValueDeleter<autofill::PasswordFormMap> best_matches_deleter_; 292 STLValueDeleter<autofill::PasswordFormMap> best_matches_deleter_;
292 293
293 // The PasswordForm from the page or dialog managed by |this|. 294 // The PasswordForm from the page or dialog managed by |this|.
294 const autofill::PasswordForm observed_form_; 295 const autofill::PasswordForm observed_form_;
295 296
296 // The origin url path of observed_form_ tokenized, for convenience when 297 // The origin url path of observed_form_ tokenized, for convenience when
297 // scoring. 298 // scoring.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 ManagerAction manager_action_; 354 ManagerAction manager_action_;
354 UserAction user_action_; 355 UserAction user_action_;
355 SubmitResult submit_result_; 356 SubmitResult submit_result_;
356 357
357 DISALLOW_COPY_AND_ASSIGN(PasswordFormManager); 358 DISALLOW_COPY_AND_ASSIGN(PasswordFormManager);
358 }; 359 };
359 360
360 } // namespace password_manager 361 } // namespace password_manager
361 362
362 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FORM_MANAGER_H_ 363 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FORM_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698