Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1158)

Side by Side Diff: chrome/browser/password_manager/password_store_proxy_mac.h

Issue 2323893002: Stop using the Keychain for passwords finally and clean up the Chrome entries there. (Closed)
Patch Set: add a comment Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/threading/thread.h" 12 #include "base/threading/thread.h"
13 #include "components/password_manager/core/browser/keychain_migration_status_mac .h" 13 #include "components/password_manager/core/browser/keychain_migration_status_mac .h"
14 #include "components/password_manager/core/browser/password_store.h" 14 #include "components/password_manager/core/browser/password_store.h"
15 #include "components/password_manager/core/common/password_manager_pref_names.h" 15 #include "components/password_manager/core/common/password_manager_pref_names.h"
16 #include "components/prefs/pref_member.h" 16 #include "components/prefs/pref_member.h"
17 17
18 namespace crypto { 18 namespace crypto {
19 class AppleKeychain; 19 class AppleKeychain;
20 } 20 }
21 21
22 namespace password_manager { 22 namespace password_manager {
23 class LoginDatabase; 23 class LoginDatabase;
24 } 24 }
25 25
26 class PasswordStoreMac;
27 class SimplePasswordStoreMac; 26 class SimplePasswordStoreMac;
28 27
29 // The class is a proxy for either PasswordStoreMac or SimplePasswordStoreMac. 28 // The class is a proxy for either PasswordStoreMac or SimplePasswordStoreMac.
30 // It is responsible for performing migration from PasswordStoreMac to 29 // It is responsible for performing migration from PasswordStoreMac to
31 // SimplePasswordStoreMac and instantiating a correct backend according to the 30 // SimplePasswordStoreMac and instantiating a correct backend according to the
32 // user's state. 31 // user's state.
33 class PasswordStoreProxyMac : public password_manager::PasswordStore { 32 class PasswordStoreProxyMac : public password_manager::PasswordStore {
34 public: 33 public:
35 PasswordStoreProxyMac( 34 PasswordStoreProxyMac(
36 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner, 35 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner,
37 std::unique_ptr<crypto::AppleKeychain> keychain, 36 std::unique_ptr<crypto::AppleKeychain> keychain,
38 std::unique_ptr<password_manager::LoginDatabase> login_db, 37 std::unique_ptr<password_manager::LoginDatabase> login_db,
39 PrefService* prefs); 38 PrefService* prefs);
40 39
41 bool Init(const syncer::SyncableService::StartSyncFlare& flare) override; 40 bool Init(const syncer::SyncableService::StartSyncFlare& flare) override;
42 void ShutdownOnUIThread() override; 41 void ShutdownOnUIThread() override;
43 scoped_refptr<base::SingleThreadTaskRunner> GetBackgroundTaskRunner() 42 scoped_refptr<base::SingleThreadTaskRunner> GetBackgroundTaskRunner()
44 override; 43 override;
45 44
46 #if defined(UNIT_TEST) 45 #if defined(UNIT_TEST)
47 password_manager::LoginDatabase* login_metadata_db() { 46 password_manager::LoginDatabase* login_metadata_db() {
48 return login_metadata_db_.get(); 47 return login_metadata_db_.get();
49 } 48 }
50 49
51 scoped_refptr<PasswordStoreMac> password_store_mac() { 50 crypto::AppleKeychain* keychain() {
52 return password_store_mac_; 51 return keychain_.get();
53 } 52 }
54 #endif 53 #endif
55 54
56 private: 55 private:
57 ~PasswordStoreProxyMac() override; 56 ~PasswordStoreProxyMac() override;
58 57
59 password_manager::PasswordStore* GetBackend() const; 58 password_manager::PasswordStore* GetBackend() const;
60 59
61 // Opens LoginDatabase on the background |thread_|. 60 // Opens LoginDatabase on the background |thread_|.
62 void InitOnBackgroundThread(password_manager::MigrationStatus status); 61 void InitOnBackgroundThread(password_manager::MigrationStatus status);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 bool FillAutofillableLogins( 94 bool FillAutofillableLogins(
96 std::vector<std::unique_ptr<autofill::PasswordForm>>* forms) override; 95 std::vector<std::unique_ptr<autofill::PasswordForm>>* forms) override;
97 bool FillBlacklistLogins( 96 bool FillBlacklistLogins(
98 std::vector<std::unique_ptr<autofill::PasswordForm>>* forms) override; 97 std::vector<std::unique_ptr<autofill::PasswordForm>>* forms) override;
99 void AddSiteStatsImpl( 98 void AddSiteStatsImpl(
100 const password_manager::InteractionsStats& stats) override; 99 const password_manager::InteractionsStats& stats) override;
101 void RemoveSiteStatsImpl(const GURL& origin_domain) override; 100 void RemoveSiteStatsImpl(const GURL& origin_domain) override;
102 std::vector<std::unique_ptr<password_manager::InteractionsStats>> 101 std::vector<std::unique_ptr<password_manager::InteractionsStats>>
103 GetSiteStatsImpl(const GURL& origin_domain) override; 102 GetSiteStatsImpl(const GURL& origin_domain) override;
104 103
105 scoped_refptr<PasswordStoreMac> password_store_mac_;
106 scoped_refptr<SimplePasswordStoreMac> password_store_simple_; 104 scoped_refptr<SimplePasswordStoreMac> password_store_simple_;
107 105
108 // The login metadata SQL database. If opening the DB on |thread_| fails, 106 // 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|. 107 // |login_metadata_db_| will be reset to NULL for the lifetime of |this|.
110 // The ownership may be transferred to |password_store_simple_|. 108 // The ownership may be transferred to |password_store_simple_|.
111 std::unique_ptr<password_manager::LoginDatabase> login_metadata_db_; 109 std::unique_ptr<password_manager::LoginDatabase> login_metadata_db_;
112 110
111 // Keychain wrapper.
112 const std::unique_ptr<crypto::AppleKeychain> keychain_;
113
113 // Thread that the synchronous methods are run on. 114 // Thread that the synchronous methods are run on.
114 std::unique_ptr<base::Thread> thread_; 115 std::unique_ptr<base::Thread> thread_;
115 116
116 // Current migration status for the profile. 117 // Current migration status for the profile.
117 IntegerPrefMember migration_status_; 118 IntegerPrefMember migration_status_;
118 119
119 // List of tasks filled by InitOnBackgroundThread. They can't be just posted 120 // 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 121 // 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 122 // them. If this is the case then Shutdown() flushes the tasks after stopping
122 // the background thread. 123 // the background thread.
123 // After InitOnBackgroundThread is run once, the queue may not be modified on 124 // After InitOnBackgroundThread is run once, the queue may not be modified on
124 // the background thread any more. 125 // the background thread any more.
125 std::vector<base::Closure> pending_ui_tasks_; 126 std::vector<base::Closure> pending_ui_tasks_;
126 127
127 DISALLOW_COPY_AND_ASSIGN(PasswordStoreProxyMac); 128 DISALLOW_COPY_AND_ASSIGN(PasswordStoreProxyMac);
128 }; 129 };
129 130
130 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_PROXY_MAC_H_ 131 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_PROXY_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698