OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_CLIENT_H_ | 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_CLIENT_H_ |
6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_CLIENT_H_ | 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_CLIENT_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
13 #include "components/autofill/core/common/password_form.h" | 13 #include "components/autofill/core/common/password_form.h" |
14 #include "components/password_manager/core/browser/credentials_filter.h" | 14 #include "components/password_manager/core/browser/credentials_filter.h" |
15 #include "components/password_manager/core/browser/password_store.h" | 15 #include "components/password_manager/core/browser/password_store.h" |
16 | 16 |
17 class PrefService; | 17 class PrefService; |
18 | 18 |
19 namespace autofill { | 19 namespace autofill { |
20 class AutofillManager; | 20 class AutofillManager; |
21 } | 21 } |
22 | 22 |
23 namespace password_manager { | 23 namespace password_manager { |
24 | 24 |
25 struct CredentialInfo; | |
26 class LogManager; | 25 class LogManager; |
27 class PasswordFormManager; | 26 class PasswordFormManager; |
28 class PasswordManager; | 27 class PasswordManager; |
29 class PasswordManagerDriver; | 28 class PasswordManagerDriver; |
30 class PasswordStore; | 29 class PasswordStore; |
31 | 30 |
32 enum PasswordSyncState { | 31 enum PasswordSyncState { |
33 NOT_SYNCING_PASSWORDS, | 32 NOT_SYNCING_PASSWORDS, |
34 SYNCING_NORMAL_ENCRYPTION, | 33 SYNCING_NORMAL_ENCRYPTION, |
35 SYNCING_WITH_CUSTOM_PASSPHRASE | 34 SYNCING_WITH_CUSTOM_PASSPHRASE |
36 }; | 35 }; |
37 | 36 |
38 enum class CredentialSourceType { | 37 enum class CredentialSourceType { |
39 CREDENTIAL_SOURCE_PASSWORD_MANAGER = 0, | 38 CREDENTIAL_SOURCE_PASSWORD_MANAGER = 0, |
40 CREDENTIAL_SOURCE_API, | 39 CREDENTIAL_SOURCE_API, |
41 CREDENTIAL_SOURCE_LAST = CREDENTIAL_SOURCE_API | 40 CREDENTIAL_SOURCE_LAST = CREDENTIAL_SOURCE_API |
42 }; | 41 }; |
43 | 42 |
44 // An abstraction of operations that depend on the embedders (e.g. Chrome) | 43 // An abstraction of operations that depend on the embedders (e.g. Chrome) |
45 // environment. | 44 // environment. |
46 class PasswordManagerClient { | 45 class PasswordManagerClient { |
47 public: | 46 public: |
| 47 using CredentialsCallback = |
| 48 base::Callback<void(const autofill::PasswordForm*)>; |
| 49 |
48 PasswordManagerClient() {} | 50 PasswordManagerClient() {} |
49 virtual ~PasswordManagerClient() {} | 51 virtual ~PasswordManagerClient() {} |
50 | 52 |
51 // For automated testing, the save password prompt should sometimes not be | 53 // For automated testing, the save password prompt should sometimes not be |
52 // shown, and password immediately saved instead. That can be enforced by | 54 // shown, and password immediately saved instead. That can be enforced by |
53 // a command-line flag. If auto-saving is enforced, this method returns true. | 55 // a command-line flag. If auto-saving is enforced, this method returns true. |
54 // The default return value is false. | 56 // The default return value is false. |
55 virtual bool IsAutomaticPasswordSavingEnabled() const; | 57 virtual bool IsAutomaticPasswordSavingEnabled() const; |
56 | 58 |
57 // Is saving new data for password autofill and filling of saved data enabled | 59 // Is saving new data for password autofill and filling of saved data enabled |
(...skipping 29 matching lines...) Expand all Loading... |
87 bool update_password) = 0; | 89 bool update_password) = 0; |
88 | 90 |
89 // Informs the embedder of a password forms that the user should choose from. | 91 // Informs the embedder of a password forms that the user should choose from. |
90 // Returns true if the prompt is indeed displayed. If the prompt is not | 92 // Returns true if the prompt is indeed displayed. If the prompt is not |
91 // displayed, returns false and does not call |callback|. | 93 // displayed, returns false and does not call |callback|. |
92 // |callback| should be invoked with the chosen form. | 94 // |callback| should be invoked with the chosen form. |
93 virtual bool PromptUserToChooseCredentials( | 95 virtual bool PromptUserToChooseCredentials( |
94 ScopedVector<autofill::PasswordForm> local_forms, | 96 ScopedVector<autofill::PasswordForm> local_forms, |
95 ScopedVector<autofill::PasswordForm> federated_forms, | 97 ScopedVector<autofill::PasswordForm> federated_forms, |
96 const GURL& origin, | 98 const GURL& origin, |
97 base::Callback<void(const CredentialInfo&)> callback) = 0; | 99 const CredentialsCallback& callback) = 0; |
98 | 100 |
99 // Informs the embedder that the user has manually requested to save the | 101 // Informs the embedder that the user has manually requested to save the |
100 // password in the focused password field. | 102 // password in the focused password field. |
101 virtual void ForceSavePassword(); | 103 virtual void ForceSavePassword(); |
102 | 104 |
103 // Informs the embedder that the user has manually requested to generate a | 105 // Informs the embedder that the user has manually requested to generate a |
104 // password in the focused password field. | 106 // password in the focused password field. |
105 virtual void GeneratePassword(); | 107 virtual void GeneratePassword(); |
106 | 108 |
107 // Informs the embedder that automatic signing in just happened. The form | 109 // Informs the embedder that automatic signing in just happened. The form |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 // Returns a LogManager instance. | 186 // Returns a LogManager instance. |
185 virtual const LogManager* GetLogManager() const; | 187 virtual const LogManager* GetLogManager() const; |
186 | 188 |
187 private: | 189 private: |
188 DISALLOW_COPY_AND_ASSIGN(PasswordManagerClient); | 190 DISALLOW_COPY_AND_ASSIGN(PasswordManagerClient); |
189 }; | 191 }; |
190 | 192 |
191 } // namespace password_manager | 193 } // namespace password_manager |
192 | 194 |
193 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_CLIENT_H_ | 195 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_CLIENT_H_ |
OLD | NEW |