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

Side by Side Diff: chrome/browser/ui/passwords/password_manager_presenter.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/ui/passwords/password_manager_presenter.h" 5 #include "chrome/browser/ui/passwords/password_manager_presenter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/metrics/user_metrics_action.h" 9 #include "base/metrics/user_metrics_action.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 PasswordStore* store = page_->GetPasswordStore(); 205 PasswordStore* store = page_->GetPasswordStore();
206 if (store != NULL) { 206 if (store != NULL) {
207 cancelable_task_tracker()->TryCancelAll(); 207 cancelable_task_tracker()->TryCancelAll();
208 store->GetAutofillableLogins(this); 208 store->GetAutofillableLogins(this);
209 } else { 209 } else {
210 LOG(ERROR) << "No password store! Cannot display passwords."; 210 LOG(ERROR) << "No password store! Cannot display passwords.";
211 } 211 }
212 } 212 }
213 213
214 void PasswordManagerPresenter::PasswordListPopulater::OnGetPasswordStoreResults( 214 void PasswordManagerPresenter::PasswordListPopulater::OnGetPasswordStoreResults(
215 const std::vector<autofill::PasswordForm*>& results) { 215 ScopedVector<autofill::PasswordForm> results) {
216 page_->password_list_.clear(); 216 page_->password_list_.swap(results);
217 page_->password_list_.insert(page_->password_list_.end(),
218 results.begin(), results.end());
219 page_->SetPasswordList(); 217 page_->SetPasswordList();
220 } 218 }
221 219
222 PasswordManagerPresenter::PasswordExceptionListPopulater:: 220 PasswordManagerPresenter::PasswordExceptionListPopulater::
223 PasswordExceptionListPopulater(PasswordManagerPresenter* page) 221 PasswordExceptionListPopulater(PasswordManagerPresenter* page)
224 : ListPopulater(page) { 222 : ListPopulater(page) {
225 } 223 }
226 224
227 void PasswordManagerPresenter::PasswordExceptionListPopulater::Populate() { 225 void PasswordManagerPresenter::PasswordExceptionListPopulater::Populate() {
228 PasswordStore* store = page_->GetPasswordStore(); 226 PasswordStore* store = page_->GetPasswordStore();
229 if (store != NULL) { 227 if (store != NULL) {
230 cancelable_task_tracker()->TryCancelAll(); 228 cancelable_task_tracker()->TryCancelAll();
231 store->GetBlacklistLogins(this); 229 store->GetBlacklistLogins(this);
232 } else { 230 } else {
233 LOG(ERROR) << "No password store! Cannot display exceptions."; 231 LOG(ERROR) << "No password store! Cannot display exceptions.";
234 } 232 }
235 } 233 }
236 234
237 void PasswordManagerPresenter::PasswordExceptionListPopulater:: 235 void PasswordManagerPresenter::PasswordExceptionListPopulater::
238 OnGetPasswordStoreResults( 236 OnGetPasswordStoreResults(ScopedVector<autofill::PasswordForm> results) {
239 const std::vector<autofill::PasswordForm*>& results) { 237 page_->password_exception_list_.swap(results);
240 page_->password_exception_list_.clear();
241 page_->password_exception_list_.insert(page_->password_exception_list_.end(),
242 results.begin(), results.end());
243 page_->SetPasswordExceptionList(); 238 page_->SetPasswordExceptionList();
244 } 239 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698