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