OLD | NEW |
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 | 6 |
7 #include <CoreServices/CoreServices.h> | 7 #include <CoreServices/CoreServices.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 return keychain_form; | 218 return keychain_form; |
219 } else if (!partial_match) { | 219 } else if (!partial_match) { |
220 partial_match = keychain_form; | 220 partial_match = keychain_form; |
221 } | 221 } |
222 } | 222 } |
223 } | 223 } |
224 return partial_match; | 224 return partial_match; |
225 } | 225 } |
226 | 226 |
227 // Iterates over all elements in |forms|, passes the pointed to objects to | 227 // Iterates over all elements in |forms|, passes the pointed to objects to |
228 // |move_form|, and clears |forms| efficiently. FormMover needs to be a callable | 228 // |mover|, and clears |forms| efficiently. FormMover needs to be a callable |
229 // entity, accepting scoped_ptr<autofill::PasswordForm> as its sole argument. | 229 // entity, accepting scoped_ptr<autofill::PasswordForm> as its sole argument. |
230 template <typename FormMover> | 230 template <typename FormMover> |
231 inline void MoveAllFormsOut(ScopedVector<autofill::PasswordForm>* forms, | 231 inline void MoveAllFormsOut(ScopedVector<autofill::PasswordForm>* forms, |
232 FormMover mover) { | 232 FormMover mover) { |
233 for (autofill::PasswordForm* form_ptr : *forms) { | 233 for (autofill::PasswordForm* form_ptr : *forms) { |
234 mover(scoped_ptr<autofill::PasswordForm>(form_ptr)); | 234 mover(scoped_ptr<autofill::PasswordForm>(form_ptr)); |
235 } | 235 } |
236 // We moved the ownership of every form out of |forms|. For performance | 236 // We moved the ownership of every form out of |forms|. For performance |
237 // reasons, we can just weak_clear it, instead of nullptr-ing the respective | 237 // reasons, we can just weak_clear it, instead of nullptr-ing the respective |
238 // elements and letting the vector's destructor to go through the list once | 238 // elements and letting the vector's destructor to go through the list once |
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1367 ScopedVector<PasswordForm> forms_with_keychain_entry; | 1367 ScopedVector<PasswordForm> forms_with_keychain_entry; |
1368 internal_keychain_helpers::GetPasswordsForForms(*keychain_, &database_forms, | 1368 internal_keychain_helpers::GetPasswordsForForms(*keychain_, &database_forms, |
1369 &forms_with_keychain_entry); | 1369 &forms_with_keychain_entry); |
1370 | 1370 |
1371 // Clean up any orphaned database entries. | 1371 // Clean up any orphaned database entries. |
1372 RemoveDatabaseForms(&database_forms); | 1372 RemoveDatabaseForms(&database_forms); |
1373 | 1373 |
1374 // Move the orphaned DB forms to the output parameter. | 1374 // Move the orphaned DB forms to the output parameter. |
1375 AppendSecondToFirst(orphaned_forms, &database_forms); | 1375 AppendSecondToFirst(orphaned_forms, &database_forms); |
1376 } | 1376 } |
OLD | NEW |