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 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 LoginDatabase* login_db) | 831 LoginDatabase* login_db) |
832 : PasswordStore(main_thread_runner, db_thread_runner), | 832 : PasswordStore(main_thread_runner, db_thread_runner), |
833 keychain_(keychain), | 833 keychain_(keychain), |
834 login_metadata_db_(login_db) { | 834 login_metadata_db_(login_db) { |
835 DCHECK(keychain_.get()); | 835 DCHECK(keychain_.get()); |
836 DCHECK(login_metadata_db_.get()); | 836 DCHECK(login_metadata_db_.get()); |
837 } | 837 } |
838 | 838 |
839 PasswordStoreMac::~PasswordStoreMac() {} | 839 PasswordStoreMac::~PasswordStoreMac() {} |
840 | 840 |
841 bool PasswordStoreMac::Init() { | 841 bool PasswordStoreMac::Init( |
| 842 const syncer::SyncableService::StartSyncFlare& flare) { |
842 thread_.reset(new base::Thread("Chrome_PasswordStore_Thread")); | 843 thread_.reset(new base::Thread("Chrome_PasswordStore_Thread")); |
843 | 844 |
844 if (!thread_->Start()) { | 845 if (!thread_->Start()) { |
845 thread_.reset(NULL); | 846 thread_.reset(NULL); |
846 return false; | 847 return false; |
847 } | 848 } |
848 return PasswordStore::Init(); | 849 return PasswordStore::Init(flare); |
849 } | 850 } |
850 | 851 |
851 // Mac stores passwords in the system keychain, which can block for an | 852 // Mac stores passwords in the system keychain, which can block for an |
852 // arbitrarily long time (most notably, it can block on user confirmation | 853 // arbitrarily long time (most notably, it can block on user confirmation |
853 // from a dialog). Run tasks on a dedicated thread to avoid blocking the DB | 854 // from a dialog). Run tasks on a dedicated thread to avoid blocking the DB |
854 // thread. | 855 // thread. |
855 scoped_refptr<base::SingleThreadTaskRunner> | 856 scoped_refptr<base::SingleThreadTaskRunner> |
856 PasswordStoreMac::GetBackgroundTaskRunner() { | 857 PasswordStoreMac::GetBackgroundTaskRunner() { |
857 return (thread_.get()) ? thread_->message_loop_proxy() : NULL; | 858 return (thread_.get()) ? thread_->message_loop_proxy() : NULL; |
858 } | 859 } |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 | 1119 |
1119 void PasswordStoreMac::RemoveKeychainForms( | 1120 void PasswordStoreMac::RemoveKeychainForms( |
1120 const std::vector<PasswordForm*>& forms) { | 1121 const std::vector<PasswordForm*>& forms) { |
1121 MacKeychainPasswordFormAdapter owned_keychain_adapter(keychain_.get()); | 1122 MacKeychainPasswordFormAdapter owned_keychain_adapter(keychain_.get()); |
1122 owned_keychain_adapter.SetFindsOnlyOwnedItems(true); | 1123 owned_keychain_adapter.SetFindsOnlyOwnedItems(true); |
1123 for (std::vector<PasswordForm*>::const_iterator i = forms.begin(); | 1124 for (std::vector<PasswordForm*>::const_iterator i = forms.begin(); |
1124 i != forms.end(); ++i) { | 1125 i != forms.end(); ++i) { |
1125 owned_keychain_adapter.RemovePassword(**i); | 1126 owned_keychain_adapter.RemovePassword(**i); |
1126 } | 1127 } |
1127 } | 1128 } |
OLD | NEW |