| 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 <algorithm> | 9 #include <algorithm> |
| 10 #include <iterator> | 10 #include <iterator> |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 keychain_forms->swap(unused_keychain_forms); | 540 keychain_forms->swap(unused_keychain_forms); |
| 541 } | 541 } |
| 542 | 542 |
| 543 std::vector<ItemFormPair> ExtractAllKeychainItemAttributesIntoPasswordForms( | 543 std::vector<ItemFormPair> ExtractAllKeychainItemAttributesIntoPasswordForms( |
| 544 std::vector<SecKeychainItemRef>* keychain_items, | 544 std::vector<SecKeychainItemRef>* keychain_items, |
| 545 const AppleKeychain& keychain) { | 545 const AppleKeychain& keychain) { |
| 546 DCHECK(keychain_items); | 546 DCHECK(keychain_items); |
| 547 MacKeychainPasswordFormAdapter keychain_adapter(&keychain); | 547 MacKeychainPasswordFormAdapter keychain_adapter(&keychain); |
| 548 *keychain_items = keychain_adapter.GetAllPasswordFormKeychainItems(); | 548 *keychain_items = keychain_adapter.GetAllPasswordFormKeychainItems(); |
| 549 std::vector<ItemFormPair> item_form_pairs; | 549 std::vector<ItemFormPair> item_form_pairs; |
| 550 for (const auto& keychain_item : *keychain_items) { | 550 for (auto* keychain_item : *keychain_items) { |
| 551 std::unique_ptr<PasswordForm> form_without_password = | 551 std::unique_ptr<PasswordForm> form_without_password = |
| 552 base::MakeUnique<PasswordForm>(); | 552 base::MakeUnique<PasswordForm>(); |
| 553 internal_keychain_helpers::FillPasswordFormFromKeychainItem( | 553 internal_keychain_helpers::FillPasswordFormFromKeychainItem( |
| 554 keychain, keychain_item, form_without_password.get(), | 554 keychain, keychain_item, form_without_password.get(), |
| 555 false); // Load password attributes, but not password data. | 555 false); // Load password attributes, but not password data. |
| 556 item_form_pairs.push_back( | 556 item_form_pairs.push_back( |
| 557 std::make_pair(keychain_item, std::move(form_without_password))); | 557 std::make_pair(keychain_item, std::move(form_without_password))); |
| 558 } | 558 } |
| 559 return item_form_pairs; | 559 return item_form_pairs; |
| 560 } | 560 } |
| (...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1378 std::vector<std::unique_ptr<PasswordForm>> forms_with_keychain_entry; | 1378 std::vector<std::unique_ptr<PasswordForm>> forms_with_keychain_entry; |
| 1379 internal_keychain_helpers::GetPasswordsForForms(*keychain_, &database_forms, | 1379 internal_keychain_helpers::GetPasswordsForForms(*keychain_, &database_forms, |
| 1380 &forms_with_keychain_entry); | 1380 &forms_with_keychain_entry); |
| 1381 | 1381 |
| 1382 // Clean up any orphaned database entries. | 1382 // Clean up any orphaned database entries. |
| 1383 RemoveDatabaseForms(&database_forms); | 1383 RemoveDatabaseForms(&database_forms); |
| 1384 | 1384 |
| 1385 // Move the orphaned DB forms to the output parameter. | 1385 // Move the orphaned DB forms to the output parameter. |
| 1386 AppendSecondToFirst(orphaned_forms, &database_forms); | 1386 AppendSecondToFirst(orphaned_forms, &database_forms); |
| 1387 } | 1387 } |
| OLD | NEW |