| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CHROME_BROWSER_UI_PASSWORDS_PASSWORDS_CLIENT_UI_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_PASSWORDS_PASSWORDS_CLIENT_UI_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_UI_PASSWORDS_PASSWORDS_CLIENT_UI_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_PASSWORDS_PASSWORDS_CLIENT_UI_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 scoped_ptr<password_manager::PasswordFormManager> form_manager) = 0; | 33 scoped_ptr<password_manager::PasswordFormManager> form_manager) = 0; |
| 34 | 34 |
| 35 // Called when the user submits a new password for an existing credential. | 35 // Called when the user submits a new password for an existing credential. |
| 36 // This stores the provided object and triggers the UI to prompt the user | 36 // This stores the provided object and triggers the UI to prompt the user |
| 37 // about whether they would like to update the password. | 37 // about whether they would like to update the password. |
| 38 virtual void OnUpdatePasswordSubmitted( | 38 virtual void OnUpdatePasswordSubmitted( |
| 39 scoped_ptr<password_manager::PasswordFormManager> form_manager) = 0; | 39 scoped_ptr<password_manager::PasswordFormManager> form_manager) = 0; |
| 40 | 40 |
| 41 // Called when the site asks user to choose from credentials. This triggers | 41 // Called when the site asks user to choose from credentials. This triggers |
| 42 // the UI to prompt the user. |local_credentials| and |federated_credentials| | 42 // the UI to prompt the user. |local_credentials| and |federated_credentials| |
| 43 // shouldn't both be empty. | 43 // shouldn't both be empty. |origin| is a URL of the site that requested a |
| 44 // credential. |
| 44 // Returns true when the UI is shown. |callback| is called when the user made | 45 // Returns true when the UI is shown. |callback| is called when the user made |
| 45 // a decision. If the UI isn't shown the method returns false and doesn't call | 46 // a decision. If the UI isn't shown the method returns false and doesn't call |
| 46 // |callback|. | 47 // |callback|. |
| 47 virtual bool OnChooseCredentials( | 48 virtual bool OnChooseCredentials( |
| 48 ScopedVector<autofill::PasswordForm> local_credentials, | 49 ScopedVector<autofill::PasswordForm> local_credentials, |
| 49 ScopedVector<autofill::PasswordForm> federated_credentials, | 50 ScopedVector<autofill::PasswordForm> federated_credentials, |
| 50 const GURL& origin, | 51 const GURL& origin, |
| 51 base::Callback<void(const password_manager::CredentialInfo&)> | 52 base::Callback<void(const password_manager::CredentialInfo&)> |
| 52 callback) = 0; | 53 callback) = 0; |
| 53 | 54 |
| 54 // Called when user is auto signed in to the site. |local_forms[0]| contains | 55 // Called when user is auto signed in to the site. |local_forms[0]| contains |
| 55 // the credential returned to the site. | 56 // the credential returned to the site. |origin| is a URL of the site. |
| 56 virtual void OnAutoSignin( | 57 virtual void OnAutoSignin( |
| 57 ScopedVector<autofill::PasswordForm> local_forms) = 0; | 58 ScopedVector<autofill::PasswordForm> local_forms, |
| 59 const GURL& origin) = 0; |
| 58 | 60 |
| 59 // Called when it's the right time to enable autosign-in explicitly. | 61 // Called when it's the right time to enable autosign-in explicitly. |
| 60 virtual void OnPromptEnableAutoSignin() = 0; | 62 virtual void OnPromptEnableAutoSignin() = 0; |
| 61 | 63 |
| 62 // Called when the password will be saved automatically, but we still wish to | 64 // Called when the password will be saved automatically, but we still wish to |
| 63 // visually inform the user that the save has occured. | 65 // visually inform the user that the save has occured. |
| 64 virtual void OnAutomaticPasswordSave( | 66 virtual void OnAutomaticPasswordSave( |
| 65 scoped_ptr<password_manager::PasswordFormManager> form_manager) = 0; | 67 scoped_ptr<password_manager::PasswordFormManager> form_manager) = 0; |
| 66 | 68 |
| 67 // Called when a form is autofilled with login information, so we can manage | 69 // Called when a form is autofilled with login information, so we can manage |
| 68 // password credentials for the current site which are stored in | 70 // password credentials for the current site which are stored in |
| 69 // |password_form_map|. This stores a copy of |password_form_map| and shows | 71 // |password_form_map|. This stores a copy of |password_form_map| and shows |
| 70 // the manage password icon. |federated_matches| contain the matching stored | 72 // the manage password icon. |federated_matches| contain the matching stored |
| 71 // federated credentials to display in the UI. | 73 // federated credentials to display in the UI. |
| 72 virtual void OnPasswordAutofilled( | 74 virtual void OnPasswordAutofilled( |
| 73 const autofill::PasswordFormMap& password_form_map, | 75 const autofill::PasswordFormMap& password_form_map, |
| 74 const GURL& origin, | 76 const GURL& origin, |
| 75 const std::vector<scoped_ptr<autofill::PasswordForm>>* | 77 const std::vector<scoped_ptr<autofill::PasswordForm>>* |
| 76 federated_matches) = 0; | 78 federated_matches) = 0; |
| 77 | 79 |
| 78 protected: | 80 protected: |
| 79 virtual ~PasswordsClientUIDelegate() = default; | 81 virtual ~PasswordsClientUIDelegate() = default; |
| 80 }; | 82 }; |
| 81 | 83 |
| 82 // Returns ManagePasswordsUIController instance for |contents| | 84 // Returns ManagePasswordsUIController instance for |contents| |
| 83 PasswordsClientUIDelegate* PasswordsClientUIDelegateFromWebContents( | 85 PasswordsClientUIDelegate* PasswordsClientUIDelegateFromWebContents( |
| 84 content::WebContents* web_contents); | 86 content::WebContents* web_contents); |
| 85 | 87 |
| 86 #endif // CHROME_BROWSER_UI_PASSWORDS_PASSWORDS_CLIENT_UI_DELEGATE_H_ | 88 #endif // CHROME_BROWSER_UI_PASSWORDS_PASSWORDS_CLIENT_UI_DELEGATE_H_ |
| OLD | NEW |