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

Unified Diff: chrome/browser/ui/webui/welcome_ui.cc

Issue 2338213007: Adding JS and C++ handlers for events on new Welcome page. (Closed)
Patch Set: Further comments from anthonyvd 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_ui.cc
diff --git a/chrome/browser/ui/webui/welcome_ui.cc b/chrome/browser/ui/webui/welcome_ui.cc
index 7c5ffe117b60636bc418bbce20ecbc3c2a720865..74d5caa194691866080366f47527045e30e44aff 100644
--- a/chrome/browser/ui/webui/welcome_ui.cc
+++ b/chrome/browser/ui/webui/welcome_ui.cc
@@ -5,32 +5,28 @@
#include "chrome/browser/ui/webui/welcome_ui.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/common/url_constants.h"
+#include "chrome/browser/ui/webui/welcome_handler.h"
#include "chrome/grit/browser_resources.h"
#include "chrome/grit/chrome_unscaled_resources.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
#include "content/public/browser/web_ui_data_source.h"
+#include "net/base/url_util.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/resources/grit/webui_resources.h"
-namespace {
-
-// A URL ending in /1 indicates that we should modify the page to use the
-// "Take Chrome Everywhere" text.
-const char* kEverywhereVariantPath = "/1";
-
-} // namespace
-
WelcomeUI::WelcomeUI(content::WebUI* web_ui, const GURL& url)
: content::WebUIController(web_ui) {
- // TODO(tmartino): Create WelcomeHandler, and add here.
+ web_ui->AddMessageHandler(new WelcomeHandler(web_ui));
content::WebUIDataSource* html_source =
content::WebUIDataSource::Create(url.host());
// Check URL for variations.
- bool is_everywhere_variant = url.path() == kEverywhereVariantPath;
+ std::string value;
+ bool is_everywhere_variant =
+ (net::GetValueForKeyInQuery(url, "variant", &value) &&
+ value == "everywhere");
int header_id = is_everywhere_variant ? IDS_WELCOME_HEADER_AFTER_FIRST_RUN
: IDS_WELCOME_HEADER;
« chrome/browser/ui/webui/welcome_handler.cc ('K') | « chrome/browser/ui/webui/welcome_ui.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698