Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / components / password_manager / core / browser / password_manager_driver.h
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_MANAGER_DRIVER_H_
6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_DRIVER_H_
7
8 #include <vector>
9
10 #include "base/macros.h"
11 #include "base/strings/string16.h"
12
13 namespace autofill {
14 class AutofillManager;
15 struct FormData;
16 struct PasswordForm;
17 struct PasswordFormFillData;
18 }  // namespace autofill
19
20 namespace password_manager {
21
22 class PasswordAutofillManager;
23 class PasswordGenerationManager;
24 class PasswordManager;
25
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 {
29  public:
30   PasswordManagerDriver() {}
31   virtual ~PasswordManagerDriver() {}
32
33   // Fills forms matching |form_data|.
34   virtual void FillPasswordForm(
35       const autofill::PasswordFormFillData& form_data) = 0;
36
37   // Returns whether any SSL certificate errors were encountered as a result of
38   // the last page load.
39   virtual bool DidLastPageLoadEncounterSSLErrors() = 0;
40
41   // If this browsing session should not be persisted.
42   virtual bool IsOffTheRecord() = 0;
43
44   // Informs the driver that |form| can be used for password generation.
45   virtual void AllowPasswordGenerationForForm(
46       const autofill::PasswordForm& form) = 0;
47
48   // Notifies the driver that account creation |forms| were found.
49   virtual void AccountCreationFormsFound(
50       const std::vector<autofill::FormData>& forms) = 0;
51
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;
55
56   // Tells the driver to preview filling form with the |username| and
57   // |password|.
58   virtual void PreviewSuggestion(const base::string16& username,
59                                  const base::string16& password) = 0;
60
61   // Tells the driver to clear previewed password and username fields.
62   virtual void ClearPreviewedForm() = 0;
63
64   // Returns the PasswordGenerationManager associated with this instance.
65   virtual PasswordGenerationManager* GetPasswordGenerationManager() = 0;
66
67   // Returns the PasswordManager associated with this instance.
68   virtual PasswordManager* GetPasswordManager() = 0;
69
70   // Returns the PasswordAutofillManager associated with this instance.
71   virtual PasswordAutofillManager* GetPasswordAutofillManager() = 0;
72
73   // Returns the AutofillManager associated with this instance.
74   virtual autofill::AutofillManager* GetAutofillManager() = 0;
75
76  private:
77   DISALLOW_COPY_AND_ASSIGN(PasswordManagerDriver);
78 };
79
80 }  // namespace password_manager
81
82 #endif  // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_DRIVER_H_