| 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 "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/scoped_vector.h" |
| 9 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| 10 #include "components/autofill/core/common/password_form.h" | 11 #include "components/autofill/core/common/password_form.h" |
| 11 #include "components/password_manager/core/browser/password_store.h" | 12 #include "components/password_manager/core/browser/password_store.h" |
| 12 | 13 |
| 13 class PrefService; | 14 class PrefService; |
| 14 | 15 |
| 15 namespace autofill { | 16 namespace autofill { |
| 16 class AutofillManager; | 17 class AutofillManager; |
| 17 } | 18 } |
| 18 | 19 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // allows it. The embedder is not required to prompt the user if it decides | 78 // allows it. The embedder is not required to prompt the user if it decides |
| 78 // that this form doesn't need to be saved. | 79 // that this form doesn't need to be saved. |
| 79 // Returns true if the prompt was indeed displayed. | 80 // Returns true if the prompt was indeed displayed. |
| 80 virtual bool PromptUserToSavePassword( | 81 virtual bool PromptUserToSavePassword( |
| 81 scoped_ptr<PasswordFormManager> form_to_save) = 0; | 82 scoped_ptr<PasswordFormManager> form_to_save) = 0; |
| 82 | 83 |
| 83 // Informs the embedder of a password forms that the user should choose from. | 84 // Informs the embedder of a password forms that the user should choose from. |
| 84 // Returns true if the prompt is indeed displayed. If the prompt is not | 85 // Returns true if the prompt is indeed displayed. If the prompt is not |
| 85 // displayed, returns false and does not call |callback|. | 86 // displayed, returns false and does not call |callback|. |
| 86 // |callback| should be invoked with the chosen form. | 87 // |callback| should be invoked with the chosen form. |
| 87 // Note: The implementation takes ownership of all PasswordForms in | |
| 88 // |local_forms| and |federated_forms|. | |
| 89 virtual bool PromptUserToChooseCredentials( | 88 virtual bool PromptUserToChooseCredentials( |
| 90 const std::vector<autofill::PasswordForm*>& local_forms, | 89 ScopedVector<autofill::PasswordForm> local_forms, |
| 91 const std::vector<autofill::PasswordForm*>& federated_forms, | 90 ScopedVector<autofill::PasswordForm> federated_forms, |
| 92 base::Callback<void(const CredentialInfo&)> callback) = 0; | 91 base::Callback<void(const CredentialInfo&)> callback) = 0; |
| 93 | 92 |
| 94 // Called when a password is saved in an automated fashion. Embedder may | 93 // Called when a password is saved in an automated fashion. Embedder may |
| 95 // inform the user that this save has occured. | 94 // inform the user that this save has occured. |
| 96 virtual void AutomaticPasswordSave( | 95 virtual void AutomaticPasswordSave( |
| 97 scoped_ptr<PasswordFormManager> saved_form_manager) = 0; | 96 scoped_ptr<PasswordFormManager> saved_form_manager) = 0; |
| 98 | 97 |
| 99 // Called when a password is autofilled. |best_matches| contains the | 98 // Called when a password is autofilled. |best_matches| contains the |
| 100 // PasswordForm into which a password was filled: the client may choose to | 99 // PasswordForm into which a password was filled: the client may choose to |
| 101 // save this to the PasswordStore, for example. Default implementation is a | 100 // save this to the PasswordStore, for example. Default implementation is a |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // Returns the main frame URL. | 162 // Returns the main frame URL. |
| 164 virtual const GURL& GetMainFrameURL(); | 163 virtual const GURL& GetMainFrameURL(); |
| 165 | 164 |
| 166 private: | 165 private: |
| 167 DISALLOW_COPY_AND_ASSIGN(PasswordManagerClient); | 166 DISALLOW_COPY_AND_ASSIGN(PasswordManagerClient); |
| 168 }; | 167 }; |
| 169 | 168 |
| 170 } // namespace password_manager | 169 } // namespace password_manager |
| 171 | 170 |
| 172 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_CLIENT_H_ | 171 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_CLIENT_H_ |
| OLD | NEW |