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 // Simple password store implementation that delegates everything to
16 class PasswordStoreDefault : public PasswordStore {
18 // Takes ownership of |login_db|.
20 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner,
21 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner,
22 LoginDatabase* login_db);
25 virtual ~PasswordStoreDefault();
27 // Implements PasswordStore interface.
28 virtual void ReportMetricsImpl() OVERRIDE;
29 virtual PasswordStoreChangeList AddLoginImpl(
30 const autofill::PasswordForm& form) OVERRIDE;
31 virtual PasswordStoreChangeList UpdateLoginImpl(
32 const autofill::PasswordForm& form) OVERRIDE;
33 virtual PasswordStoreChangeList RemoveLoginImpl(
34 const autofill::PasswordForm& form) OVERRIDE;
35 virtual PasswordStoreChangeList RemoveLoginsCreatedBetweenImpl(
36 const base::Time& delete_begin, const base::Time& delete_end) OVERRIDE;
37 virtual void GetLoginsImpl(
38 const autofill::PasswordForm& form,
39 AuthorizationPromptPolicy prompt_policy,
40 const ConsumerCallbackRunner& callback_runner) OVERRIDE;
41 virtual void GetAutofillableLoginsImpl(GetLoginsRequest* request) OVERRIDE;
42 virtual void GetBlacklistLoginsImpl(GetLoginsRequest* request) OVERRIDE;
43 virtual bool FillAutofillableLogins(
44 std::vector<autofill::PasswordForm*>* forms) OVERRIDE;
45 virtual bool FillBlacklistLogins(
46 std::vector<autofill::PasswordForm*>* forms) OVERRIDE;
49 inline bool DeleteAndRecreateDatabaseFile() {
50 return login_db_->DeleteAndRecreateDatabaseFile();
54 scoped_ptr<LoginDatabase> login_db_;
56 DISALLOW_COPY_AND_ASSIGN(PasswordStoreDefault);
59 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_STORE_DEFAULT_H_