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

Side by Side Diff: components/password_manager/core/browser/password_store_default.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: Second fix of the rebase 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/password_store_default.h" 5 #include "components/password_manager/core/browser/password_store_default.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 const autofill::PasswordForm& form, 115 const autofill::PasswordForm& form,
116 AuthorizationPromptPolicy prompt_policy, 116 AuthorizationPromptPolicy prompt_policy,
117 const ConsumerCallbackRunner& callback_runner) { 117 const ConsumerCallbackRunner& callback_runner) {
118 ScopedVector<autofill::PasswordForm> matched_forms; 118 ScopedVector<autofill::PasswordForm> matched_forms;
119 if (login_db_) 119 if (login_db_)
120 login_db_->GetLogins(form, &matched_forms); 120 login_db_->GetLogins(form, &matched_forms);
121 callback_runner.Run(matched_forms.Pass()); 121 callback_runner.Run(matched_forms.Pass());
122 } 122 }
123 123
124 void PasswordStoreDefault::GetAutofillableLoginsImpl( 124 void PasswordStoreDefault::GetAutofillableLoginsImpl(
125 GetLoginsRequest* request) { 125 scoped_ptr<GetLoginsRequest> request) {
126 // TODO(vabr) -- request should have a ScopedVector<autofill::PasswordForm>
127 // instead of using |logins| here.
128 DCHECK(request->result()->empty()); 126 DCHECK(request->result()->empty());
129 ScopedVector<autofill::PasswordForm> logins; 127 FillAutofillableLogins(request->result());
130 FillAutofillableLogins(&logins); 128 ForwardLoginsResult(request.Pass());
131 logins.swap(*request->result());
132 ForwardLoginsResult(request);
133 } 129 }
134 130
135 void PasswordStoreDefault::GetBlacklistLoginsImpl(GetLoginsRequest* request) { 131 void PasswordStoreDefault::GetBlacklistLoginsImpl(
136 // TODO(vabr) -- request should have a ScopedVector<autofill::PasswordForm> 132 scoped_ptr<GetLoginsRequest> request) {
137 // instead of using |logins| here.
138 DCHECK(request->result()->empty()); 133 DCHECK(request->result()->empty());
139 ScopedVector<autofill::PasswordForm> logins; 134 FillBlacklistLogins(request->result());
140 FillBlacklistLogins(&logins); 135 ForwardLoginsResult(request.Pass());
141 logins.swap(*request->result());
142 ForwardLoginsResult(request);
143 } 136 }
144 137
145 bool PasswordStoreDefault::FillAutofillableLogins( 138 bool PasswordStoreDefault::FillAutofillableLogins(
146 ScopedVector<autofill::PasswordForm>* forms) { 139 ScopedVector<autofill::PasswordForm>* forms) {
147 DCHECK(GetBackgroundTaskRunner()->BelongsToCurrentThread()); 140 DCHECK(GetBackgroundTaskRunner()->BelongsToCurrentThread());
148 return login_db_ && login_db_->GetAutofillableLogins(forms); 141 return login_db_ && login_db_->GetAutofillableLogins(forms);
149 } 142 }
150 143
151 bool PasswordStoreDefault::FillBlacklistLogins( 144 bool PasswordStoreDefault::FillBlacklistLogins(
152 ScopedVector<autofill::PasswordForm>* forms) { 145 ScopedVector<autofill::PasswordForm>* forms) {
153 DCHECK(GetBackgroundTaskRunner()->BelongsToCurrentThread()); 146 DCHECK(GetBackgroundTaskRunner()->BelongsToCurrentThread());
154 return login_db_ && login_db_->GetBlacklistLogins(forms); 147 return login_db_ && login_db_->GetBlacklistLogins(forms);
155 } 148 }
156 149
157 } // namespace password_manager 150 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698