Chromium Code Reviews| Index: chrome/browser/ui/passwords/manage_passwords_bubble_model.h |
| diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble_model.h b/chrome/browser/ui/passwords/manage_passwords_bubble_model.h |
| index b8cc326435282bfa80238dc5488e5f4b410c7d0f..d2c371887abc732cc50624970a8742c82bb7fae0 100644 |
| --- a/chrome/browser/ui/passwords/manage_passwords_bubble_model.h |
| +++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model.h |
| @@ -5,7 +5,9 @@ |
| #ifndef CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_ |
| #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_ |
| +#include "chrome/browser/ui/passwords/manage_passwords_bubble.h" |
| #include "components/autofill/core/common/password_form.h" |
| +#include "components/password_manager/core/browser/password_manager_metrics_util.h" |
| #include "content/public/browser/web_contents_observer.h" |
| class ManagePasswordsIconController; |
| @@ -18,9 +20,6 @@ class WebContents; |
| // password management actions. |
| class ManagePasswordsBubbleModel : public content::WebContentsObserver { |
|
markusheintz_
2014/04/22 11:00:54
For future CLs: This class should not be called mo
Mike West
2014/04/22 11:57:39
Duly noted. :)
|
| public: |
| - explicit ManagePasswordsBubbleModel(content::WebContents* web_contents); |
| - virtual ~ManagePasswordsBubbleModel(); |
| - |
| enum ManagePasswordsBubbleState { |
| PASSWORD_TO_BE_SAVED, |
| MANAGE_PASSWORDS, |
| @@ -29,6 +28,20 @@ class ManagePasswordsBubbleModel : public content::WebContentsObserver { |
| enum PasswordAction { REMOVE_PASSWORD, ADD_PASSWORD }; |
| + // Creates a ManagePasswordsBubbleModel, which holds a raw pointer to the |
| + // WebContents in which it lives. Defaults to a display disposition of |
| + // AUTOMATIC_WITH_PASSWORD_PENDING, and a dismissal reason of NOT_DISPLAYED. |
| + // The bubble's state is updated from the ManagePasswordsBubbleUIController |
| + // associated with |web_contents| upon creation. |
| + explicit ManagePasswordsBubbleModel(content::WebContents* web_contents); |
| + virtual ~ManagePasswordsBubbleModel(); |
| + |
| + // Called by the view code when the bubble is shown. |
| + void OnBubbleShown(ManagePasswordsBubble::DisplayReason reason); |
| + |
| + // Called by the view code when the bubble is hidden. |
| + void OnBubbleHidden(); |
| + |
| // Called by the view code when the "Nope" button in clicked by the user. |
| void OnNopeClicked(); |
| @@ -39,6 +52,9 @@ class ManagePasswordsBubbleModel : public content::WebContentsObserver { |
| // Called by the view code when the save button in clicked by the user. |
| void OnSaveClicked(); |
| + // Called by the view code when the "Done" button is clicked by the user. |
| + void OnDoneClicked(); |
| + |
| // Called by the view code when the manage link is clicked by the user. |
| void OnManageLinkClicked(); |
| @@ -47,6 +63,10 @@ class ManagePasswordsBubbleModel : public content::WebContentsObserver { |
| void OnPasswordAction(const autofill::PasswordForm& password_form, |
| PasswordAction action); |
| + // Called by the view code when the bubble is closed without ever displaying |
| + // content to the user. We shouldn't log to UMA in this case. |
| + void OnCloseWithoutLogging(); |
| + |
| ManagePasswordsBubbleState manage_passwords_bubble_state() { |
| return manage_passwords_bubble_state_; |
| } |
| @@ -62,6 +82,22 @@ class ManagePasswordsBubbleModel : public content::WebContentsObserver { |
| const autofill::PasswordFormMap& best_matches() { return best_matches_; } |
| const base::string16& manage_link() { return manage_link_; } |
| + // Gets and sets the reason the bubble was displayed; exposed for testing. |
| + password_manager::metrics_util::UIDisplayDisposition display_disposition() |
| + const { |
| + return display_disposition_; |
| + } |
| + |
| + // Gets the reason the bubble was dismissed; exposed for testing. |
| + password_manager::metrics_util::UIDismissalReason dismissal_reason() const { |
| + return dismissal_reason_; |
| + } |
| + |
| + // State setter; exposed for testing. |
| + void set_manage_passwords_bubble_state(ManagePasswordsBubbleState state) { |
| + manage_passwords_bubble_state_ = state; |
| + } |
| + |
| private: |
| // content::WebContentsObserver |
| virtual void WebContentsDestroyed( |
| @@ -74,6 +110,9 @@ class ManagePasswordsBubbleModel : public content::WebContentsObserver { |
| autofill::PasswordFormMap best_matches_; |
| base::string16 manage_link_; |
| + password_manager::metrics_util::UIDisplayDisposition display_disposition_; |
| + password_manager::metrics_util::UIDismissalReason dismissal_reason_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleModel); |
| }; |