OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_STORE_DEFAULT_H_ | 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_STORE_DEFAULT_H_ |
6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_STORE_DEFAULT_H_ | 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_STORE_DEFAULT_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "components/password_manager/core/browser/login_database.h" | 11 #include "components/password_manager/core/browser/login_database.h" |
12 #include "components/password_manager/core/browser/password_store.h" | 12 #include "components/password_manager/core/browser/password_store.h" |
13 | 13 |
14 namespace password_manager { | 14 namespace password_manager { |
15 | 15 |
16 // Simple password store implementation that delegates everything to | 16 // Simple password store implementation that delegates everything to |
17 // the LoginDatabase. | 17 // the LoginDatabase. |
18 class PasswordStoreDefault : public PasswordStore { | 18 class PasswordStoreDefault : public PasswordStore { |
19 public: | 19 public: |
20 // Takes ownership of |login_db|. | 20 // Takes ownership of |login_db|. |
21 PasswordStoreDefault( | 21 PasswordStoreDefault( |
22 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner, | 22 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner, |
23 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner, | 23 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner, |
24 LoginDatabase* login_db); | 24 const base::FilePath& login_db_file_path); |
25 | |
26 bool Init(const syncer::SyncableService::StartSyncFlare& flare) override; | |
27 | |
28 // Used for testing. | |
vabr (Chromium)
2015/01/05 13:47:05
nit: Maybe be stricter and say: "Use only for test
| |
29 LoginDatabase* login_db() const { | |
30 return login_db_.get(); | |
31 } | |
25 | 32 |
26 protected: | 33 protected: |
27 ~PasswordStoreDefault() override; | 34 ~PasswordStoreDefault() override; |
28 | 35 |
36 // Opens |login_db_| on the DB thread. | |
37 void InitOnDBThread(); | |
38 | |
29 // Implements PasswordStore interface. | 39 // Implements PasswordStore interface. |
30 void ReportMetricsImpl(const std::string& sync_username, | 40 void ReportMetricsImpl(const std::string& sync_username, |
31 bool custom_passphrase_sync_enabled) override; | 41 bool custom_passphrase_sync_enabled) override; |
32 PasswordStoreChangeList AddLoginImpl( | 42 PasswordStoreChangeList AddLoginImpl( |
33 const autofill::PasswordForm& form) override; | 43 const autofill::PasswordForm& form) override; |
34 PasswordStoreChangeList UpdateLoginImpl( | 44 PasswordStoreChangeList UpdateLoginImpl( |
35 const autofill::PasswordForm& form) override; | 45 const autofill::PasswordForm& form) override; |
36 PasswordStoreChangeList RemoveLoginImpl( | 46 PasswordStoreChangeList RemoveLoginImpl( |
37 const autofill::PasswordForm& form) override; | 47 const autofill::PasswordForm& form) override; |
38 PasswordStoreChangeList RemoveLoginsCreatedBetweenImpl( | 48 PasswordStoreChangeList RemoveLoginsCreatedBetweenImpl( |
(...skipping 11 matching lines...) Expand all Loading... | |
50 std::vector<autofill::PasswordForm*>* forms) override; | 60 std::vector<autofill::PasswordForm*>* forms) override; |
51 bool FillBlacklistLogins( | 61 bool FillBlacklistLogins( |
52 std::vector<autofill::PasswordForm*>* forms) override; | 62 std::vector<autofill::PasswordForm*>* forms) override; |
53 | 63 |
54 protected: | 64 protected: |
55 inline bool DeleteAndRecreateDatabaseFile() { | 65 inline bool DeleteAndRecreateDatabaseFile() { |
56 return login_db_->DeleteAndRecreateDatabaseFile(); | 66 return login_db_->DeleteAndRecreateDatabaseFile(); |
57 } | 67 } |
58 | 68 |
59 private: | 69 private: |
70 base::FilePath login_db_file_path_; | |
vabr (Chromium)
2015/01/05 13:47:05
Could this be const?
| |
71 | |
72 // The SQLite login database, opened on the DB thread in a deferred manner. | |
73 // Will be NULL for the lifetime of |this| if opening fails. | |
60 scoped_ptr<LoginDatabase> login_db_; | 74 scoped_ptr<LoginDatabase> login_db_; |
61 | 75 |
62 DISALLOW_COPY_AND_ASSIGN(PasswordStoreDefault); | 76 DISALLOW_COPY_AND_ASSIGN(PasswordStoreDefault); |
63 }; | 77 }; |
64 | 78 |
65 } // namespace password_manager | 79 } // namespace password_manager |
66 | 80 |
67 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_STORE_DEFAULT_H_ | 81 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_STORE_DEFAULT_H_ |
OLD | NEW |