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

Side by Side Diff: chrome/browser/password_manager/password_store_mac.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 (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 #include "chrome/browser/password_manager/password_store_mac.h" 5 #include "chrome/browser/password_manager/password_store_mac.h"
6 #include "chrome/browser/password_manager/password_store_mac_internal.h" 6 #include "chrome/browser/password_manager/password_store_mac_internal.h"
7 7
8 #include <CoreServices/CoreServices.h> 8 #include <CoreServices/CoreServices.h>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 AppendSecondToFirst(&matched_forms, &keychain_forms); 1080 AppendSecondToFirst(&matched_forms, &keychain_forms);
1081 1081
1082 if (!database_forms.empty()) { 1082 if (!database_forms.empty()) {
1083 RemoveDatabaseForms(database_forms.get()); 1083 RemoveDatabaseForms(database_forms.get());
1084 NotifyLoginsChanged(FormsToRemoveChangeList(database_forms.get())); 1084 NotifyLoginsChanged(FormsToRemoveChangeList(database_forms.get()));
1085 } 1085 }
1086 1086
1087 callback_runner.Run(matched_forms.Pass()); 1087 callback_runner.Run(matched_forms.Pass());
1088 } 1088 }
1089 1089
1090 void PasswordStoreMac::GetBlacklistLoginsImpl(GetLoginsRequest* request) { 1090 void PasswordStoreMac::GetBlacklistLoginsImpl(
1091 scoped_ptr<PasswordStore::GetLoginsRequest> request) {
1091 ScopedVector<autofill::PasswordForm> obtained_forms; 1092 ScopedVector<autofill::PasswordForm> obtained_forms;
1092 FillBlacklistLogins(&obtained_forms); 1093 FillBlacklistLogins(&obtained_forms);
1093 request->result()->swap(obtained_forms.get()); 1094 request->result()->swap(obtained_forms.get());
1094 ForwardLoginsResult(request); 1095 ForwardLoginsResult(request.Pass());
1095 } 1096 }
1096 1097
1097 void PasswordStoreMac::GetAutofillableLoginsImpl(GetLoginsRequest* request) { 1098 void PasswordStoreMac::GetAutofillableLoginsImpl(
1099 scoped_ptr<PasswordStore::GetLoginsRequest> request) {
1098 ScopedVector<autofill::PasswordForm> obtained_forms; 1100 ScopedVector<autofill::PasswordForm> obtained_forms;
1099 FillAutofillableLogins(&obtained_forms); 1101 FillAutofillableLogins(&obtained_forms);
1100 request->result()->swap(obtained_forms.get()); 1102 request->result()->swap(obtained_forms.get());
1101 ForwardLoginsResult(request); 1103 ForwardLoginsResult(request.Pass());
1102 } 1104 }
1103 1105
1104 bool PasswordStoreMac::FillAutofillableLogins( 1106 bool PasswordStoreMac::FillAutofillableLogins(
1105 ScopedVector<autofill::PasswordForm>* forms) { 1107 ScopedVector<autofill::PasswordForm>* forms) {
1106 DCHECK(thread_->message_loop() == base::MessageLoop::current()); 1108 DCHECK(thread_->message_loop() == base::MessageLoop::current());
1107 1109
1108 ScopedVector<PasswordForm> database_forms; 1110 ScopedVector<PasswordForm> database_forms;
1109 if (!login_metadata_db_ || 1111 if (!login_metadata_db_ ||
1110 !login_metadata_db_->GetAutofillableLogins(&database_forms)) 1112 !login_metadata_db_->GetAutofillableLogins(&database_forms))
1111 return false; 1113 return false;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 ScopedVector<PasswordForm> forms_with_keychain_entry; 1188 ScopedVector<PasswordForm> forms_with_keychain_entry;
1187 internal_keychain_helpers::GetPasswordsForForms(*keychain_, &database_forms, 1189 internal_keychain_helpers::GetPasswordsForForms(*keychain_, &database_forms,
1188 &forms_with_keychain_entry); 1190 &forms_with_keychain_entry);
1189 1191
1190 // Clean up any orphaned database entries. 1192 // Clean up any orphaned database entries.
1191 RemoveDatabaseForms(database_forms.get()); 1193 RemoveDatabaseForms(database_forms.get());
1192 1194
1193 // Move the orphaned DB forms to the output parameter. 1195 // Move the orphaned DB forms to the output parameter.
1194 AppendSecondToFirst(orphaned_forms, &database_forms); 1196 AppendSecondToFirst(orphaned_forms, &database_forms);
1195 } 1197 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698