| 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 60173a9474a89c2c29823c484a8a957eab29fa9e..bd1fdfa9b86bf3c2e2cc0fefc9ecb074a9ff0a6f 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 {
|
| public:
|
| - explicit ManagePasswordsBubbleModel(content::WebContents* web_contents);
|
| - virtual ~ManagePasswordsBubbleModel();
|
| -
|
| enum ManagePasswordsBubbleState {
|
| PASSWORD_TO_BE_SAVED,
|
| MANAGE_PASSWORDS_AFTER_SAVING,
|
| @@ -30,6 +29,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();
|
|
|
| @@ -40,6 +53,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();
|
|
|
| @@ -48,6 +64,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();
|
| +
|
| // Called by the view code when the ManagePasswordItemView is destroyed and
|
| // the user chose to delete the password.
|
| // TODO(npentrel): Remove this once best_matches_ are newly made on bubble
|
| @@ -70,6 +90,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(
|
| @@ -83,6 +119,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);
|
| };
|
|
|
|
|