OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_PASSWORDS_PASSWORDS_CLIENT_UI_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_UI_PASSWORDS_PASSWORDS_CLIENT_UI_DELEGATE_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/scoped_vector.h" |
| 11 #include "components/autofill/core/common/password_form.h" |
| 12 |
| 13 namespace content { |
| 14 class WebContents; |
| 15 } |
| 16 |
| 17 namespace password_manager { |
| 18 struct CredentialInfo; |
| 19 class PasswordFormManager; |
| 20 } |
| 21 |
| 22 // An interface for ChromePasswordManagerClient implemented by |
| 23 // ManagePasswordsUIController. Allows to push a new state for the tab. |
| 24 class PasswordsClientUIDelegate { |
| 25 public: |
| 26 // Called when the user submits a form containing login information, so the |
| 27 // later requests to save or blacklist can be handled. |
| 28 // This stores the provided object and triggers the UI to prompt the user |
| 29 // about whether they would like to save the password. |
| 30 virtual void OnPasswordSubmitted( |
| 31 scoped_ptr<password_manager::PasswordFormManager> form_manager) = 0; |
| 32 |
| 33 // Called when the user submits a new password for an existing credential. |
| 34 // This stores the provided object and triggers the UI to prompt the user |
| 35 // about whether they would like to update the password. |
| 36 virtual void OnUpdatePasswordSubmitted( |
| 37 scoped_ptr<password_manager::PasswordFormManager> form_manager) = 0; |
| 38 |
| 39 // Called when the site asks user to choose from credentials. This triggers |
| 40 // the UI to prompt the user. |local_credentials| and |federated_credentials| |
| 41 // shouldn't both be empty. |
| 42 // Returns true when the UI is shown. |callback| is called when the user made |
| 43 // a decision. If the UI isn't shown the method returns false and doesn't call |
| 44 // |callback|. |
| 45 virtual bool OnChooseCredentials( |
| 46 ScopedVector<autofill::PasswordForm> local_credentials, |
| 47 ScopedVector<autofill::PasswordForm> federated_credentials, |
| 48 const GURL& origin, |
| 49 base::Callback<void(const password_manager::CredentialInfo&)> |
| 50 callback) = 0; |
| 51 |
| 52 // Called when user is auto signed in to the site. |local_forms[0]| contains |
| 53 // the credential returned to the site. |
| 54 virtual void OnAutoSignin( |
| 55 ScopedVector<autofill::PasswordForm> local_forms) = 0; |
| 56 |
| 57 // Called when the password will be saved automatically, but we still wish to |
| 58 // visually inform the user that the save has occured. |
| 59 virtual void OnAutomaticPasswordSave( |
| 60 scoped_ptr<password_manager::PasswordFormManager> form_manager) = 0; |
| 61 |
| 62 // Called when a form is autofilled with login information, so we can manage |
| 63 // password credentials for the current site which are stored in |
| 64 // |password_form_map|. This stores a copy of |password_form_map| and shows |
| 65 // the manage password icon. |
| 66 virtual void OnPasswordAutofilled( |
| 67 const autofill::PasswordFormMap& password_form_map, |
| 68 const GURL& origin) = 0; |
| 69 |
| 70 protected: |
| 71 virtual ~PasswordsClientUIDelegate() = default; |
| 72 }; |
| 73 |
| 74 // Returns ManagePasswordsUIController instance for |contents| |
| 75 PasswordsClientUIDelegate* PasswordsClientUIDelegateFromWebContents( |
| 76 content::WebContents* web_contents); |
| 77 |
| 78 #endif // CHROME_BROWSER_UI_PASSWORDS_PASSWORDS_CLIENT_UI_DELEGATE_H_ |
OLD | NEW |