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

Side by Side Diff: chrome/browser/ui/desktop_ios_promotion/desktop_ios_promotion_controller.h

Issue 2803293002: Create Bookmark Footnote desktop iOS promotion (Closed)
Patch Set: win only Created 3 years, 7 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 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"
13 12
14 namespace desktop_ios_promotion { 13 namespace desktop_ios_promotion {
15 enum class PromotionEntryPoint; 14 enum class PromotionEntryPoint;
16 enum class PromotionDismissalReason; 15 enum class PromotionDismissalReason;
17 } 16 }
18 17
19 class DesktopIOSPromotionView;
20 class Profile; 18 class Profile;
21 class PrefService; 19 class PrefService;
22 20
23 // This class provides data to the Desktop to mobile promotion and control the 21 // This class provides data to the Desktop to mobile promotion and control the
24 // promotion actions. 22 // promotion actions.
25 class DesktopIOSPromotionController { 23 class DesktopIOSPromotionController {
26 public: 24 public:
27 // Must be instantiated on the UI thread. 25 // Must be instantiated on the UI thread.
28 DesktopIOSPromotionController( 26 DesktopIOSPromotionController(
29 Profile* profile, 27 Profile* profile,
30 DesktopIOSPromotionView* promotion_view,
31 desktop_ios_promotion::PromotionEntryPoint entry_point); 28 desktop_ios_promotion::PromotionEntryPoint entry_point);
32 ~DesktopIOSPromotionController(); 29 ~DesktopIOSPromotionController();
33 30
34 // Returns the current promotion entry point. 31 // Returns the current promotion entry point.
35 desktop_ios_promotion::PromotionEntryPoint entry_point() const { 32 desktop_ios_promotion::PromotionEntryPoint entry_point() const {
36 return entry_point_; 33 return entry_point_;
37 } 34 }
38 35
39 // Called by the view code when "Send SMS" button is clicked by the user. 36 desktop_ios_promotion::PromotionDismissalReason dismissal_reason() const {
40 void OnSendSMSClicked(); 37 return dismissal_reason_;
38 }
41 39
42 // Called by the view code when the promotion is ready to show. 40 // Called by the view code when the promotion is ready to show.
43 void OnPromotionShown(); 41 void OnPromotionShown();
44 42
45 // Called by the view code when "No Thanks" button is clicked by the user. 43 // Called by the view when link to detailed promo is clicked by the user.
46 void OnNoThanksClicked(); 44 void OnLearnMoreLinkClicked();
47 45
48 // Returns the Recovery phone number, returns empy string if the number is not 46 protected:
49 // set. 47 void SetDismissalReason(
50 std::string GetUsersRecoveryPhoneNumber(); 48 desktop_ios_promotion::PromotionDismissalReason reason);
51 49
52 // Used for testing. 50 PrefService* profile_prefs() { return profile_prefs_; }
53 desktop_ios_promotion::PromotionDismissalReason dismissal_reason() const {
54 return dismissal_reason_;
55 }
56 51
57 private: 52 private:
58 // Updates the user's recovery phone number once the sms_service phone query
59 // returns a response.
60 void OnGotPhoneNumber(SMSService::Request* request,
61 bool success,
62 const std::string& number);
63
64 // Callback that logs the result when sms_service send sms returns a response.
65 void OnSendSMS(SMSService::Request* request,
66 bool success,
67 const std::string& number);
68
69 PrefService* profile_prefs_; 53 PrefService* profile_prefs_;
70 const desktop_ios_promotion::PromotionEntryPoint entry_point_; 54 const desktop_ios_promotion::PromotionEntryPoint entry_point_;
71 // Service used to send SMS to the user recovery phone number. 55
72 SMSService* sms_service_;
73 // User's recovery phone number, this is updated by the sms_service.
74 std::string recovery_number_;
75 // A Weak pointer to the promotion view.
76 DesktopIOSPromotionView* promotion_view_;
77 // Track the action that is responsible for the promotion Dismissal. 56 // Track the action that is responsible for the promotion Dismissal.
78 desktop_ios_promotion::PromotionDismissalReason dismissal_reason_; 57 desktop_ios_promotion::PromotionDismissalReason dismissal_reason_;
79 58
80 base::WeakPtrFactory<DesktopIOSPromotionController> weak_ptr_factory_;
81
82 DISALLOW_COPY_AND_ASSIGN(DesktopIOSPromotionController); 59 DISALLOW_COPY_AND_ASSIGN(DesktopIOSPromotionController);
83 }; 60 };
84 61
85 #endif // CHROME_BROWSER_UI_DESKTOP_IOS_PROMOTION_DESKTOP_IOS_PROMOTION_CONTROL LER_H_ 62 #endif // CHROME_BROWSER_UI_DESKTOP_IOS_PROMOTION_DESKTOP_IOS_PROMOTION_CONTROL LER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698