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 #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> |
11 #include <utility> | 11 #include <utility> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/mac/mac_logging.h" | 16 #include "base/mac/mac_logging.h" |
17 #include "base/mac/mac_util.h" | 17 #include "base/mac/mac_util.h" |
18 #include "base/message_loop/message_loop.h" | 18 #include "base/message_loop/message_loop.h" |
19 #include "base/stl_util.h" | 19 #include "base/stl_util.h" |
20 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
21 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
22 #include "chrome/browser/chrome_notification_types.h" | 22 #include "chrome/browser/chrome_notification_types.h" |
| 23 #include "chrome/browser/mac/security_wrappers.h" |
23 #include "chrome/browser/password_manager/login_database.h" | 24 #include "chrome/browser/password_manager/login_database.h" |
24 #include "chrome/browser/password_manager/password_store_change.h" | 25 #include "chrome/browser/password_manager/password_store_change.h" |
25 #include "content/public/browser/notification_service.h" | 26 #include "content/public/browser/notification_service.h" |
26 #include "crypto/apple_keychain.h" | 27 #include "crypto/apple_keychain.h" |
27 | 28 |
28 using autofill::PasswordForm; | 29 using autofill::PasswordForm; |
29 using crypto::AppleKeychain; | 30 using crypto::AppleKeychain; |
30 | 31 |
31 // Utility class to handle the details of constructing and running a keychain | 32 // Utility class to handle the details of constructing and running a keychain |
32 // search from a set of attributes. | 33 // search from a set of attributes. |
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 content::NotificationService::current()->Notify( | 973 content::NotificationService::current()->Notify( |
973 chrome::NOTIFICATION_LOGINS_CHANGED, | 974 chrome::NOTIFICATION_LOGINS_CHANGED, |
974 content::Source<PasswordStore>(this), | 975 content::Source<PasswordStore>(this), |
975 content::Details<PasswordStoreChangeList>(&changes)); | 976 content::Details<PasswordStoreChangeList>(&changes)); |
976 } | 977 } |
977 } | 978 } |
978 } | 979 } |
979 | 980 |
980 void PasswordStoreMac::GetLoginsImpl( | 981 void PasswordStoreMac::GetLoginsImpl( |
981 const autofill::PasswordForm& form, | 982 const autofill::PasswordForm& form, |
| 983 AuthorizationPromptPolicy prompt_policy, |
982 const ConsumerCallbackRunner& callback_runner) { | 984 const ConsumerCallbackRunner& callback_runner) { |
| 985 chrome::ScopedSecKeychainSetUserInteractionAllowed user_interaction_allowed( |
| 986 prompt_policy == ALLOW_PROMPT); |
| 987 |
983 MacKeychainPasswordFormAdapter keychain_adapter(keychain_.get()); | 988 MacKeychainPasswordFormAdapter keychain_adapter(keychain_.get()); |
984 std::vector<PasswordForm*> keychain_forms = | 989 std::vector<PasswordForm*> keychain_forms = |
985 keychain_adapter.PasswordsFillingForm(form); | 990 keychain_adapter.PasswordsFillingForm(form); |
986 | 991 |
987 std::vector<PasswordForm*> database_forms; | 992 std::vector<PasswordForm*> database_forms; |
988 login_metadata_db_->GetLogins(form, &database_forms); | 993 login_metadata_db_->GetLogins(form, &database_forms); |
989 | 994 |
990 std::vector<PasswordForm*> matched_forms; | 995 std::vector<PasswordForm*> matched_forms; |
991 internal_keychain_helpers::MergePasswordForms(&keychain_forms, | 996 internal_keychain_helpers::MergePasswordForms(&keychain_forms, |
992 &database_forms, | 997 &database_forms, |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1104 owned_keychain_adapter.SetFindsOnlyOwnedItems(true); | 1109 owned_keychain_adapter.SetFindsOnlyOwnedItems(true); |
1105 for (std::vector<PasswordForm*>::const_iterator i = forms.begin(); | 1110 for (std::vector<PasswordForm*>::const_iterator i = forms.begin(); |
1106 i != forms.end(); ++i) { | 1111 i != forms.end(); ++i) { |
1107 owned_keychain_adapter.RemovePassword(**i); | 1112 owned_keychain_adapter.RemovePassword(**i); |
1108 } | 1113 } |
1109 } | 1114 } |
1110 | 1115 |
1111 void PasswordStoreMac::CreateNotificationService() { | 1116 void PasswordStoreMac::CreateNotificationService() { |
1112 notification_service_.reset(content::NotificationService::Create()); | 1117 notification_service_.reset(content::NotificationService::Create()); |
1113 } | 1118 } |
OLD | NEW |