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 CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_CLIENT_H_
6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_CLIENT_H_
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"
12 class PasswordFormManager
;
13 class PasswordManagerDriver
;
17 // An abstraction of operations that depend on the embedders (e.g. Chrome)
19 class PasswordManagerClient
{
21 PasswordManagerClient() {}
22 virtual ~PasswordManagerClient() {}
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;
29 // Called when a password is autofilled. Default implementation is a no-op.
30 virtual void PasswordWasAutofilled(
31 const autofill::PasswordFormMap
& best_matches
) const {}
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;
38 // Gets prefs associated with this embedder.
39 virtual PrefService
* GetPrefs() = 0;
41 // Returns the PasswordStore associated with this instance.
42 virtual PasswordStore
* GetPasswordStore() = 0;
44 // Returns the PasswordManagerDriver instance associated with this instance.
45 virtual PasswordManagerDriver
* GetDriver() = 0;
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
);
52 // Returns true if password sync is enabled in the embedder. The default
53 // implementation returns false.
54 virtual bool IsPasswordSyncEnabled();
57 DISALLOW_COPY_AND_ASSIGN(PasswordManagerClient
);
60 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_CLIENT_H_