OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_DESKTOP_IOS_PROMOTION_DESKTOP_IOS_PROMOTION_CONTROLLER _H_ | 5 #ifndef CHROME_BROWSER_UI_DESKTOP_IOS_PROMOTION_DESKTOP_IOS_PROMOTION_CONTROLLER _H_ |
6 #define CHROME_BROWSER_UI_DESKTOP_IOS_PROMOTION_DESKTOP_IOS_PROMOTION_CONTROLLER _H_ | 6 #define CHROME_BROWSER_UI_DESKTOP_IOS_PROMOTION_DESKTOP_IOS_PROMOTION_CONTROLLER _H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "chrome/browser/ui/desktop_ios_promotion/sms_service.h" | 12 #include "chrome/browser/ui/desktop_ios_promotion/sms_service.h" |
13 | 13 |
14 namespace desktop_ios_promotion { | 14 namespace desktop_ios_promotion { |
15 enum class PromotionEntryPoint; | 15 enum class PromotionEntryPoint; |
16 enum class PromotionDismissalReason; | 16 enum class PromotionDismissalReason; |
17 } | 17 } |
18 | 18 |
19 class DesktopIOSPromotionView; | 19 class DesktopIOSPromotionView; |
20 class Profile; | 20 class Profile; |
21 class PrefService; | 21 class PrefService; |
22 | 22 |
23 // This class provides data to the Desktop to mobile promotion and control the | 23 // This class provides data to the Desktop to mobile promotion and control the |
24 // promotion actions. | 24 // promotion actions. |
25 class DesktopIOSPromotionController { | 25 class DesktopIOSPromotionController { |
sky
2017/05/17 16:00:41
I'm having a hard time seeing why you want to shar
mrefaat
2017/05/17 19:44:56
Both are promotions surfaces and need logging & an
sky
2017/05/18 02:55:38
How about refactoring the SMS code out so that thi
mrefaat1
2017/05/23 22:15:34
Done.
mrefaat
2017/05/24 19:04:19
Done.
| |
26 public: | 26 public: |
27 // Must be instantiated on the UI thread. | 27 // Must be instantiated on the UI thread. |
28 DesktopIOSPromotionController( | 28 DesktopIOSPromotionController( |
29 Profile* profile, | 29 Profile* profile, |
30 DesktopIOSPromotionView* promotion_view, | 30 DesktopIOSPromotionView* promotion_view, |
31 desktop_ios_promotion::PromotionEntryPoint entry_point); | 31 desktop_ios_promotion::PromotionEntryPoint entry_point); |
32 ~DesktopIOSPromotionController(); | 32 ~DesktopIOSPromotionController(); |
33 | 33 |
34 // Returns the current promotion entry point. | 34 // Returns the current promotion entry point. |
35 desktop_ios_promotion::PromotionEntryPoint entry_point() const { | 35 desktop_ios_promotion::PromotionEntryPoint entry_point() const { |
36 return entry_point_; | 36 return entry_point_; |
37 } | 37 } |
38 | 38 |
39 // Called by the view code when "Send SMS" button is clicked by the user. | 39 // Called by the view code when "Send SMS" button is clicked by the user. |
40 void OnSendSMSClicked(); | 40 void OnSendSMSClicked(); |
41 | 41 |
42 // Called by the view code when the promotion is ready to show. | 42 // Called by the view code when the promotion is ready to show. |
43 void OnPromotionShown(); | 43 void OnPromotionShown(); |
44 | 44 |
45 // Called by the view when link to detailed promo is clicked by the user. | |
46 void OnLearnMoreLinkClicked(); | |
47 | |
45 // Called by the view code when "No Thanks" button is clicked by the user. | 48 // Called by the view code when "No Thanks" button is clicked by the user. |
46 void OnNoThanksClicked(); | 49 void OnNoThanksClicked(); |
47 | 50 |
48 // Returns the Recovery phone number, returns empy string if the number is not | 51 // Returns the Recovery phone number, returns empy string if the number is not |
49 // set. | 52 // set. |
50 std::string GetUsersRecoveryPhoneNumber(); | 53 std::string GetUsersRecoveryPhoneNumber(); |
51 | 54 |
52 // Used for testing. | 55 // Used for testing. |
53 desktop_ios_promotion::PromotionDismissalReason dismissal_reason() const { | 56 desktop_ios_promotion::PromotionDismissalReason dismissal_reason() const { |
54 return dismissal_reason_; | 57 return dismissal_reason_; |
(...skipping 21 matching lines...) Expand all Loading... | |
76 DesktopIOSPromotionView* promotion_view_; | 79 DesktopIOSPromotionView* promotion_view_; |
77 // Track the action that is responsible for the promotion Dismissal. | 80 // Track the action that is responsible for the promotion Dismissal. |
78 desktop_ios_promotion::PromotionDismissalReason dismissal_reason_; | 81 desktop_ios_promotion::PromotionDismissalReason dismissal_reason_; |
79 | 82 |
80 base::WeakPtrFactory<DesktopIOSPromotionController> weak_ptr_factory_; | 83 base::WeakPtrFactory<DesktopIOSPromotionController> weak_ptr_factory_; |
81 | 84 |
82 DISALLOW_COPY_AND_ASSIGN(DesktopIOSPromotionController); | 85 DISALLOW_COPY_AND_ASSIGN(DesktopIOSPromotionController); |
83 }; | 86 }; |
84 | 87 |
85 #endif // CHROME_BROWSER_UI_DESKTOP_IOS_PROMOTION_DESKTOP_IOS_PROMOTION_CONTROL LER_H_ | 88 #endif // CHROME_BROWSER_UI_DESKTOP_IOS_PROMOTION_DESKTOP_IOS_PROMOTION_CONTROL LER_H_ |
OLD | NEW |