Chromium Code Reviews| Index: components/password_manager/core/browser/form_saver.h |
| diff --git a/components/password_manager/core/browser/form_saver.h b/components/password_manager/core/browser/form_saver.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..092cc99bee367bb38ba4a2b47b05fdc9b902ec74 |
| --- /dev/null |
| +++ b/components/password_manager/core/browser/form_saver.h |
| @@ -0,0 +1,56 @@ |
| +// Copyright 2016 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 COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_FORM_SAVER_H_ |
| +#define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_FORM_SAVER_H_ |
| + |
| +#include <vector> |
| + |
| +#include "base/macros.h" |
| +#include "base/optional.h" |
| +#include "components/autofill/core/common/password_form.h" |
| + |
| +namespace password_manager { |
| + |
| +// This interface allows the caller to save passwords and blacklist entries in |
| +// a password store. |
| +class FormSaver { |
| + public: |
| + FormSaver() = default; |
| + |
| + virtual ~FormSaver() = default; |
| + |
| + // Configures the |observed| form to become a blacklist entry and saves it. |
| + virtual void PermanentlyBlacklist(autofill::PasswordForm* observed) = 0; |
| + |
| + // Saves the |pending| form appropriately with respect to whether it |
| + // |is_new_login|, and updates the stored preference on |best_matches|. If |
| + // |old_primary_key| is given, uses it for saving |pending|. It also updates |
| + // the password store with all |credentials_to_update|. |
| + virtual void Save( |
|
dvadym
2016/06/23 15:28:22
I'd prefer to split this function on 2, Save and U
vabr (Chromium)
2016/06/23 16:38:56
Done.
|
| + const autofill::PasswordForm& pending, |
| + bool is_new_login, |
| + const autofill::PasswordFormMap& best_matches, |
| + const std::vector<const autofill::PasswordForm*>* credentials_to_update, |
| + const autofill::PasswordForm* old_primary_key) = 0; |
| + |
| + // Ensures that |generated| is saved in the store. This is in ideal case |
| + // either followed by a call to Save or RemovePresavedPassword. But if the |
| + // user interaction does not allow to call either of those, calling |
| + // PresaveGeneratedPassword alone is a legitimate thing to do to avoid data |
| + // loss. |
| + virtual void PresaveGeneratedPassword( |
| + const autofill::PasswordForm& generated) = 0; |
| + |
| + // Undo PresaveGeneratedPassword, e.g., when the user deletes the generated |
| + // password. |
| + virtual void RemovePresavedPassword() = 0; |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(FormSaver); |
| +}; |
| + |
| +} // namespace password_manager |
| + |
| +#endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_FORM_SAVER_H_ |