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 LoginDatabase* login_db); |
25 | 25 |
26 protected: | 26 protected: |
27 virtual ~PasswordStoreDefault(); | 27 virtual ~PasswordStoreDefault(); |
28 | 28 |
29 // Implements PasswordStore interface. | 29 // Implements PasswordStore interface. |
30 virtual void ReportMetricsImpl(const std::string& sync_username) OVERRIDE; | 30 virtual void ReportMetricsImpl(const std::string& sync_username) override; |
31 virtual PasswordStoreChangeList AddLoginImpl( | 31 virtual PasswordStoreChangeList AddLoginImpl( |
32 const autofill::PasswordForm& form) OVERRIDE; | 32 const autofill::PasswordForm& form) override; |
33 virtual PasswordStoreChangeList UpdateLoginImpl( | 33 virtual PasswordStoreChangeList UpdateLoginImpl( |
34 const autofill::PasswordForm& form) OVERRIDE; | 34 const autofill::PasswordForm& form) override; |
35 virtual PasswordStoreChangeList RemoveLoginImpl( | 35 virtual PasswordStoreChangeList RemoveLoginImpl( |
36 const autofill::PasswordForm& form) OVERRIDE; | 36 const autofill::PasswordForm& form) override; |
37 virtual PasswordStoreChangeList RemoveLoginsCreatedBetweenImpl( | 37 virtual PasswordStoreChangeList RemoveLoginsCreatedBetweenImpl( |
38 base::Time delete_begin, | 38 base::Time delete_begin, |
39 base::Time delete_end) OVERRIDE; | 39 base::Time delete_end) override; |
40 virtual PasswordStoreChangeList RemoveLoginsSyncedBetweenImpl( | 40 virtual PasswordStoreChangeList RemoveLoginsSyncedBetweenImpl( |
41 base::Time delete_begin, | 41 base::Time delete_begin, |
42 base::Time delete_end) OVERRIDE; | 42 base::Time delete_end) override; |
43 virtual void GetLoginsImpl( | 43 virtual void GetLoginsImpl( |
44 const autofill::PasswordForm& form, | 44 const autofill::PasswordForm& form, |
45 AuthorizationPromptPolicy prompt_policy, | 45 AuthorizationPromptPolicy prompt_policy, |
46 const ConsumerCallbackRunner& callback_runner) OVERRIDE; | 46 const ConsumerCallbackRunner& callback_runner) override; |
47 virtual void GetAutofillableLoginsImpl(GetLoginsRequest* request) OVERRIDE; | 47 virtual void GetAutofillableLoginsImpl(GetLoginsRequest* request) override; |
48 virtual void GetBlacklistLoginsImpl(GetLoginsRequest* request) OVERRIDE; | 48 virtual void GetBlacklistLoginsImpl(GetLoginsRequest* request) override; |
49 virtual bool FillAutofillableLogins( | 49 virtual bool FillAutofillableLogins( |
50 std::vector<autofill::PasswordForm*>* forms) OVERRIDE; | 50 std::vector<autofill::PasswordForm*>* forms) override; |
51 virtual bool FillBlacklistLogins( | 51 virtual bool FillBlacklistLogins( |
52 std::vector<autofill::PasswordForm*>* forms) OVERRIDE; | 52 std::vector<autofill::PasswordForm*>* forms) override; |
53 | 53 |
54 protected: | 54 protected: |
55 inline bool DeleteAndRecreateDatabaseFile() { | 55 inline bool DeleteAndRecreateDatabaseFile() { |
56 return login_db_->DeleteAndRecreateDatabaseFile(); | 56 return login_db_->DeleteAndRecreateDatabaseFile(); |
57 } | 57 } |
58 | 58 |
59 private: | 59 private: |
60 scoped_ptr<LoginDatabase> login_db_; | 60 scoped_ptr<LoginDatabase> login_db_; |
61 | 61 |
62 DISALLOW_COPY_AND_ASSIGN(PasswordStoreDefault); | 62 DISALLOW_COPY_AND_ASSIGN(PasswordStoreDefault); |
63 }; | 63 }; |
64 | 64 |
65 } // namespace password_manager | 65 } // namespace password_manager |
66 | 66 |
67 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_STORE_DEFAULT_H_ | 67 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_STORE_DEFAULT_H_ |
OLD | NEW |