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