OLD | NEW |
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 DesktopIOSPromotion; |
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 Loading... |
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 DesktopIOSPromotion* GetDesktopIOSPromotion(); |
| 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(); |
(...skipping 18 matching lines...) Expand all Loading... |
148 // Responsible for recording all the interactions required. | 151 // Responsible for recording all the interactions required. |
149 std::unique_ptr<InteractionKeeper> interaction_keeper_; | 152 std::unique_ptr<InteractionKeeper> interaction_keeper_; |
150 | 153 |
151 // A bridge to ManagePasswordsUIController instance. | 154 // A bridge to ManagePasswordsUIController instance. |
152 base::WeakPtr<PasswordsModelDelegate> delegate_; | 155 base::WeakPtr<PasswordsModelDelegate> delegate_; |
153 | 156 |
154 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleModel); | 157 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleModel); |
155 }; | 158 }; |
156 | 159 |
157 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_ | 160 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_ |
OLD | NEW |