| 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/browser_process_impl.h" | 5 #include "chrome/browser/browser_process_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 // Linux. We have a timeout here because we're unable to run the UI messageloop | 124 // Linux. We have a timeout here because we're unable to run the UI messageloop |
| 125 // and there's some deadlock risk. Our only option is to exit anyway. | 125 // and there's some deadlock risk. Our only option is to exit anyway. |
| 126 static const int kEndSessionTimeoutSeconds = 10; | 126 static const int kEndSessionTimeoutSeconds = 10; |
| 127 #endif | 127 #endif |
| 128 | 128 |
| 129 using content::BrowserThread; | 129 using content::BrowserThread; |
| 130 using content::ChildProcessSecurityPolicy; | 130 using content::ChildProcessSecurityPolicy; |
| 131 using content::PluginService; | 131 using content::PluginService; |
| 132 using content::ResourceDispatcherHost; | 132 using content::ResourceDispatcherHost; |
| 133 | 133 |
| 134 BrowserProcessImpl::BrowserProcessImpl(const CommandLine& command_line) | 134 BrowserProcessImpl::BrowserProcessImpl( |
| 135 base::SequencedTaskRunner* local_state_task_runner, |
| 136 const CommandLine& command_line) |
| 135 : created_metrics_service_(false), | 137 : created_metrics_service_(false), |
| 136 created_watchdog_thread_(false), | 138 created_watchdog_thread_(false), |
| 137 created_browser_policy_connector_(false), | 139 created_browser_policy_connector_(false), |
| 138 created_profile_manager_(false), | 140 created_profile_manager_(false), |
| 139 created_local_state_(false), | 141 created_local_state_(false), |
| 140 created_icon_manager_(false), | 142 created_icon_manager_(false), |
| 141 created_notification_ui_manager_(false), | 143 created_notification_ui_manager_(false), |
| 142 created_safe_browsing_service_(false), | 144 created_safe_browsing_service_(false), |
| 143 module_ref_count_(0), | 145 module_ref_count_(0), |
| 144 did_start_(false), | 146 did_start_(false), |
| 145 checked_for_new_frames_(false), | 147 checked_for_new_frames_(false), |
| 146 using_new_frames_(false), | 148 using_new_frames_(false), |
| 147 render_widget_snapshot_taker_(new RenderWidgetSnapshotTaker), | 149 render_widget_snapshot_taker_(new RenderWidgetSnapshotTaker), |
| 148 download_status_updater_(new DownloadStatusUpdater) { | 150 download_status_updater_(new DownloadStatusUpdater), |
| 151 local_state_task_runner_(local_state_task_runner) { |
| 149 g_browser_process = this; | 152 g_browser_process = this; |
| 150 | 153 |
| 151 #if defined(ENABLE_PRINTING) | 154 #if defined(ENABLE_PRINTING) |
| 152 // Must be created after the NotificationService. | 155 // Must be created after the NotificationService. |
| 153 print_job_manager_.reset(new printing::PrintJobManager); | 156 print_job_manager_.reset(new printing::PrintJobManager); |
| 154 #endif | 157 #endif |
| 155 | 158 |
| 156 net_log_.reset(new ChromeNetLog); | 159 net_log_.reset(new ChromeNetLog); |
| 157 | 160 |
| 158 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme( | 161 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme( |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 FilePath user_data_dir; | 708 FilePath user_data_dir; |
| 706 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); | 709 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); |
| 707 profile_manager_.reset(new ProfileManager(user_data_dir)); | 710 profile_manager_.reset(new ProfileManager(user_data_dir)); |
| 708 } | 711 } |
| 709 | 712 |
| 710 void BrowserProcessImpl::CreateLocalState() { | 713 void BrowserProcessImpl::CreateLocalState() { |
| 711 DCHECK(!created_local_state_ && local_state_.get() == NULL); | 714 DCHECK(!created_local_state_ && local_state_.get() == NULL); |
| 712 created_local_state_ = true; | 715 created_local_state_ = true; |
| 713 | 716 |
| 714 FilePath local_state_path; | 717 FilePath local_state_path; |
| 715 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); | 718 CHECK(PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path)); |
| 716 local_state_.reset( | 719 local_state_.reset( |
| 717 PrefService::CreatePrefService(local_state_path, policy_service(), NULL, | 720 PrefService::CreatePrefService(local_state_path, local_state_task_runner_, |
| 718 false)); | 721 policy_service(), NULL, false)); |
| 719 | 722 |
| 720 // Initialize the prefs of the local state. | 723 // Initialize the prefs of the local state. |
| 721 chrome::RegisterLocalState(local_state_.get()); | 724 chrome::RegisterLocalState(local_state_.get()); |
| 722 | 725 |
| 723 pref_change_registrar_.Init(local_state_.get()); | 726 pref_change_registrar_.Init(local_state_.get()); |
| 724 | 727 |
| 725 // Initialize the notification for the default browser setting policy. | 728 // Initialize the notification for the default browser setting policy. |
| 726 local_state_->RegisterBooleanPref(prefs::kDefaultBrowserSettingEnabled, | 729 local_state_->RegisterBooleanPref(prefs::kDefaultBrowserSettingEnabled, |
| 727 false); | 730 false); |
| 728 pref_change_registrar_.Add(prefs::kDefaultBrowserSettingEnabled, this); | 731 pref_change_registrar_.Add(prefs::kDefaultBrowserSettingEnabled, this); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 949 } | 952 } |
| 950 | 953 |
| 951 void BrowserProcessImpl::OnAutoupdateTimer() { | 954 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 952 if (CanAutorestartForUpdate()) { | 955 if (CanAutorestartForUpdate()) { |
| 953 DLOG(WARNING) << "Detected update. Restarting browser."; | 956 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 954 RestartBackgroundInstance(); | 957 RestartBackgroundInstance(); |
| 955 } | 958 } |
| 956 } | 959 } |
| 957 | 960 |
| 958 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 961 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |