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 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_PROXY_MAC_H_ | |
6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_PROXY_MAC_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "base/macros.h" | |
11 #include "base/threading/thread.h" | |
12 #include "components/password_manager/core/browser/keychain_migration_status_mac
.h" | |
13 #include "components/password_manager/core/browser/password_store_default.h" | |
14 #include "components/prefs/pref_member.h" | |
15 | |
16 namespace password_manager { | |
17 class LoginDatabase; | |
18 } | |
19 | |
20 // Password store for Mac. It creates a dedicated background thread | |
21 class PasswordStoreProxyMac : public password_manager::PasswordStoreDefault { | |
22 public: | |
23 PasswordStoreProxyMac( | |
24 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner, | |
25 std::unique_ptr<password_manager::LoginDatabase> login_db, | |
26 PrefService* prefs); | |
27 | |
28 // PasswordStore: | |
29 bool Init(const syncer::SyncableService::StartSyncFlare& flare, | |
30 PrefService* prefs) override; | |
31 void ShutdownOnUIThread() override; | |
32 scoped_refptr<base::SingleThreadTaskRunner> GetBackgroundTaskRunner() | |
33 override; | |
34 | |
35 #if defined(UNIT_TEST) | |
36 password_manager::LoginDatabase* login_metadata_db() { return login_db(); } | |
37 #endif | |
38 | |
39 private: | |
40 ~PasswordStoreProxyMac() override; | |
41 | |
42 void InitOnBackgroundThread(password_manager::MigrationStatus status); | |
43 | |
44 // Writes status to the prefs. | |
45 void UpdateStatusPref(password_manager::MigrationStatus status); | |
46 | |
47 // Thread that the synchronous methods are run on. | |
48 std::unique_ptr<base::Thread> thread_; | |
49 | |
50 // Current migration status for the profile. | |
51 IntegerPrefMember migration_status_; | |
52 | |
53 DISALLOW_COPY_AND_ASSIGN(PasswordStoreProxyMac); | |
54 }; | |
55 | |
56 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_PROXY_MAC_H_ | |
OLD | NEW |