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

Side by Side Diff: components/password_manager/core/browser/test_password_store.cc

Issue 866983003: GetLoginsRequest: Use ScopedVector to express ownership of forms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@324291_scopedvector
Patch Set: Fix Mac unittest 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "components/password_manager/core/browser/test_password_store.h" 5 #include "components/password_manager/core/browser/test_password_store.h"
6 6
7 #include "components/autofill/core/common/password_form.h" 7 #include "components/autofill/core/common/password_form.h"
8 8
9 namespace password_manager { 9 namespace password_manager {
10 10
(...skipping 28 matching lines...) Expand all
39 bool TestPasswordStore::FormsAreEquivalent(const autofill::PasswordForm& lhs, 39 bool TestPasswordStore::FormsAreEquivalent(const autofill::PasswordForm& lhs,
40 const autofill::PasswordForm& rhs) { 40 const autofill::PasswordForm& rhs) {
41 return lhs.origin == rhs.origin && 41 return lhs.origin == rhs.origin &&
42 lhs.username_element == rhs.username_element && 42 lhs.username_element == rhs.username_element &&
43 lhs.username_value == rhs.username_value && 43 lhs.username_value == rhs.username_value &&
44 lhs.password_element == rhs.password_element && 44 lhs.password_element == rhs.password_element &&
45 lhs.signon_realm == rhs.signon_realm; 45 lhs.signon_realm == rhs.signon_realm;
46 } 46 }
47 47
48 void TestPasswordStore::GetAutofillableLoginsImpl( 48 void TestPasswordStore::GetAutofillableLoginsImpl(
49 PasswordStore::GetLoginsRequest* request) { 49 scoped_ptr<GetLoginsRequest> request) {
50 for (auto& forms_for_realm : stored_passwords_) { 50 for (auto& forms_for_realm : stored_passwords_) {
51 for (const autofill::PasswordForm& form : forms_for_realm.second) 51 for (const autofill::PasswordForm& form : forms_for_realm.second)
52 request->result()->push_back(new autofill::PasswordForm(form)); 52 request->result()->push_back(new autofill::PasswordForm(form));
53 } 53 }
54 ForwardLoginsResult(request); 54 ForwardLoginsResult(request.Pass());
55 } 55 }
56 56
57 PasswordStoreChangeList TestPasswordStore::AddLoginImpl( 57 PasswordStoreChangeList TestPasswordStore::AddLoginImpl(
58 const autofill::PasswordForm& form) { 58 const autofill::PasswordForm& form) {
59 PasswordStoreChangeList changes; 59 PasswordStoreChangeList changes;
60 stored_passwords_[form.signon_realm].push_back(form); 60 stored_passwords_[form.signon_realm].push_back(form);
61 changes.push_back(PasswordStoreChange(PasswordStoreChange::ADD, form)); 61 changes.push_back(PasswordStoreChange(PasswordStoreChange::ADD, form));
62 return changes; 62 return changes;
63 } 63 }
64 64
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 ScopedVector<autofill::PasswordForm>* forms) { 125 ScopedVector<autofill::PasswordForm>* forms) {
126 return true; 126 return true;
127 } 127 }
128 128
129 bool TestPasswordStore::FillBlacklistLogins( 129 bool TestPasswordStore::FillBlacklistLogins(
130 ScopedVector<autofill::PasswordForm>* forms) { 130 ScopedVector<autofill::PasswordForm>* forms) {
131 return true; 131 return true;
132 } 132 }
133 133
134 } // namespace password_manager 134 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698