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

Side by Side Diff: chrome/browser/ui/webui/welcome_ui.cc

Issue 2252063002: Adding client code for new desktop First Run Experience. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing build issues after rebasing 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 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 #include "chrome/browser/ui/webui/welcome_ui.h"
6
7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/common/url_constants.h"
9 #include "chrome/grit/browser_resources.h"
10 #include "chrome/grit/chrome_unscaled_resources.h"
11 #include "chrome/grit/chromium_strings.h"
12 #include "chrome/grit/generated_resources.h"
13 #include "content/public/browser/web_ui_data_source.h"
14 #include "ui/base/l10n/l10n_util.h"
15 #include "ui/resources/grit/webui_resources.h"
16
17 // A URL ending in /1 indicates that we should modify the page to use the
18 // "Take Chrome Everywhere" text.
19 const char* kEverywhereVariantPath = "/1";
20
21 WelcomeUI::WelcomeUI(content::WebUI* web_ui, const GURL& url)
22 : content::WebUIController(web_ui) {
23 // TODO(tmartino): Create WelcomeHandler.
24 // web_ui->AddMessageHandler(new WelcomeHandler());
michaelpg 2016/09/06 22:21:57 don't leave commented-out code in (even with TODO.
tmartino 2016/09/07 23:06:42 Done
25
26 content::WebUIDataSource* html_source =
27 content::WebUIDataSource::Create(url.host());
28
29 // Check URL for variations.
30 bool is_everywhere_variant = url.path().compare(kEverywhereVariantPath) == 0;
31
32 int header_id = is_everywhere_variant ? IDS_WELCOME_UI_EVERYWHERE_HEADER
33 : IDS_WELCOME_UI_WELCOME_HEADER;
34 html_source->AddString("headerText", l10n_util::GetStringUTF16(header_id));
35
36 // The subheader describes the browser as being "by Google", so we only show
37 // it in the "Welcome to Chrome" variant, and only on branded builds.
38 base::string16 subheader = base::string16();
michaelpg 2016/09/06 22:21:56 this is equivalent to base::string16 subheade
tmartino 2016/09/07 23:06:43 N/A anymore, but yes.
39
40 #if defined(GOOGLE_CHROME_BUILD)
41 if (!is_everywhere_variant)
42 subheader = l10n_util::GetStringUTF16(IDS_WELCOME_UI_SUBHEADER);
43 #endif
44 html_source->AddString("subheaderText", subheader);
michaelpg 2016/09/06 22:21:57 if you can limit the use of subheaderText to Googl
tmartino 2016/09/07 23:06:43 Done
45
46 html_source->AddLocalizedString("descriptionText",
47 IDS_WELCOME_UI_DESCRIPTION);
48 html_source->AddLocalizedString("acceptText", IDS_WELCOME_UI_ACCEPT_BUTTON);
49 html_source->AddLocalizedString("declineText", IDS_WELCOME_UI_DECLINE_BUTTON);
50
51 html_source->AddResourcePath("welcome.js", IDR_WELCOME_JS);
52 html_source->AddResourcePath("logo.png", IDR_PRODUCT_LOGO_128);
53 html_source->AddResourcePath("logo2x.png", IDR_PRODUCT_LOGO_256);
54 html_source->AddResourcePath("watermark.svg", IDR_WEBUI_IMAGES_GOOGLE_LOGO);
55 html_source->SetDefaultResource(IDR_WELCOME_HTML);
56
57 Profile* profile = Profile::FromWebUI(web_ui);
58 content::WebUIDataSource::Add(profile, html_source);
59 }
60
61 WelcomeUI::~WelcomeUI() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698