| Index: chrome/browser/first_run/first_run.cc
|
| diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc
|
| index 72945a63b443c94302c9cb01c20f054ad132aca1..9f86b2ff8ea542819f0a81eb33a4f7a0c97cf1db 100644
|
| --- a/chrome/browser/first_run/first_run.cc
|
| +++ b/chrome/browser/first_run/first_run.cc
|
| @@ -25,6 +25,7 @@
|
| #include "chrome/browser/chrome_notification_types.h"
|
| #include "chrome/browser/extensions/extension_service.h"
|
| #include "chrome/browser/extensions/updater/extension_updater.h"
|
| +#include "chrome/browser/first_run/first_run_features.h"
|
| #include "chrome/browser/first_run/first_run_internal.h"
|
| #include "chrome/browser/google/google_brand.h"
|
| #include "chrome/browser/importer/external_process_importer_host.h"
|
| @@ -74,6 +75,10 @@
|
| #include "ui/base/l10n/l10n_util.h"
|
| #include "url/gurl.h"
|
|
|
| +#if defined(OS_WIN)
|
| +#include "base/win/windows_version.h"
|
| +#endif
|
| +
|
| namespace content {
|
| class BrowserContext;
|
| }
|
| @@ -82,6 +87,11 @@ using base::UserMetricsAction;
|
|
|
| namespace {
|
|
|
| +// Constants: Magic words used by Master Prefs files to indicate that internal
|
| +// pages should appear on first run.
|
| +constexpr char kNewTabKeyword[] = "new_tab_page";
|
| +constexpr char kWelcomePageKeyword[] = "welcome_page";
|
| +
|
| // A bitfield formed from values in AutoImportState to record the state of
|
| // AutoImport. This is used in testing to verify import startup actions that
|
| // occur before an observer can be registered in the test.
|
| @@ -492,6 +502,15 @@ void ProcessDefaultBrowserPolicy(bool make_chrome_default_for_user) {
|
| }
|
| }
|
|
|
| +// Returns true iff the current OS is Windows and the version is >= 10.
|
| +bool IsWin10() {
|
| +#if defined(OS_WIN)
|
| + return base::win::GetVersion() >= base::win::VERSION_WIN10;
|
| +#else
|
| + return false;
|
| +#endif
|
| +}
|
| +
|
| } // namespace
|
|
|
| namespace first_run {
|
| @@ -647,6 +666,11 @@ bool IsChromeFirstRun() {
|
| return internal::g_first_run == internal::FIRST_RUN_TRUE;
|
| }
|
|
|
| +void SetFirstRunForTesting(bool is_first_run) {
|
| + internal::g_first_run =
|
| + is_first_run ? internal::FIRST_RUN_TRUE : internal::FIRST_RUN_FALSE;
|
| +}
|
| +
|
| #if defined(OS_MACOSX)
|
| bool IsFirstRunSuppressed(const base::CommandLine& command_line) {
|
| return command_line.HasSwitch(switches::kNoFirstRun);
|
| @@ -714,6 +738,39 @@ bool ShouldShowWelcomePage() {
|
| return retval;
|
| }
|
|
|
| +GURL GetWelcomePageURL() {
|
| + // TODO(tmartino): Once Consolidated FRE page is implemented, return that
|
| + // here when kUseConsolidatedFirstRun is true.
|
| + return GURL(l10n_util::GetStringUTF8(IDS_WELCOME_PAGE_URL));
|
| +}
|
| +
|
| +std::vector<GURL> GetOnboardingTabs() {
|
| + std::vector<GURL> tabs;
|
| + if (IsWin10()) {
|
| + // TODO(tmartino): Win 10 logic is more complex and will be added in its
|
| + // own change.
|
| + } else if (IsChromeFirstRun()) {
|
| + tabs.push_back(GetWelcomePageURL());
|
| + }
|
| + return tabs;
|
| +}
|
| +
|
| +std::vector<GURL> ProcessMasterPrefsTabs(const std::vector<GURL>& tabs) {
|
| + std::vector<GURL> processed_tabs;
|
| + if (IsChromeFirstRun()) {
|
| + for (const GURL& tab : tabs) {
|
| + if (tab.host() == kNewTabKeyword) {
|
| + processed_tabs.push_back(GURL(chrome::kChromeUINewTabURL));
|
| + } else if (tab.host() == kWelcomePageKeyword) {
|
| + processed_tabs.push_back(GetWelcomePageURL());
|
| + } else {
|
| + processed_tabs.push_back(tab);
|
| + }
|
| + }
|
| + }
|
| + return processed_tabs;
|
| +}
|
| +
|
| void SetShouldDoPersonalDataManagerFirstRun() {
|
| g_should_do_autofill_personal_data_manager_first_run = true;
|
| }
|
|
|