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