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

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

Issue 2694893002: Integrate SMS service with Desktop iOS promotion (Closed)
Patch Set: passwords and histogram changes Created 3 years, 10 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 #include <vector> 9 #include <vector>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/time/clock.h" 13 #include "base/time/clock.h"
14 #include "components/autofill/core/common/password_form.h" 14 #include "components/autofill/core/common/password_form.h"
15 #include "components/password_manager/core/browser/password_manager_metrics_util .h" 15 #include "components/password_manager/core/browser/password_manager_metrics_util .h"
16 #include "components/password_manager/core/browser/statistics_table.h" 16 #include "components/password_manager/core/browser/statistics_table.h"
17 #include "components/password_manager/core/common/password_manager_ui.h" 17 #include "components/password_manager/core/common/password_manager_ui.h"
18 #include "ui/gfx/range/range.h" 18 #include "ui/gfx/range/range.h"
19 19
20 namespace content { 20 namespace content {
21 class WebContents; 21 class WebContents;
22 } 22 }
23 23
24 class DesktopIOSPromotionController;
24 class PasswordsModelDelegate; 25 class PasswordsModelDelegate;
25 class Profile; 26 class Profile;
26 27
27 // This model provides data for the ManagePasswordsBubble and controls the 28 // This model provides data for the ManagePasswordsBubble and controls the
28 // password management actions. 29 // password management actions.
29 class ManagePasswordsBubbleModel { 30 class ManagePasswordsBubbleModel {
30 public: 31 public:
31 enum PasswordAction { REMOVE_PASSWORD, ADD_PASSWORD }; 32 enum PasswordAction { REMOVE_PASSWORD, ADD_PASSWORD };
32 enum DisplayReason { AUTOMATIC, USER_ACTION }; 33 enum DisplayReason { AUTOMATIC, USER_ACTION };
33 34
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // should be presented. 111 // should be presented.
111 bool ShouldShowMultipleAccountUpdateUI() const; 112 bool ShouldShowMultipleAccountUpdateUI() const;
112 113
113 // Returns true and updates the internal state iff the Save bubble should 114 // Returns true and updates the internal state iff the Save bubble should
114 // switch to show a promotion after the password was saved. Otherwise, 115 // switch to show a promotion after the password was saved. Otherwise,
115 // returns false and leaves the current state. 116 // returns false and leaves the current state.
116 bool ReplaceToShowPromotionIfNeeded(); 117 bool ReplaceToShowPromotionIfNeeded();
117 118
118 void SetClockForTesting(std::unique_ptr<base::Clock> clock); 119 void SetClockForTesting(std::unique_ptr<base::Clock> clock);
119 120
121 DesktopIOSPromotionController* GetDesktopIOSPromotionController();
vasilii 2017/02/17 14:19:37 Optionally: rename to ios_promotion_controller() a
mrefaat 2017/02/17 14:44:47 Done.
122
120 private: 123 private:
121 enum UserBehaviorOnUpdateBubble { 124 enum UserBehaviorOnUpdateBubble {
122 UPDATE_CLICKED, 125 UPDATE_CLICKED,
123 NOPE_CLICKED, 126 NOPE_CLICKED,
124 NO_INTERACTION 127 NO_INTERACTION
125 }; 128 };
126 class InteractionKeeper; 129 class InteractionKeeper;
127 // Updates |title_| and |title_brand_link_range_| for the 130 // Updates |title_| and |title_brand_link_range_| for the
128 // PENDING_PASSWORD_STATE. 131 // PENDING_PASSWORD_STATE.
129 void UpdatePendingStateTitle(); 132 void UpdatePendingStateTitle();
130 // Updates |title_| for the MANAGE_STATE. 133 // Updates |title_| for the MANAGE_STATE.
131 void UpdateManageStateTitle(); 134 void UpdateManageStateTitle();
132 password_manager::metrics_util::UpdatePasswordSubmissionEvent 135 password_manager::metrics_util::UpdatePasswordSubmissionEvent
133 GetUpdateDismissalReason(UserBehaviorOnUpdateBubble behavior) const; 136 GetUpdateDismissalReason(UserBehaviorOnUpdateBubble behavior) const;
134 // URL of the page from where this bubble was triggered. 137 // URL of the page from where this bubble was triggered.
135 GURL origin_; 138 GURL origin_;
136 password_manager::ui::State state_; 139 password_manager::ui::State state_;
137 base::string16 title_; 140 base::string16 title_;
138 // Range of characters in the title that contains the Smart Lock Brand and 141 // Range of characters in the title that contains the Smart Lock Brand and
139 // should point to an article. For the default title the range is empty. 142 // should point to an article. For the default title the range is empty.
140 gfx::Range title_brand_link_range_; 143 gfx::Range title_brand_link_range_;
141 autofill::PasswordForm pending_password_; 144 autofill::PasswordForm pending_password_;
142 bool password_overridden_; 145 bool password_overridden_;
143 std::vector<autofill::PasswordForm> local_credentials_; 146 std::vector<autofill::PasswordForm> local_credentials_;
144 base::string16 manage_link_; 147 base::string16 manage_link_;
145 base::string16 save_confirmation_text_; 148 base::string16 save_confirmation_text_;
146 gfx::Range save_confirmation_link_range_; 149 gfx::Range save_confirmation_link_range_;
147 150
151 // The controller for the desktop ios promotion.
152 std::unique_ptr<DesktopIOSPromotionController> ios_promotion_controller_;
153
148 // Responsible for recording all the interactions required. 154 // Responsible for recording all the interactions required.
149 std::unique_ptr<InteractionKeeper> interaction_keeper_; 155 std::unique_ptr<InteractionKeeper> interaction_keeper_;
150 156
151 // A bridge to ManagePasswordsUIController instance. 157 // A bridge to ManagePasswordsUIController instance.
152 base::WeakPtr<PasswordsModelDelegate> delegate_; 158 base::WeakPtr<PasswordsModelDelegate> delegate_;
153 159
154 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleModel); 160 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleModel);
155 }; 161 };
156 162
157 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_ 163 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698