NUX Onboarding: clean up build process.
This CL cleans up the remnants of the NUX Experiments bulid configs. Including:
- removing os_win and google_chrome_branded build flag.
- removing prefs that tracks if the one-off NUX experiments were seen.
- fixing closure compile errors now that it needs to build on non-official bots.
Bug: 874153
Change-Id: I03c1ed09c54f5ba91944bcb31837e80a0ee1fc74
Reviewed-on: https://chromium-review.googlesource.com/c/1252906
Commit-Queue: Scott Chen <scottchen@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#596432}
diff --git a/BUILD.gn b/BUILD.gn
index ce3ab61f..2fcdd32 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1167,10 +1167,6 @@
if (is_android) {
data_deps += [ "components/offline_pages/resources:closure_compile" ]
}
- if (is_win && is_chrome_branded) {
- # TODO(scottchen): uncomment after fixing closure compile deps for NUX.
- # data_deps += [ "components/nux/resources:closure_compile" ]
- }
}
}
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc
index ff55c4c..cdecc9d 100644
--- a/chrome/browser/profiles/profile_manager.cc
+++ b/chrome/browser/profiles/profile_manager.cc
@@ -1092,9 +1092,6 @@
#if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
// Enterprise users should not be included in any NUX flow.
if (!base::win::IsEnterpriseManaged()) {
- profile->GetPrefs()->SetBoolean(prefs::kHasSeenGoogleAppsPromoPage,
- false);
- profile->GetPrefs()->SetBoolean(prefs::kHasSeenEmailPromoPage, false);
profile->GetPrefs()->SetBoolean(prefs::kOnboardDuringNUX, true);
}
#endif // defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
diff --git a/chrome/browser/resources/BUILD.gn b/chrome/browser/resources/BUILD.gn
index 0bdaeb3..8922d4c 100644
--- a/chrome/browser/resources/BUILD.gn
+++ b/chrome/browser/resources/BUILD.gn
@@ -27,6 +27,7 @@
"print_preview:closure_compile",
"settings:closure_compile",
"signin/dice_sync_confirmation:closure_compile",
+ "welcome/onboarding_welcome:closure_compile",
]
}
if (is_chromeos) {
diff --git a/chrome/browser/resources/welcome/onboarding_welcome/BUILD.gn b/chrome/browser/resources/welcome/onboarding_welcome/BUILD.gn
new file mode 100644
index 0000000..7de44a6
--- /dev/null
+++ b/chrome/browser/resources/welcome/onboarding_welcome/BUILD.gn
@@ -0,0 +1,49 @@
+# Copyright 2018 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.
+
+import("//third_party/closure_compiler/compile_js.gni")
+
+group("closure_compile") {
+ deps = [
+ ":welcome_files",
+ "./email:closure_compile",
+ "./google_apps:closure_compile",
+ "./set_as_default:closure_compile",
+ ]
+}
+
+js_type_check("welcome_files") {
+ deps = [
+ ":landing_view",
+ ":welcome_app",
+ ]
+}
+
+js_library("landing_view") {
+ deps = [
+ ":navigation_behavior",
+ ":welcome_browser_proxy",
+ ]
+}
+
+js_library("navigation_behavior") {
+ deps = [
+ "//ui/webui/resources/js:cr",
+ ]
+}
+
+js_library("welcome_app") {
+ deps = [
+ ":navigation_behavior",
+ ":welcome_browser_proxy",
+ "//ui/webui/resources/cr_elements/cr_view_manager:cr_view_manager",
+ ]
+}
+
+js_library("welcome_browser_proxy") {
+ deps = [
+ "//ui/webui/resources/js:cr",
+ ]
+ externs_list = [ "$externs_path/chrome_send.js" ]
+}
diff --git a/chrome/browser/resources/welcome/onboarding_welcome/email/BUILD.gn b/chrome/browser/resources/welcome/onboarding_welcome/email/BUILD.gn
index 957d207..f09341e 100644
--- a/chrome/browser/resources/welcome/onboarding_welcome/email/BUILD.gn
+++ b/chrome/browser/resources/welcome/onboarding_welcome/email/BUILD.gn
@@ -6,6 +6,7 @@
js_type_check("closure_compile") {
deps = [
+ ":email_chooser",
":nux_email",
]
}
@@ -13,3 +14,22 @@
js_library("nux_email") {
deps = []
}
+
+js_library("email_chooser") {
+ deps = [
+ ":nux_email_proxy",
+ "//third_party/polymer/v1_0/components-chromium/iron-a11y-announcer:iron-a11y-announcer-extracted",
+ "//ui/webui/resources/js:i18n_behavior",
+ ]
+}
+
+js_library("nux_email_proxy") {
+ deps = [
+ "//ui/webui/resources/js:cr",
+ ]
+ externs_list = [
+ "$externs_path/chrome_extensions.js",
+ "$externs_path/chrome_send.js",
+ "$externs_path/metrics_private.js",
+ ]
+}
diff --git a/chrome/browser/resources/welcome/onboarding_welcome/google_apps/BUILD.gn b/chrome/browser/resources/welcome/onboarding_welcome/google_apps/BUILD.gn
index c2ce565..2355eb1 100644
--- a/chrome/browser/resources/welcome/onboarding_welcome/google_apps/BUILD.gn
+++ b/chrome/browser/resources/welcome/onboarding_welcome/google_apps/BUILD.gn
@@ -23,5 +23,8 @@
}
js_library("nux_google_apps_proxy") {
- deps = []
+ deps = [
+ "//ui/webui/resources/js:cr",
+ ]
+ externs_list = [ "$externs_path/chrome_send.js" ]
}
diff --git a/chrome/browser/resources/welcome/onboarding_welcome/set_as_default/BUILD.gn b/chrome/browser/resources/welcome/onboarding_welcome/set_as_default/BUILD.gn
index 4db1759..cf61b6c 100644
--- a/chrome/browser/resources/welcome/onboarding_welcome/set_as_default/BUILD.gn
+++ b/chrome/browser/resources/welcome/onboarding_welcome/set_as_default/BUILD.gn
@@ -13,9 +13,13 @@
js_library("nux_set_as_default") {
deps = [
":nux_set_as_default_proxy",
+ "//ui/webui/resources/js:web_ui_listener_behavior",
]
}
js_library("nux_set_as_default_proxy") {
- deps = []
+ deps = [
+ "//ui/webui/resources/js:cr",
+ ]
+ externs_list = [ "$externs_path/chrome_send.js" ]
}
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn
index a9bbebb..b161cdf 100644
--- a/chrome/browser/ui/BUILD.gn
+++ b/chrome/browser/ui/BUILD.gn
@@ -1955,15 +1955,11 @@
"webui/welcome/welcome_ui.h",
]
- # TODO(scottchen): Remove if-check once nux files are non-exclusive
- # to windows.
- if (is_win && is_chrome_branded) {
- deps += [
- "//chrome/browser/ui/webui/welcome/nux:constants",
- "//chrome/browser/ui/webui/welcome/nux:email_feature",
- "//chrome/browser/ui/webui/welcome/nux:google_apps_feature",
- ]
- }
+ deps += [
+ "//chrome/browser/ui/webui/welcome/nux:constants",
+ "//chrome/browser/ui/webui/welcome/nux:email_feature",
+ "//chrome/browser/ui/webui/welcome/nux:google_apps_feature",
+ ]
if (enable_dice_support) {
sources += [
diff --git a/chrome/browser/ui/startup/startup_browser_creator.cc b/chrome/browser/ui/startup/startup_browser_creator.cc
index fd89147b9..dd13003 100644
--- a/chrome/browser/ui/startup/startup_browser_creator.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator.cc
@@ -463,12 +463,6 @@
// creation.
registry->RegisterBooleanPref(prefs::kHasSeenWelcomePage, true);
#if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
- // TODO(scottchen): To make this testable early by trybots, instead of hiding
- // behind GOOGLE_CHROME_BUILD, use a function that returns true for official
- // builds and conditionally returns true based on a command line switch to
- // be set by tests.
- registry->RegisterBooleanPref(prefs::kHasSeenGoogleAppsPromoPage, true);
- registry->RegisterBooleanPref(prefs::kHasSeenEmailPromoPage, true);
// This will be set to true for newly created profiles, and is used to
// indicate which users went through FRE after NUX is enabled.
registry->RegisterBooleanPref(prefs::kOnboardDuringNUX, false);
diff --git a/chrome/browser/ui/startup/startup_tab_provider.cc b/chrome/browser/ui/startup/startup_tab_provider.cc
index d0e80b8..8809d8b9 100644
--- a/chrome/browser/ui/startup/startup_tab_provider.cc
+++ b/chrome/browser/ui/startup/startup_tab_provider.cc
@@ -59,11 +59,6 @@
} // namespace
-StartupTabProviderImpl::StandardOnboardingTabsParams::
- StandardOnboardingTabsParams() = default;
-StartupTabProviderImpl::StandardOnboardingTabsParams::
- ~StandardOnboardingTabsParams() = default;
-
StartupTabs StartupTabProviderImpl::GetOnboardingTabs(Profile* profile) const {
// Onboarding content has not been launched on Chrome OS.
#if defined(OS_CHROMEOS)
@@ -86,29 +81,9 @@
standard_params.is_supervised_user = profile->IsSupervised();
standard_params.is_force_signin_enabled = signin_util::IsForceSigninEnabled();
+// TODO(scottchen): make win-10 also show NUX onboarding page when its enabled.
+
#if defined(OS_WIN)
-#if defined(GOOGLE_CHROME_BUILD)
- // To avoid diluting data collection, existing users should not be assigned
- // an NUX group. So, the kOnboardDuringNUX flag is used to short-circuit the
- // feature checks below.
- bool onboard_during_nux =
- prefs && prefs->GetBoolean(prefs::kOnboardDuringNUX);
-
- if (onboard_during_nux &&
- base::FeatureList::IsEnabled(nux::kNuxGoogleAppsFeature)) {
- standard_params.is_apps_promo_allowed = true;
- standard_params.has_seen_apps_promo =
- prefs && prefs->GetBoolean(prefs::kHasSeenGoogleAppsPromoPage);
- }
-
- if (onboard_during_nux &&
- base::FeatureList::IsEnabled(nux::kNuxEmailFeature)) {
- standard_params.is_email_promo_allowed = true;
- standard_params.has_seen_email_promo =
- prefs && prefs->GetBoolean(prefs::kHasSeenEmailPromoPage);
- }
-#endif // defined(GOOGLE_CHROME_BUILD)
-
// Windows 10 has unique onboarding policies and content.
if (base::win::GetVersion() >= base::win::VERSION_WIN10) {
Win10OnboardingTabsParams win10_params;
@@ -228,19 +203,6 @@
// static
StartupTabs StartupTabProviderImpl::GetStandardOnboardingTabsForState(
const StandardOnboardingTabsParams& params) {
-#if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
- // Should be shown before any other new user experience.
- if (ShouldShowNewUserExperience(params.is_apps_promo_allowed,
- params.has_seen_apps_promo)) {
- return StartupTabs({StartupTab(GURL(nux::kNuxGoogleAppsUrl), false)});
- }
-
- if (ShouldShowNewUserExperience(params.is_email_promo_allowed,
- params.has_seen_email_promo)) {
- return StartupTabs({StartupTab(GURL(nux::kNuxEmailUrl), false)});
- }
-#endif // defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
-
StartupTabs tabs;
if (CanShowWelcome(params.is_signin_allowed, params.is_supervised_user,
params.is_force_signin_enabled) &&
@@ -271,19 +233,6 @@
StartupTabs StartupTabProviderImpl::GetWin10OnboardingTabsForState(
const StandardOnboardingTabsParams& standard_params,
const Win10OnboardingTabsParams& win10_params) {
-#if defined(GOOGLE_CHROME_BUILD)
- // Should be shown before any other new user experience.
- if (ShouldShowNewUserExperience(standard_params.is_apps_promo_allowed,
- standard_params.has_seen_apps_promo)) {
- return StartupTabs({StartupTab(GURL(nux::kNuxGoogleAppsUrl), false)});
- }
-
- if (ShouldShowNewUserExperience(standard_params.is_email_promo_allowed,
- standard_params.has_seen_email_promo)) {
- return StartupTabs({StartupTab(GURL(nux::kNuxEmailUrl), false)});
- }
-#endif // defined(GOOGLE_CHROME_BUILD)
-
if (CanShowWin10Welcome(win10_params.set_default_browser_allowed,
standard_params.is_supervised_user) &&
ShouldShowWin10WelcomeForOnboarding(win10_params.has_seen_win10_promo,
@@ -294,14 +243,6 @@
return GetStandardOnboardingTabsForState(standard_params);
}
-
-#if defined(GOOGLE_CHROME_BUILD)
-// static
-bool StartupTabProviderImpl::ShouldShowNewUserExperience(bool is_promo_allowed,
- bool has_seen_promo) {
- return is_promo_allowed && !has_seen_promo;
-}
-#endif // defined(GOOGLE_CHROME_BUILD)
#endif // defined(OS_WIN)
// static
diff --git a/chrome/browser/ui/startup/startup_tab_provider.h b/chrome/browser/ui/startup/startup_tab_provider.h
index 352c606..c7874ca78 100644
--- a/chrome/browser/ui/startup/startup_tab_provider.h
+++ b/chrome/browser/ui/startup/startup_tab_provider.h
@@ -65,9 +65,6 @@
class StartupTabProviderImpl : public StartupTabProvider {
public:
struct StandardOnboardingTabsParams {
- StandardOnboardingTabsParams();
- ~StandardOnboardingTabsParams();
-
bool is_first_run = false;
bool has_seen_welcome_page = false;
bool is_signin_allowed = false;
@@ -75,12 +72,6 @@
bool is_signin_in_progress = false;
bool is_supervised_user = false;
bool is_force_signin_enabled = false;
-#if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
- bool has_seen_apps_promo = false;
- bool is_apps_promo_allowed = false;
- bool has_seen_email_promo = false;
- bool is_email_promo_allowed = false;
-#endif // defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
};
struct Win10OnboardingTabsParams {
@@ -127,13 +118,6 @@
static StartupTabs GetWin10OnboardingTabsForState(
const StandardOnboardingTabsParams& standard_params,
const Win10OnboardingTabsParams& win10_params);
-
-#if defined(GOOGLE_CHROME_BUILD)
- // Returns true if showing one of the new user experience experiments is
- // permissible.
- static bool ShouldShowNewUserExperience(bool is_promo_allowed,
- bool has_seen_promo);
-#endif // defined(GOOGLE_CHROME_BUILD)
#endif // defined(OS_WIN)
// Processes first run URLs specified in Master Preferences file, replacing
diff --git a/chrome/browser/ui/webui/welcome/nux/google_apps_handler.cc b/chrome/browser/ui/webui/welcome/nux/google_apps_handler.cc
index c36b9a7..bdc6a12 100644
--- a/chrome/browser/ui/webui/welcome/nux/google_apps_handler.cc
+++ b/chrome/browser/ui/webui/welcome/nux/google_apps_handler.cc
@@ -9,7 +9,6 @@
#include "base/metrics/histogram_macros.h"
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/ui/webui/welcome/nux/show_promo_delegate.h"
#include "chrome/grit/browser_resources.h"
#include "chrome/grit/generated_resources.h"
#include "components/bookmarks/browser/bookmark_model.h"
@@ -124,11 +123,6 @@
// Enable bookmark bar.
prefs_->SetBoolean(bookmarks::prefs::kShowBookmarkBar, true);
- // Show bookmark bubble.
- ShowPromoDelegate::CreatePromoDelegate(
- IDS_NUX_GOOGLE_APPS_DESCRIPTION_PROMO_BUBBLE)
- ->ShowForNode(bookmark_model_->bookmark_bar_node()->GetChild(0));
-
UMA_HISTOGRAM_ENUMERATION(kGoogleAppsInteractionHistogram,
GoogleAppsInteraction::kGetStarted,
GoogleAppsInteraction::kCount);
diff --git a/chrome/browser/ui/webui/welcome/nux_helper.cc b/chrome/browser/ui/webui/welcome/nux_helper.cc
index a9617a4..6e42b69 100644
--- a/chrome/browser/ui/webui/welcome/nux_helper.cc
+++ b/chrome/browser/ui/webui/welcome/nux_helper.cc
@@ -5,13 +5,9 @@
#include "chrome/browser/ui/webui/welcome/nux_helper.h"
#include "base/feature_list.h"
#include "build/build_config.h"
-
-// TODO(scottchen): remove #if guard once components/nux/ is moved to
-// chrome/browser/ui/webui/welcome/ and included by non-win platforms.
-// Also check if it makes sense to merge nux_helper.* with nux/constants.*.
-#if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
#include "chrome/browser/ui/webui/welcome/nux/constants.h"
-#endif // defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
+#include "chrome/common/pref_names.h"
+#include "components/prefs/pref_service.h"
namespace nux {
// This feature flag is used to force the feature to be turned on for non-win
@@ -19,12 +15,20 @@
extern const base::Feature kNuxOnboardingForceEnabled{
"NuxOnboardingForceEnabled", base::FEATURE_DISABLED_BY_DEFAULT};
-bool IsNuxOnboardingEnabled() {
+bool IsNuxOnboardingEnabled(Profile* profile) {
if (base::FeatureList::IsEnabled(nux::kNuxOnboardingForceEnabled)) {
return true;
} else {
#if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
- return base::FeatureList::IsEnabled(nux::kNuxOnboardingFeature);
+ // To avoid diluting data collection, existing users should not be assigned
+ // an NUX group. So, the kOnboardDuringNUX flag is used to short-circuit the
+ // feature checks below.
+ PrefService* prefs = profile->GetPrefs();
+ bool onboard_during_nux =
+ prefs && prefs->GetBoolean(prefs::kOnboardDuringNUX);
+
+ return onboard_during_nux &&
+ base::FeatureList::IsEnabled(nux::kNuxOnboardingFeature);
#else
return false;
#endif // defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
diff --git a/chrome/browser/ui/webui/welcome/nux_helper.h b/chrome/browser/ui/webui/welcome/nux_helper.h
index b27b3373..0e4019c 100644
--- a/chrome/browser/ui/webui/welcome/nux_helper.h
+++ b/chrome/browser/ui/webui/welcome/nux_helper.h
@@ -6,9 +6,12 @@
#define CHROME_BROWSER_UI_WEBUI_WELCOME_NUX_HELPER_H_
#include "base/macros.h"
+#include "chrome/browser/profiles/profile.h"
+
+class Profile;
namespace nux {
-bool IsNuxOnboardingEnabled();
-}; // namespace nux
+bool IsNuxOnboardingEnabled(Profile* profile);
+} // namespace nux
#endif // CHROME_BROWSER_UI_WEBUI_WELCOME_NUX_HELPER_H_
diff --git a/chrome/browser/ui/webui/welcome/welcome_ui.cc b/chrome/browser/ui/webui/welcome/welcome_ui.cc
index 53ae802..1945d08 100644
--- a/chrome/browser/ui/webui/welcome/welcome_ui.cc
+++ b/chrome/browser/ui/webui/welcome/welcome_ui.cc
@@ -7,9 +7,16 @@
#include <memory>
#include <string>
+#include "base/metrics/histogram_macros.h"
#include "build/build_config.h"
+#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/favicon/favicon_service_factory.h"
#include "chrome/browser/signin/account_consistency_mode_manager.h"
+#include "chrome/browser/ui/webui/welcome/nux/constants.h"
+#include "chrome/browser/ui/webui/welcome/nux/email_handler.h"
+#include "chrome/browser/ui/webui/welcome/nux/google_apps_handler.h"
+#include "chrome/browser/ui/webui/welcome/nux/set_as_default_handler.h"
+#include "chrome/browser/ui/webui/welcome/nux/show_promo_delegate.h"
#include "chrome/browser/ui/webui/welcome/nux_helper.h"
#include "chrome/browser/ui/webui/welcome/welcome_handler.h"
#include "chrome/common/pref_names.h"
@@ -18,21 +25,11 @@
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
#include "components/prefs/pref_service.h"
+#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui_data_source.h"
#include "net/base/url_util.h"
#include "ui/base/l10n/l10n_util.h"
-#if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
-#include "base/metrics/histogram_macros.h"
-#include "chrome/browser/bookmarks/bookmark_model_factory.h"
-#include "chrome/browser/ui/webui/welcome/nux/constants.h"
-#include "chrome/browser/ui/webui/welcome/nux/email_handler.h"
-#include "chrome/browser/ui/webui/welcome/nux/google_apps_handler.h"
-#include "chrome/browser/ui/webui/welcome/nux/set_as_default_handler.h"
-#include "chrome/browser/ui/webui/welcome/nux/show_promo_delegate.h"
-#include "content/public/browser/web_contents.h"
-#endif // defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
-
namespace {
const bool kIsBranded =
#if defined(GOOGLE_CHROME_BUILD)
@@ -53,7 +50,7 @@
return;
}
- StorePageSeen(profile, url);
+ StorePageSeen(profile);
web_ui->AddMessageHandler(std::make_unique<WelcomeHandler>(web_ui));
@@ -68,7 +65,7 @@
html_source->AddResourcePath("logo.png", IDR_PRODUCT_LOGO_128);
html_source->AddResourcePath("logo2x.png", IDR_PRODUCT_LOGO_256);
- if (nux::IsNuxOnboardingEnabled()) {
+ if (nux::IsNuxOnboardingEnabled(profile)) {
// Add Onboarding welcome strings.
html_source->AddLocalizedString("headerText", IDS_WELCOME_HEADER);
html_source->AddLocalizedString("acceptText", IDS_WELCOME_ACCEPT_BUTTON);
@@ -98,6 +95,30 @@
html_source->AddResourcePath(
"welcome_browser_proxy.js",
IDR_WELCOME_ONBOARDING_WELCOME_WELCOME_BROWSER_PROXY_JS);
+
+ // Add resources shared by the NUX modules.
+ html_source->AddResourcePath("shared/chooser_shared_css.html",
+ IDR_NUX_CHOOSER_SHARED_CSS);
+
+ // Add email provider bookmarking onboarding module.
+ web_ui->AddMessageHandler(std::make_unique<nux::EmailHandler>(
+ profile->GetPrefs(), FaviconServiceFactory::GetForProfile(
+ profile, ServiceAccessType::EXPLICIT_ACCESS)));
+ nux::EmailHandler::AddSources(html_source, profile->GetPrefs());
+
+ // Add google apps bookmarking onboarding module.
+ content::BrowserContext* browser_context =
+ web_ui->GetWebContents()->GetBrowserContext();
+ web_ui->AddMessageHandler(std::make_unique<nux::GoogleAppsHandler>(
+ profile->GetPrefs(),
+ FaviconServiceFactory::GetForProfile(
+ profile, ServiceAccessType::EXPLICIT_ACCESS),
+ BookmarkModelFactory::GetForBrowserContext(browser_context)));
+ nux::GoogleAppsHandler::AddSources(html_source);
+
+ // Add set-as-default onboarding module.
+ web_ui->AddMessageHandler(std::make_unique<nux::SetAsDefaultHandler>());
+ nux::SetAsDefaultHandler::AddSources(html_source);
} else if (kIsBranded && is_dice) {
// Use special layout if the application is branded and DICE is enabled.
html_source->AddLocalizedString("headerText", IDS_WELCOME_HEADER);
@@ -143,78 +164,12 @@
html_source->SetDefaultResource(IDR_WELCOME_HTML);
}
-#if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
- // TODO(hcarmona): Move this behind nux::kNuxOnboardingFeature when email and
- // apps experiments end.
- html_source->AddResourcePath("shared/chooser_shared_css.html",
- IDR_NUX_CHOOSER_SHARED_CSS);
-
- if (base::FeatureList::IsEnabled(nux::kNuxOnboardingFeature)) {
- web_ui->AddMessageHandler(std::make_unique<nux::SetAsDefaultHandler>());
- nux::SetAsDefaultHandler::AddSources(html_source);
-
- // TODO(scottchen): move all NUX features under this flag once individual
- // experiments launch.
- }
-
- // To avoid diluting data collection, existing users should not be assigned
- // an NUX group. So, the kOnboardDuringNUX flag is used to short-circuit the
- // feature checks below.
- PrefService* prefs = profile->GetPrefs();
- bool onboard_during_nux =
- prefs && prefs->GetBoolean(prefs::kOnboardDuringNUX);
-
- if (onboard_during_nux &&
- base::FeatureList::IsEnabled(nux::kNuxEmailFeature)) {
- web_ui->AddMessageHandler(std::make_unique<nux::EmailHandler>(
- profile->GetPrefs(), FaviconServiceFactory::GetForProfile(
- profile, ServiceAccessType::EXPLICIT_ACCESS)));
-
- nux::EmailHandler::AddSources(html_source, profile->GetPrefs());
- }
-
- if (onboard_during_nux &&
- base::FeatureList::IsEnabled(nux::kNuxGoogleAppsFeature)) {
- content::BrowserContext* browser_context =
- web_ui->GetWebContents()->GetBrowserContext();
- web_ui->AddMessageHandler(std::make_unique<nux::GoogleAppsHandler>(
- profile->GetPrefs(),
- FaviconServiceFactory::GetForProfile(
- profile, ServiceAccessType::EXPLICIT_ACCESS),
- BookmarkModelFactory::GetForBrowserContext(browser_context)));
-
- nux::GoogleAppsHandler::AddSources(html_source);
- }
-#endif // defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD
-
content::WebUIDataSource::Add(profile, html_source);
}
WelcomeUI::~WelcomeUI() {}
-void WelcomeUI::StorePageSeen(Profile* profile, const GURL& url) {
-#if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
- if (url.EqualsIgnoringRef(GURL(nux::kNuxGoogleAppsUrl))) {
- // Record that the new user experience page was visited.
- profile->GetPrefs()->SetBoolean(prefs::kHasSeenGoogleAppsPromoPage, true);
-
- // Record UMA.
- UMA_HISTOGRAM_ENUMERATION(nux::kGoogleAppsInteractionHistogram,
- nux::GoogleAppsInteraction::kPromptShown,
- nux::GoogleAppsInteraction::kCount);
- return;
- }
-
- if (url.EqualsIgnoringRef(GURL(nux::kNuxEmailUrl))) {
- // Record that the new user experience page was visited.
- profile->GetPrefs()->SetBoolean(prefs::kHasSeenEmailPromoPage, true);
-
- // TODO(scottchen): Record UMA.
-
- return;
- }
-#endif // defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
-
+void WelcomeUI::StorePageSeen(Profile* profile) {
// Store that this profile has been shown the Welcome page.
profile->GetPrefs()->SetBoolean(prefs::kHasSeenWelcomePage, true);
}
diff --git a/chrome/browser/ui/webui/welcome/welcome_ui.h b/chrome/browser/ui/webui/welcome/welcome_ui.h
index acadd2f..a352818 100644
--- a/chrome/browser/ui/webui/welcome/welcome_ui.h
+++ b/chrome/browser/ui/webui/welcome/welcome_ui.h
@@ -19,7 +19,9 @@
~WelcomeUI() override;
private:
- void StorePageSeen(Profile* profile, const GURL& url);
+ void StorePageSeen(Profile* profile);
+
+ DISALLOW_COPY_AND_ASSIGN(WelcomeUI);
};
#endif // CHROME_BROWSER_UI_WEBUI_WELCOME_WELCOME_UI_H_
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc
index 6cd80827..fc21bf7 100644
--- a/chrome/common/pref_names.cc
+++ b/chrome/common/pref_names.cc
@@ -1269,13 +1269,6 @@
const char kHasSeenWin10PromoPage[] = "browser.has_seen_win10_promo_page";
#if defined(GOOGLE_CHROME_BUILD)
-// Whether or not this profile has been shown the new user experience promo
-// page for google apps.
-const char kHasSeenGoogleAppsPromoPage[] =
- "browser.has_seen_google_apps_promo_page";
-// Whether or not this profile has been shown the new user experience promo
-// page for adding email provider to bookmark.
-const char kHasSeenEmailPromoPage[] = "browser.has_seen_email_promo_page";
// Whether or not this user went through the first-run experience after NUX
// launched. This is necessary for determining which users to keep "tagging"
// with the NUX finch experiment group, and allows a more accurate analysis.
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h
index d724b117..86fe3a9 100644
--- a/chrome/common/pref_names.h
+++ b/chrome/common/pref_names.h
@@ -438,8 +438,6 @@
#if defined(OS_WIN)
extern const char kHasSeenWin10PromoPage[];
#if defined(GOOGLE_CHROME_BUILD)
-extern const char kHasSeenGoogleAppsPromoPage[];
-extern const char kHasSeenEmailPromoPage[];
extern const char kOnboardDuringNUX[];
#endif // defined(GOOGLE_CHROME_BUILD)
#endif // defined(OS_WIN)