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..f0d6a6b19d1755e8d6f451521e3dfc4bf32a2334 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" |
@@ -82,6 +83,11 @@ using base::UserMetricsAction; |
namespace { |
+// Constants: Magic words used by Master Prefs files to indicate that internal |
+// pages should appear on first run. |
+const char* kNewTabMagicWord = "new_tab_page"; |
+const char* kWelcomePageMagicWord = "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. |
@@ -491,7 +497,6 @@ void ProcessDefaultBrowserPolicy(bool make_chrome_default_for_user) { |
} |
} |
} |
- |
} // namespace |
namespace first_run { |
@@ -647,6 +652,14 @@ bool IsChromeFirstRun() { |
return internal::g_first_run == internal::FIRST_RUN_TRUE; |
} |
+void SetFirstRunForTesting(bool is_first_run) { |
+ if (is_first_run) { |
+ internal::g_first_run = internal::FIRST_RUN_TRUE; |
+ } else { |
+ internal::g_first_run = internal::FIRST_RUN_FALSE; |
+ } |
+} |
Roger Tawa OOO till Jul 10th
2016/07/26 15:00:26
Nit:
internal::g_first_run =
is_first_run
tmartino
2016/07/27 18:40:43
Done.
|
+ |
#if defined(OS_MACOSX) |
bool IsFirstRunSuppressed(const base::CommandLine& command_line) { |
return command_line.HasSwitch(switches::kNoFirstRun); |
@@ -714,6 +727,50 @@ bool ShouldShowWelcomePage() { |
return retval; |
} |
+GURL GetWelcomePageURL() { |
+ if (base::FeatureList::IsEnabled(features::kUseNewFirstRun)) { |
+ return GURL("http://www.startribune.com"); |
+ } else { |
+ return GURL(l10n_util::GetStringUTF8(IDS_WELCOME_PAGE_URL)); |
+ } |
+} |
+ |
+bool IsWin10() { |
+#if defined(OS_WIN) |
+ return os_info->version() >= base::win::VERSION_WIN10; |
+#else |
+ return false; |
+#endif |
+} |
+ |
+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. |
+ NOTREACHED(); |
+ } else if (IsChromeFirstRun()) { |
+ tabs.push_back(GetWelcomePageURL()); |
+ } |
+ return tabs; |
+} |
Roger Tawa OOO till Jul 10th
2016/07/26 15:00:26
Might be better to move some parts of GetOnboardin
tmartino
2016/07/27 18:40:43
Hmm. I've thought about this a bit and the best wa
|
+ |
+std::vector<GURL> ProcessMasterPrefsTabs(const std::vector<GURL>& tabs) { |
+ std::vector<GURL> processed_tabs; |
+ if (IsChromeFirstRun()) { |
+ for (GURL tab : tabs) { |
+ if (tab.host() == kNewTabMagicWord) { |
+ processed_tabs.push_back(GURL(chrome::kChromeUINewTabURL)); |
+ } else if (tab.host() == kWelcomePageMagicWord) { |
+ 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; |
} |