| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_PROXY_MAC_H_ | 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_PROXY_MAC_H_ |
| 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_PROXY_MAC_H_ | 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_PROXY_MAC_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 class SimplePasswordStoreMac; | 27 class SimplePasswordStoreMac; |
| 28 | 28 |
| 29 // The class is a proxy for either PasswordStoreMac or SimplePasswordStoreMac. | 29 // The class is a proxy for either PasswordStoreMac or SimplePasswordStoreMac. |
| 30 // It is responsible for performing migration from PasswordStoreMac to | 30 // It is responsible for performing migration from PasswordStoreMac to |
| 31 // SimplePasswordStoreMac and instantiating a correct backend according to the | 31 // SimplePasswordStoreMac and instantiating a correct backend according to the |
| 32 // user's state. | 32 // user's state. |
| 33 class PasswordStoreProxyMac : public password_manager::PasswordStore { | 33 class PasswordStoreProxyMac : public password_manager::PasswordStore { |
| 34 public: | 34 public: |
| 35 PasswordStoreProxyMac( | 35 PasswordStoreProxyMac( |
| 36 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner, | 36 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner, |
| 37 scoped_ptr<crypto::AppleKeychain> keychain, | 37 std::unique_ptr<crypto::AppleKeychain> keychain, |
| 38 scoped_ptr<password_manager::LoginDatabase> login_db, | 38 std::unique_ptr<password_manager::LoginDatabase> login_db, |
| 39 PrefService* prefs); | 39 PrefService* prefs); |
| 40 | 40 |
| 41 bool Init(const syncer::SyncableService::StartSyncFlare& flare) override; | 41 bool Init(const syncer::SyncableService::StartSyncFlare& flare) override; |
| 42 void ShutdownOnUIThread() override; | 42 void ShutdownOnUIThread() override; |
| 43 scoped_refptr<base::SingleThreadTaskRunner> GetBackgroundTaskRunner() | 43 scoped_refptr<base::SingleThreadTaskRunner> GetBackgroundTaskRunner() |
| 44 override; | 44 override; |
| 45 | 45 |
| 46 #if defined(UNIT_TEST) | 46 #if defined(UNIT_TEST) |
| 47 password_manager::LoginDatabase* login_metadata_db() { | 47 password_manager::LoginDatabase* login_metadata_db() { |
| 48 return login_metadata_db_.get(); | 48 return login_metadata_db_.get(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 base::Time delete_end) override; | 92 base::Time delete_end) override; |
| 93 ScopedVector<autofill::PasswordForm> FillMatchingLogins( | 93 ScopedVector<autofill::PasswordForm> FillMatchingLogins( |
| 94 const autofill::PasswordForm& form) override; | 94 const autofill::PasswordForm& form) override; |
| 95 bool FillAutofillableLogins( | 95 bool FillAutofillableLogins( |
| 96 ScopedVector<autofill::PasswordForm>* forms) override; | 96 ScopedVector<autofill::PasswordForm>* forms) override; |
| 97 bool FillBlacklistLogins( | 97 bool FillBlacklistLogins( |
| 98 ScopedVector<autofill::PasswordForm>* forms) override; | 98 ScopedVector<autofill::PasswordForm>* forms) override; |
| 99 void AddSiteStatsImpl( | 99 void AddSiteStatsImpl( |
| 100 const password_manager::InteractionsStats& stats) override; | 100 const password_manager::InteractionsStats& stats) override; |
| 101 void RemoveSiteStatsImpl(const GURL& origin_domain) override; | 101 void RemoveSiteStatsImpl(const GURL& origin_domain) override; |
| 102 std::vector<scoped_ptr<password_manager::InteractionsStats>> GetSiteStatsImpl( | 102 std::vector<std::unique_ptr<password_manager::InteractionsStats>> |
| 103 const GURL& origin_domain) override; | 103 GetSiteStatsImpl(const GURL& origin_domain) override; |
| 104 | 104 |
| 105 scoped_refptr<PasswordStoreMac> password_store_mac_; | 105 scoped_refptr<PasswordStoreMac> password_store_mac_; |
| 106 scoped_refptr<SimplePasswordStoreMac> password_store_simple_; | 106 scoped_refptr<SimplePasswordStoreMac> password_store_simple_; |
| 107 | 107 |
| 108 // The login metadata SQL database. If opening the DB on |thread_| fails, | 108 // The login metadata SQL database. If opening the DB on |thread_| fails, |
| 109 // |login_metadata_db_| will be reset to NULL for the lifetime of |this|. | 109 // |login_metadata_db_| will be reset to NULL for the lifetime of |this|. |
| 110 // The ownership may be transferred to |password_store_simple_|. | 110 // The ownership may be transferred to |password_store_simple_|. |
| 111 scoped_ptr<password_manager::LoginDatabase> login_metadata_db_; | 111 std::unique_ptr<password_manager::LoginDatabase> login_metadata_db_; |
| 112 | 112 |
| 113 // Thread that the synchronous methods are run on. | 113 // Thread that the synchronous methods are run on. |
| 114 scoped_ptr<base::Thread> thread_; | 114 std::unique_ptr<base::Thread> thread_; |
| 115 | 115 |
| 116 // Current migration status for the profile. | 116 // Current migration status for the profile. |
| 117 IntegerPrefMember migration_status_; | 117 IntegerPrefMember migration_status_; |
| 118 | 118 |
| 119 // List of tasks filled by InitOnBackgroundThread. They can't be just posted | 119 // List of tasks filled by InitOnBackgroundThread. They can't be just posted |
| 120 // to the UI thread because the message loop can shut down before executing | 120 // to the UI thread because the message loop can shut down before executing |
| 121 // them. If this is the case then Shutdown() flushes the tasks after stopping | 121 // them. If this is the case then Shutdown() flushes the tasks after stopping |
| 122 // the background thread. | 122 // the background thread. |
| 123 // After InitOnBackgroundThread is run once, the queue may not be modified on | 123 // After InitOnBackgroundThread is run once, the queue may not be modified on |
| 124 // the background thread any more. | 124 // the background thread any more. |
| 125 std::vector<base::Closure> pending_ui_tasks_; | 125 std::vector<base::Closure> pending_ui_tasks_; |
| 126 | 126 |
| 127 DISALLOW_COPY_AND_ASSIGN(PasswordStoreProxyMac); | 127 DISALLOW_COPY_AND_ASSIGN(PasswordStoreProxyMac); |
| 128 }; | 128 }; |
| 129 | 129 |
| 130 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_PROXY_MAC_H_ | 130 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_PROXY_MAC_H_ |
| OLD | NEW |