tmartino | e3f9c38e | 2016-09-13 14:05:32 | [diff] [blame] | 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 | |
Scott Chen | 532ec2c | 2018-09-26 21:50:05 | [diff] [blame] | 5 | #include "chrome/browser/ui/webui/welcome/welcome_ui.h" |
tmartino | e3f9c38e | 2016-09-13 14:05:32 | [diff] [blame] | 6 | |
Jinho Bang | 7ab7a4e | 2018-01-15 14:36:07 | [diff] [blame] | 7 | #include <memory> |
Hector Carmona | 8f2c3cb | 2018-07-12 21:07:58 | [diff] [blame] | 8 | #include <string> |
Jinho Bang | 7ab7a4e | 2018-01-15 14:36:07 | [diff] [blame] | 9 | |
Scott Chen | f68c9b2 | 2018-10-12 02:15:25 | [diff] [blame] | 10 | #include "base/metrics/histogram_macros.h" |
Hector Carmona | c98557a99 | 2018-06-27 17:51:43 | [diff] [blame] | 11 | #include "build/build_config.h" |
David Roger | f53a075 | 2018-06-18 14:46:48 | [diff] [blame] | 12 | #include "chrome/browser/signin/account_consistency_mode_manager.h" |
Hector Carmona | 207744f | 2018-10-25 23:49:54 | [diff] [blame] | 13 | #include "chrome/browser/ui/webui/welcome/nux/bookmark_handler.h" |
Scott Chen | f68c9b2 | 2018-10-12 02:15:25 | [diff] [blame] | 14 | #include "chrome/browser/ui/webui/welcome/nux/constants.h" |
| 15 | #include "chrome/browser/ui/webui/welcome/nux/email_handler.h" |
| 16 | #include "chrome/browser/ui/webui/welcome/nux/google_apps_handler.h" |
| 17 | #include "chrome/browser/ui/webui/welcome/nux/set_as_default_handler.h" |
Scott Chen | c74ed76 | 2018-09-21 00:23:16 | [diff] [blame] | 18 | #include "chrome/browser/ui/webui/welcome/nux_helper.h" |
Scott Chen | 532ec2c | 2018-09-26 21:50:05 | [diff] [blame] | 19 | #include "chrome/browser/ui/webui/welcome/welcome_handler.h" |
tmartino | 6254f47 | 2016-11-21 01:22:56 | [diff] [blame] | 20 | #include "chrome/common/pref_names.h" |
tmartino | e3f9c38e | 2016-09-13 14:05:32 | [diff] [blame] | 21 | #include "chrome/grit/browser_resources.h" |
| 22 | #include "chrome/grit/chrome_unscaled_resources.h" |
| 23 | #include "chrome/grit/chromium_strings.h" |
| 24 | #include "chrome/grit/generated_resources.h" |
dpapad | b1f8e9a | 2018-10-18 21:36:08 | [diff] [blame] | 25 | #include "chrome/grit/onboarding_welcome_resources.h" |
| 26 | #include "chrome/grit/onboarding_welcome_resources_map.h" |
tmartino | 6254f47 | 2016-11-21 01:22:56 | [diff] [blame] | 27 | #include "components/prefs/pref_service.h" |
Scott Chen | 395516b | 2018-10-23 00:05:48 | [diff] [blame] | 28 | #include "components/strings/grit/components_strings.h" |
Scott Chen | f68c9b2 | 2018-10-12 02:15:25 | [diff] [blame] | 29 | #include "content/public/browser/web_contents.h" |
tmartino | e3f9c38e | 2016-09-13 14:05:32 | [diff] [blame] | 30 | #include "content/public/browser/web_ui_data_source.h" |
tmartino | 7f0818b | 2016-09-27 23:39:07 | [diff] [blame] | 31 | #include "net/base/url_util.h" |
tmartino | e3f9c38e | 2016-09-13 14:05:32 | [diff] [blame] | 32 | #include "ui/base/l10n/l10n_util.h" |
tmartino | e3f9c38e | 2016-09-13 14:05:32 | [diff] [blame] | 33 | |
Scott Chen | e841488 | 2018-10-30 03:14:35 | [diff] [blame] | 34 | #if defined(OS_WIN) |
| 35 | #include "base/win/windows_version.h" |
| 36 | #endif |
| 37 | |
Scott Chen | c670667 | 2017-11-17 17:40:27 | [diff] [blame] | 38 | namespace { |
Scott Chen | 532ec2c | 2018-09-26 21:50:05 | [diff] [blame] | 39 | const bool kIsBranded = |
Scott Chen | c670667 | 2017-11-17 17:40:27 | [diff] [blame] | 40 | #if defined(GOOGLE_CHROME_BUILD) |
Scott Chen | 532ec2c | 2018-09-26 21:50:05 | [diff] [blame] | 41 | true; |
Scott Chen | c670667 | 2017-11-17 17:40:27 | [diff] [blame] | 42 | #else |
Scott Chen | 532ec2c | 2018-09-26 21:50:05 | [diff] [blame] | 43 | false; |
Scott Chen | c670667 | 2017-11-17 17:40:27 | [diff] [blame] | 44 | #endif |
Scott Chen | 532ec2c | 2018-09-26 21:50:05 | [diff] [blame] | 45 | } // namespace |
Scott Chen | c670667 | 2017-11-17 17:40:27 | [diff] [blame] | 46 | |
Scott Chen | 395516b | 2018-10-23 00:05:48 | [diff] [blame] | 47 | // TODO(scottchen): reuse instead of copy from |
| 48 | // md_settings_localized_strings_provider.cc. |
| 49 | struct LocalizedString { |
| 50 | const char* name; |
| 51 | int id; |
| 52 | }; |
| 53 | |
| 54 | void AddOnboardingStrings(content::WebUIDataSource* html_source) { |
| 55 | static constexpr LocalizedString kLocalizedStrings[] = { |
| 56 | // Shared strings. |
Scott Chen | 395516b | 2018-10-23 00:05:48 | [diff] [blame] | 57 | {"acceptText", IDS_WELCOME_ACCEPT_BUTTON}, |
Scott Chen | 395516b | 2018-10-23 00:05:48 | [diff] [blame] | 58 | {"bookmarkAdded", IDS_ONBOARDING_WELCOME_BOOKMARK_ADDED}, |
Hector Carmona | 6d77928 | 2018-10-30 23:48:40 | [diff] [blame] | 59 | {"bookmarksAdded", IDS_ONBOARDING_WELCOME_BOOKMARKS_ADDED}, |
Scott Chen | 395516b | 2018-10-23 00:05:48 | [diff] [blame] | 60 | {"bookmarkRemoved", IDS_ONBOARDING_WELCOME_BOOKMARK_REMOVED}, |
Hector Carmona | 6d77928 | 2018-10-30 23:48:40 | [diff] [blame] | 61 | {"bookmarksRemoved", IDS_ONBOARDING_WELCOME_BOOKMARKS_REMOVED}, |
Scott Chen | 395516b | 2018-10-23 00:05:48 | [diff] [blame] | 62 | {"bookmarkReplaced", IDS_ONBOARDING_WELCOME_BOOKMARK_REPLACED}, |
Scott Chen | ebfdce73 | 2018-10-26 02:34:26 | [diff] [blame] | 63 | {"getStarted", IDS_ONBOARDING_WELCOME_GET_STARTED}, |
| 64 | {"headerText", IDS_WELCOME_HEADER}, |
| 65 | {"next", IDS_ONBOARDING_WELCOME_NEXT}, |
| 66 | {"noThanks", IDS_NO_THANKS}, |
| 67 | {"skip", IDS_ONBOARDING_WELCOME_SKIP}, |
Scott Chen | 395516b | 2018-10-23 00:05:48 | [diff] [blame] | 68 | |
| 69 | // Sign-in view strings. |
| 70 | {"signInHeader", IDS_ONBOARDING_WELCOME_SIGNIN_VIEW_HEADER}, |
| 71 | {"signInSubHeader", IDS_ONBOARDING_WELCOME_SIGNIN_VIEW_SUB_HEADER}, |
| 72 | {"signIn", IDS_ONBOARDING_WELCOME_SIGNIN_VIEW_SIGNIN}, |
| 73 | |
| 74 | // Email provider module strings. |
Scott Chen | ebfdce73 | 2018-10-26 02:34:26 | [diff] [blame] | 75 | {"emailProviderTitle", IDS_ONBOARDING_WELCOME_NUX_EMAIL_TITLE}, |
Scott Chen | 395516b | 2018-10-23 00:05:48 | [diff] [blame] | 76 | |
| 77 | // Google apps module strings. |
| 78 | {"googleAppsDescription", |
| 79 | IDS_ONBOARDING_WELCOME_NUX_GOOGLE_APPS_DESCRIPTION}, |
| 80 | |
| 81 | // Set as default module strings. |
| 82 | {"setDefaultHeader", IDS_ONBOARDING_WELCOME_NUX_SET_AS_DEFAULT_HEADER}, |
| 83 | {"setDefaultSubHeader", |
| 84 | IDS_ONBOARDING_WELCOME_NUX_SET_AS_DEFAULT_SUB_HEADER}, |
| 85 | {"setDefaultSkip", IDS_ONBOARDING_WELCOME_NUX_SET_AS_DEFAULT_SKIP}, |
| 86 | {"setDefaultConfirm", |
| 87 | IDS_ONBOARDING_WELCOME_NUX_SET_AS_DEFAULT_SET_AS_DEFAULT}, |
Scott Chen | 618035d | 2018-10-24 00:48:15 | [diff] [blame] | 88 | |
| 89 | // Landing view strings. |
| 90 | {"landingTitle", IDS_ONBOARDING_WELCOME_LANDING_TITLE}, |
| 91 | {"landingDescription", IDS_ONBOARDING_WELCOME_LANDING_DESCRIPTION}, |
| 92 | {"landingNewUser", IDS_ONBOARDING_WELCOME_LANDING_NEW_USER}, |
| 93 | {"landingExistingUser", IDS_ONBOARDING_WELCOME_LANDING_EXISTING_USER}, |
| 94 | |
| 95 | // Email interstitial strings. |
| 96 | {"emailInterstitialTitle", |
| 97 | IDS_ONBOARDING_WELCOME_EMAIL_INTERSTITIAL_TITLE}, |
| 98 | {"emailInterstitialContinue", |
| 99 | IDS_ONBOARDING_WELCOME_EMAIL_INTERSTITIAL_CONTINUE}, |
Scott Chen | 395516b | 2018-10-23 00:05:48 | [diff] [blame] | 100 | }; |
| 101 | |
| 102 | // TODO(scottchen): reuse instead of copy from |
| 103 | // md_settings_localized_strings_provider.cc. |
| 104 | for (size_t i = 0; i < base::size(kLocalizedStrings); i++) { |
| 105 | html_source->AddLocalizedString(kLocalizedStrings[i].name, |
| 106 | kLocalizedStrings[i].id); |
| 107 | } |
| 108 | } |
| 109 | |
tmartino | e3f9c38e | 2016-09-13 14:05:32 | [diff] [blame] | 110 | WelcomeUI::WelcomeUI(content::WebUI* web_ui, const GURL& url) |
| 111 | : content::WebUIController(web_ui) { |
tmartino | 7f0818b | 2016-09-27 23:39:07 | [diff] [blame] | 112 | Profile* profile = Profile::FromWebUI(web_ui); |
| 113 | |
| 114 | // This page is not shown to incognito or guest profiles. If one should end up |
| 115 | // here, we return, causing a 404-like page. |
| 116 | if (!profile || |
| 117 | profile->GetProfileType() != Profile::ProfileType::REGULAR_PROFILE) { |
| 118 | return; |
| 119 | } |
| 120 | |
Scott Chen | f68c9b2 | 2018-10-12 02:15:25 | [diff] [blame] | 121 | StorePageSeen(profile); |
tmartino | 6254f47 | 2016-11-21 01:22:56 | [diff] [blame] | 122 | |
Jinho Bang | 7ab7a4e | 2018-01-15 14:36:07 | [diff] [blame] | 123 | web_ui->AddMessageHandler(std::make_unique<WelcomeHandler>(web_ui)); |
tmartino | e3f9c38e | 2016-09-13 14:05:32 | [diff] [blame] | 124 | |
| 125 | content::WebUIDataSource* html_source = |
| 126 | content::WebUIDataSource::Create(url.host()); |
| 127 | |
David Roger | f53a075 | 2018-06-18 14:46:48 | [diff] [blame] | 128 | bool is_dice = |
| 129 | AccountConsistencyModeManager::IsDiceEnabledForProfile(profile); |
tmartino | e3f9c38e | 2016-09-13 14:05:32 | [diff] [blame] | 130 | |
Scott Chen | c670667 | 2017-11-17 17:40:27 | [diff] [blame] | 131 | // There are multiple possible configurations that affects the layout, but |
| 132 | // first add resources that are shared across all layouts. |
tmartino | e3f9c38e | 2016-09-13 14:05:32 | [diff] [blame] | 133 | html_source->AddResourcePath("logo.png", IDR_PRODUCT_LOGO_128); |
| 134 | html_source->AddResourcePath("logo2x.png", IDR_PRODUCT_LOGO_256); |
Scott Chen | a126445 | 2017-11-14 13:32:08 | [diff] [blame] | 135 | |
Scott Chen | f68c9b2 | 2018-10-12 02:15:25 | [diff] [blame] | 136 | if (nux::IsNuxOnboardingEnabled(profile)) { |
Scott Chen | c74ed76 | 2018-09-21 00:23:16 | [diff] [blame] | 137 | // Add Onboarding welcome strings. |
Scott Chen | 395516b | 2018-10-23 00:05:48 | [diff] [blame] | 138 | AddOnboardingStrings(html_source); |
Scott Chen | c74ed76 | 2018-09-21 00:23:16 | [diff] [blame] | 139 | |
dpapad | b1f8e9a | 2018-10-18 21:36:08 | [diff] [blame] | 140 | // Add all Onboarding resources. |
| 141 | for (size_t i = 0; i < kOnboardingWelcomeResourcesSize; ++i) { |
| 142 | html_source->AddResourcePath(kOnboardingWelcomeResources[i].name, |
| 143 | kOnboardingWelcomeResources[i].value); |
| 144 | } |
Scott Chen | aac2e18 | 2018-10-23 01:49:44 | [diff] [blame] | 145 | |
| 146 | // chrome://welcome |
Scott Chen | c74ed76 | 2018-09-21 00:23:16 | [diff] [blame] | 147 | html_source->SetDefaultResource( |
| 148 | IDR_WELCOME_ONBOARDING_WELCOME_WELCOME_HTML); |
Scott Chen | f68c9b2 | 2018-10-12 02:15:25 | [diff] [blame] | 149 | |
Scott Chen | aac2e18 | 2018-10-23 01:49:44 | [diff] [blame] | 150 | // chrome://welcome/email-interstitial |
| 151 | html_source->AddResourcePath( |
| 152 | "email-interstitial", |
| 153 | IDR_WELCOME_ONBOARDING_WELCOME_EMAIL_INTERSTITIAL_HTML); |
| 154 | |
Scott Chen | d92e6ff | 2018-10-16 23:54:39 | [diff] [blame] | 155 | html_source->AddResourcePath( |
| 156 | "images/background_svgs/blue_circle.svg", |
| 157 | IDR_WELCOME_ONBOARDING_WELCOME_IMAGES_BACKGROUND_SVGS_BLUE_CIRCLE_SVG); |
| 158 | html_source->AddResourcePath( |
| 159 | "images/background_svgs/green_rectangle.svg", |
| 160 | IDR_WELCOME_ONBOARDING_WELCOME_IMAGES_BACKGROUND_SVGS_GREEN_RECTANGLE_SVG); |
| 161 | html_source->AddResourcePath( |
| 162 | "images/background_svgs/grey_oval.svg", |
| 163 | IDR_WELCOME_ONBOARDING_WELCOME_IMAGES_BACKGROUND_SVGS_GREY_OVAL_SVG); |
| 164 | html_source->AddResourcePath( |
| 165 | "images/background_svgs/grey_rounded_rectangle.svg", |
| 166 | IDR_WELCOME_ONBOARDING_WELCOME_IMAGES_BACKGROUND_SVGS_GREY_ROUNDED_RECTANGLE_SVG); |
| 167 | html_source->AddResourcePath( |
| 168 | "images/background_svgs/red_triangle.svg", |
| 169 | IDR_WELCOME_ONBOARDING_WELCOME_IMAGES_BACKGROUND_SVGS_RED_TRIANGLE_SVG); |
| 170 | html_source->AddResourcePath( |
| 171 | "images/background_svgs/yellow_dots.svg", |
| 172 | IDR_WELCOME_ONBOARDING_WELCOME_IMAGES_BACKGROUND_SVGS_YELLOW_DOTS_SVG); |
| 173 | html_source->AddResourcePath( |
| 174 | "images/background_svgs/yellow_semicircle.svg", |
| 175 | IDR_WELCOME_ONBOARDING_WELCOME_IMAGES_BACKGROUND_SVGS_YELLOW_SEMICIRCLE_SVG); |
Scott Chen | f68c9b2 | 2018-10-12 02:15:25 | [diff] [blame] | 176 | |
Scott Chen | ebfdce73 | 2018-10-26 02:34:26 | [diff] [blame] | 177 | html_source->AddResourcePath("images/email_provider_1x.png", |
| 178 | IDR_NUX_EMAIL_PROVIDER_LOGO_1X); |
| 179 | html_source->AddResourcePath("images/email_provider_2x.png", |
| 180 | IDR_NUX_EMAIL_PROVIDER_LOGO_2X); |
| 181 | html_source->AddResourcePath("images/set_as_default_1x.png", |
| 182 | IDR_NUX_SET_AS_DEFAULT_LOGO_1X); |
| 183 | html_source->AddResourcePath("images/set_as_default_2x.png", |
| 184 | IDR_NUX_SET_AS_DEFAULT_LOGO_2X); |
| 185 | html_source->AddResourcePath("images/set_as_default_illustration_1x.png", |
| 186 | IDR_NUX_SET_AS_DEFAULT_ILLUSTRATION_1X); |
| 187 | html_source->AddResourcePath("images/set_as_default_illustration_2x.png", |
| 188 | IDR_NUX_SET_AS_DEFAULT_ILLUSTRATION_2X); |
| 189 | |
Scott Chen | e841488 | 2018-10-30 03:14:35 | [diff] [blame] | 190 | #if defined(OS_WIN) |
| 191 | html_source->AddBoolean( |
| 192 | "is_win10", base::win::GetVersion() >= base::win::VERSION_WIN10); |
| 193 | #endif |
| 194 | |
Hector Carmona | 207744f | 2018-10-25 23:49:54 | [diff] [blame] | 195 | // Add the shared bookmark handler for onboarding modules. |
| 196 | web_ui->AddMessageHandler( |
| 197 | std::make_unique<nux::BookmarkHandler>(profile->GetPrefs())); |
Hector Carmona | 207744f | 2018-10-25 23:49:54 | [diff] [blame] | 198 | |
Scott Chen | f68c9b2 | 2018-10-12 02:15:25 | [diff] [blame] | 199 | // Add email provider bookmarking onboarding module. |
Scott Chen | 3bb4c57836 | 2018-10-31 00:23:31 | [diff] [blame] | 200 | web_ui->AddMessageHandler(std::make_unique<nux::EmailHandler>()); |
Hector Carmona | 207744f | 2018-10-25 23:49:54 | [diff] [blame] | 201 | nux::EmailHandler::AddSources(html_source); |
Scott Chen | f68c9b2 | 2018-10-12 02:15:25 | [diff] [blame] | 202 | |
| 203 | // Add google apps bookmarking onboarding module. |
Scott Chen | 3bb4c57836 | 2018-10-31 00:23:31 | [diff] [blame] | 204 | web_ui->AddMessageHandler(std::make_unique<nux::GoogleAppsHandler>()); |
Hector Carmona | 207744f | 2018-10-25 23:49:54 | [diff] [blame] | 205 | nux::GoogleAppsHandler::AddSources(html_source); |
Scott Chen | f68c9b2 | 2018-10-12 02:15:25 | [diff] [blame] | 206 | |
| 207 | // Add set-as-default onboarding module. |
| 208 | web_ui->AddMessageHandler(std::make_unique<nux::SetAsDefaultHandler>()); |
Scott Chen | 0085824 | 2018-11-01 23:40:47 | [diff] [blame^] | 209 | |
| 210 | html_source->AddString( |
| 211 | "new_user_modules", |
| 212 | nux::GetNuxOnboardingModules(profile).FindKey("new-user")->GetString()); |
| 213 | html_source->AddString("returning_user_modules", |
| 214 | nux::GetNuxOnboardingModules(profile) |
| 215 | .FindKey("returning-user") |
| 216 | ->GetString()); |
Scott Chen | c74ed76 | 2018-09-21 00:23:16 | [diff] [blame] | 217 | } else if (kIsBranded && is_dice) { |
| 218 | // Use special layout if the application is branded and DICE is enabled. |
Scott Chen | c670667 | 2017-11-17 17:40:27 | [diff] [blame] | 219 | html_source->AddLocalizedString("headerText", IDS_WELCOME_HEADER); |
Thomas Tangl | 441b0678 | 2018-09-27 19:37:07 | [diff] [blame] | 220 | html_source->AddLocalizedString("acceptText", |
| 221 | IDS_PROFILES_DICE_SIGNIN_BUTTON); |
Scott Chen | c670667 | 2017-11-17 17:40:27 | [diff] [blame] | 222 | html_source->AddLocalizedString("secondHeaderText", |
| 223 | IDS_DICE_WELCOME_SECOND_HEADER); |
| 224 | html_source->AddLocalizedString("descriptionText", |
| 225 | IDS_DICE_WELCOME_DESCRIPTION); |
| 226 | html_source->AddLocalizedString("declineText", |
| 227 | IDS_DICE_WELCOME_DECLINE_BUTTON); |
Mihai Sardarescu | 631f3b47 | 2018-05-04 15:08:15 | [diff] [blame] | 228 | html_source->AddResourcePath("welcome_browser_proxy.html", |
| 229 | IDR_DICE_WELCOME_BROWSER_PROXY_HTML); |
| 230 | html_source->AddResourcePath("welcome_browser_proxy.js", |
| 231 | IDR_DICE_WELCOME_BROWSER_PROXY_JS); |
Scott Chen | c670667 | 2017-11-17 17:40:27 | [diff] [blame] | 232 | html_source->AddResourcePath("welcome_app.html", IDR_DICE_WELCOME_APP_HTML); |
| 233 | html_source->AddResourcePath("welcome_app.js", IDR_DICE_WELCOME_APP_JS); |
Scott Chen | a126445 | 2017-11-14 13:32:08 | [diff] [blame] | 234 | html_source->AddResourcePath("welcome.css", IDR_DICE_WELCOME_CSS); |
| 235 | html_source->SetDefaultResource(IDR_DICE_WELCOME_HTML); |
| 236 | } else { |
Mihai Sardarescu | 631f3b47 | 2018-05-04 15:08:15 | [diff] [blame] | 237 | // Use default layout for non-DICE or unbranded build. |
| 238 | std::string value; |
| 239 | bool is_everywhere_variant = |
| 240 | (net::GetValueForKeyInQuery(url, "variant", &value) && |
| 241 | value == "everywhere"); |
| 242 | |
Scott Chen | c670667 | 2017-11-17 17:40:27 | [diff] [blame] | 243 | if (kIsBranded) { |
| 244 | base::string16 subheader = |
| 245 | is_everywhere_variant |
| 246 | ? base::string16() |
| 247 | : l10n_util::GetStringUTF16(IDS_WELCOME_SUBHEADER); |
| 248 | html_source->AddString("subheaderText", subheader); |
| 249 | } |
| 250 | |
| 251 | int header_id = is_everywhere_variant ? IDS_WELCOME_HEADER_AFTER_FIRST_RUN |
| 252 | : IDS_WELCOME_HEADER; |
| 253 | html_source->AddString("headerText", l10n_util::GetStringUTF16(header_id)); |
Thomas Tangl | 441b0678 | 2018-09-27 19:37:07 | [diff] [blame] | 254 | html_source->AddLocalizedString("acceptText", IDS_WELCOME_ACCEPT_BUTTON); |
Scott Chen | c670667 | 2017-11-17 17:40:27 | [diff] [blame] | 255 | html_source->AddLocalizedString("descriptionText", IDS_WELCOME_DESCRIPTION); |
| 256 | html_source->AddLocalizedString("declineText", IDS_WELCOME_DECLINE_BUTTON); |
Scott Chen | a126445 | 2017-11-14 13:32:08 | [diff] [blame] | 257 | html_source->AddResourcePath("welcome.js", IDR_WELCOME_JS); |
| 258 | html_source->AddResourcePath("welcome.css", IDR_WELCOME_CSS); |
| 259 | html_source->SetDefaultResource(IDR_WELCOME_HTML); |
| 260 | } |
tmartino | e3f9c38e | 2016-09-13 14:05:32 | [diff] [blame] | 261 | |
tmartino | e3f9c38e | 2016-09-13 14:05:32 | [diff] [blame] | 262 | content::WebUIDataSource::Add(profile, html_source); |
| 263 | } |
| 264 | |
| 265 | WelcomeUI::~WelcomeUI() {} |
Hector Carmona | 8f2c3cb | 2018-07-12 21:07:58 | [diff] [blame] | 266 | |
Scott Chen | f68c9b2 | 2018-10-12 02:15:25 | [diff] [blame] | 267 | void WelcomeUI::StorePageSeen(Profile* profile) { |
Hector Carmona | 8f2c3cb | 2018-07-12 21:07:58 | [diff] [blame] | 268 | // Store that this profile has been shown the Welcome page. |
| 269 | profile->GetPrefs()->SetBoolean(prefs::kHasSeenWelcomePage, true); |
| 270 | } |