diff options
-rw-r--r-- | chrome/browser/chrome_browser_main.cc | 111 | ||||
-rw-r--r-- | chrome/browser/chrome_browser_main.h | 5 | ||||
-rw-r--r-- | chrome/browser/chrome_browser_main_extra_parts.h | 2 | ||||
-rw-r--r-- | chrome/browser/chrome_browser_main_win.cc | 23 | ||||
-rw-r--r-- | chrome/browser/chrome_browser_main_win.h | 1 | ||||
-rw-r--r-- | chrome/browser/first_run/first_run.cc | 12 | ||||
-rw-r--r-- | chrome/browser/first_run/first_run.h | 8 | ||||
-rw-r--r-- | chrome/browser/first_run/first_run_browsertest.cc | 5 | ||||
-rw-r--r-- | chrome/browser/first_run/first_run_internal.h | 2 | ||||
-rw-r--r-- | chrome/browser/first_run/first_run_posix.cc | 16 | ||||
-rw-r--r-- | chrome/browser/first_run/first_run_win.cc | 22 | ||||
-rw-r--r-- | chrome/browser/process_singleton_browsertest.cc | 4 | ||||
-rw-r--r-- | chrome/common/chrome_switches.cc | 13 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 3 | ||||
-rw-r--r-- | chrome/common/switch_utils.cc | 2 | ||||
-rw-r--r-- | chrome/common/switch_utils_unittest.cc | 4 | ||||
-rw-r--r-- | chrome/installer/setup/setup_main.cc | 2 |
17 files changed, 113 insertions, 122 deletions
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index dd7f5fa..07e9876 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc @@ -489,8 +489,7 @@ ChromeBrowserMainParts::ChromeBrowserMainParts( profile_(NULL), run_message_loop_(true), notify_result_(ProcessSingleton::PROCESS_NONE), - is_first_run_(false), - first_run_ui_bypass_(false), + do_first_run_tasks_(false), local_state_(NULL), restart_last_session_(false) { // If we're running tests (ui_task is non-null). @@ -690,16 +689,26 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() { << "Must be able to get user data directory!"; #endif + // Whether this is First Run. |do_first_run_tasks_| should be prefered to this + // unless the desire is actually to know whether this is really First Run + // (i.e., even if --no-first-run is passed). + bool is_first_run = false; // Android's first run is done in Java instead of native. #if !defined(OS_ANDROID) + process_singleton_.reset(new ProcessSingleton(user_data_dir_)); // Ensure ProcessSingleton won't process messages too early. It will be // unlocked in PostBrowserStart(). process_singleton_->Lock(NULL); - is_first_run_ = - (first_run::IsChromeFirstRun() || - parsed_command_line().HasSwitch(switches::kFirstRun)) && + bool force_first_run = + parsed_command_line().HasSwitch(switches::kForceFirstRun); + bool force_skip_first_run_tasks = + (!force_first_run && + parsed_command_line().HasSwitch(switches::kNoFirstRun)); + + is_first_run = + (force_first_run || first_run::IsChromeFirstRun()) && !ProfileManager::IsImportProcess(parsed_command_line()); #endif @@ -733,7 +742,7 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() { local_state_ = InitializeLocalState(local_state_task_runner, parsed_command_line(), - is_first_run_); + is_first_run); // These members must be initialized before returning from this function. master_prefs_.reset(new first_run::MasterPrefs); @@ -800,29 +809,30 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() { // On first run, we need to process the predictor preferences before the // browser's profile_manager object is created, but after ResourceBundle // is initialized. - first_run_ui_bypass_ = false; // True to skip first run UI. - if (is_first_run_) { + if (is_first_run) { first_run::ProcessMasterPreferencesResult pmp_result = first_run::ProcessMasterPreferences(user_data_dir_, master_prefs_.get()); if (pmp_result == first_run::EULA_EXIT_NOW) return chrome::RESULT_CODE_EULA_REFUSED; - first_run_ui_bypass_ = (pmp_result == first_run::SKIP_FIRST_RUN); - - AddFirstRunNewTabs(browser_creator_.get(), master_prefs_->new_tabs); - - // If we are running in App mode, we do not want to show the importer - // (first run) UI. - if (!first_run_ui_bypass_ && - (parsed_command_line().HasSwitch(switches::kApp) || - parsed_command_line().HasSwitch(switches::kAppId) || - parsed_command_line().HasSwitch(switches::kNoFirstRun))) - first_run_ui_bypass_ = true; - - // Create Sentinel if no-first-run argument is passed in. - if (parsed_command_line().HasSwitch(switches::kNoFirstRun)) + // Do first run tasks unless: + // - Explicitly forced not to by |force_skip_first_run_tasks| or + // |pmp_result|. + // - Running in App mode, where showing the importer (first run) UI is + // undesired. + do_first_run_tasks_ = (!force_skip_first_run_tasks && + pmp_result != first_run::SKIP_FIRST_RUN_TASKS && + !parsed_command_line().HasSwitch(switches::kApp) && + !parsed_command_line().HasSwitch(switches::kAppId)); + + if (do_first_run_tasks_) { + AddFirstRunNewTabs(browser_creator_.get(), master_prefs_->new_tabs); + } else if (parsed_command_line().HasSwitch(switches::kNoFirstRun)) { + // Create the First Run beacon anyways if --no-first-run was passed on the + // command line. first_run::CreateSentinel(); + } } #endif @@ -884,10 +894,6 @@ void ChromeBrowserMainParts::PreMainMessageLoopRun() { // ... additional setup, including CreateProfile() // PostProfileInit() // ... additional setup -// PreInteractiveFirstRunInit() -// ... first_run::AutoImport() -// PostInteractiveFirstRunInit() -// ... additional setup // PreBrowserStart() // ... browser_creator_->Start (OR parameters().ui_task->Run()) // PostBrowserStart() @@ -903,16 +909,6 @@ void ChromeBrowserMainParts::PostProfileInit() { chrome_extra_parts_[i]->PostProfileInit(); } -void ChromeBrowserMainParts::PreInteractiveFirstRunInit() { - for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) - chrome_extra_parts_[i]->PreInteractiveFirstRunInit(); -} - -void ChromeBrowserMainParts::PostInteractiveFirstRunInit() { - for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) - chrome_extra_parts_[i]->PostInteractiveFirstRunInit(); -} - void ChromeBrowserMainParts::PreBrowserStart() { for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) chrome_extra_parts_[i]->PreBrowserStart(); @@ -1122,7 +1118,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { // Profile creation ---------------------------------------------------------- - if (is_first_run_) { + if (do_first_run_tasks_) { // Warn the ProfileManager that an import process will run, possibly // locking the WebDataService directory of the next Profile created. browser_process_->profile_manager()->SetWillImport(); @@ -1192,31 +1188,14 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { // Note that this be done _after_ the PrefService is initialized and all // preferences are registered, since some of the code that the importer // touches reads preferences. - if (is_first_run_) { - PreInteractiveFirstRunInit(); - - if (!first_run_ui_bypass_ || - parsed_command_line().HasSwitch(switches::kFirstRunForceImport)) { - first_run::AutoImport(profile_, - master_prefs_->homepage_defined, - master_prefs_->do_import_items, - master_prefs_->dont_import_items, - process_singleton_.get()); - first_run::DoFirstRunTasks(profile_, master_prefs_->make_chrome_default); -#if defined(OS_POSIX) && !defined(OS_CHROMEOS) - // TODO(thakis): Look into moving this POSIX-specific section to - // ChromeBrowserMainPartsPosix::PostInteractiveFirstRunInit(). - - // On Windows, the download is tagged with enable/disable stats so there - // is no need for this code. - - // If stats reporting was turned on by the first run dialog then toggle - // the pref. - if (GoogleUpdateSettings::GetCollectStatsConsent()) - local_state_->SetBoolean(prefs::kMetricsReportingEnabled, true); -#endif // OS_POSIX && !OS_CHROMEOS - } // if (!first_run_ui_bypass_) - PostInteractiveFirstRunInit(); + if (do_first_run_tasks_) { + first_run::AutoImport(profile_, + master_prefs_->homepage_defined, + master_prefs_->do_import_items, + master_prefs_->dont_import_items, + process_singleton_.get()); + // Note: this can pop the first run consent dialog on linux. + first_run::DoPostImportTasks(profile_, master_prefs_->make_chrome_default); browser_process_->profile_manager()->OnImportFinished(profile_); @@ -1226,7 +1205,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { } else { browser_creator_->set_is_default_browser_dialog_suppressed(true); } - } // if (is_first_run_) + } // if (do_first_run_tasks_) #endif // !defined(OS_ANDROID) #if defined(OS_WIN) @@ -1260,12 +1239,12 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { // file thread to be run sometime later. If this is the first run we record // the installation event. PrefService* pref_service = profile_->GetPrefs(); - int ping_delay = is_first_run_ ? master_prefs_->ping_delay : + int ping_delay = do_first_run_tasks_ ? master_prefs_->ping_delay : pref_service->GetInteger(first_run::GetPingDelayPrefName().c_str()); // Negative ping delay means to send ping immediately after a first search is // recorded. RLZTracker::InitRlzFromProfileDelayed( - profile_, is_first_run_, ping_delay < 0, + profile_, do_first_run_tasks_, ping_delay < 0, base::TimeDelta::FromMilliseconds(abs(ping_delay))); #endif // defined(ENABLE_RLZ) && !defined(OS_CHROMEOS) @@ -1362,7 +1341,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { #if defined(OS_WIN) // We check this here because if the profile is OTR (chromeos possibility) // it won't still be accessible after browser is destroyed. - record_search_engine_ = is_first_run_ && !profile_->IsOffTheRecord(); + record_search_engine_ = do_first_run_tasks_ && !profile_->IsOffTheRecord(); #endif // Create the instance of the cloud print proxy service so that it can launch diff --git a/chrome/browser/chrome_browser_main.h b/chrome/browser/chrome_browser_main.h index 5e7cf1e..4250951 100644 --- a/chrome/browser/chrome_browser_main.h +++ b/chrome/browser/chrome_browser_main.h @@ -78,8 +78,6 @@ class ChromeBrowserMainParts : public content::BrowserMainParts { // in order from PreMainMessageLoopRun(). See implementation for details. virtual void PreProfileInit(); virtual void PostProfileInit(); - virtual void PreInteractiveFirstRunInit(); - virtual void PostInteractiveFirstRunInit(); virtual void PreBrowserStart(); virtual void PostBrowserStart(); @@ -185,8 +183,7 @@ class ChromeBrowserMainParts : public content::BrowserMainParts { // Members initialized in PreMainMessageLoopRun, needed in // PreMainMessageLoopRunThreadsCreated. - bool is_first_run_; - bool first_run_ui_bypass_; + bool do_first_run_tasks_; PrefService* local_state_; FilePath user_data_dir_; diff --git a/chrome/browser/chrome_browser_main_extra_parts.h b/chrome/browser/chrome_browser_main_extra_parts.h index 0904ed6..4ba21198 100644 --- a/chrome/browser/chrome_browser_main_extra_parts.h +++ b/chrome/browser/chrome_browser_main_extra_parts.h @@ -38,8 +38,6 @@ class ChromeBrowserMainExtraParts { // MainMessageLoopRun methods. virtual void PreProfileInit() {} virtual void PostProfileInit() {} - virtual void PreInteractiveFirstRunInit() {} - virtual void PostInteractiveFirstRunInit() {} virtual void PreBrowserStart() {} virtual void PostBrowserStart() {} virtual void PreMainMessageLoopRun() {} diff --git a/chrome/browser/chrome_browser_main_win.cc b/chrome/browser/chrome_browser_main_win.cc index 5e959c4..67850ba 100644 --- a/chrome/browser/chrome_browser_main_win.cc +++ b/chrome/browser/chrome_browser_main_win.cc @@ -17,8 +17,6 @@ #include "base/path_service.h" #include "base/scoped_native_library.h" #include "base/string_number_conversions.h" -#include "base/threading/sequenced_worker_pool.h" -#include "base/time.h" #include "base/utf_string_conversions.h" #include "base/win/metro.h" #include "base/win/text_services_message_filter.h" @@ -43,7 +41,6 @@ #include "chrome/installer/util/install_util.h" #include "chrome/installer/util/l10n_string_util.h" #include "chrome/installer/util/shell_util.h" -#include "content/public/browser/browser_thread.h" #include "content/public/common/main_function_params.h" #include "grit/app_locale_settings.h" #include "grit/chromium_strings.h" @@ -230,26 +227,6 @@ void ChromeBrowserMainPartsWin::PreMainMessageLoopRun() { removable_device_notifications_window_->Init(); } -void ChromeBrowserMainPartsWin::PreInteractiveFirstRunInit() { - // Trigger the Active Setup command for system-level Chromes to finish - // configuring this user's install (e.g. per-user shortcuts). - // Delay the task slightly to give Chrome launch I/O priority while also - // making sure shortcuts are created promptly to avoid annoying the user by - // re-creating shortcuts he previously deleted. - static const int64 kTiggerActiveSetupDelaySeconds = 5; - FilePath chrome_exe; - if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { - NOTREACHED(); - } else if (!InstallUtil::IsPerUserInstall(chrome_exe.value().c_str())) { - content::BrowserThread::GetBlockingPool()->PostDelayedTask( - FROM_HERE, - base::Bind(&InstallUtil::TriggerActiveSetupCommand), - base::TimeDelta::FromSeconds(kTiggerActiveSetupDelaySeconds)); - } - - ChromeBrowserMainParts::PreInteractiveFirstRunInit(); -} - void ChromeBrowserMainPartsWin::ShowMissingLocaleMessageBox() { ui::MessageBox(NULL, ASCIIToUTF16(chrome_browser::kMissingLocaleDataMessage), ASCIIToUTF16(chrome_browser::kMissingLocaleDataTitle), diff --git a/chrome/browser/chrome_browser_main_win.h b/chrome/browser/chrome_browser_main_win.h index 5cbc59b..7ea8b34 100644 --- a/chrome/browser/chrome_browser_main_win.h +++ b/chrome/browser/chrome_browser_main_win.h @@ -36,7 +36,6 @@ class ChromeBrowserMainPartsWin : public ChromeBrowserMainParts { virtual void PreMainMessageLoopRun() OVERRIDE; // ChromeBrowserMainParts overrides. - virtual void PreInteractiveFirstRunInit() OVERRIDE; virtual void ShowMissingLocaleMessageBox() OVERRIDE; // Prepares the localized strings that are going to be displayed to diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc index 2e1693f..a829438 100644 --- a/chrome/browser/first_run/first_run.cc +++ b/chrome/browser/first_run/first_run.cc @@ -556,14 +556,14 @@ ProcessMasterPreferencesResult ProcessMasterPreferences( // Chrome OS has its own out-of-box-experience code. Create the sentinel to // mark the fact that we've run once but skip the full first-run flow. CreateSentinel(); - return SKIP_FIRST_RUN; + return SKIP_FIRST_RUN_TASKS; #endif FilePath master_prefs_path; scoped_ptr<installer::MasterPreferences> install_prefs(internal::LoadMasterPrefs(&master_prefs_path)); if (!install_prefs.get()) - return SHOW_FIRST_RUN; + return DO_FIRST_RUN_TASKS; out_prefs->new_tabs = install_prefs->GetFirstRunTabs(); @@ -573,7 +573,7 @@ ProcessMasterPreferencesResult ProcessMasterPreferences( return EULA_EXIT_NOW; if (!internal::CopyPrefFile(user_data_dir, master_prefs_path)) - return SHOW_FIRST_RUN; + return DO_FIRST_RUN_TASKS; DoDelayedInstallExtensionsIfNeeded(install_prefs.get()); @@ -583,7 +583,7 @@ ProcessMasterPreferencesResult ProcessMasterPreferences( internal::SetImportPreferencesAndLaunchImport(out_prefs, install_prefs.get()); internal::SetDefaultBrowser(install_prefs.get()); - return SHOW_FIRST_RUN; + return DO_FIRST_RUN_TASKS; } void AutoImport( @@ -678,7 +678,7 @@ void AutoImport( #endif // !defined(USE_AURA) } -void DoFirstRunTasks(Profile* profile, bool make_chrome_default) { +void DoPostImportTasks(Profile* profile, bool make_chrome_default) { if (make_chrome_default && ShellIntegration::CanSetAsDefaultBrowser() == ShellIntegration::SET_DEFAULT_UNATTENDED) { @@ -704,6 +704,8 @@ void DoFirstRunTasks(Profile* profile, bool make_chrome_default) { SetShowWelcomePagePref(); SetPersonalDataManagerFirstRunPref(); #endif // !defined(USE_AURA) + + internal::DoPostImportPlatformSpecificTasks(); } } // namespace first_run diff --git a/chrome/browser/first_run/first_run.h b/chrome/browser/first_run/first_run.h index 31524e3..d289c95 100644 --- a/chrome/browser/first_run/first_run.h +++ b/chrome/browser/first_run/first_run.h @@ -50,8 +50,8 @@ enum FirstRunBubbleOptions { }; enum ProcessMasterPreferencesResult { - SHOW_FIRST_RUN = 0, // Should show the first run flow. - SKIP_FIRST_RUN, // Should skip the first run flow. + DO_FIRST_RUN_TASKS = 0, // Should do the first run tasks. + SKIP_FIRST_RUN_TASKS, // Should skip the first run tasks. EULA_EXIT_NOW, // Should immediately exit due to EULA flow. }; @@ -123,8 +123,8 @@ void AutoImport(Profile* profile, ProcessSingleton* process_singleton); // Does remaining first run tasks for |profile| and makes Chrome default browser -// if |make_chrome_default|. -void DoFirstRunTasks(Profile* profile, bool make_chrome_default); +// if |make_chrome_default|. This can pop the first run consent dialog on linux. +void DoPostImportTasks(Profile* profile, bool make_chrome_default); // Imports bookmarks and/or browser items (depending on platform support) // in this process. This function is paired with first_run::ImportSettings(). diff --git a/chrome/browser/first_run/first_run_browsertest.cc b/chrome/browser/first_run/first_run_browsertest.cc index 026b616..fa789ac6 100644 --- a/chrome/browser/first_run/first_run_browsertest.cc +++ b/chrome/browser/first_run/first_run_browsertest.cc @@ -59,6 +59,7 @@ IN_PROC_BROWSER_TEST_F(FirstRunBrowserTest, SetShowWelcomePagePref) { prefs::kShouldShowWelcomePage)); } +#if !defined(OS_CHROMEOS) namespace { class FirstRunIntegrationBrowserTest : public InProcessBrowserTest { public: @@ -66,8 +67,7 @@ class FirstRunIntegrationBrowserTest : public InProcessBrowserTest { protected: virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { InProcessBrowserTest::SetUpCommandLine(command_line); - command_line->AppendSwitch(switches::kFirstRun); - command_line->AppendSwitch(switches::kFirstRunForceImport); + command_line->AppendSwitch(switches::kForceFirstRun); EXPECT_FALSE(ProfileManager::DidPerformProfileImport()); extensions::ComponentLoader::EnableBackgroundExtensionsForTesting(); @@ -85,3 +85,4 @@ class FirstRunIntegrationBrowserTest : public InProcessBrowserTest { IN_PROC_BROWSER_TEST_F(FirstRunIntegrationBrowserTest, WaitForImport) { ASSERT_TRUE(ProfileManager::DidPerformProfileImport()); } +#endif // !defined(OS_CHROMEOS) diff --git a/chrome/browser/first_run/first_run_internal.h b/chrome/browser/first_run/first_run_internal.h index 26fafec..9e56673 100644 --- a/chrome/browser/first_run/first_run_internal.h +++ b/chrome/browser/first_run/first_run_internal.h @@ -70,6 +70,8 @@ void SetRLZPref(first_run::MasterPrefs* out_prefs, // -- Platform-specific functions -- +void DoPostImportPlatformSpecificTasks(); + // Gives the full path to the sentinel file. The file might not exist. // This function has a common implementation on OS_POSIX and a windows specific // implementation. diff --git a/chrome/browser/first_run/first_run_posix.cc b/chrome/browser/first_run/first_run_posix.cc index ee40cb0..09cbc9c 100644 --- a/chrome/browser/first_run/first_run_posix.cc +++ b/chrome/browser/first_run/first_run_posix.cc @@ -6,14 +6,18 @@ #include "base/path_service.h" #include "base/utf_string_conversions.h" +#include "chrome/browser/browser_process.h" #include "chrome/browser/first_run/first_run_internal.h" #include "chrome/browser/importer/importer_host.h" #include "chrome/browser/importer/importer_list.h" #include "chrome/browser/importer/importer_progress_dialog.h" #include "chrome/browser/importer/importer_progress_observer.h" +#include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" +#include "chrome/common/pref_names.h" +#include "chrome/installer/util/google_update_settings.h" #include "chrome/installer/util/master_preferences.h" #include "chrome/installer/util/master_preferences_constants.h" @@ -61,6 +65,18 @@ class ImportEndedObserver : public importer::ImporterProgressObserver { namespace first_run { namespace internal { +void DoPostImportPlatformSpecificTasks() { +#if !defined(OS_CHROMEOS) + // If stats reporting was turned on by the first run dialog then toggle + // the pref (on Windows, the download is tagged with enable/disable stats so + // this is POSIX-specific). + if (GoogleUpdateSettings::GetCollectStatsConsent()) { + g_browser_process->local_state()->SetBoolean( + prefs::kMetricsReportingEnabled, true); + } +#endif +} + bool GetFirstRunSentinelFilePath(FilePath* path) { FilePath first_run_sentinel; diff --git a/chrome/browser/first_run/first_run_win.cc b/chrome/browser/first_run/first_run_win.cc index 0ad9b17..0afde72 100644 --- a/chrome/browser/first_run/first_run_win.cc +++ b/chrome/browser/first_run/first_run_win.cc @@ -10,12 +10,15 @@ #include "base/callback.h" #include "base/environment.h" +#include "base/file_path.h" #include "base/file_util.h" #include "base/path_service.h" #include "base/process_util.h" #include "base/string_number_conversions.h" #include "base/string_split.h" #include "base/stringprintf.h" +#include "base/threading/sequenced_worker_pool.h" +#include "base/time.h" #include "base/utf_string_conversions.h" #include "base/win/metro.h" #include "base/win/object_watcher.h" @@ -43,6 +46,7 @@ #include "chrome/installer/util/master_preferences_constants.h" #include "chrome/installer/util/shell_util.h" #include "chrome/installer/util/util_constants.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/user_metrics.h" #include "google_update/google_update_idl.h" @@ -379,6 +383,24 @@ bool ImportSettingsWin(Profile* profile, namespace first_run { namespace internal { +void DoPostImportPlatformSpecificTasks() { + // Trigger the Active Setup command for system-level Chromes to finish + // configuring this user's install (e.g. per-user shortcuts). + // Delay the task slightly to give Chrome launch I/O priority while also + // making sure shortcuts are created promptly to avoid annoying the user by + // re-creating shortcuts he previously deleted. + static const int64 kTiggerActiveSetupDelaySeconds = 5; + FilePath chrome_exe; + if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { + NOTREACHED(); + } else if (!InstallUtil::IsPerUserInstall(chrome_exe.value().c_str())) { + content::BrowserThread::GetBlockingPool()->PostDelayedTask( + FROM_HERE, + base::Bind(&InstallUtil::TriggerActiveSetupCommand), + base::TimeDelta::FromSeconds(kTiggerActiveSetupDelaySeconds)); + } +} + bool ImportSettings(Profile* profile, scoped_refptr<ImporterHost> importer_host, scoped_refptr<ImporterList> importer_list, diff --git a/chrome/browser/process_singleton_browsertest.cc b/chrome/browser/process_singleton_browsertest.cc index c0053fb..556a4bab 100644 --- a/chrome/browser/process_singleton_browsertest.cc +++ b/chrome/browser/process_singleton_browsertest.cc @@ -64,7 +64,7 @@ class ChromeStarter : public base::RefCountedThreadSafe<ChromeStarter> { command_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir_); if (first_run) - command_line.AppendSwitch(switches::kFirstRun); + command_line.AppendSwitch(switches::kForceFirstRun); else command_line.AppendSwitch(switches::kNoFirstRun); @@ -77,7 +77,7 @@ class ChromeStarter : public base::RefCountedThreadSafe<ChromeStarter> { i != switch_map.end(); ++i) { const std::string& switch_name = i->first; if (switch_name == switches::kUserDataDir || - switch_name == switches::kFirstRun || + switch_name == switches::kForceFirstRun || switch_name == switches::kNoFirstRun) continue; diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 0024aef..8f947f5 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -694,11 +694,8 @@ const char kFeedbackServer[] = "feedback-server"; const char kFileDescriptorLimit[] = "file-descriptor-limit"; // Displays the First Run experience when the browser is started, regardless of -// whether or not it's actually the first run. -const char kFirstRun[] = "first-run"; - -// Force a profile auto-import that would occur on a first run. -const char kFirstRunForceImport[] = "first-run-force-import"; +// whether or not it's actually the First Run (this overrides kNoFirstRun). +const char kForceFirstRun[] = "force-first-run"; // Enables using GAIA information to populate profile name and icon. const char kGaiaProfileInfo[] = "gaia-profile-info"; @@ -878,8 +875,10 @@ const char kNoEvents[] = "no-events"; // then restart chrome without this switch again. const char kNoExperiments[] = "no-experiments"; -// Whether or not it's actually the first run. Overrides kFirstRun in case -// you're for some reason tempted to pass them both. +// Skip First Run tasks, whether or not it's actually the First Run. Overridden +// by kForceFirstRun. +// Also drops the First Run beacon so that First Run will not occur in +// subsequent runs as well. const char kNoFirstRun[] = "no-first-run"; // Support a separate switch that enables the v8 playback extension. diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 8207995..a6ea85e 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -193,8 +193,7 @@ extern const char kFlagSwitchesBegin[]; extern const char kFlagSwitchesEnd[]; extern const char kFeedbackServer[]; extern const char kFileDescriptorLimit[]; -extern const char kFirstRun[]; -extern const char kFirstRunForceImport[]; +extern const char kForceFirstRun[]; extern const char kGaiaProfileInfo[]; extern const char kGoogleSearchDomainCheckURL[]; extern const char kGSSAPILibraryName[]; diff --git a/chrome/common/switch_utils.cc b/chrome/common/switch_utils.cc index 41752da..507df93 100644 --- a/chrome/common/switch_utils.cc +++ b/chrome/common/switch_utils.cc @@ -16,7 +16,7 @@ namespace switches { const char* const kSwitchesToRemoveOnAutorestart[] = { switches::kApp, switches::kAppId, - switches::kFirstRun, + switches::kForceFirstRun, switches::kImport, switches::kImportFromFile, switches::kMakeDefaultBrowser, diff --git a/chrome/common/switch_utils_unittest.cc b/chrome/common/switch_utils_unittest.cc index 74bc8af..b522d91 100644 --- a/chrome/common/switch_utils_unittest.cc +++ b/chrome/common/switch_utils_unittest.cc @@ -13,7 +13,7 @@ TEST(SwitchUtilsTest, RemoveSwitches) { const CommandLine::CharType* argv[] = { FILE_PATH_LITERAL("program"), FILE_PATH_LITERAL("--app=http://www.google.com/"), - FILE_PATH_LITERAL("--first-run"), + FILE_PATH_LITERAL("--force-first-run"), FILE_PATH_LITERAL("--import"), FILE_PATH_LITERAL("--import-from-file=c:\\test.html"), FILE_PATH_LITERAL("--make-default-browser"), @@ -39,7 +39,7 @@ TEST(SwitchUtilsTest, RemoveSwitchesFromString) { CommandLine cmd_line = CommandLine::FromString( L"program" L" --app=http://www.google.com/" - L" --first-run" + L" --force-first-run" L" --import" L" --import-from-file=c:\\test.html" L" --make-default-browser" diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index f781f06..fef8e4c 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc @@ -588,7 +588,7 @@ bool CheckPreInstallConditions(const InstallationState& original_state, *status = installer::EXISTING_VERSION_LAUNCHED; FilePath chrome_exe = install_path.Append(installer::kChromeExe); CommandLine cmd(chrome_exe); - cmd.AppendSwitch(switches::kFirstRun); + cmd.AppendSwitch(switches::kForceFirstRun); installer_state->WriteInstallerResult(*status, 0, NULL); VLOG(1) << "Launching existing system-level chrome instead."; base::LaunchProcess(cmd, base::LaunchOptions(), NULL); |