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

Unified Diff: chrome/browser/ui/desktop_ios_promotion/desktop_ios_promotion_controller.h

Issue 2694893002: Integrate SMS service with Desktop iOS promotion (Closed)
Patch Set: unique_ptr 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/desktop_ios_promotion/desktop_ios_promotion_controller.h
diff --git a/chrome/browser/ui/desktop_ios_promotion/desktop_ios_promotion_controller.h b/chrome/browser/ui/desktop_ios_promotion/desktop_ios_promotion_controller.h
index c167041e9d958f3e1eeac350cf611fdbab3a8c0e..7f660637ce06275b6a1589b4280e0f3326f8be89 100644
--- a/chrome/browser/ui/desktop_ios_promotion/desktop_ios_promotion_controller.h
+++ b/chrome/browser/ui/desktop_ios_promotion/desktop_ios_promotion_controller.h
@@ -5,28 +5,74 @@
#ifndef CHROME_BROWSER_UI_DESKTOP_IOS_PROMOTION_DESKTOP_IOS_PROMOTION_CONTROLLER_H_
#define CHROME_BROWSER_UI_DESKTOP_IOS_PROMOTION_DESKTOP_IOS_PROMOTION_CONTROLLER_H_
+#include <memory>
+#include <string>
+
#include "base/macros.h"
+#include "chrome/browser/ui/desktop_ios_promotion/sms_service.h"
namespace desktop_ios_promotion {
enum class PromotionEntryPoint;
+enum class PromotionDismissalReason;
}
+class DesktopIOSPromotionView;
+class Profile;
+class PrefService;
+
// This class provides data to the Desktop to mobile promotion and control the
// promotion actions.
class DesktopIOSPromotionController {
public:
- // Should be instantiated on the UI thread.
- DesktopIOSPromotionController();
+ // Must be instantiated on the UI thread.
+ DesktopIOSPromotionController(
+ Profile* profile,
+ DesktopIOSPromotionView* promotion_view,
+ desktop_ios_promotion::PromotionEntryPoint entry_point);
~DesktopIOSPromotionController();
+ // Returns the current promotion entry point.
+ desktop_ios_promotion::PromotionEntryPoint entry_point() const {
+ return entry_point_;
+ }
+
// Called by the view code when "Send SMS" button is clicked by the user.
void OnSendSMSClicked();
+ // Called by the view code when the promotion is ready to show.
+ void OnPromotionShown();
+
// Called by the view code when "No Thanks" button is clicked by the user.
void OnNoThanksClicked();
- // (TODO): If needed verify that functions that affect the UI are done
- // on the same thread.
+ // Returns the Recovery phone number, returns empy string if the number is not
+ // set.
+ std::string GetUsersRecoveryPhoneNumber();
+
+ private:
+ // Updates the user's recovery phone number once the sms_service phone query
+ // returns a response.
+ void OnGotPhoneNumber(SMSService::Request* request,
+ bool success,
+ const std::string& number);
+
+ // Callback that logs the result when sms_service send sms returns a response.
+ void OnSendSMS(SMSService::Request* request,
+ bool success,
+ const std::string& number);
+
+ PrefService* profile_prefs_;
+ const desktop_ios_promotion::PromotionEntryPoint entry_point_;
+ // Service used to send SMS to the user recovery phone number.
+ SMSService* sms_service_;
+ // User's recovery phone number, this is updated by the sms_service.
+ std::string recovery_number_;
+ // A Weak pointer to the promotion view.
+ DesktopIOSPromotionView* promotion_view_ = nullptr;
sky 2017/02/18 18:03:51 Now that you set this in the initializer list it i
mrefaat 2017/02/18 19:12:00 Done.
+ // Track the action that is responsible for the promotion Dismissal.
+ desktop_ios_promotion::PromotionDismissalReason dismissal_reason_;
+
+ base::WeakPtrFactory<DesktopIOSPromotionController> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(DesktopIOSPromotionController);
};

Powered by Google App Engine
This is Rietveld 408576698