| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_WEBUI_WELCOME_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_WELCOME_HANDLER_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "content/public/browser/web_ui_message_handler.h" |
| 10 #include "google_apis/gaia/oauth2_token_service.h" |
| 11 |
| 12 class Browser; |
| 13 class Profile; |
| 14 class ProfileOAuth2TokenService; |
| 15 |
| 16 // Handles actions on Welcome page. |
| 17 class WelcomeHandler : public content::WebUIMessageHandler, |
| 18 public OAuth2TokenService::Observer { |
| 19 public: |
| 20 explicit WelcomeHandler(content::WebUI* web_ui); |
| 21 ~WelcomeHandler() override; |
| 22 |
| 23 // OAuth2TokenService::Observer: |
| 24 void OnRefreshTokenAvailable(const std::string& account_id) override; |
| 25 |
| 26 // content::WebUIMessageHandler: |
| 27 void RegisterMessages() override; |
| 28 |
| 29 private: |
| 30 enum WelcomeResult { |
| 31 DEFAULT = 0, |
| 32 SIGNED_IN, // User clicked the "Sign In" button and completed sign-in. |
| 33 DECLINED // User clicked the "No Thanks" button. |
| 34 }; |
| 35 |
| 36 void HandleActivateSignIn(const base::ListValue* args); |
| 37 void HandleUserDecline(const base::ListValue* args); |
| 38 void GoToNewTabPage(); |
| 39 |
| 40 Profile* profile_; |
| 41 Browser* browser_; |
| 42 ProfileOAuth2TokenService* oauth2_token_service_; |
| 43 WelcomeResult result_; |
| 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(WelcomeHandler); |
| 46 }; |
| 47 |
| 48 #endif // CHROME_BROWSER_UI_WEBUI_WELCOME_HANDLER_H_ |
| OLD | NEW |