Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: chrome/browser/chrome_browser_main.cc

Issue 20483002: Merge 3 different ways of obtaining first run state into a single one. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge up to r214457 -- fix conflict with r214339 -- dcommit since tests pass on previous patch set Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chrome_browser_main.h ('k') | chrome/browser/chrome_browser_main_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chrome_browser_main.h" 5 #include "chrome/browser/chrome_browser_main.h"
6 6
7 #if defined(TOOLKIT_GTK) 7 #if defined(TOOLKIT_GTK)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 it != new_tabs.end(); ++it) { 219 it != new_tabs.end(); ++it) {
220 if (it->is_valid()) 220 if (it->is_valid())
221 browser_creator->AddFirstRunTab(*it); 221 browser_creator->AddFirstRunTab(*it);
222 } 222 }
223 } 223 }
224 224
225 // Returns the new local state object, guaranteed non-NULL. 225 // Returns the new local state object, guaranteed non-NULL.
226 // |local_state_task_runner| must be a shutdown-blocking task runner. 226 // |local_state_task_runner| must be a shutdown-blocking task runner.
227 PrefService* InitializeLocalState( 227 PrefService* InitializeLocalState(
228 base::SequencedTaskRunner* local_state_task_runner, 228 base::SequencedTaskRunner* local_state_task_runner,
229 const CommandLine& parsed_command_line, 229 const CommandLine& parsed_command_line) {
230 bool is_first_run) {
231 TRACE_EVENT0("startup", "ChromeBrowserMainParts::InitializeLocalState") 230 TRACE_EVENT0("startup", "ChromeBrowserMainParts::InitializeLocalState")
232 base::FilePath local_state_path; 231 base::FilePath local_state_path;
233 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); 232 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path);
234 bool local_state_file_exists = base::PathExists(local_state_path); 233 bool local_state_file_exists = base::PathExists(local_state_path);
235 234
236 // Load local state. This includes the application locale so we know which 235 // Load local state. This includes the application locale so we know which
237 // locale dll to load. This also causes local state prefs to be registered. 236 // locale dll to load. This also causes local state prefs to be registered.
238 PrefService* local_state = g_browser_process->local_state(); 237 PrefService* local_state = g_browser_process->local_state();
239 DCHECK(local_state); 238 DCHECK(local_state);
240 239
241 if (is_first_run) {
242 #if defined(OS_WIN) 240 #if defined(OS_WIN)
241 if (first_run::IsChromeFirstRun()) {
243 // During first run we read the google_update registry key to find what 242 // During first run we read the google_update registry key to find what
244 // language the user selected when downloading the installer. This 243 // language the user selected when downloading the installer. This
245 // becomes our default language in the prefs. 244 // becomes our default language in the prefs.
246 // Other platforms obey the system locale. 245 // Other platforms obey the system locale.
247 std::wstring install_lang; 246 std::wstring install_lang;
248 if (GoogleUpdateSettings::GetLanguage(&install_lang)) { 247 if (GoogleUpdateSettings::GetLanguage(&install_lang)) {
249 local_state->SetString(prefs::kApplicationLocale, 248 local_state->SetString(prefs::kApplicationLocale,
250 WideToASCII(install_lang)); 249 WideToASCII(install_lang));
251 } 250 }
251 }
252 #endif // defined(OS_WIN) 252 #endif // defined(OS_WIN)
253 }
254 253
255 // If the local state file for the current profile doesn't exist and the 254 // If the local state file for the current profile doesn't exist and the
256 // parent profile command line flag is present, then we should inherit some 255 // parent profile command line flag is present, then we should inherit some
257 // local state from the parent profile. 256 // local state from the parent profile.
258 // Checking that the local state file for the current profile doesn't exist 257 // Checking that the local state file for the current profile doesn't exist
259 // is the most robust way to determine whether we need to inherit or not 258 // is the most robust way to determine whether we need to inherit or not
260 // since the parent profile command line flag can be present even when the 259 // since the parent profile command line flag can be present even when the
261 // current profile is not a new one, and in that case we do not want to 260 // current profile is not a new one, and in that case we do not want to
262 // inherit and reset the user's setting. 261 // inherit and reset the user's setting.
263 // 262 //
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 result_code_(content::RESULT_CODE_NORMAL_EXIT), 544 result_code_(content::RESULT_CODE_NORMAL_EXIT),
546 startup_watcher_(new StartupTimeBomb()), 545 startup_watcher_(new StartupTimeBomb()),
547 shutdown_watcher_(new ShutdownWatcherHelper()), 546 shutdown_watcher_(new ShutdownWatcherHelper()),
548 startup_timer_(new performance_monitor::StartupTimer()), 547 startup_timer_(new performance_monitor::StartupTimer()),
549 browser_field_trials_(parameters.command_line), 548 browser_field_trials_(parameters.command_line),
550 rvh_callback_(base::Bind(&RenderViewHostCreated)), 549 rvh_callback_(base::Bind(&RenderViewHostCreated)),
551 translate_manager_(NULL), 550 translate_manager_(NULL),
552 profile_(NULL), 551 profile_(NULL),
553 run_message_loop_(true), 552 run_message_loop_(true),
554 notify_result_(ProcessSingleton::PROCESS_NONE), 553 notify_result_(ProcessSingleton::PROCESS_NONE),
555 do_first_run_tasks_(false),
556 local_state_(NULL), 554 local_state_(NULL),
557 restart_last_session_(false) { 555 restart_last_session_(false) {
558 // If we're running tests (ui_task is non-null). 556 // If we're running tests (ui_task is non-null).
559 if (parameters.ui_task) 557 if (parameters.ui_task)
560 browser_defaults::enable_help_app = false; 558 browser_defaults::enable_help_app = false;
561 559
562 // Chrome disallows cookies by default. All code paths that want to use 560 // Chrome disallows cookies by default. All code paths that want to use
563 // cookies need to go through one of Chrome's URLRequestContexts which have 561 // cookies need to go through one of Chrome's URLRequestContexts which have
564 // a ChromeNetworkDelegate attached that selectively allows cookies again. 562 // a ChromeNetworkDelegate attached that selectively allows cookies again.
565 if (!disable_enforcing_cookie_policies_for_tests_) 563 if (!disable_enforcing_cookie_policies_for_tests_)
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 #if defined(OS_CHROMEOS) 674 #if defined(OS_CHROMEOS)
677 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, 675 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref,
678 &enabled); 676 &enabled);
679 #else 677 #else
680 enabled = local_state_->GetBoolean(prefs::kMetricsReportingEnabled); 678 enabled = local_state_->GetBoolean(prefs::kMetricsReportingEnabled);
681 #endif // #if defined(OS_CHROMEOS) 679 #endif // #if defined(OS_CHROMEOS)
682 #endif // defined(GOOGLE_CHROME_BUILD) 680 #endif // defined(GOOGLE_CHROME_BUILD)
683 return enabled; 681 return enabled;
684 } 682 }
685 683
686 void ChromeBrowserMainParts::RecordBrowserStartupTime(bool is_first_run) { 684 void ChromeBrowserMainParts::RecordBrowserStartupTime() {
687 // Don't record any metrics if UI was displayed before this point e.g. 685 // Don't record any metrics if UI was displayed before this point e.g.
688 // warning dialogs. 686 // warning dialogs.
689 if (startup_metric_utils::WasNonBrowserUIDisplayed()) 687 if (startup_metric_utils::WasNonBrowserUIDisplayed())
690 return; 688 return;
691 689
690 bool is_first_run = first_run::IsChromeFirstRun();
691
692 // CurrentProcessInfo::CreationTime() is currently only implemented on Mac and 692 // CurrentProcessInfo::CreationTime() is currently only implemented on Mac and
693 // Windows. 693 // Windows.
694 #if defined(OS_MACOSX) || defined(OS_WIN) 694 #if defined(OS_MACOSX) || defined(OS_WIN)
695 const base::Time* process_creation_time = 695 const base::Time* process_creation_time =
696 base::CurrentProcessInfo::CreationTime(); 696 base::CurrentProcessInfo::CreationTime();
697 697
698 if (!is_first_run && process_creation_time) { 698 if (!is_first_run && process_creation_time) {
699 RecordPreReadExperimentTime("Startup.BrowserMessageLoopStartTime", 699 RecordPreReadExperimentTime("Startup.BrowserMessageLoopStartTime",
700 base::Time::Now() - *process_creation_time); 700 base::Time::Now() - *process_creation_time);
701 } 701 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 run_message_loop_ = false; 816 run_message_loop_ = false;
817 { 817 {
818 TRACE_EVENT0("startup", 818 TRACE_EVENT0("startup",
819 "ChromeBrowserMainParts::PreCreateThreadsImpl:GetUserDataDir"); 819 "ChromeBrowserMainParts::PreCreateThreadsImpl:GetUserDataDir");
820 user_data_dir_ = chrome::GetUserDataDir(parameters()); 820 user_data_dir_ = chrome::GetUserDataDir(parameters());
821 } 821 }
822 822
823 // Force MediaCaptureDevicesDispatcher to be created on UI thread. 823 // Force MediaCaptureDevicesDispatcher to be created on UI thread.
824 MediaCaptureDevicesDispatcher::GetInstance(); 824 MediaCaptureDevicesDispatcher::GetInstance();
825 825
826 // Whether this is First Run. |do_first_run_tasks_| should be prefered to this
827 // unless the desire is actually to know whether this is really First Run
828 // (i.e., even if --no-first-run is passed).
829 bool is_first_run = false;
830 // Android's first run is done in Java instead of native. 826 // Android's first run is done in Java instead of native.
831 #if !defined(OS_ANDROID) 827 #if !defined(OS_ANDROID)
832 process_singleton_.reset(new ChromeProcessSingleton( 828 process_singleton_.reset(new ChromeProcessSingleton(
833 user_data_dir_, base::Bind(&ProcessSingletonNotificationCallback))); 829 user_data_dir_, base::Bind(&ProcessSingletonNotificationCallback)));
834 830
835 bool force_first_run = 831 // Cache first run state early.
836 parsed_command_line().HasSwitch(switches::kForceFirstRun); 832 first_run::IsChromeFirstRun();
837 bool force_skip_first_run_tasks =
838 (!force_first_run &&
839 parsed_command_line().HasSwitch(switches::kNoFirstRun));
840
841 is_first_run = force_first_run || first_run::IsChromeFirstRun();
842 #endif 833 #endif
843 834
844 scoped_refptr<base::SequencedTaskRunner> local_state_task_runner = 835 scoped_refptr<base::SequencedTaskRunner> local_state_task_runner =
845 JsonPrefStore::GetTaskRunnerForFile( 836 JsonPrefStore::GetTaskRunnerForFile(
846 base::FilePath(chrome::kLocalStorePoolName), 837 base::FilePath(chrome::kLocalStorePoolName),
847 BrowserThread::GetBlockingPool()); 838 BrowserThread::GetBlockingPool());
848 839
849 { 840 {
850 TRACE_EVENT0("startup", 841 TRACE_EVENT0("startup",
851 "ChromeBrowserMainParts::PreCreateThreadsImpl:InitBrowswerProcessImpl"); 842 "ChromeBrowserMainParts::PreCreateThreadsImpl:InitBrowswerProcessImpl");
(...skipping 17 matching lines...) Expand all
869 tracked_objects::ThreadData::InitializeAndSetTrackingStatus(status); 860 tracked_objects::ThreadData::InitializeAndSetTrackingStatus(status);
870 } 861 }
871 862
872 if (parsed_command_line().HasSwitch(switches::kProfilingOutputFile)) { 863 if (parsed_command_line().HasSwitch(switches::kProfilingOutputFile)) {
873 tracking_objects_.set_output_file_path( 864 tracking_objects_.set_output_file_path(
874 parsed_command_line().GetSwitchValuePath( 865 parsed_command_line().GetSwitchValuePath(
875 switches::kProfilingOutputFile)); 866 switches::kProfilingOutputFile));
876 } 867 }
877 868
878 local_state_ = InitializeLocalState( 869 local_state_ = InitializeLocalState(
879 local_state_task_runner.get(), parsed_command_line(), is_first_run); 870 local_state_task_runner.get(), parsed_command_line());
880 871
881 // These members must be initialized before returning from this function. 872 // These members must be initialized before returning from this function.
882 master_prefs_.reset(new first_run::MasterPrefs); 873 master_prefs_.reset(new first_run::MasterPrefs);
883 874
884 #if !defined(OS_ANDROID) 875 #if !defined(OS_ANDROID)
885 // Android doesn't use StartupBrowserCreator. 876 // Android doesn't use StartupBrowserCreator.
886 browser_creator_.reset(new StartupBrowserCreator); 877 browser_creator_.reset(new StartupBrowserCreator);
887 // TODO(yfriedman): Refactor Android to re-use UMABrowsingActivityObserver 878 // TODO(yfriedman): Refactor Android to re-use UMABrowsingActivityObserver
888 chrome::UMABrowsingActivityObserver::Init(); 879 chrome::UMABrowsingActivityObserver::Init();
889 #endif 880 #endif
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 resources_pack_path, ui::SCALE_FACTOR_NONE); 949 resources_pack_path, ui::SCALE_FACTOR_NONE);
959 } 950 }
960 #endif // defined(OS_MACOSX) 951 #endif // defined(OS_MACOSX)
961 } 952 }
962 953
963 #if defined(TOOLKIT_GTK) 954 #if defined(TOOLKIT_GTK)
964 g_set_application_name(l10n_util::GetStringUTF8(IDS_PRODUCT_NAME).c_str()); 955 g_set_application_name(l10n_util::GetStringUTF8(IDS_PRODUCT_NAME).c_str());
965 #endif 956 #endif
966 957
967 // Android does first run in Java instead of native. 958 // Android does first run in Java instead of native.
968 #if !defined(OS_ANDROID) 959 // Chrome OS has its own out-of-box-experience code.
960 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
969 // On first run, we need to process the predictor preferences before the 961 // On first run, we need to process the predictor preferences before the
970 // browser's profile_manager object is created, but after ResourceBundle 962 // browser's profile_manager object is created, but after ResourceBundle
971 // is initialized. 963 // is initialized.
972 if (is_first_run) { 964 if (first_run::IsChromeFirstRun()) {
973 first_run::ProcessMasterPreferencesResult pmp_result = 965 first_run::ProcessMasterPreferencesResult pmp_result =
974 first_run::ProcessMasterPreferences(user_data_dir_, 966 first_run::ProcessMasterPreferences(user_data_dir_,
975 master_prefs_.get()); 967 master_prefs_.get());
976 if (pmp_result == first_run::EULA_EXIT_NOW) 968 if (pmp_result == first_run::EULA_EXIT_NOW)
977 return chrome::RESULT_CODE_EULA_REFUSED; 969 return chrome::RESULT_CODE_EULA_REFUSED;
978 970
979 // Do first run tasks unless: 971 if (!parsed_command_line().HasSwitch(switches::kApp) &&
980 // - Explicitly forced not to by |force_skip_first_run_tasks| or
981 // |pmp_result|.
982 // - Running in App (or App Launcher) mode, where showing the importer
983 // (first run) UI is undesired.
984 do_first_run_tasks_ = (
985 !force_skip_first_run_tasks &&
986 pmp_result != first_run::SKIP_FIRST_RUN_TASKS &&
987 !parsed_command_line().HasSwitch(switches::kApp) &&
988 !parsed_command_line().HasSwitch(switches::kAppId) && 972 !parsed_command_line().HasSwitch(switches::kAppId) &&
989 !parsed_command_line().HasSwitch(switches::kShowAppList)); 973 !parsed_command_line().HasSwitch(switches::kShowAppList)) {
990
991 if (do_first_run_tasks_) {
992 AddFirstRunNewTabs(browser_creator_.get(), master_prefs_->new_tabs); 974 AddFirstRunNewTabs(browser_creator_.get(), master_prefs_->new_tabs);
993
994 // TODO(macourteau): refactor preferences that are copied from
995 // master_preferences into local_state, as a "local_state" section in
996 // master preferences. If possible, a generic solution would be prefered
997 // over a copy one-by-one of specific preferences. Also see related TODO
998 // in first_run.h.
999
1000 // Store the initial VariationsService seed in local state, if it exists
1001 // in master prefs.
1002 if (!master_prefs_->variations_seed.empty()) {
1003 local_state_->SetString(prefs::kVariationsSeed,
1004 master_prefs_->variations_seed);
1005 // Set the variation seed date to the current system time. If the user's
1006 // clock is incorrect, this may cause some field trial expiry checks to
1007 // not do the right thing until the next seed update from the server,
1008 // when this value will be updated.
1009 local_state_->SetInt64(prefs::kVariationsSeedDate,
1010 base::Time::Now().ToInternalValue());
1011 }
1012
1013 if (!master_prefs_->suppress_default_browser_prompt_for_version.empty()) {
1014 local_state_->SetString(
1015 prefs::kBrowserSuppressDefaultBrowserPrompt,
1016 master_prefs_->suppress_default_browser_prompt_for_version);
1017 }
1018
1019 AppListService::Get()->HandleFirstRun();
1020 } 975 }
1021 976
1022 if (do_first_run_tasks_ || 977 // TODO(macourteau): refactor preferences that are copied from
1023 parsed_command_line().HasSwitch(switches::kNoFirstRun)) { 978 // master_preferences into local_state, as a "local_state" section in
1024 // Create the First Run sentinel whether first run tasks are executed 979 // master preferences. If possible, a generic solution would be prefered
1025 // or not. 980 // over a copy one-by-one of specific preferences. Also see related TODO
1026 first_run::CreateSentinel(); 981 // in first_run.h.
982
983 // Store the initial VariationsService seed in local state, if it exists
984 // in master prefs.
985 if (!master_prefs_->variations_seed.empty()) {
986 local_state_->SetString(prefs::kVariationsSeed,
987 master_prefs_->variations_seed);
988 // Set the variation seed date to the current system time. If the user's
989 // clock is incorrect, this may cause some field trial expiry checks to
990 // not do the right thing until the next seed update from the server,
991 // when this value will be updated.
992 local_state_->SetInt64(prefs::kVariationsSeedDate,
993 base::Time::Now().ToInternalValue());
1027 } 994 }
995
996 if (!master_prefs_->suppress_default_browser_prompt_for_version.empty()) {
997 local_state_->SetString(
998 prefs::kBrowserSuppressDefaultBrowserPrompt,
999 master_prefs_->suppress_default_browser_prompt_for_version);
1000 }
1001
1002 AppListService::Get()->HandleFirstRun();
1028 } 1003 }
1029 #endif 1004 #endif
1030 1005
1031 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_MACOSX) 1006 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_MACOSX)
1032 // Set the product channel for crash reports. 1007 // Set the product channel for crash reports.
1033 child_process_logging::SetChannel( 1008 child_process_logging::SetChannel(
1034 chrome::VersionInfo::GetVersionStringModifier()); 1009 chrome::VersionInfo::GetVersionStringModifier());
1035 #endif 1010 #endif
1036 1011
1037 // Initialize tracking synchronizer system. 1012 // Initialize tracking synchronizer system.
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
1349 PostProfileInit(); 1324 PostProfileInit();
1350 1325
1351 // Retrieve cached GL strings from local state and use them for GPU 1326 // Retrieve cached GL strings from local state and use them for GPU
1352 // blacklist decisions. 1327 // blacklist decisions.
1353 if (g_browser_process->gl_string_manager()) 1328 if (g_browser_process->gl_string_manager())
1354 g_browser_process->gl_string_manager()->Initialize(); 1329 g_browser_process->gl_string_manager()->Initialize();
1355 1330
1356 // Create an instance of GpuModeManager to watch gpu mode pref change. 1331 // Create an instance of GpuModeManager to watch gpu mode pref change.
1357 g_browser_process->gpu_mode_manager(); 1332 g_browser_process->gpu_mode_manager();
1358 1333
1359 #if !defined(OS_ANDROID) 1334 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
1360 // Show the First Run UI if this is the first time Chrome has been run on 1335 // Show the First Run UI if this is the first time Chrome has been run on
1361 // this computer, or we're being compelled to do so by a command line flag. 1336 // this computer, or we're being compelled to do so by a command line flag.
1362 // Note that this be done _after_ the PrefService is initialized and all 1337 // Note that this be done _after_ the PrefService is initialized and all
1363 // preferences are registered, since some of the code that the importer 1338 // preferences are registered, since some of the code that the importer
1364 // touches reads preferences. 1339 // touches reads preferences.
1365 if (do_first_run_tasks_) { 1340 if (first_run::IsChromeFirstRun()) {
1366 first_run::AutoImport(profile_, 1341 first_run::AutoImport(profile_,
1367 master_prefs_->homepage_defined, 1342 master_prefs_->homepage_defined,
1368 master_prefs_->do_import_items, 1343 master_prefs_->do_import_items,
1369 master_prefs_->dont_import_items, 1344 master_prefs_->dont_import_items,
1370 master_prefs_->import_bookmarks_path); 1345 master_prefs_->import_bookmarks_path);
1371 1346
1372 // Note: this can pop the first run consent dialog on linux. 1347 // Note: this can pop the first run consent dialog on linux.
1373 first_run::DoPostImportTasks(profile_, master_prefs_->make_chrome_default); 1348 first_run::DoPostImportTasks(profile_, master_prefs_->make_chrome_default);
1374 1349
1375 if (!master_prefs_->suppress_first_run_default_browser_prompt) { 1350 if (!master_prefs_->suppress_first_run_default_browser_prompt) {
1376 browser_creator_->set_show_main_browser_window( 1351 browser_creator_->set_show_main_browser_window(
1377 !chrome::ShowFirstRunDefaultBrowserPrompt(profile_)); 1352 !chrome::ShowFirstRunDefaultBrowserPrompt(profile_));
1378 } else { 1353 } else {
1379 browser_creator_->set_is_default_browser_dialog_suppressed(true); 1354 browser_creator_->set_is_default_browser_dialog_suppressed(true);
1380 } 1355 }
1381 } // if (do_first_run_tasks_) 1356 }
1382 #endif // !defined(OS_ANDROID) 1357 #endif // !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
1383 1358
1384 #if defined(OS_WIN) 1359 #if defined(OS_WIN)
1385 // Sets things up so that if we crash from this point on, a dialog will 1360 // Sets things up so that if we crash from this point on, a dialog will
1386 // popup asking the user to restart chrome. It is done this late to avoid 1361 // popup asking the user to restart chrome. It is done this late to avoid
1387 // testing against a bunch of special cases that are taken care early on. 1362 // testing against a bunch of special cases that are taken care early on.
1388 ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment( 1363 ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment(
1389 parsed_command_line()); 1364 parsed_command_line());
1390 1365
1391 // Registers Chrome with the Windows Restart Manager, which will restore the 1366 // Registers Chrome with the Windows Restart Manager, which will restore the
1392 // Chrome session when the computer is restarted after a system update. 1367 // Chrome session when the computer is restarted after a system update.
(...skipping 12 matching lines...) Expand all
1405 base::Bind(&NetworkProfileBubble::CheckNetworkProfile, 1380 base::Bind(&NetworkProfileBubble::CheckNetworkProfile,
1406 profile_->GetPath())); 1381 profile_->GetPath()));
1407 } 1382 }
1408 #endif // OS_WIN 1383 #endif // OS_WIN
1409 1384
1410 #if defined(ENABLE_RLZ) && !defined(OS_CHROMEOS) 1385 #if defined(ENABLE_RLZ) && !defined(OS_CHROMEOS)
1411 // Init the RLZ library. This just binds the dll and schedules a task on the 1386 // Init the RLZ library. This just binds the dll and schedules a task on the
1412 // file thread to be run sometime later. If this is the first run we record 1387 // file thread to be run sometime later. If this is the first run we record
1413 // the installation event. 1388 // the installation event.
1414 PrefService* pref_service = profile_->GetPrefs(); 1389 PrefService* pref_service = profile_->GetPrefs();
1415 int ping_delay = do_first_run_tasks_ ? master_prefs_->ping_delay : 1390 int ping_delay = first_run::IsChromeFirstRun() ? master_prefs_->ping_delay :
1416 pref_service->GetInteger(first_run::GetPingDelayPrefName().c_str()); 1391 pref_service->GetInteger(first_run::GetPingDelayPrefName().c_str());
1417 // Negative ping delay means to send ping immediately after a first search is 1392 // Negative ping delay means to send ping immediately after a first search is
1418 // recorded. 1393 // recorded.
1419 RLZTracker::InitRlzFromProfileDelayed( 1394 RLZTracker::InitRlzFromProfileDelayed(
1420 profile_, do_first_run_tasks_, ping_delay < 0, 1395 profile_, first_run::IsChromeFirstRun(), ping_delay < 0,
1421 base::TimeDelta::FromMilliseconds(abs(ping_delay))); 1396 base::TimeDelta::FromMilliseconds(abs(ping_delay)));
1422 #endif // defined(ENABLE_RLZ) && !defined(OS_CHROMEOS) 1397 #endif // defined(ENABLE_RLZ) && !defined(OS_CHROMEOS)
1423 1398
1424 // Configure modules that need access to resources. 1399 // Configure modules that need access to resources.
1425 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider); 1400 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider);
1426 1401
1427 // In unittest mode, this will do nothing. In normal mode, this will create 1402 // In unittest mode, this will do nothing. In normal mode, this will create
1428 // the global IntranetRedirectDetector instance, which will promptly go to 1403 // the global IntranetRedirectDetector instance, which will promptly go to
1429 // sleep for seven seconds (to avoid slowing startup), and wake up afterwards 1404 // sleep for seven seconds (to avoid slowing startup), and wake up afterwards
1430 // to see if it should do anything else. 1405 // to see if it should do anything else.
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1633 return true; 1608 return true;
1634 #else 1609 #else
1635 // Set the result code set in PreMainMessageLoopRun or set above. 1610 // Set the result code set in PreMainMessageLoopRun or set above.
1636 *result_code = result_code_; 1611 *result_code = result_code_;
1637 if (!run_message_loop_) 1612 if (!run_message_loop_)
1638 return true; // Don't run the default message loop. 1613 return true; // Don't run the default message loop.
1639 1614
1640 // These should be invoked as close to the start of the browser's 1615 // These should be invoked as close to the start of the browser's
1641 // UI thread message loop as possible to get a stable measurement 1616 // UI thread message loop as possible to get a stable measurement
1642 // across versions. 1617 // across versions.
1643 RecordBrowserStartupTime(do_first_run_tasks_); 1618 RecordBrowserStartupTime();
1644 startup_timer_->SignalStartupComplete( 1619 startup_timer_->SignalStartupComplete(
1645 performance_monitor::StartupTimer::STARTUP_NORMAL); 1620 performance_monitor::StartupTimer::STARTUP_NORMAL);
1646 1621
1647 DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); 1622 DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type());
1648 #if !defined(USE_AURA) && defined(TOOLKIT_VIEWS) 1623 #if !defined(USE_AURA) && defined(TOOLKIT_VIEWS)
1649 views::AcceleratorHandler accelerator_handler; 1624 views::AcceleratorHandler accelerator_handler;
1650 base::RunLoop run_loop(&accelerator_handler); 1625 base::RunLoop run_loop(&accelerator_handler);
1651 #else 1626 #else
1652 base::RunLoop run_loop; 1627 base::RunLoop run_loop;
1653 #endif 1628 #endif
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1725 chromeos::CrosSettings::Shutdown(); 1700 chromeos::CrosSettings::Shutdown();
1726 #endif 1701 #endif
1727 #endif 1702 #endif
1728 } 1703 }
1729 1704
1730 // Public members: 1705 // Public members:
1731 1706
1732 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { 1707 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) {
1733 chrome_extra_parts_.push_back(parts); 1708 chrome_extra_parts_.push_back(parts);
1734 } 1709 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_main.h ('k') | chrome/browser/chrome_browser_main_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698