| 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_MODEL_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_PASSWORDS_PASSWORDS_MODEL_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_UI_PASSWORDS_PASSWORDS_MODEL_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_PASSWORDS_PASSWORDS_MODEL_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "components/password_manager/core/common/credential_manager_types.h" | 10 #include "components/password_manager/core/common/credential_manager_types.h" |
| 11 #include "components/password_manager/core/common/password_manager_ui.h" | 11 #include "components/password_manager/core/common/password_manager_ui.h" |
| 12 | 12 |
| 13 namespace autofill { | 13 namespace autofill { |
| 14 struct PasswordForm; | 14 struct PasswordForm; |
| 15 } | 15 } |
| 16 namespace content { | 16 namespace content { |
| 17 class WebContents; | 17 class WebContents; |
| 18 } | 18 } |
| 19 namespace password_manager { | 19 namespace password_manager { |
| 20 struct InteractionsStats; | 20 struct InteractionsStats; |
| 21 } | 21 } |
| 22 class GURL; | 22 class GURL; |
| 23 | 23 |
| 24 // An interface for ManagePasswordsBubbleModel implemented by | 24 // An interface for ManagePasswordsBubbleModel implemented by |
| 25 // ManagePasswordsUIController. Allows to retrieve the current state of the tab | 25 // ManagePasswordsUIController. Allows to retrieve the current state of the tab |
| 26 // and notify about user actions. | 26 // and notify about user actions. |
| 27 class PasswordsModelDelegate { | 27 class PasswordsModelDelegate { |
| 28 public: | 28 public: |
| 29 // Returns WebContents* the model is attached to. |
| 30 virtual content::WebContents* GetWebContents() const = 0; |
| 31 |
| 29 // Returns the URL of the site the current forms are retrieved for. | 32 // Returns the URL of the site the current forms are retrieved for. |
| 30 virtual const GURL& GetOrigin() const = 0; | 33 virtual const GURL& GetOrigin() const = 0; |
| 31 | 34 |
| 32 // Returns the current tab state. | 35 // Returns the current tab state. |
| 33 virtual password_manager::ui::State GetState() const = 0; | 36 virtual password_manager::ui::State GetState() const = 0; |
| 34 | 37 |
| 35 // Returns the pending password in PENDING_PASSWORD_STATE and | 38 // Returns the pending password in PENDING_PASSWORD_STATE and |
| 36 // PENDING_PASSWORD_UPDATE_STATE, the saved password in CONFIRMATION_STATE, | 39 // PENDING_PASSWORD_UPDATE_STATE, the saved password in CONFIRMATION_STATE, |
| 37 // the returned credential in AUTO_SIGNIN_STATE. | 40 // the returned credential in AUTO_SIGNIN_STATE. |
| 38 virtual const autofill::PasswordForm& GetPendingPassword() const = 0; | 41 virtual const autofill::PasswordForm& GetPendingPassword() const = 0; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 69 // Called from the model when the user chooses to never save passwords. | 72 // Called from the model when the user chooses to never save passwords. |
| 70 virtual void NeverSavePassword() = 0; | 73 virtual void NeverSavePassword() = 0; |
| 71 | 74 |
| 72 // Called from the model when the user chooses to save a password. | 75 // Called from the model when the user chooses to save a password. |
| 73 virtual void SavePassword() = 0; | 76 virtual void SavePassword() = 0; |
| 74 | 77 |
| 75 // Called from the model when the user chooses to update a password. | 78 // Called from the model when the user chooses to update a password. |
| 76 virtual void UpdatePassword(const autofill::PasswordForm& password_form) = 0; | 79 virtual void UpdatePassword(const autofill::PasswordForm& password_form) = 0; |
| 77 | 80 |
| 78 // Called from the dialog controller when the user chooses a credential. | 81 // Called from the dialog controller when the user chooses a credential. |
| 79 // Everything is passed by value because the controller can be destroyed | 82 // Controller can be destroyed inside the method. |
| 80 // inside the method. | |
| 81 virtual void ChooseCredential( | 83 virtual void ChooseCredential( |
| 82 autofill::PasswordForm form, | 84 const autofill::PasswordForm& form, |
| 83 password_manager::CredentialType credential_type) = 0; | 85 password_manager::CredentialType credential_type) = 0; |
| 84 | 86 |
| 85 // Open a new tab pointing to passwords.google.com. | 87 // Open a new tab pointing to passwords.google.com. |
| 86 virtual void NavigateToExternalPasswordManager() = 0; | 88 virtual void NavigateToExternalPasswordManager() = 0; |
| 87 // Open a new tab, pointing to the Smart Lock help article. | 89 // Open a new tab, pointing to the Smart Lock help article. |
| 88 virtual void NavigateToSmartLockHelpPage() = 0; | 90 virtual void NavigateToSmartLockHelpPage() = 0; |
| 89 // Open a new tab, pointing to the password manager settings page. | 91 // Open a new tab, pointing to the password manager settings page. |
| 90 virtual void NavigateToPasswordManagerSettingsPage() = 0; | 92 virtual void NavigateToPasswordManagerSettingsPage() = 0; |
| 91 // Starts the Chrome Sign in flow. | 93 // Starts the Chrome Sign in flow. |
| 92 virtual void NavigateToChromeSignIn() = 0; | 94 virtual void NavigateToChromeSignIn() = 0; |
| 93 | 95 |
| 94 // Called from the dialog controller when the dialog is hidden. | 96 // Called from the dialog controller when the dialog is hidden. |
| 95 virtual void OnDialogHidden() = 0; | 97 virtual void OnDialogHidden() = 0; |
| 96 | 98 |
| 97 protected: | 99 protected: |
| 98 virtual ~PasswordsModelDelegate() = default; | 100 virtual ~PasswordsModelDelegate() = default; |
| 99 }; | 101 }; |
| 100 | 102 |
| 101 // Returns ManagePasswordsUIController instance for |contents| | |
| 102 PasswordsModelDelegate* PasswordsModelDelegateFromWebContents( | |
| 103 content::WebContents* web_contents); | |
| 104 | |
| 105 #endif // CHROME_BROWSER_UI_PASSWORDS_PASSWORDS_MODEL_DELEGATE_H_ | 103 #endif // CHROME_BROWSER_UI_PASSWORDS_PASSWORDS_MODEL_DELEGATE_H_ |
| OLD | NEW |