Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1587)

Side by Side Diff: chrome/browser/ui/passwords/manage_passwords_bubble_model.h

Issue 2025003002: Refactor ManagePasswordsBubbleModel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_MANAGE_PASSWORDS_BUBBLE_MODEL_H_ 5 #ifndef CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_
6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_ 6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_
7 7
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 Profile* GetProfile() const; 98 Profile* GetProfile() const;
99 99
100 // Returns true iff the multiple account selection prompt for account update 100 // Returns true iff the multiple account selection prompt for account update
101 // should be presented. 101 // should be presented.
102 bool ShouldShowMultipleAccountUpdateUI() const; 102 bool ShouldShowMultipleAccountUpdateUI() const;
103 103
104 // True if the save bubble should display the warm welcome for Google Smart 104 // True if the save bubble should display the warm welcome for Google Smart
105 // Lock. 105 // Lock.
106 bool ShouldShowGoogleSmartLockWelcome() const; 106 bool ShouldShowGoogleSmartLockWelcome() const;
107 107
108 #if defined(UNIT_TEST) 108 void SetClockForTesting(std::unique_ptr<base::Clock> clock);
109 // Gets the reason the bubble was dismissed.
110 password_manager::metrics_util::UIDismissalReason dismissal_reason() const {
111 return dismissal_reason_;
112 }
113
114 void set_clock(std::unique_ptr<base::Clock> clock) {
115 clock_ = std::move(clock);
116 }
117 #endif
118 109
119 private: 110 private:
120 enum UserBehaviorOnUpdateBubble { 111 enum UserBehaviorOnUpdateBubble {
121 UPDATE_CLICKED, 112 UPDATE_CLICKED,
122 NOPE_CLICKED, 113 NOPE_CLICKED,
123 NO_INTERACTION 114 NO_INTERACTION
124 }; 115 };
116 class InteractionKeeper;
125 // Updates |title_| and |title_brand_link_range_| for the 117 // Updates |title_| and |title_brand_link_range_| for the
126 // PENDING_PASSWORD_STATE. 118 // PENDING_PASSWORD_STATE.
127 void UpdatePendingStateTitle(); 119 void UpdatePendingStateTitle();
128 // Updates |title_| for the MANAGE_STATE. 120 // Updates |title_| for the MANAGE_STATE.
129 void UpdateManageStateTitle(); 121 void UpdateManageStateTitle();
130 password_manager::metrics_util::UpdatePasswordSubmissionEvent 122 password_manager::metrics_util::UpdatePasswordSubmissionEvent
131 GetUpdateDismissalReason(UserBehaviorOnUpdateBubble behavior) const; 123 GetUpdateDismissalReason(UserBehaviorOnUpdateBubble behavior) const;
132 // URL of the page from where this bubble was triggered. 124 // URL of the page from where this bubble was triggered.
133 GURL origin_; 125 GURL origin_;
134 password_manager::ui::State state_; 126 password_manager::ui::State state_;
135 base::string16 title_; 127 base::string16 title_;
136 // Range of characters in the title that contains the Smart Lock Brand and 128 // Range of characters in the title that contains the Smart Lock Brand and
137 // should point to an article. For the default title the range is empty. 129 // should point to an article. For the default title the range is empty.
138 gfx::Range title_brand_link_range_; 130 gfx::Range title_brand_link_range_;
139 autofill::PasswordForm pending_password_; 131 autofill::PasswordForm pending_password_;
140 bool password_overridden_; 132 bool password_overridden_;
141 ScopedVector<const autofill::PasswordForm> local_credentials_; 133 ScopedVector<const autofill::PasswordForm> local_credentials_;
142 base::string16 manage_link_; 134 base::string16 manage_link_;
143 base::string16 save_confirmation_text_; 135 base::string16 save_confirmation_text_;
144 gfx::Range save_confirmation_link_range_; 136 gfx::Range save_confirmation_link_range_;
145 password_manager::metrics_util::UIDisplayDisposition display_disposition_;
146 password_manager::metrics_util::UIDismissalReason dismissal_reason_;
147 password_manager::metrics_util::UpdatePasswordSubmissionEvent
148 update_password_submission_event_;
149 137
150 // Current statistics for the save password bubble; 138 // Responsible for recording all the interactions required.
151 password_manager::InteractionsStats interaction_stats_; 139 std::unique_ptr<InteractionKeeper> interaction_keeper_;
152
153 // Used to retrieve the current time, in base::Time units.
154 std::unique_ptr<base::Clock> clock_;
155 140
156 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleModel); 141 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleModel);
157 }; 142 };
158 143
159 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_ 144 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698