Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / password_manager / password_manager_client.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 CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_CLIENT_H_
6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_CLIENT_H_
7
8 #include "base/metrics/field_trial.h"
9 #include "components/autofill/core/common/password_form.h"
10 #include "components/autofill/core/common/password_form_fill_data.h"
11
12 class PasswordFormManager;
13 class PasswordManagerDriver;
14 class PasswordStore;
15 class PrefService;
16
17 // An abstraction of operations that depend on the embedders (e.g. Chrome)
18 // environment.
19 class PasswordManagerClient {
20  public:
21   PasswordManagerClient() {}
22   virtual ~PasswordManagerClient() {}
23
24   // Informs the embedder of a password form that can be saved if the user
25   // allows it. The embedder is not required to prompt the user if it decides
26   // that this form doesn't need to be saved.
27   virtual void PromptUserToSavePassword(PasswordFormManager* form_to_save) = 0;
28
29   // Called when a password is autofilled. Default implementation is a no-op.
30   virtual void PasswordWasAutofilled(
31       const autofill::PasswordFormMap& best_matches) const {}
32
33   // Called to authenticate the autofill password data.  If authentication is
34   // successful, this should continue filling the form.
35   virtual void AuthenticateAutofillAndFillForm(
36       scoped_ptr<autofill::PasswordFormFillData> fill_data) = 0;
37
38   // Gets prefs associated with this embedder.
39   virtual PrefService* GetPrefs() = 0;
40
41   // Returns the PasswordStore associated with this instance.
42   virtual PasswordStore* GetPasswordStore() = 0;
43
44   // Returns the PasswordManagerDriver instance associated with this instance.
45   virtual PasswordManagerDriver* GetDriver() = 0;
46
47   // Returns the probability that the experiment identified by |experiment_name|
48   // should be enabled. The default implementation returns 0.
49   virtual base::FieldTrial::Probability GetProbabilityForExperiment(
50       const std::string& experiment_name);
51
52   // Returns true if password sync is enabled in the embedder. The default
53   // implementation returns false.
54   virtual bool IsPasswordSyncEnabled();
55
56  private:
57   DISALLOW_COPY_AND_ASSIGN(PasswordManagerClient);
58 };
59
60 #endif  // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_CLIENT_H_