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> |
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
928 ForwardLoginsResult(request); | 928 ForwardLoginsResult(request); |
929 } | 929 } |
930 | 930 |
931 void PasswordStoreMac::GetAutofillableLoginsImpl(GetLoginsRequest* request) { | 931 void PasswordStoreMac::GetAutofillableLoginsImpl(GetLoginsRequest* request) { |
932 FillAutofillableLogins(&request->value); | 932 FillAutofillableLogins(&request->value); |
933 ForwardLoginsResult(request); | 933 ForwardLoginsResult(request); |
934 } | 934 } |
935 | 935 |
936 bool PasswordStoreMac::FillAutofillableLogins( | 936 bool PasswordStoreMac::FillAutofillableLogins( |
937 std::vector<PasswordForm*>* forms) { | 937 std::vector<PasswordForm*>* forms) { |
938 DCHECK(thread_->message_loop() == MessageLoop::current()); | 938 DCHECK(thread_->message_loop() == base::MessageLoop::current()); |
939 | 939 |
940 std::vector<PasswordForm*> database_forms; | 940 std::vector<PasswordForm*> database_forms; |
941 login_metadata_db_->GetAutofillableLogins(&database_forms); | 941 login_metadata_db_->GetAutofillableLogins(&database_forms); |
942 | 942 |
943 std::vector<PasswordForm*> merged_forms = | 943 std::vector<PasswordForm*> merged_forms = |
944 internal_keychain_helpers::GetPasswordsForForms(*keychain_, | 944 internal_keychain_helpers::GetPasswordsForForms(*keychain_, |
945 &database_forms); | 945 &database_forms); |
946 | 946 |
947 // Clean up any orphaned database entries. | 947 // Clean up any orphaned database entries. |
948 RemoveDatabaseForms(database_forms); | 948 RemoveDatabaseForms(database_forms); |
949 STLDeleteElements(&database_forms); | 949 STLDeleteElements(&database_forms); |
950 | 950 |
951 forms->insert(forms->end(), merged_forms.begin(), merged_forms.end()); | 951 forms->insert(forms->end(), merged_forms.begin(), merged_forms.end()); |
952 return true; | 952 return true; |
953 } | 953 } |
954 | 954 |
955 bool PasswordStoreMac::FillBlacklistLogins( | 955 bool PasswordStoreMac::FillBlacklistLogins( |
956 std::vector<PasswordForm*>* forms) { | 956 std::vector<PasswordForm*>* forms) { |
957 DCHECK(thread_->message_loop() == MessageLoop::current()); | 957 DCHECK(thread_->message_loop() == base::MessageLoop::current()); |
958 return login_metadata_db_->GetBlacklistLogins(forms); | 958 return login_metadata_db_->GetBlacklistLogins(forms); |
959 } | 959 } |
960 | 960 |
961 bool PasswordStoreMac::AddToKeychainIfNecessary(const PasswordForm& form) { | 961 bool PasswordStoreMac::AddToKeychainIfNecessary(const PasswordForm& form) { |
962 if (form.blacklisted_by_user) { | 962 if (form.blacklisted_by_user) { |
963 return true; | 963 return true; |
964 } | 964 } |
965 MacKeychainPasswordFormAdapter keychainAdapter(keychain_.get()); | 965 MacKeychainPasswordFormAdapter keychainAdapter(keychain_.get()); |
966 return keychainAdapter.AddPassword(form); | 966 return keychainAdapter.AddPassword(form); |
967 } | 967 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 owned_keychain_adapter.SetFindsOnlyOwnedItems(true); | 1018 owned_keychain_adapter.SetFindsOnlyOwnedItems(true); |
1019 for (std::vector<PasswordForm*>::const_iterator i = forms.begin(); | 1019 for (std::vector<PasswordForm*>::const_iterator i = forms.begin(); |
1020 i != forms.end(); ++i) { | 1020 i != forms.end(); ++i) { |
1021 owned_keychain_adapter.RemovePassword(**i); | 1021 owned_keychain_adapter.RemovePassword(**i); |
1022 } | 1022 } |
1023 } | 1023 } |
1024 | 1024 |
1025 void PasswordStoreMac::CreateNotificationService() { | 1025 void PasswordStoreMac::CreateNotificationService() { |
1026 notification_service_.reset(content::NotificationService::Create()); | 1026 notification_service_.reset(content::NotificationService::Create()); |
1027 } | 1027 } |
OLD | NEW |