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/ref_counted.h" |
12 #include "components/autofill/core/common/password_form.h" | 13 #include "components/autofill/core/common/password_form.h" |
13 #include "components/password_manager/core/browser/credentials_filter.h" | 14 #include "components/password_manager/core/browser/credentials_filter.h" |
14 #include "components/password_manager/core/browser/password_store.h" | 15 #include "components/password_manager/core/browser/password_store.h" |
15 | 16 |
16 class PrefService; | 17 class PrefService; |
17 | 18 |
18 namespace autofill { | 19 namespace autofill { |
19 class AutofillManager; | 20 class AutofillManager; |
20 } | 21 } |
21 | 22 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // the unique element from |form_to_save.best_matches_|. | 85 // the unique element from |form_to_save.best_matches_|. |
85 // 2.A change password form was submitted and the user has more than one | 86 // 2.A change password form was submitted and the user has more than one |
86 // stored credential. Then we shouldn't expect anything from | 87 // stored credential. Then we shouldn't expect anything from |
87 // form_to_save.pending_credentials() except correct origin, since we don't | 88 // form_to_save.pending_credentials() except correct origin, since we don't |
88 // know which credentials should be updated. | 89 // know which credentials should be updated. |
89 // 3.A sign-in password form was submitted with a password different from | 90 // 3.A sign-in password form was submitted with a password different from |
90 // the stored one. In this case form_to_save.password_overridden() == true | 91 // the stored one. In this case form_to_save.password_overridden() == true |
91 // and form_to_save.pending_credentials() should correspond to the credential | 92 // and form_to_save.pending_credentials() should correspond to the credential |
92 // that was overidden. | 93 // that was overidden. |
93 virtual bool PromptUserToSaveOrUpdatePassword( | 94 virtual bool PromptUserToSaveOrUpdatePassword( |
94 std::unique_ptr<PasswordFormManager> form_to_save, | 95 scoped_refptr<PasswordFormManager> form_to_save, |
95 bool update_password) = 0; | 96 bool update_password) = 0; |
96 | 97 |
97 // Informs the embedder of a password forms that the user should choose from. | 98 // Informs the embedder of a password forms that the user should choose from. |
98 // Returns true if the prompt is indeed displayed. If the prompt is not | 99 // Returns true if the prompt is indeed displayed. If the prompt is not |
99 // displayed, returns false and does not call |callback|. | 100 // displayed, returns false and does not call |callback|. |
100 // |callback| should be invoked with the chosen form. | 101 // |callback| should be invoked with the chosen form. |
101 virtual bool PromptUserToChooseCredentials( | 102 virtual bool PromptUserToChooseCredentials( |
102 std::vector<std::unique_ptr<autofill::PasswordForm>> local_forms, | 103 std::vector<std::unique_ptr<autofill::PasswordForm>> local_forms, |
103 const GURL& origin, | 104 const GURL& origin, |
104 const CredentialsCallback& callback) = 0; | 105 const CredentialsCallback& callback) = 0; |
(...skipping 24 matching lines...) Expand all Loading... |
129 // |form| contains the form used. | 130 // |form| contains the form used. |
130 virtual void NotifySuccessfulLoginWithExistingPassword( | 131 virtual void NotifySuccessfulLoginWithExistingPassword( |
131 const autofill::PasswordForm& form) = 0; | 132 const autofill::PasswordForm& form) = 0; |
132 | 133 |
133 // Inform the embedder that the site called 'store()'. | 134 // Inform the embedder that the site called 'store()'. |
134 virtual void NotifyStorePasswordCalled() = 0; | 135 virtual void NotifyStorePasswordCalled() = 0; |
135 | 136 |
136 // Called when a password is saved in an automated fashion. Embedder may | 137 // Called when a password is saved in an automated fashion. Embedder may |
137 // inform the user that this save has occured. | 138 // inform the user that this save has occured. |
138 virtual void AutomaticPasswordSave( | 139 virtual void AutomaticPasswordSave( |
139 std::unique_ptr<PasswordFormManager> saved_form_manager) = 0; | 140 scoped_refptr<PasswordFormManager> saved_form_manager) = 0; |
140 | 141 |
141 // Called when a password is autofilled. |best_matches| contains the | 142 // Called when a password is autofilled. |best_matches| contains the |
142 // PasswordForm into which a password was filled: the client may choose to | 143 // PasswordForm into which a password was filled: the client may choose to |
143 // save this to the PasswordStore, for example. |origin| is the origin of the | 144 // save this to the PasswordStore, for example. |origin| is the origin of the |
144 // form into which a password was filled. |federated_matches| are the stored | 145 // form into which a password was filled. |federated_matches| are the stored |
145 // federated matches relevant to the filled form, this argument may be null. | 146 // federated matches relevant to the filled form, this argument may be null. |
146 // They are never filled, but might be needed in the UI, for example. Default | 147 // They are never filled, but might be needed in the UI, for example. Default |
147 // implementation is a noop. | 148 // implementation is a noop. |
148 virtual void PasswordWasAutofilled( | 149 virtual void PasswordWasAutofilled( |
149 const std::map<base::string16, const autofill::PasswordForm*>& | 150 const std::map<base::string16, const autofill::PasswordForm*>& |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 const std::string& password_saved_domain) = 0; | 215 const std::string& password_saved_domain) = 0; |
215 #endif | 216 #endif |
216 | 217 |
217 private: | 218 private: |
218 DISALLOW_COPY_AND_ASSIGN(PasswordManagerClient); | 219 DISALLOW_COPY_AND_ASSIGN(PasswordManagerClient); |
219 }; | 220 }; |
220 | 221 |
221 } // namespace password_manager | 222 } // namespace password_manager |
222 | 223 |
223 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_CLIENT_H_ | 224 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_CLIENT_H_ |
OLD | NEW |