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

Side by Side Diff: chrome/browser/password_manager/password_store_mac.cc

Issue 906973007: PasswordStore: Clean up expectations about rewriting vectors of forms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 void PasswordStoreMac::GetAutofillableLoginsImpl( 1118 void PasswordStoreMac::GetAutofillableLoginsImpl(
1119 scoped_ptr<PasswordStore::GetLoginsRequest> request) { 1119 scoped_ptr<PasswordStore::GetLoginsRequest> request) {
1120 ScopedVector<autofill::PasswordForm> obtained_forms; 1120 ScopedVector<autofill::PasswordForm> obtained_forms;
1121 FillAutofillableLogins(&obtained_forms); 1121 FillAutofillableLogins(&obtained_forms);
1122 request->NotifyConsumerWithResults(obtained_forms.Pass()); 1122 request->NotifyConsumerWithResults(obtained_forms.Pass());
1123 } 1123 }
1124 1124
1125 bool PasswordStoreMac::FillAutofillableLogins( 1125 bool PasswordStoreMac::FillAutofillableLogins(
1126 ScopedVector<autofill::PasswordForm>* forms) { 1126 ScopedVector<autofill::PasswordForm>* forms) {
1127 DCHECK(thread_->message_loop() == base::MessageLoop::current()); 1127 DCHECK(thread_->message_loop() == base::MessageLoop::current());
1128 forms->clear();
1128 1129
1129 ScopedVector<PasswordForm> database_forms; 1130 ScopedVector<PasswordForm> database_forms;
1130 if (!login_metadata_db_ || 1131 if (!login_metadata_db_ ||
1131 !login_metadata_db_->GetAutofillableLogins(&database_forms)) 1132 !login_metadata_db_->GetAutofillableLogins(&database_forms))
1132 return false; 1133 return false;
1133 1134
1134 internal_keychain_helpers::GetPasswordsForForms(*keychain_, &database_forms, 1135 internal_keychain_helpers::GetPasswordsForForms(*keychain_, &database_forms,
1135 forms); 1136 forms);
1136 1137
1137 if (!database_forms.empty()) { 1138 if (!database_forms.empty()) {
1138 RemoveDatabaseForms(&database_forms); 1139 RemoveDatabaseForms(&database_forms);
1139 NotifyLoginsChanged(FormsToRemoveChangeList(database_forms.get())); 1140 NotifyLoginsChanged(FormsToRemoveChangeList(database_forms.get()));
1140 } 1141 }
1141 1142
1142 return true; 1143 return true;
1143 } 1144 }
1144 1145
1145 bool PasswordStoreMac::FillBlacklistLogins( 1146 bool PasswordStoreMac::FillBlacklistLogins(
1146 ScopedVector<autofill::PasswordForm>* forms) { 1147 ScopedVector<autofill::PasswordForm>* forms) {
1147 DCHECK(thread_->message_loop() == base::MessageLoop::current()); 1148 DCHECK(thread_->message_loop() == base::MessageLoop::current());
engedy 2015/02/25 15:17:48 Need to clear |forms| above here.
vabr (Chromium) 2015/03/09 10:56:19 Done.
1148 return login_metadata_db_ && login_metadata_db_->GetBlacklistLogins(forms); 1149 return login_metadata_db_ && login_metadata_db_->GetBlacklistLogins(forms);
1149 } 1150 }
1150 1151
1151 bool PasswordStoreMac::AddToKeychainIfNecessary(const PasswordForm& form) { 1152 bool PasswordStoreMac::AddToKeychainIfNecessary(const PasswordForm& form) {
1152 if (form.blacklisted_by_user) { 1153 if (form.blacklisted_by_user) {
1153 return true; 1154 return true;
1154 } 1155 }
1155 MacKeychainPasswordFormAdapter keychainAdapter(keychain_.get()); 1156 MacKeychainPasswordFormAdapter keychainAdapter(keychain_.get());
1156 return keychainAdapter.AddPassword(form); 1157 return keychainAdapter.AddPassword(form);
1157 } 1158 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 ScopedVector<PasswordForm> forms_with_keychain_entry; 1211 ScopedVector<PasswordForm> forms_with_keychain_entry;
1211 internal_keychain_helpers::GetPasswordsForForms(*keychain_, &database_forms, 1212 internal_keychain_helpers::GetPasswordsForForms(*keychain_, &database_forms,
1212 &forms_with_keychain_entry); 1213 &forms_with_keychain_entry);
1213 1214
1214 // Clean up any orphaned database entries. 1215 // Clean up any orphaned database entries.
1215 RemoveDatabaseForms(&database_forms); 1216 RemoveDatabaseForms(&database_forms);
1216 1217
1217 // Move the orphaned DB forms to the output parameter. 1218 // Move the orphaned DB forms to the output parameter.
1218 AppendSecondToFirst(orphaned_forms, &database_forms); 1219 AppendSecondToFirst(orphaned_forms, &database_forms);
1219 } 1220 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698