blob: 16eac832a4d5b8d296ded094ab1e0283fd22df93 [file] [log] [blame]
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_DEFAULT_H_
#define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_DEFAULT_H_
#include <vector>
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/password_manager/login_database.h"
#include "chrome/browser/password_manager/password_store.h"
class Profile;
// Simple password store implementation that delegates everything to
// the LoginDatabase.
class PasswordStoreDefault : public PasswordStore {
public:
// Takes ownership of |login_db|.
PasswordStoreDefault(LoginDatabase* login_db,
Profile* profile);
protected:
virtual ~PasswordStoreDefault();
// Implements RefCountedBrowserContextKeyedService.
virtual void ShutdownOnUIThread() OVERRIDE;
// Implements PasswordStore interface.
virtual void ReportMetricsImpl() OVERRIDE;
virtual void AddLoginImpl(const autofill::PasswordForm& form) OVERRIDE;
virtual void UpdateLoginImpl(
const autofill::PasswordForm& form) OVERRIDE;
virtual void RemoveLoginImpl(
const autofill::PasswordForm& form) OVERRIDE;
virtual void RemoveLoginsCreatedBetweenImpl(
const base::Time& delete_begin, const base::Time& delete_end) OVERRIDE;
virtual void GetLoginsImpl(
const autofill::PasswordForm& form,
AuthorizationPromptPolicy prompt_policy,
const ConsumerCallbackRunner& callback_runner) OVERRIDE;
virtual void GetAutofillableLoginsImpl(GetLoginsRequest* request) OVERRIDE;
virtual void GetBlacklistLoginsImpl(GetLoginsRequest* request) OVERRIDE;
virtual bool FillAutofillableLogins(
std::vector<autofill::PasswordForm*>* forms) OVERRIDE;
virtual bool FillBlacklistLogins(
std::vector<autofill::PasswordForm*>* forms) OVERRIDE;
protected:
inline bool DeleteAndRecreateDatabaseFile() {
return login_db_->DeleteAndRecreateDatabaseFile();
}
private:
scoped_ptr<LoginDatabase> login_db_;
Profile* profile_;
DISALLOW_COPY_AND_ASSIGN(PasswordStoreDefault);
};
#endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_DEFAULT_H_