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.
4
5#ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_SYNC_INTERFACE_H_
6#define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_SYNC_INTERFACE_H_
7
8#include <vector>
9
10#include "components/password_manager/core/browser/password_store_change.h"
11
12namespace password_manager {
13
14// PasswordStore interface for PasswordSyncableService. It provides access to
15// synchronous methods of PasswordStore which shouldn't be accessible to other
16// classes. These methods are to be called on the PasswordStore background
17// thread only.
18class PasswordStoreSync {
19 public:
20  // Finds all non-blacklist PasswordForms, and fills the vector.
21  virtual bool FillAutofillableLogins(
22      std::vector<autofill::PasswordForm*>* forms) = 0;
23
24  // Finds all blacklist PasswordForms, and fills the vector.
25  virtual bool FillBlacklistLogins(
26      std::vector<autofill::PasswordForm*>* forms) = 0;
27
28  // Synchronous implementation to add the given login.
29  virtual PasswordStoreChangeList AddLoginImpl(
30      const autofill::PasswordForm& form) = 0;
31
32  // Synchronous implementation to update the given login.
33  virtual PasswordStoreChangeList UpdateLoginImpl(
34      const autofill::PasswordForm& form) = 0;
35
36  // Synchronous implementation to remove the given login.
37  virtual PasswordStoreChangeList RemoveLoginImpl(
38      const autofill::PasswordForm& form) = 0;
39
40  // Notifies observers that password store data may have been changed.
41  virtual void NotifyLoginsChanged(const PasswordStoreChangeList& changes) = 0;
42
43 protected:
44  virtual ~PasswordStoreSync();
45};
46
47}  // namespace password_manager
48
49#endif  // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_SYNC_INTERFACE_H_
50