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

Unified Diff: chrome/browser/password_manager/password_store_x.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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/password_manager/password_store_x.cc
diff --git a/chrome/browser/password_manager/password_store_x.cc b/chrome/browser/password_manager/password_store_x.cc
index fa5c7b03516566ea274e52956d630697ca1e4c06..e45f7eab4c417cc953b7d3a578e6e32cc5f93765 100644
--- a/chrome/browser/password_manager/password_store_x.cc
+++ b/chrome/browser/password_manager/password_store_x.cc
@@ -157,39 +157,41 @@ void PasswordStoreX::GetLoginsImpl(
callback_runner.Run(matched_forms.Pass());
}
-void PasswordStoreX::GetAutofillableLoginsImpl(GetLoginsRequest* request) {
+void PasswordStoreX::GetAutofillableLoginsImpl(
+ scoped_ptr<PasswordStore::GetLoginsRequest> request) {
CheckMigration();
ScopedVector<autofill::PasswordForm> obtained_forms;
if (use_native_backend() &&
backend_->GetAutofillableLogins(&obtained_forms)) {
- request->result()->swap(obtained_forms.get());
- SortLoginsByOrigin(request->result());
+ SortLoginsByOrigin(&obtained_forms.get());
// See GetLoginsImpl() for why we disallow fallback conditionally here.
- if (request->result()->size() > 0)
+ if (!obtained_forms.empty())
allow_fallback_ = false;
+ request->result()->swap(obtained_forms);
} else if (allow_default_store()) {
- PasswordStoreDefault::GetAutofillableLoginsImpl(request);
+ PasswordStoreDefault::GetAutofillableLoginsImpl(request.Pass());
return;
}
// The consumer will be left hanging unless we reply.
- ForwardLoginsResult(request);
+ ForwardLoginsResult(request.Pass());
}
-void PasswordStoreX::GetBlacklistLoginsImpl(GetLoginsRequest* request) {
+void PasswordStoreX::GetBlacklistLoginsImpl(
+ scoped_ptr<PasswordStore::GetLoginsRequest> request) {
CheckMigration();
ScopedVector<autofill::PasswordForm> obtained_forms;
if (use_native_backend() && backend_->GetBlacklistLogins(&obtained_forms)) {
- request->result()->swap(obtained_forms.get());
- SortLoginsByOrigin(request->result());
+ SortLoginsByOrigin(&obtained_forms.get());
// See GetLoginsImpl() for why we disallow fallback conditionally here.
- if (request->result()->size() > 0)
+ if (!obtained_forms.empty())
allow_fallback_ = false;
+ request->result()->swap(obtained_forms);
} else if (allow_default_store()) {
- PasswordStoreDefault::GetBlacklistLoginsImpl(request);
+ PasswordStoreDefault::GetBlacklistLoginsImpl(request.Pass());
return;
}
// The consumer will be left hanging unless we reply.
- ForwardLoginsResult(request);
+ ForwardLoginsResult(request.Pass());
}
bool PasswordStoreX::FillAutofillableLogins(
« no previous file with comments | « chrome/browser/password_manager/password_store_x.h ('k') | chrome/browser/password_manager/password_store_x_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698