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_MANAGER_DRIVER_H_
6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_DRIVER_H_
10 #include "base/macros.h"
11 #include "base/strings/string16.h"
14 class AutofillManager;
17 struct PasswordFormFillData;
18 } // namespace autofill
20 namespace password_manager {
22 class PasswordAutofillManager;
23 class PasswordGenerationManager;
24 class PasswordManager;
26 // Interface that allows PasswordManager core code to interact with its driver
27 // (i.e., obtain information from it and give information to it).
28 class PasswordManagerDriver {
30 PasswordManagerDriver() {}
31 virtual ~PasswordManagerDriver() {}
33 // Fills forms matching |form_data|.
34 virtual void FillPasswordForm(
35 const autofill::PasswordFormFillData& form_data) = 0;
37 // Returns whether any SSL certificate errors were encountered as a result of
38 // the last page load.
39 virtual bool DidLastPageLoadEncounterSSLErrors() = 0;
41 // If this browsing session should not be persisted.
42 virtual bool IsOffTheRecord() = 0;
44 // Informs the driver that |form| can be used for password generation.
45 virtual void AllowPasswordGenerationForForm(
46 const autofill::PasswordForm& form) = 0;
48 // Notifies the driver that account creation |forms| were found.
49 virtual void AccountCreationFormsFound(
50 const std::vector<autofill::FormData>& forms) = 0;
52 // Tells the driver to fill the form with the |username| and |password|.
53 virtual void FillSuggestion(const base::string16& username,
54 const base::string16& password) = 0;
56 // Tells the driver to preview filling form with the |username| and
58 virtual void PreviewSuggestion(const base::string16& username,
59 const base::string16& password) = 0;
61 // Tells the driver to clear previewed password and username fields.
62 virtual void ClearPreviewedForm() = 0;
64 // Returns the PasswordGenerationManager associated with this instance.
65 virtual PasswordGenerationManager* GetPasswordGenerationManager() = 0;
67 // Returns the PasswordManager associated with this instance.
68 virtual PasswordManager* GetPasswordManager() = 0;
70 // Returns the PasswordAutofillManager associated with this instance.
71 virtual PasswordAutofillManager* GetPasswordAutofillManager() = 0;
73 // Returns the AutofillManager associated with this instance.
74 virtual autofill::AutofillManager* GetAutofillManager() = 0;
77 DISALLOW_COPY_AND_ASSIGN(PasswordManagerDriver);
80 } // namespace password_manager
82 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_DRIVER_H_