OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/password_manager/password_store_proxy_mac.h" |
| 6 |
| 7 #include "chrome/browser/password_manager/password_store_mac.h" |
| 8 #include "chrome/browser/password_manager/simple_password_store_mac.h" |
| 9 #include "crypto/apple_keychain.h" |
| 10 |
| 11 using password_manager::PasswordStoreChangeList; |
| 12 |
| 13 PasswordStoreProxyMac::PasswordStoreProxyMac( |
| 14 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner, |
| 15 scoped_ptr<crypto::AppleKeychain> keychain, |
| 16 scoped_ptr<password_manager::LoginDatabase> login_db) |
| 17 : PasswordStore(main_thread_runner, nullptr) { |
| 18 // TODO(vasilii): for now the class is just a wrapper around PasswordStoreMac. |
| 19 password_store_mac_ = new PasswordStoreMac(main_thread_runner, nullptr, |
| 20 keychain.Pass(), login_db.Pass()); |
| 21 } |
| 22 |
| 23 PasswordStoreProxyMac::~PasswordStoreProxyMac() { |
| 24 } |
| 25 |
| 26 bool PasswordStoreProxyMac::Init( |
| 27 const syncer::SyncableService::StartSyncFlare& flare) { |
| 28 return GetBackend()->Init(flare); |
| 29 } |
| 30 |
| 31 void PasswordStoreProxyMac::Shutdown() { |
| 32 return GetBackend()->Shutdown(); |
| 33 } |
| 34 |
| 35 password_manager::PasswordStore* PasswordStoreProxyMac::GetBackend() const { |
| 36 if (password_store_mac_) |
| 37 return password_store_mac_.get(); |
| 38 return password_store_simple_.get(); |
| 39 } |
| 40 |
| 41 scoped_refptr<base::SingleThreadTaskRunner> |
| 42 PasswordStoreProxyMac::GetBackgroundTaskRunner() { |
| 43 return GetBackend()->GetBackgroundTaskRunner(); |
| 44 } |
| 45 |
| 46 void PasswordStoreProxyMac::ReportMetricsImpl( |
| 47 const std::string& sync_username, |
| 48 bool custom_passphrase_sync_enabled) { |
| 49 GetBackend()->ReportMetricsImpl(sync_username, |
| 50 custom_passphrase_sync_enabled); |
| 51 } |
| 52 |
| 53 PasswordStoreChangeList PasswordStoreProxyMac::AddLoginImpl( |
| 54 const autofill::PasswordForm& form) { |
| 55 return GetBackend()->AddLoginImpl(form); |
| 56 } |
| 57 |
| 58 PasswordStoreChangeList PasswordStoreProxyMac::UpdateLoginImpl( |
| 59 const autofill::PasswordForm& form) { |
| 60 return GetBackend()->UpdateLoginImpl(form); |
| 61 } |
| 62 |
| 63 PasswordStoreChangeList PasswordStoreProxyMac::RemoveLoginImpl( |
| 64 const autofill::PasswordForm& form) { |
| 65 return GetBackend()->RemoveLoginImpl(form); |
| 66 } |
| 67 |
| 68 PasswordStoreChangeList PasswordStoreProxyMac::RemoveLoginsCreatedBetweenImpl( |
| 69 base::Time delete_begin, |
| 70 base::Time delete_end) { |
| 71 return GetBackend()->RemoveLoginsCreatedBetweenImpl(delete_begin, delete_end); |
| 72 } |
| 73 |
| 74 PasswordStoreChangeList PasswordStoreProxyMac::RemoveLoginsSyncedBetweenImpl( |
| 75 base::Time delete_begin, |
| 76 base::Time delete_end) { |
| 77 return GetBackend()->RemoveLoginsSyncedBetweenImpl(delete_begin, delete_end); |
| 78 } |
| 79 |
| 80 ScopedVector<autofill::PasswordForm> PasswordStoreProxyMac::FillMatchingLogins( |
| 81 const autofill::PasswordForm& form, |
| 82 AuthorizationPromptPolicy prompt_policy) { |
| 83 return GetBackend()->FillMatchingLogins(form, prompt_policy); |
| 84 } |
| 85 |
| 86 void PasswordStoreProxyMac::GetAutofillableLoginsImpl( |
| 87 scoped_ptr<PasswordStore::GetLoginsRequest> request) { |
| 88 GetBackend()->GetAutofillableLoginsImpl(request.Pass()); |
| 89 } |
| 90 |
| 91 void PasswordStoreProxyMac::GetBlacklistLoginsImpl( |
| 92 scoped_ptr<PasswordStore::GetLoginsRequest> request) { |
| 93 GetBackend()->GetBlacklistLoginsImpl(request.Pass()); |
| 94 } |
| 95 |
| 96 bool PasswordStoreProxyMac::FillAutofillableLogins( |
| 97 ScopedVector<autofill::PasswordForm>* forms) { |
| 98 return GetBackend()->FillAutofillableLogins(forms); |
| 99 } |
| 100 |
| 101 bool PasswordStoreProxyMac::FillBlacklistLogins( |
| 102 ScopedVector<autofill::PasswordForm>* forms) { |
| 103 return GetBackend()->FillBlacklistLogins(forms); |
| 104 } |
| 105 |
| 106 void PasswordStoreProxyMac::AddSiteStatsImpl( |
| 107 const password_manager::InteractionsStats& stats) { |
| 108 GetBackend()->AddSiteStatsImpl(stats); |
| 109 } |
| 110 |
| 111 void PasswordStoreProxyMac::RemoveSiteStatsImpl(const GURL& origin_domain) { |
| 112 GetBackend()->RemoveSiteStatsImpl(origin_domain); |
| 113 } |
| 114 |
| 115 scoped_ptr<password_manager::InteractionsStats> |
| 116 PasswordStoreProxyMac::GetSiteStatsImpl(const GURL& origin_domain) { |
| 117 return GetBackend()->GetSiteStatsImpl(origin_domain); |
| 118 } |
OLD | NEW |