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 // Whether this is First Run. |do_first_run_tasks_| should be prefered to this |
| 693 // unless the desire is actually to know whether this is really First Run |
| 694 // (i.e., even if --no-first-run is passed). |
| 695 bool is_first_run = false; |
693 // Android's first run is done in Java instead of native. | 696 // Android's first run is done in Java instead of native. |
694 #if !defined(OS_ANDROID) | 697 #if !defined(OS_ANDROID) |
| 698 |
695 process_singleton_.reset(new ProcessSingleton(user_data_dir_)); | 699 process_singleton_.reset(new ProcessSingleton(user_data_dir_)); |
696 // Ensure ProcessSingleton won't process messages too early. It will be | 700 // Ensure ProcessSingleton won't process messages too early. It will be |
697 // unlocked in PostBrowserStart(). | 701 // unlocked in PostBrowserStart(). |
698 process_singleton_->Lock(NULL); | 702 process_singleton_->Lock(NULL); |
699 | 703 |
700 is_first_run_ = | 704 bool force_first_run = |
701 (first_run::IsChromeFirstRun() || | 705 parsed_command_line().HasSwitch(switches::kForceFirstRun); |
702 parsed_command_line().HasSwitch(switches::kFirstRun)) && | 706 bool force_skip_first_run_tasks = |
| 707 (!force_first_run && |
| 708 parsed_command_line().HasSwitch(switches::kNoFirstRun)); |
| 709 |
| 710 is_first_run = |
| 711 (force_first_run || first_run::IsChromeFirstRun()) && |
703 !ProfileManager::IsImportProcess(parsed_command_line()); | 712 !ProfileManager::IsImportProcess(parsed_command_line()); |
704 #endif | 713 #endif |
705 | 714 |
706 FilePath local_state_path; | 715 FilePath local_state_path; |
707 CHECK(PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path)); | 716 CHECK(PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path)); |
708 scoped_refptr<base::SequencedTaskRunner> local_state_task_runner = | 717 scoped_refptr<base::SequencedTaskRunner> local_state_task_runner = |
709 JsonPrefStore::GetTaskRunnerForFile(local_state_path, | 718 JsonPrefStore::GetTaskRunnerForFile(local_state_path, |
710 BrowserThread::GetBlockingPool()); | 719 BrowserThread::GetBlockingPool()); |
711 browser_process_.reset(new BrowserProcessImpl(local_state_task_runner, | 720 browser_process_.reset(new BrowserProcessImpl(local_state_task_runner, |
712 parsed_command_line())); | 721 parsed_command_line())); |
(...skipping 13 matching lines...) Expand all Loading... |
726 } | 735 } |
727 | 736 |
728 if (parsed_command_line().HasSwitch(switches::kProfilingOutputFile)) { | 737 if (parsed_command_line().HasSwitch(switches::kProfilingOutputFile)) { |
729 tracking_objects_.set_output_file_path( | 738 tracking_objects_.set_output_file_path( |
730 parsed_command_line().GetSwitchValuePath( | 739 parsed_command_line().GetSwitchValuePath( |
731 switches::kProfilingOutputFile)); | 740 switches::kProfilingOutputFile)); |
732 } | 741 } |
733 | 742 |
734 local_state_ = InitializeLocalState(local_state_task_runner, | 743 local_state_ = InitializeLocalState(local_state_task_runner, |
735 parsed_command_line(), | 744 parsed_command_line(), |
736 is_first_run_); | 745 is_first_run); |
737 | 746 |
738 // These members must be initialized before returning from this function. | 747 // These members must be initialized before returning from this function. |
739 master_prefs_.reset(new first_run::MasterPrefs); | 748 master_prefs_.reset(new first_run::MasterPrefs); |
740 | 749 |
741 #if !defined(OS_ANDROID) | 750 #if !defined(OS_ANDROID) |
742 // Android doesn't use StartupBrowserCreator. | 751 // Android doesn't use StartupBrowserCreator. |
743 browser_creator_.reset(new StartupBrowserCreator); | 752 browser_creator_.reset(new StartupBrowserCreator); |
744 // TODO(yfriedman): Refactor Android to re-use UMABrowsingActivityObserver | 753 // TODO(yfriedman): Refactor Android to re-use UMABrowsingActivityObserver |
745 chrome::UMABrowsingActivityObserver::Init(); | 754 chrome::UMABrowsingActivityObserver::Init(); |
746 #endif | 755 #endif |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 | 802 |
794 #if defined(TOOLKIT_GTK) | 803 #if defined(TOOLKIT_GTK) |
795 g_set_application_name(l10n_util::GetStringUTF8(IDS_PRODUCT_NAME).c_str()); | 804 g_set_application_name(l10n_util::GetStringUTF8(IDS_PRODUCT_NAME).c_str()); |
796 #endif | 805 #endif |
797 | 806 |
798 // Android does first run in Java instead of native. | 807 // Android does first run in Java instead of native. |
799 #if !defined(OS_ANDROID) | 808 #if !defined(OS_ANDROID) |
800 // On first run, we need to process the predictor preferences before the | 809 // On first run, we need to process the predictor preferences before the |
801 // browser's profile_manager object is created, but after ResourceBundle | 810 // browser's profile_manager object is created, but after ResourceBundle |
802 // is initialized. | 811 // is initialized. |
803 first_run_ui_bypass_ = false; // True to skip first run UI. | 812 if (is_first_run) { |
804 if (is_first_run_) { | |
805 first_run::ProcessMasterPreferencesResult pmp_result = | 813 first_run::ProcessMasterPreferencesResult pmp_result = |
806 first_run::ProcessMasterPreferences(user_data_dir_, | 814 first_run::ProcessMasterPreferences(user_data_dir_, |
807 master_prefs_.get()); | 815 master_prefs_.get()); |
808 if (pmp_result == first_run::EULA_EXIT_NOW) | 816 if (pmp_result == first_run::EULA_EXIT_NOW) |
809 return chrome::RESULT_CODE_EULA_REFUSED; | 817 return chrome::RESULT_CODE_EULA_REFUSED; |
810 | 818 |
811 first_run_ui_bypass_ = (pmp_result == first_run::SKIP_FIRST_RUN); | 819 // Do first run tasks unless: |
| 820 // - Explicitly forced not to by |force_skip_first_run_tasks| or |
| 821 // |pmp_result|. |
| 822 // - Running in App mode, where showing the importer (first run) UI is |
| 823 // undesired. |
| 824 do_first_run_tasks_ = (!force_skip_first_run_tasks && |
| 825 pmp_result != first_run::SKIP_FIRST_RUN_TASKS && |
| 826 !parsed_command_line().HasSwitch(switches::kApp) && |
| 827 !parsed_command_line().HasSwitch(switches::kAppId)); |
812 | 828 |
813 AddFirstRunNewTabs(browser_creator_.get(), master_prefs_->new_tabs); | 829 if (do_first_run_tasks_) { |
814 | 830 AddFirstRunNewTabs(browser_creator_.get(), master_prefs_->new_tabs); |
815 // If we are running in App mode, we do not want to show the importer | 831 } else if (parsed_command_line().HasSwitch(switches::kNoFirstRun)) { |
816 // (first run) UI. | 832 // Create the First Run beacon anyways if --no-first-run was passed on the |
817 if (!first_run_ui_bypass_ && | 833 // command line. |
818 (parsed_command_line().HasSwitch(switches::kApp) || | |
819 parsed_command_line().HasSwitch(switches::kAppId) || | |
820 parsed_command_line().HasSwitch(switches::kNoFirstRun))) | |
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(); | 834 first_run::CreateSentinel(); |
| 835 } |
826 } | 836 } |
827 #endif | 837 #endif |
828 | 838 |
829 // TODO(viettrungluu): why don't we run this earlier? | 839 // TODO(viettrungluu): why don't we run this earlier? |
830 if (!parsed_command_line().HasSwitch(switches::kNoErrorDialogs)) | 840 if (!parsed_command_line().HasSwitch(switches::kNoErrorDialogs)) |
831 WarnAboutMinimumSystemRequirements(); | 841 WarnAboutMinimumSystemRequirements(); |
832 | 842 |
833 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_MACOSX) | 843 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_MACOSX) |
834 // Set the product channel for crash reports. | 844 // Set the product channel for crash reports. |
835 child_process_logging::SetChannel( | 845 child_process_logging::SetChannel( |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 chrome_extra_parts_[i]->PreMainMessageLoopRun(); | 887 chrome_extra_parts_[i]->PreMainMessageLoopRun(); |
878 } | 888 } |
879 | 889 |
880 // PreMainMessageLoopRun calls these extra stages in the following order: | 890 // PreMainMessageLoopRun calls these extra stages in the following order: |
881 // PreMainMessageLoopRunImpl() | 891 // PreMainMessageLoopRunImpl() |
882 // ... initial setup, including browser_process_ setup. | 892 // ... initial setup, including browser_process_ setup. |
883 // PreProfileInit() | 893 // PreProfileInit() |
884 // ... additional setup, including CreateProfile() | 894 // ... additional setup, including CreateProfile() |
885 // PostProfileInit() | 895 // PostProfileInit() |
886 // ... additional setup | 896 // ... additional setup |
887 // PreInteractiveFirstRunInit() | |
888 // ... first_run::AutoImport() | |
889 // PostInteractiveFirstRunInit() | |
890 // ... additional setup | |
891 // PreBrowserStart() | 897 // PreBrowserStart() |
892 // ... browser_creator_->Start (OR parameters().ui_task->Run()) | 898 // ... browser_creator_->Start (OR parameters().ui_task->Run()) |
893 // PostBrowserStart() | 899 // PostBrowserStart() |
894 | 900 |
895 void ChromeBrowserMainParts::PreProfileInit() { | 901 void ChromeBrowserMainParts::PreProfileInit() { |
896 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 902 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
897 chrome_extra_parts_[i]->PreProfileInit(); | 903 chrome_extra_parts_[i]->PreProfileInit(); |
898 } | 904 } |
899 | 905 |
900 void ChromeBrowserMainParts::PostProfileInit() { | 906 void ChromeBrowserMainParts::PostProfileInit() { |
901 LaunchDevToolsHandlerIfNeeded(profile(), parsed_command_line()); | 907 LaunchDevToolsHandlerIfNeeded(profile(), parsed_command_line()); |
902 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 908 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
903 chrome_extra_parts_[i]->PostProfileInit(); | 909 chrome_extra_parts_[i]->PostProfileInit(); |
904 } | 910 } |
905 | 911 |
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() { | 912 void ChromeBrowserMainParts::PreBrowserStart() { |
917 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 913 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
918 chrome_extra_parts_[i]->PreBrowserStart(); | 914 chrome_extra_parts_[i]->PreBrowserStart(); |
919 #if !defined(OS_ANDROID) | 915 #if !defined(OS_ANDROID) |
920 gpu_util::InstallBrowserMonitor(); | 916 gpu_util::InstallBrowserMonitor(); |
921 #endif | 917 #endif |
922 } | 918 } |
923 | 919 |
924 void ChromeBrowserMainParts::PostBrowserStart() { | 920 void ChromeBrowserMainParts::PostBrowserStart() { |
925 #if !defined(OS_ANDROID) | 921 #if !defined(OS_ANDROID) |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 ShellIntegration::SetAsDefaultBrowser(); | 1111 ShellIntegration::SetAsDefaultBrowser(); |
1116 } | 1112 } |
1117 #else | 1113 #else |
1118 // We don't support retention experiments on Mac or Linux. | 1114 // We don't support retention experiments on Mac or Linux. |
1119 return content::RESULT_CODE_NORMAL_EXIT; | 1115 return content::RESULT_CODE_NORMAL_EXIT; |
1120 #endif // defined(OS_WIN) | 1116 #endif // defined(OS_WIN) |
1121 } | 1117 } |
1122 | 1118 |
1123 // Profile creation ---------------------------------------------------------- | 1119 // Profile creation ---------------------------------------------------------- |
1124 | 1120 |
1125 if (is_first_run_) { | 1121 if (do_first_run_tasks_) { |
1126 // Warn the ProfileManager that an import process will run, possibly | 1122 // Warn the ProfileManager that an import process will run, possibly |
1127 // locking the WebDataService directory of the next Profile created. | 1123 // locking the WebDataService directory of the next Profile created. |
1128 browser_process_->profile_manager()->SetWillImport(); | 1124 browser_process_->profile_manager()->SetWillImport(); |
1129 } | 1125 } |
1130 | 1126 |
1131 profile_ = CreateProfile(parameters(), user_data_dir_, parsed_command_line()); | 1127 profile_ = CreateProfile(parameters(), user_data_dir_, parsed_command_line()); |
1132 if (!profile_) | 1128 if (!profile_) |
1133 return content::RESULT_CODE_NORMAL_EXIT; | 1129 return content::RESULT_CODE_NORMAL_EXIT; |
1134 | 1130 |
1135 #if defined(ENABLE_BACKGROUND) | 1131 #if defined(ENABLE_BACKGROUND) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1185 // blacklist decisions. | 1181 // blacklist decisions. |
1186 if (g_browser_process->gl_string_manager()) | 1182 if (g_browser_process->gl_string_manager()) |
1187 g_browser_process->gl_string_manager()->Initialize(); | 1183 g_browser_process->gl_string_manager()->Initialize(); |
1188 | 1184 |
1189 #if !defined(OS_ANDROID) | 1185 #if !defined(OS_ANDROID) |
1190 // Show the First Run UI if this is the first time Chrome has been run on | 1186 // 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. | 1187 // 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 | 1188 // Note that this be done _after_ the PrefService is initialized and all |
1193 // preferences are registered, since some of the code that the importer | 1189 // preferences are registered, since some of the code that the importer |
1194 // touches reads preferences. | 1190 // touches reads preferences. |
1195 if (is_first_run_) { | 1191 if (do_first_run_tasks_) { |
1196 PreInteractiveFirstRunInit(); | 1192 first_run::AutoImport(profile_, |
1197 | 1193 master_prefs_->homepage_defined, |
1198 if (!first_run_ui_bypass_ || | 1194 master_prefs_->do_import_items, |
1199 parsed_command_line().HasSwitch(switches::kFirstRunForceImport)) { | 1195 master_prefs_->dont_import_items, |
1200 first_run::AutoImport(profile_, | 1196 process_singleton_.get()); |
1201 master_prefs_->homepage_defined, | 1197 // Note: this can pop the first run consent dialog on linux. |
1202 master_prefs_->do_import_items, | 1198 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 | 1199 |
1221 browser_process_->profile_manager()->OnImportFinished(profile_); | 1200 browser_process_->profile_manager()->OnImportFinished(profile_); |
1222 | 1201 |
1223 if (!master_prefs_->suppress_first_run_default_browser_prompt) { | 1202 if (!master_prefs_->suppress_first_run_default_browser_prompt) { |
1224 browser_creator_->set_show_main_browser_window( | 1203 browser_creator_->set_show_main_browser_window( |
1225 !chrome::ShowFirstRunDefaultBrowserPrompt(profile_)); | 1204 !chrome::ShowFirstRunDefaultBrowserPrompt(profile_)); |
1226 } else { | 1205 } else { |
1227 browser_creator_->set_is_default_browser_dialog_suppressed(true); | 1206 browser_creator_->set_is_default_browser_dialog_suppressed(true); |
1228 } | 1207 } |
1229 } // if (is_first_run_) | 1208 } // if (do_first_run_tasks_) |
1230 #endif // !defined(OS_ANDROID) | 1209 #endif // !defined(OS_ANDROID) |
1231 | 1210 |
1232 #if defined(OS_WIN) | 1211 #if defined(OS_WIN) |
1233 // Sets things up so that if we crash from this point on, a dialog will | 1212 // 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 | 1213 // 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. | 1214 // testing against a bunch of special cases that are taken care early on. |
1236 ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment( | 1215 ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment( |
1237 parsed_command_line()); | 1216 parsed_command_line()); |
1238 | 1217 |
1239 // Registers Chrome with the Windows Restart Manager, which will restore the | 1218 // Registers Chrome with the Windows Restart Manager, which will restore the |
(...skipping 13 matching lines...) Expand all Loading... |
1253 base::Bind(&NetworkProfileBubble::CheckNetworkProfile, | 1232 base::Bind(&NetworkProfileBubble::CheckNetworkProfile, |
1254 profile_->GetPath())); | 1233 profile_->GetPath())); |
1255 } | 1234 } |
1256 #endif // OS_WIN | 1235 #endif // OS_WIN |
1257 | 1236 |
1258 #if defined(ENABLE_RLZ) && !defined(OS_CHROMEOS) | 1237 #if defined(ENABLE_RLZ) && !defined(OS_CHROMEOS) |
1259 // Init the RLZ library. This just binds the dll and schedules a task on the | 1238 // 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 | 1239 // file thread to be run sometime later. If this is the first run we record |
1261 // the installation event. | 1240 // the installation event. |
1262 PrefService* pref_service = profile_->GetPrefs(); | 1241 PrefService* pref_service = profile_->GetPrefs(); |
1263 int ping_delay = is_first_run_ ? master_prefs_->ping_delay : | 1242 int ping_delay = do_first_run_tasks_ ? master_prefs_->ping_delay : |
1264 pref_service->GetInteger(first_run::GetPingDelayPrefName().c_str()); | 1243 pref_service->GetInteger(first_run::GetPingDelayPrefName().c_str()); |
1265 // Negative ping delay means to send ping immediately after a first search is | 1244 // Negative ping delay means to send ping immediately after a first search is |
1266 // recorded. | 1245 // recorded. |
1267 RLZTracker::InitRlzFromProfileDelayed( | 1246 RLZTracker::InitRlzFromProfileDelayed( |
1268 profile_, is_first_run_, ping_delay < 0, | 1247 profile_, do_first_run_tasks_, ping_delay < 0, |
1269 base::TimeDelta::FromMilliseconds(abs(ping_delay))); | 1248 base::TimeDelta::FromMilliseconds(abs(ping_delay))); |
1270 #endif // defined(ENABLE_RLZ) && !defined(OS_CHROMEOS) | 1249 #endif // defined(ENABLE_RLZ) && !defined(OS_CHROMEOS) |
1271 | 1250 |
1272 // Configure modules that need access to resources. | 1251 // Configure modules that need access to resources. |
1273 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider); | 1252 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider); |
1274 | 1253 |
1275 // In unittest mode, this will do nothing. In normal mode, this will create | 1254 // In unittest mode, this will do nothing. In normal mode, this will create |
1276 // the global IntranetRedirectDetector instance, which will promptly go to | 1255 // the global IntranetRedirectDetector instance, which will promptly go to |
1277 // sleep for seven seconds (to avoid slowing startup), and wake up afterwards | 1256 // sleep for seven seconds (to avoid slowing startup), and wake up afterwards |
1278 // to see if it should do anything else. | 1257 // 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 | 1334 // ThreadWatcher takes over or when browser is shutdown or when |
1356 // startup_watcher_ is deleted. | 1335 // startup_watcher_ is deleted. |
1357 startup_watcher_->Arm(base::TimeDelta::FromSeconds(300)); | 1336 startup_watcher_->Arm(base::TimeDelta::FromSeconds(300)); |
1358 | 1337 |
1359 // Start watching for a hang. | 1338 // Start watching for a hang. |
1360 MetricsService::LogNeedForCleanShutdown(); | 1339 MetricsService::LogNeedForCleanShutdown(); |
1361 | 1340 |
1362 #if defined(OS_WIN) | 1341 #if defined(OS_WIN) |
1363 // We check this here because if the profile is OTR (chromeos possibility) | 1342 // We check this here because if the profile is OTR (chromeos possibility) |
1364 // it won't still be accessible after browser is destroyed. | 1343 // it won't still be accessible after browser is destroyed. |
1365 record_search_engine_ = is_first_run_ && !profile_->IsOffTheRecord(); | 1344 record_search_engine_ = do_first_run_tasks_ && !profile_->IsOffTheRecord(); |
1366 #endif | 1345 #endif |
1367 | 1346 |
1368 // Create the instance of the cloud print proxy service so that it can launch | 1347 // 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 | 1348 // the service process if needed. This is needed because the service process |
1370 // might have shutdown because an update was available. | 1349 // might have shutdown because an update was available. |
1371 // TODO(torne): this should maybe be done with | 1350 // TODO(torne): this should maybe be done with |
1372 // ProfileKeyedServiceFactory::ServiceIsCreatedWithProfile() instead? | 1351 // ProfileKeyedServiceFactory::ServiceIsCreatedWithProfile() instead? |
1373 #if !defined(OS_ANDROID) | 1352 #if !defined(OS_ANDROID) |
1374 CloudPrintProxyServiceFactory::GetForProfile(profile_); | 1353 CloudPrintProxyServiceFactory::GetForProfile(profile_); |
1375 #endif | 1354 #endif |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1687 if (base::win::GetVersion() <= base::win::VERSION_XP) | 1666 if (base::win::GetVersion() <= base::win::VERSION_XP) |
1688 uma_name += "_XP"; | 1667 uma_name += "_XP"; |
1689 | 1668 |
1690 uma_name += "_PreRead_"; | 1669 uma_name += "_PreRead_"; |
1691 uma_name += pre_read_percentage; | 1670 uma_name += pre_read_percentage; |
1692 AddPreReadHistogramTime(uma_name.c_str(), time); | 1671 AddPreReadHistogramTime(uma_name.c_str(), time); |
1693 } | 1672 } |
1694 #endif | 1673 #endif |
1695 #endif | 1674 #endif |
1696 } | 1675 } |
OLD | NEW |