OLD | NEW |
---|---|
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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
482 result_code_(content::RESULT_CODE_NORMAL_EXIT), | 482 result_code_(content::RESULT_CODE_NORMAL_EXIT), |
483 startup_watcher_(new StartupTimeBomb()), | 483 startup_watcher_(new StartupTimeBomb()), |
484 shutdown_watcher_(new ShutdownWatcherHelper()), | 484 shutdown_watcher_(new ShutdownWatcherHelper()), |
485 startup_timer_(new performance_monitor::StartupTimer()), | 485 startup_timer_(new performance_monitor::StartupTimer()), |
486 browser_field_trials_(parameters.command_line), | 486 browser_field_trials_(parameters.command_line), |
487 record_search_engine_(false), | 487 record_search_engine_(false), |
488 translate_manager_(NULL), | 488 translate_manager_(NULL), |
489 profile_(NULL), | 489 profile_(NULL), |
490 run_message_loop_(true), | 490 run_message_loop_(true), |
491 notify_result_(ProcessSingleton::PROCESS_NONE), | 491 notify_result_(ProcessSingleton::PROCESS_NONE), |
492 is_first_run_(false), | 492 do_first_run_tasks_(false), |
493 first_run_ui_bypass_(false), | |
494 local_state_(NULL), | 493 local_state_(NULL), |
495 restart_last_session_(false) { | 494 restart_last_session_(false) { |
496 // If we're running tests (ui_task is non-null). | 495 // If we're running tests (ui_task is non-null). |
497 if (parameters.ui_task) | 496 if (parameters.ui_task) |
498 browser_defaults::enable_help_app = false; | 497 browser_defaults::enable_help_app = false; |
499 | 498 |
500 // Chrome disallows cookies by default. All code paths that want to use | 499 // Chrome disallows cookies by default. All code paths that want to use |
501 // cookies need to go through one of Chrome's URLRequestContexts which have | 500 // cookies need to go through one of Chrome's URLRequestContexts which have |
502 // a ChromeNetworkDelegate attached that selectively allows cookies again. | 501 // a ChromeNetworkDelegate attached that selectively allows cookies again. |
503 if (!disable_enforcing_cookie_policies_for_tests_) | 502 if (!disable_enforcing_cookie_policies_for_tests_) |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
683 #else | 682 #else |
684 // Getting the user data dir can fail if the directory isn't | 683 // Getting the user data dir can fail if the directory isn't |
685 // creatable, for example; on Windows in code below we bring up a | 684 // creatable, for example; on Windows in code below we bring up a |
686 // dialog prompting the user to pick a different directory. | 685 // dialog prompting the user to pick a different directory. |
687 // However, ProcessSingleton needs a real user_data_dir on Mac/Linux, | 686 // However, ProcessSingleton needs a real user_data_dir on Mac/Linux, |
688 // so it's better to fail here than fail mysteriously elsewhere. | 687 // so it's better to fail here than fail mysteriously elsewhere. |
689 CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir_)) | 688 CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir_)) |
690 << "Must be able to get user data directory!"; | 689 << "Must be able to get user data directory!"; |
691 #endif | 690 #endif |
692 | 691 |
692 bool is_first_run = false; | |
693 // Android's first run is done in Java instead of native. | 693 // Android's first run is done in Java instead of native. |
694 #if !defined(OS_ANDROID) | 694 #if !defined(OS_ANDROID) |
695 // Create Sentinel if no-first-run argument is passed in (note that First Run | |
696 // might still occur if --force-first-run is also passed in). | |
697 if (parsed_command_line().HasSwitch(switches::kNoFirstRun)) | |
698 first_run::CreateSentinel(); | |
699 | |
695 process_singleton_.reset(new ProcessSingleton(user_data_dir_)); | 700 process_singleton_.reset(new ProcessSingleton(user_data_dir_)); |
696 // Ensure ProcessSingleton won't process messages too early. It will be | 701 // Ensure ProcessSingleton won't process messages too early. It will be |
697 // unlocked in PostBrowserStart(). | 702 // unlocked in PostBrowserStart(). |
698 process_singleton_->Lock(NULL); | 703 process_singleton_->Lock(NULL); |
699 | 704 |
700 is_first_run_ = | 705 is_first_run = |
701 (first_run::IsChromeFirstRun() || | 706 (first_run::IsChromeFirstRun() || |
cpu_(ooo_6.6-7.5)
2012/12/27 23:53:05
Should first_run::IsChromeFirstRun() be changed as
gab
2012/12/28 20:17:46
is_first_run will be true if this is actually firs
| |
702 parsed_command_line().HasSwitch(switches::kFirstRun)) && | 707 parsed_command_line().HasSwitch(switches::kForceFirstRun)) && |
703 !ProfileManager::IsImportProcess(parsed_command_line()); | 708 !ProfileManager::IsImportProcess(parsed_command_line()); |
704 #endif | 709 #endif |
705 | 710 |
706 FilePath local_state_path; | 711 FilePath local_state_path; |
707 CHECK(PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path)); | 712 CHECK(PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path)); |
708 scoped_refptr<base::SequencedTaskRunner> local_state_task_runner = | 713 scoped_refptr<base::SequencedTaskRunner> local_state_task_runner = |
709 JsonPrefStore::GetTaskRunnerForFile(local_state_path, | 714 JsonPrefStore::GetTaskRunnerForFile(local_state_path, |
710 BrowserThread::GetBlockingPool()); | 715 BrowserThread::GetBlockingPool()); |
711 browser_process_.reset(new BrowserProcessImpl(local_state_task_runner, | 716 browser_process_.reset(new BrowserProcessImpl(local_state_task_runner, |
712 parsed_command_line())); | 717 parsed_command_line())); |
(...skipping 13 matching lines...) Expand all Loading... | |
726 } | 731 } |
727 | 732 |
728 if (parsed_command_line().HasSwitch(switches::kProfilingOutputFile)) { | 733 if (parsed_command_line().HasSwitch(switches::kProfilingOutputFile)) { |
729 tracking_objects_.set_output_file_path( | 734 tracking_objects_.set_output_file_path( |
730 parsed_command_line().GetSwitchValuePath( | 735 parsed_command_line().GetSwitchValuePath( |
731 switches::kProfilingOutputFile)); | 736 switches::kProfilingOutputFile)); |
732 } | 737 } |
733 | 738 |
734 local_state_ = InitializeLocalState(local_state_task_runner, | 739 local_state_ = InitializeLocalState(local_state_task_runner, |
735 parsed_command_line(), | 740 parsed_command_line(), |
736 is_first_run_); | 741 is_first_run); |
737 | 742 |
738 // These members must be initialized before returning from this function. | 743 // These members must be initialized before returning from this function. |
739 master_prefs_.reset(new first_run::MasterPrefs); | 744 master_prefs_.reset(new first_run::MasterPrefs); |
740 | 745 |
741 #if !defined(OS_ANDROID) | 746 #if !defined(OS_ANDROID) |
742 // Android doesn't use StartupBrowserCreator. | 747 // Android doesn't use StartupBrowserCreator. |
743 browser_creator_.reset(new StartupBrowserCreator); | 748 browser_creator_.reset(new StartupBrowserCreator); |
744 // TODO(yfriedman): Refactor Android to re-use UMABrowsingActivityObserver | 749 // TODO(yfriedman): Refactor Android to re-use UMABrowsingActivityObserver |
745 chrome::UMABrowsingActivityObserver::Init(); | 750 chrome::UMABrowsingActivityObserver::Init(); |
746 #endif | 751 #endif |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
793 | 798 |
794 #if defined(TOOLKIT_GTK) | 799 #if defined(TOOLKIT_GTK) |
795 g_set_application_name(l10n_util::GetStringUTF8(IDS_PRODUCT_NAME).c_str()); | 800 g_set_application_name(l10n_util::GetStringUTF8(IDS_PRODUCT_NAME).c_str()); |
796 #endif | 801 #endif |
797 | 802 |
798 // Android does first run in Java instead of native. | 803 // Android does first run in Java instead of native. |
799 #if !defined(OS_ANDROID) | 804 #if !defined(OS_ANDROID) |
800 // On first run, we need to process the predictor preferences before the | 805 // On first run, we need to process the predictor preferences before the |
801 // browser's profile_manager object is created, but after ResourceBundle | 806 // browser's profile_manager object is created, but after ResourceBundle |
802 // is initialized. | 807 // is initialized. |
803 first_run_ui_bypass_ = false; // True to skip first run UI. | 808 if (is_first_run) { |
804 if (is_first_run_) { | |
805 first_run::ProcessMasterPreferencesResult pmp_result = | 809 first_run::ProcessMasterPreferencesResult pmp_result = |
806 first_run::ProcessMasterPreferences(user_data_dir_, | 810 first_run::ProcessMasterPreferences(user_data_dir_, |
807 master_prefs_.get()); | 811 master_prefs_.get()); |
808 if (pmp_result == first_run::EULA_EXIT_NOW) | 812 if (pmp_result == first_run::EULA_EXIT_NOW) |
809 return chrome::RESULT_CODE_EULA_REFUSED; | 813 return chrome::RESULT_CODE_EULA_REFUSED; |
810 | 814 |
811 first_run_ui_bypass_ = (pmp_result == first_run::SKIP_FIRST_RUN); | 815 do_first_run_tasks_ = (pmp_result != first_run::SKIP_FIRST_RUN_TASKS); |
812 | 816 |
813 AddFirstRunNewTabs(browser_creator_.get(), master_prefs_->new_tabs); | 817 AddFirstRunNewTabs(browser_creator_.get(), master_prefs_->new_tabs); |
814 | 818 |
815 // If we are running in App mode, we do not want to show the importer | 819 // If we are running in App mode, we do not want to show the importer |
816 // (first run) UI. | 820 // (first run) UI. |
817 if (!first_run_ui_bypass_ && | 821 if (parsed_command_line().HasSwitch(switches::kApp) || |
818 (parsed_command_line().HasSwitch(switches::kApp) || | 822 parsed_command_line().HasSwitch(switches::kAppId)) { |
819 parsed_command_line().HasSwitch(switches::kAppId) || | 823 do_first_run_tasks_ = false; |
820 parsed_command_line().HasSwitch(switches::kNoFirstRun))) | 824 } |
821 first_run_ui_bypass_ = true; | |
822 | |
823 // Create Sentinel if no-first-run argument is passed in. | |
824 if (parsed_command_line().HasSwitch(switches::kNoFirstRun)) | |
825 first_run::CreateSentinel(); | |
cpu_(ooo_6.6-7.5)
2012/12/27 23:53:05
I am a bit confused here, I expected the code 824-
gab
2012/12/28 20:17:46
Well in the description I stated what I need as an
| |
826 } | 825 } |
827 #endif | 826 #endif |
828 | 827 |
829 // TODO(viettrungluu): why don't we run this earlier? | 828 // TODO(viettrungluu): why don't we run this earlier? |
830 if (!parsed_command_line().HasSwitch(switches::kNoErrorDialogs)) | 829 if (!parsed_command_line().HasSwitch(switches::kNoErrorDialogs)) |
831 WarnAboutMinimumSystemRequirements(); | 830 WarnAboutMinimumSystemRequirements(); |
832 | 831 |
833 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_MACOSX) | 832 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_MACOSX) |
834 // Set the product channel for crash reports. | 833 // Set the product channel for crash reports. |
835 child_process_logging::SetChannel( | 834 child_process_logging::SetChannel( |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
877 chrome_extra_parts_[i]->PreMainMessageLoopRun(); | 876 chrome_extra_parts_[i]->PreMainMessageLoopRun(); |
878 } | 877 } |
879 | 878 |
880 // PreMainMessageLoopRun calls these extra stages in the following order: | 879 // PreMainMessageLoopRun calls these extra stages in the following order: |
881 // PreMainMessageLoopRunImpl() | 880 // PreMainMessageLoopRunImpl() |
882 // ... initial setup, including browser_process_ setup. | 881 // ... initial setup, including browser_process_ setup. |
883 // PreProfileInit() | 882 // PreProfileInit() |
884 // ... additional setup, including CreateProfile() | 883 // ... additional setup, including CreateProfile() |
885 // PostProfileInit() | 884 // PostProfileInit() |
886 // ... additional setup | 885 // ... additional setup |
887 // PreInteractiveFirstRunInit() | |
888 // ... first_run::AutoImport() | |
889 // PostInteractiveFirstRunInit() | |
890 // ... additional setup | |
891 // PreBrowserStart() | 886 // PreBrowserStart() |
892 // ... browser_creator_->Start (OR parameters().ui_task->Run()) | 887 // ... browser_creator_->Start (OR parameters().ui_task->Run()) |
893 // PostBrowserStart() | 888 // PostBrowserStart() |
894 | 889 |
895 void ChromeBrowserMainParts::PreProfileInit() { | 890 void ChromeBrowserMainParts::PreProfileInit() { |
896 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 891 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
897 chrome_extra_parts_[i]->PreProfileInit(); | 892 chrome_extra_parts_[i]->PreProfileInit(); |
898 } | 893 } |
899 | 894 |
900 void ChromeBrowserMainParts::PostProfileInit() { | 895 void ChromeBrowserMainParts::PostProfileInit() { |
901 LaunchDevToolsHandlerIfNeeded(profile(), parsed_command_line()); | 896 LaunchDevToolsHandlerIfNeeded(profile(), parsed_command_line()); |
902 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 897 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
903 chrome_extra_parts_[i]->PostProfileInit(); | 898 chrome_extra_parts_[i]->PostProfileInit(); |
904 } | 899 } |
905 | 900 |
906 void ChromeBrowserMainParts::PreInteractiveFirstRunInit() { | |
907 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | |
908 chrome_extra_parts_[i]->PreInteractiveFirstRunInit(); | |
909 } | |
910 | |
911 void ChromeBrowserMainParts::PostInteractiveFirstRunInit() { | |
912 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | |
913 chrome_extra_parts_[i]->PostInteractiveFirstRunInit(); | |
914 } | |
915 | |
916 void ChromeBrowserMainParts::PreBrowserStart() { | 901 void ChromeBrowserMainParts::PreBrowserStart() { |
917 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 902 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
918 chrome_extra_parts_[i]->PreBrowserStart(); | 903 chrome_extra_parts_[i]->PreBrowserStart(); |
919 #if !defined(OS_ANDROID) | 904 #if !defined(OS_ANDROID) |
920 gpu_util::InstallBrowserMonitor(); | 905 gpu_util::InstallBrowserMonitor(); |
921 #endif | 906 #endif |
922 } | 907 } |
923 | 908 |
924 void ChromeBrowserMainParts::PostBrowserStart() { | 909 void ChromeBrowserMainParts::PostBrowserStart() { |
925 #if !defined(OS_ANDROID) | 910 #if !defined(OS_ANDROID) |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1115 ShellIntegration::SetAsDefaultBrowser(); | 1100 ShellIntegration::SetAsDefaultBrowser(); |
1116 } | 1101 } |
1117 #else | 1102 #else |
1118 // We don't support retention experiments on Mac or Linux. | 1103 // We don't support retention experiments on Mac or Linux. |
1119 return content::RESULT_CODE_NORMAL_EXIT; | 1104 return content::RESULT_CODE_NORMAL_EXIT; |
1120 #endif // defined(OS_WIN) | 1105 #endif // defined(OS_WIN) |
1121 } | 1106 } |
1122 | 1107 |
1123 // Profile creation ---------------------------------------------------------- | 1108 // Profile creation ---------------------------------------------------------- |
1124 | 1109 |
1125 if (is_first_run_) { | 1110 if (do_first_run_tasks_) { |
1126 // Warn the ProfileManager that an import process will run, possibly | 1111 // Warn the ProfileManager that an import process will run, possibly |
1127 // locking the WebDataService directory of the next Profile created. | 1112 // locking the WebDataService directory of the next Profile created. |
1128 browser_process_->profile_manager()->SetWillImport(); | 1113 browser_process_->profile_manager()->SetWillImport(); |
1129 } | 1114 } |
1130 | 1115 |
1131 profile_ = CreateProfile(parameters(), user_data_dir_, parsed_command_line()); | 1116 profile_ = CreateProfile(parameters(), user_data_dir_, parsed_command_line()); |
1132 if (!profile_) | 1117 if (!profile_) |
1133 return content::RESULT_CODE_NORMAL_EXIT; | 1118 return content::RESULT_CODE_NORMAL_EXIT; |
1134 | 1119 |
1135 #if defined(ENABLE_BACKGROUND) | 1120 #if defined(ENABLE_BACKGROUND) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1185 // blacklist decisions. | 1170 // blacklist decisions. |
1186 if (g_browser_process->gl_string_manager()) | 1171 if (g_browser_process->gl_string_manager()) |
1187 g_browser_process->gl_string_manager()->Initialize(); | 1172 g_browser_process->gl_string_manager()->Initialize(); |
1188 | 1173 |
1189 #if !defined(OS_ANDROID) | 1174 #if !defined(OS_ANDROID) |
1190 // Show the First Run UI if this is the first time Chrome has been run on | 1175 // Show the First Run UI if this is the first time Chrome has been run on |
1191 // this computer, or we're being compelled to do so by a command line flag. | 1176 // this computer, or we're being compelled to do so by a command line flag. |
1192 // Note that this be done _after_ the PrefService is initialized and all | 1177 // Note that this be done _after_ the PrefService is initialized and all |
1193 // preferences are registered, since some of the code that the importer | 1178 // preferences are registered, since some of the code that the importer |
1194 // touches reads preferences. | 1179 // touches reads preferences. |
1195 if (is_first_run_) { | 1180 if (do_first_run_tasks_) { |
1196 PreInteractiveFirstRunInit(); | 1181 first_run::AutoImport(profile_, |
1197 | 1182 master_prefs_->homepage_defined, |
1198 if (!first_run_ui_bypass_ || | 1183 master_prefs_->do_import_items, |
1199 parsed_command_line().HasSwitch(switches::kFirstRunForceImport)) { | 1184 master_prefs_->dont_import_items, |
1200 first_run::AutoImport(profile_, | 1185 process_singleton_.get()); |
1201 master_prefs_->homepage_defined, | 1186 // Note: this can pop the first run consent dialog on linux. |
1202 master_prefs_->do_import_items, | 1187 first_run::DoPostImportTasks(profile_, master_prefs_->make_chrome_default); |
1203 master_prefs_->dont_import_items, | |
1204 process_singleton_.get()); | |
1205 first_run::DoFirstRunTasks(profile_, master_prefs_->make_chrome_default); | |
1206 #if defined(OS_POSIX) && !defined(OS_CHROMEOS) | |
1207 // TODO(thakis): Look into moving this POSIX-specific section to | |
1208 // ChromeBrowserMainPartsPosix::PostInteractiveFirstRunInit(). | |
1209 | |
1210 // On Windows, the download is tagged with enable/disable stats so there | |
1211 // is no need for this code. | |
1212 | |
1213 // If stats reporting was turned on by the first run dialog then toggle | |
1214 // the pref. | |
1215 if (GoogleUpdateSettings::GetCollectStatsConsent()) | |
1216 local_state_->SetBoolean(prefs::kMetricsReportingEnabled, true); | |
1217 #endif // OS_POSIX && !OS_CHROMEOS | |
1218 } // if (!first_run_ui_bypass_) | |
1219 PostInteractiveFirstRunInit(); | |
1220 | 1188 |
1221 browser_process_->profile_manager()->OnImportFinished(profile_); | 1189 browser_process_->profile_manager()->OnImportFinished(profile_); |
1222 | 1190 |
1223 if (!master_prefs_->suppress_first_run_default_browser_prompt) { | 1191 if (!master_prefs_->suppress_first_run_default_browser_prompt) { |
1224 browser_creator_->set_show_main_browser_window( | 1192 browser_creator_->set_show_main_browser_window( |
1225 !chrome::ShowFirstRunDefaultBrowserPrompt(profile_)); | 1193 !chrome::ShowFirstRunDefaultBrowserPrompt(profile_)); |
1226 } else { | 1194 } else { |
1227 browser_creator_->set_is_default_browser_dialog_suppressed(true); | 1195 browser_creator_->set_is_default_browser_dialog_suppressed(true); |
1228 } | 1196 } |
1229 } // if (is_first_run_) | 1197 } // if (do_first_run_tasks_) |
1230 #endif // !defined(OS_ANDROID) | 1198 #endif // !defined(OS_ANDROID) |
1231 | 1199 |
1232 #if defined(OS_WIN) | 1200 #if defined(OS_WIN) |
1233 // Sets things up so that if we crash from this point on, a dialog will | 1201 // Sets things up so that if we crash from this point on, a dialog will |
1234 // popup asking the user to restart chrome. It is done this late to avoid | 1202 // popup asking the user to restart chrome. It is done this late to avoid |
1235 // testing against a bunch of special cases that are taken care early on. | 1203 // testing against a bunch of special cases that are taken care early on. |
1236 ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment( | 1204 ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment( |
1237 parsed_command_line()); | 1205 parsed_command_line()); |
1238 | 1206 |
1239 // Registers Chrome with the Windows Restart Manager, which will restore the | 1207 // Registers Chrome with the Windows Restart Manager, which will restore the |
(...skipping 13 matching lines...) Expand all Loading... | |
1253 base::Bind(&NetworkProfileBubble::CheckNetworkProfile, | 1221 base::Bind(&NetworkProfileBubble::CheckNetworkProfile, |
1254 profile_->GetPath())); | 1222 profile_->GetPath())); |
1255 } | 1223 } |
1256 #endif // OS_WIN | 1224 #endif // OS_WIN |
1257 | 1225 |
1258 #if defined(ENABLE_RLZ) && !defined(OS_CHROMEOS) | 1226 #if defined(ENABLE_RLZ) && !defined(OS_CHROMEOS) |
1259 // Init the RLZ library. This just binds the dll and schedules a task on the | 1227 // Init the RLZ library. This just binds the dll and schedules a task on the |
1260 // file thread to be run sometime later. If this is the first run we record | 1228 // file thread to be run sometime later. If this is the first run we record |
1261 // the installation event. | 1229 // the installation event. |
1262 PrefService* pref_service = profile_->GetPrefs(); | 1230 PrefService* pref_service = profile_->GetPrefs(); |
1263 int ping_delay = is_first_run_ ? master_prefs_->ping_delay : | 1231 int ping_delay = do_first_run_tasks_ ? master_prefs_->ping_delay : |
1264 pref_service->GetInteger(first_run::GetPingDelayPrefName().c_str()); | 1232 pref_service->GetInteger(first_run::GetPingDelayPrefName().c_str()); |
1265 // Negative ping delay means to send ping immediately after a first search is | 1233 // Negative ping delay means to send ping immediately after a first search is |
1266 // recorded. | 1234 // recorded. |
1267 RLZTracker::InitRlzFromProfileDelayed( | 1235 RLZTracker::InitRlzFromProfileDelayed( |
1268 profile_, is_first_run_, ping_delay < 0, | 1236 profile_, do_first_run_tasks_, ping_delay < 0, |
1269 base::TimeDelta::FromMilliseconds(abs(ping_delay))); | 1237 base::TimeDelta::FromMilliseconds(abs(ping_delay))); |
1270 #endif // defined(ENABLE_RLZ) && !defined(OS_CHROMEOS) | 1238 #endif // defined(ENABLE_RLZ) && !defined(OS_CHROMEOS) |
1271 | 1239 |
1272 // Configure modules that need access to resources. | 1240 // Configure modules that need access to resources. |
1273 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider); | 1241 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider); |
1274 | 1242 |
1275 // In unittest mode, this will do nothing. In normal mode, this will create | 1243 // In unittest mode, this will do nothing. In normal mode, this will create |
1276 // the global IntranetRedirectDetector instance, which will promptly go to | 1244 // the global IntranetRedirectDetector instance, which will promptly go to |
1277 // sleep for seven seconds (to avoid slowing startup), and wake up afterwards | 1245 // sleep for seven seconds (to avoid slowing startup), and wake up afterwards |
1278 // to see if it should do anything else. | 1246 // to see if it should do anything else. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1355 // ThreadWatcher takes over or when browser is shutdown or when | 1323 // ThreadWatcher takes over or when browser is shutdown or when |
1356 // startup_watcher_ is deleted. | 1324 // startup_watcher_ is deleted. |
1357 startup_watcher_->Arm(base::TimeDelta::FromSeconds(300)); | 1325 startup_watcher_->Arm(base::TimeDelta::FromSeconds(300)); |
1358 | 1326 |
1359 // Start watching for a hang. | 1327 // Start watching for a hang. |
1360 MetricsService::LogNeedForCleanShutdown(); | 1328 MetricsService::LogNeedForCleanShutdown(); |
1361 | 1329 |
1362 #if defined(OS_WIN) | 1330 #if defined(OS_WIN) |
1363 // We check this here because if the profile is OTR (chromeos possibility) | 1331 // We check this here because if the profile is OTR (chromeos possibility) |
1364 // it won't still be accessible after browser is destroyed. | 1332 // it won't still be accessible after browser is destroyed. |
1365 record_search_engine_ = is_first_run_ && !profile_->IsOffTheRecord(); | 1333 record_search_engine_ = do_first_run_tasks_ && !profile_->IsOffTheRecord(); |
1366 #endif | 1334 #endif |
1367 | 1335 |
1368 // Create the instance of the cloud print proxy service so that it can launch | 1336 // Create the instance of the cloud print proxy service so that it can launch |
1369 // the service process if needed. This is needed because the service process | 1337 // the service process if needed. This is needed because the service process |
1370 // might have shutdown because an update was available. | 1338 // might have shutdown because an update was available. |
1371 // TODO(torne): this should maybe be done with | 1339 // TODO(torne): this should maybe be done with |
1372 // ProfileKeyedServiceFactory::ServiceIsCreatedWithProfile() instead? | 1340 // ProfileKeyedServiceFactory::ServiceIsCreatedWithProfile() instead? |
1373 #if !defined(OS_ANDROID) | 1341 #if !defined(OS_ANDROID) |
1374 CloudPrintProxyServiceFactory::GetForProfile(profile_); | 1342 CloudPrintProxyServiceFactory::GetForProfile(profile_); |
1375 #endif | 1343 #endif |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1687 if (base::win::GetVersion() <= base::win::VERSION_XP) | 1655 if (base::win::GetVersion() <= base::win::VERSION_XP) |
1688 uma_name += "_XP"; | 1656 uma_name += "_XP"; |
1689 | 1657 |
1690 uma_name += "_PreRead_"; | 1658 uma_name += "_PreRead_"; |
1691 uma_name += pre_read_percentage; | 1659 uma_name += pre_read_percentage; |
1692 AddPreReadHistogramTime(uma_name.c_str(), time); | 1660 AddPreReadHistogramTime(uma_name.c_str(), time); |
1693 } | 1661 } |
1694 #endif | 1662 #endif |
1695 #endif | 1663 #endif |
1696 } | 1664 } |
OLD | NEW |