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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_STORE_DEFAULT_H_
6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_STORE_DEFAULT_H_
10 #include "base/memory/scoped_ptr.h"
11 #include "components/password_manager/core/browser/login_database.h"
12 #include "components/password_manager/core/browser/password_store.h"
14 namespace password_manager {
16 // Simple password store implementation that delegates everything to
18 class PasswordStoreDefault : public PasswordStore {
20 // Takes ownership of |login_db|.
22 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner,
23 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner,
24 LoginDatabase* login_db);
27 virtual ~PasswordStoreDefault();
29 // Implements PasswordStore interface.
30 virtual void ReportMetricsImpl(const std::string& sync_username) OVERRIDE;
31 virtual PasswordStoreChangeList AddLoginImpl(
32 const autofill::PasswordForm& form) OVERRIDE;
33 virtual PasswordStoreChangeList UpdateLoginImpl(
34 const autofill::PasswordForm& form) OVERRIDE;
35 virtual PasswordStoreChangeList RemoveLoginImpl(
36 const autofill::PasswordForm& form) OVERRIDE;
37 virtual PasswordStoreChangeList RemoveLoginsCreatedBetweenImpl(
38 base::Time delete_begin,
39 base::Time delete_end) OVERRIDE;
40 virtual PasswordStoreChangeList RemoveLoginsSyncedBetweenImpl(
41 base::Time delete_begin,
42 base::Time delete_end) OVERRIDE;
43 virtual void GetLoginsImpl(
44 const autofill::PasswordForm& form,
45 AuthorizationPromptPolicy prompt_policy,
46 const ConsumerCallbackRunner& callback_runner) OVERRIDE;
47 virtual void GetAutofillableLoginsImpl(GetLoginsRequest* request) OVERRIDE;
48 virtual void GetBlacklistLoginsImpl(GetLoginsRequest* request) OVERRIDE;
49 virtual bool FillAutofillableLogins(
50 std::vector<autofill::PasswordForm*>* forms) OVERRIDE;
51 virtual bool FillBlacklistLogins(
52 std::vector<autofill::PasswordForm*>* forms) OVERRIDE;
55 inline bool DeleteAndRecreateDatabaseFile() {
56 return login_db_->DeleteAndRecreateDatabaseFile();
60 scoped_ptr<LoginDatabase> login_db_;
62 DISALLOW_COPY_AND_ASSIGN(PasswordStoreDefault);
65 } // namespace password_manager
67 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_STORE_DEFAULT_H_