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

Unified Diff: chrome/browser/ui/webui/welcome_handler.h

Issue 2338213007: Adding JS and C++ handlers for events on new Welcome page. (Closed)
Patch Set: Forward Declarations Created 4 years, 3 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/webui/welcome_handler.h
diff --git a/chrome/browser/ui/webui/welcome_handler.h b/chrome/browser/ui/webui/welcome_handler.h
new file mode 100644
index 0000000000000000000000000000000000000000..a9a7af7acf50c4d1cb1c6f82c9bf7f2f35e5dba6
--- /dev/null
+++ b/chrome/browser/ui/webui/welcome_handler.h
@@ -0,0 +1,48 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_WELCOME_HANDLER_H_
+#define CHROME_BROWSER_UI_WEBUI_WELCOME_HANDLER_H_
+
+#include "base/macros.h"
+#include "content/public/browser/web_ui_message_handler.h"
+#include "google_apis/gaia/oauth2_token_service.h"
+
+class Browser;
+class Profile;
+class ProfileOAuth2TokenService;
+
+// Handles actions on Welcome page.
+class WelcomeHandler : public content::WebUIMessageHandler,
+ public OAuth2TokenService::Observer {
+ public:
+ explicit WelcomeHandler(content::WebUI* web_ui);
+ ~WelcomeHandler() override;
+
+ // OAuth2TokenService::Observer:
+ void OnRefreshTokenAvailable(const std::string& account_id) override;
+
+ // content::WebUIMessageHandler:
+ void RegisterMessages() override;
+
+ private:
+ enum WelcomeResult {
+ DEFAULT = 0,
+ SIGNED_IN, // User clicked the "Sign In" button and completed sign-in.
+ DECLINED // User clicked the "No Thanks" button.
+ };
+
+ void HandleActivateSignIn(const base::ListValue* args);
+ void HandleUserDecline(const base::ListValue* args);
+ void GoToNewTabPage();
+
+ Profile* profile_;
+ Browser* browser_;
+ ProfileOAuth2TokenService* oauth2_token_service_;
+ WelcomeResult result_;
+
+ DISALLOW_COPY_AND_ASSIGN(WelcomeHandler);
+};
+
+#endif // CHROME_BROWSER_UI_WEBUI_WELCOME_HANDLER_H_

Powered by Google App Engine
This is Rietveld 408576698