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_MODEL_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_UI_PASSWORDS_PASSWORDS_MODEL_DELEGATE_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "components/password_manager/core/common/credential_manager_types.h" |
| 11 #include "components/password_manager/core/common/password_manager_ui.h" |
| 12 |
| 13 namespace autofill { |
| 14 struct PasswordForm; |
| 15 } |
| 16 namespace content { |
| 17 class WebContents; |
| 18 } |
| 19 namespace password_manager { |
| 20 struct InteractionsStats; |
| 21 } |
| 22 class GURL; |
| 23 |
| 24 // An interface for ManagePasswordsBubbleModel implemented by |
| 25 // ManagePasswordsUIController. Allows to retrieve the current state of the tab |
| 26 // and notify about user actions. |
| 27 class PasswordsModelDelegate { |
| 28 public: |
| 29 // Returns the origin of the current page. |
| 30 virtual const GURL& GetOrigin() const = 0; |
| 31 |
| 32 // Returns the current tab state. |
| 33 virtual password_manager::ui::State GetState() const = 0; |
| 34 |
| 35 // Returns the pending password in PENDING_PASSWORD_STATE and |
| 36 // PENDING_PASSWORD_UPDATE_STATE, the saved password in CONFIRMATION_STATE, |
| 37 // the returned credential in AUTO_SIGNIN_STATE. |
| 38 virtual const autofill::PasswordForm& GetPendingPassword() const = 0; |
| 39 |
| 40 // True if the password for previously stored account was overridden, i.e. in |
| 41 // newly submitted form the password is different from stored one. |
| 42 virtual bool IsPasswordOverridden() const = 0; |
| 43 |
| 44 // Returns current local forms for the current page. |
| 45 virtual const std::vector<const autofill::PasswordForm*>& |
| 46 GetCurrentForms() const = 0; |
| 47 |
| 48 // Returns possible identity provider's credentials for the current site. |
| 49 virtual const std::vector<const autofill::PasswordForm*>& |
| 50 GetFederatedForms() const = 0; |
| 51 |
| 52 // For PENDING_PASSWORD_STATE state returns the current statistics for |
| 53 // the pending username. |
| 54 virtual password_manager::InteractionsStats* GetCurrentInteractionStats() |
| 55 const = 0; |
| 56 |
| 57 // Called from the model when the bubble is displayed. |
| 58 virtual void OnBubbleShown() = 0; |
| 59 |
| 60 // Called from the model when the bubble is hidden. |
| 61 virtual void OnBubbleHidden() = 0; |
| 62 |
| 63 // Called when the user didn't interact with the Update UI. |
| 64 virtual void OnNoInteractionOnUpdate() = 0; |
| 65 |
| 66 // Called when the user chose not to update password. |
| 67 virtual void OnNopeUpdateClicked() = 0; |
| 68 |
| 69 // Called from the model when the user chooses to never save passwords. |
| 70 virtual void NeverSavePassword() = 0; |
| 71 |
| 72 // Called from the model when the user chooses to save a password. |
| 73 virtual void SavePassword() = 0; |
| 74 |
| 75 // Called from the model when the user chooses to update a password. |
| 76 virtual void UpdatePassword(const autofill::PasswordForm& password_form) = 0; |
| 77 |
| 78 // Called from the model when the user chooses a credential. |
| 79 virtual void ChooseCredential( |
| 80 const autofill::PasswordForm& form, |
| 81 password_manager::CredentialType credential_type) = 0; |
| 82 |
| 83 // Two different ways to open a new tab pointing to passwords.google.com. |
| 84 // TODO(crbug.com/548259) eliminate one of them. |
| 85 virtual void NavigateToExternalPasswordManager() = 0; |
| 86 virtual void NavigateToSmartLockPage() = 0; |
| 87 // Open a new tab, pointing to the Smart Lock help article. |
| 88 virtual void NavigateToSmartLockHelpPage() = 0; |
| 89 // Open a new tab, pointing to the password manager settings page. |
| 90 virtual void NavigateToPasswordManagerSettingsPage() = 0; |
| 91 |
| 92 protected: |
| 93 virtual ~PasswordsModelDelegate() = default; |
| 94 }; |
| 95 |
| 96 // Returns ManagePasswordsUIController instance for |contents| |
| 97 PasswordsModelDelegate* PasswordsModelDelegateFromWebContents( |
| 98 content::WebContents* web_contents); |
| 99 |
| 100 #endif // CHROME_BROWSER_UI_PASSWORDS_PASSWORDS_MODEL_DELEGATE_H_ |
OLD | NEW |