| 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 <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/debug/alias.h" | 14 #include "base/debug/alias.h" |
| 15 #include "base/debug/leak_annotations.h" | 15 #include "base/debug/leak_annotations.h" |
| 16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 17 #include "base/prefs/json_pref_store.h" | 17 #include "base/prefs/json_pref_store.h" |
| 18 #include "base/prefs/pref_registry_simple.h" | 18 #include "base/prefs/pref_registry_simple.h" |
| 19 #include "base/prefs/pref_service.h" | 19 #include "base/prefs/pref_service.h" |
| 20 #include "base/synchronization/waitable_event.h" | 20 #include "base/synchronization/waitable_event.h" |
| 21 #include "base/threading/thread.h" | 21 #include "base/threading/thread.h" |
| 22 #include "base/threading/thread_restrictions.h" | 22 #include "base/threading/thread_restrictions.h" |
| 23 #include "base/time/default_tick_clock.h" |
| 23 #include "chrome/browser/apps/chrome_apps_client.h" | 24 #include "chrome/browser/apps/chrome_apps_client.h" |
| 24 #include "chrome/browser/background/background_mode_manager.h" | 25 #include "chrome/browser/background/background_mode_manager.h" |
| 25 #include "chrome/browser/chrome_browser_main.h" | 26 #include "chrome/browser/chrome_browser_main.h" |
| 26 #include "chrome/browser/chrome_content_browser_client.h" | 27 #include "chrome/browser/chrome_content_browser_client.h" |
| 27 #include "chrome/browser/chrome_notification_types.h" | 28 #include "chrome/browser/chrome_notification_types.h" |
| 28 #include "chrome/browser/component_updater/component_updater_configurator.h" | 29 #include "chrome/browser/component_updater/component_updater_configurator.h" |
| 29 #include "chrome/browser/component_updater/component_updater_service.h" | 30 #include "chrome/browser/component_updater/component_updater_service.h" |
| 30 #include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h" | 31 #include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h" |
| 31 #include "chrome/browser/defaults.h" | 32 #include "chrome/browser/defaults.h" |
| 32 #include "chrome/browser/devtools/remote_debugging_server.h" | 33 #include "chrome/browser/devtools/remote_debugging_server.h" |
| 33 #include "chrome/browser/download/download_request_limiter.h" | 34 #include "chrome/browser/download/download_request_limiter.h" |
| 34 #include "chrome/browser/download/download_status_updater.h" | 35 #include "chrome/browser/download/download_status_updater.h" |
| 35 #include "chrome/browser/extensions/chrome_extensions_browser_client.h" | 36 #include "chrome/browser/extensions/chrome_extensions_browser_client.h" |
| 36 #include "chrome/browser/extensions/event_router_forwarder.h" | 37 #include "chrome/browser/extensions/event_router_forwarder.h" |
| 37 #include "chrome/browser/extensions/extension_renderer_state.h" | 38 #include "chrome/browser/extensions/extension_renderer_state.h" |
| 38 #include "chrome/browser/first_run/upgrade_util.h" | 39 #include "chrome/browser/first_run/upgrade_util.h" |
| 39 #include "chrome/browser/gpu/gl_string_manager.h" | 40 #include "chrome/browser/gpu/gl_string_manager.h" |
| 40 #include "chrome/browser/gpu/gpu_mode_manager.h" | 41 #include "chrome/browser/gpu/gpu_mode_manager.h" |
| 41 #include "chrome/browser/icon_manager.h" | 42 #include "chrome/browser/icon_manager.h" |
| 42 #include "chrome/browser/idle.h" | 43 #include "chrome/browser/idle.h" |
| 43 #include "chrome/browser/intranet_redirect_detector.h" | 44 #include "chrome/browser/intranet_redirect_detector.h" |
| 44 #include "chrome/browser/io_thread.h" | 45 #include "chrome/browser/io_thread.h" |
| 45 #include "chrome/browser/lifetime/application_lifetime.h" | 46 #include "chrome/browser/lifetime/application_lifetime.h" |
| 46 #include "chrome/browser/metrics/metrics_service.h" | 47 #include "chrome/browser/metrics/metrics_service.h" |
| 47 #include "chrome/browser/metrics/metrics_services_manager.h" | 48 #include "chrome/browser/metrics/metrics_services_manager.h" |
| 48 #include "chrome/browser/metrics/thread_watcher.h" | 49 #include "chrome/browser/metrics/thread_watcher.h" |
| 49 #include "chrome/browser/net/chrome_net_log.h" | 50 #include "chrome/browser/net/chrome_net_log.h" |
| 50 #include "chrome/browser/net/crl_set_fetcher.h" | 51 #include "chrome/browser/net/crl_set_fetcher.h" |
| 51 #include "chrome/browser/net/sdch_dictionary_fetcher.h" | 52 #include "chrome/browser/net/sdch_dictionary_fetcher.h" |
| 53 #include "chrome/browser/network_time/network_time_tracker.h" |
| 52 #include "chrome/browser/notifications/notification_ui_manager.h" | 54 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 53 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" | 55 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
| 54 #include "chrome/browser/plugins/plugin_finder.h" | 56 #include "chrome/browser/plugins/plugin_finder.h" |
| 55 #include "chrome/browser/prefs/browser_prefs.h" | 57 #include "chrome/browser/prefs/browser_prefs.h" |
| 56 #include "chrome/browser/prefs/chrome_pref_service_factory.h" | 58 #include "chrome/browser/prefs/chrome_pref_service_factory.h" |
| 57 #include "chrome/browser/prerender/prerender_tracker.h" | 59 #include "chrome/browser/prerender/prerender_tracker.h" |
| 58 #include "chrome/browser/printing/background_printing_manager.h" | 60 #include "chrome/browser/printing/background_printing_manager.h" |
| 59 #include "chrome/browser/printing/print_job_manager.h" | 61 #include "chrome/browser/printing/print_job_manager.h" |
| 60 #include "chrome/browser/printing/print_preview_dialog_controller.h" | 62 #include "chrome/browser/printing/print_preview_dialog_controller.h" |
| 61 #include "chrome/browser/profiles/profile_manager.h" | 63 #include "chrome/browser/profiles/profile_manager.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 : created_watchdog_thread_(false), | 147 : created_watchdog_thread_(false), |
| 146 created_browser_policy_connector_(false), | 148 created_browser_policy_connector_(false), |
| 147 created_profile_manager_(false), | 149 created_profile_manager_(false), |
| 148 created_local_state_(false), | 150 created_local_state_(false), |
| 149 created_icon_manager_(false), | 151 created_icon_manager_(false), |
| 150 created_notification_ui_manager_(false), | 152 created_notification_ui_manager_(false), |
| 151 created_safe_browsing_service_(false), | 153 created_safe_browsing_service_(false), |
| 152 module_ref_count_(0), | 154 module_ref_count_(0), |
| 153 did_start_(false), | 155 did_start_(false), |
| 154 download_status_updater_(new DownloadStatusUpdater), | 156 download_status_updater_(new DownloadStatusUpdater), |
| 155 local_state_task_runner_(local_state_task_runner) { | 157 local_state_task_runner_(local_state_task_runner), |
| 158 network_time_tracker_(new NetworkTimeTracker( |
| 159 scoped_ptr<base::TickClock>(new base::DefaultTickClock()))) { |
| 156 g_browser_process = this; | 160 g_browser_process = this; |
| 157 platform_part_.reset(new BrowserProcessPlatformPart()); | 161 platform_part_.reset(new BrowserProcessPlatformPart()); |
| 158 | 162 |
| 159 #if defined(ENABLE_PRINTING) | 163 #if defined(ENABLE_PRINTING) |
| 160 // Must be created after the NotificationService. | 164 // Must be created after the NotificationService. |
| 161 print_job_manager_.reset(new printing::PrintJobManager); | 165 print_job_manager_.reset(new printing::PrintJobManager); |
| 162 #endif | 166 #endif |
| 163 | 167 |
| 164 net_log_.reset(new ChromeNetLog); | 168 net_log_.reset(new ChromeNetLog); |
| 165 | 169 |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 } | 613 } |
| 610 | 614 |
| 611 #if defined(ENABLE_WEBRTC) | 615 #if defined(ENABLE_WEBRTC) |
| 612 WebRtcLogUploader* BrowserProcessImpl::webrtc_log_uploader() { | 616 WebRtcLogUploader* BrowserProcessImpl::webrtc_log_uploader() { |
| 613 if (!webrtc_log_uploader_.get()) | 617 if (!webrtc_log_uploader_.get()) |
| 614 webrtc_log_uploader_.reset(new WebRtcLogUploader()); | 618 webrtc_log_uploader_.reset(new WebRtcLogUploader()); |
| 615 return webrtc_log_uploader_.get(); | 619 return webrtc_log_uploader_.get(); |
| 616 } | 620 } |
| 617 #endif | 621 #endif |
| 618 | 622 |
| 623 NetworkTimeTracker* BrowserProcessImpl::network_time_tracker() { |
| 624 return network_time_tracker_.get(); |
| 625 } |
| 626 |
| 619 // static | 627 // static |
| 620 void BrowserProcessImpl::RegisterPrefs(PrefRegistrySimple* registry) { | 628 void BrowserProcessImpl::RegisterPrefs(PrefRegistrySimple* registry) { |
| 621 registry->RegisterBooleanPref(prefs::kDefaultBrowserSettingEnabled, | 629 registry->RegisterBooleanPref(prefs::kDefaultBrowserSettingEnabled, |
| 622 false); | 630 false); |
| 623 // This policy needs to be defined before the net subsystem is initialized, | 631 // This policy needs to be defined before the net subsystem is initialized, |
| 624 // so we do it here. | 632 // so we do it here. |
| 625 registry->RegisterIntegerPref(prefs::kMaxConnectionsPerProxy, | 633 registry->RegisterIntegerPref(prefs::kMaxConnectionsPerProxy, |
| 626 net::kDefaultMaxSocketsPerProxyServer); | 634 net::kDefaultMaxSocketsPerProxyServer); |
| 627 | 635 |
| 628 registry->RegisterBooleanPref(prefs::kAllowCrossOriginAuthPrompt, false); | 636 registry->RegisterBooleanPref(prefs::kAllowCrossOriginAuthPrompt, false); |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1040 } | 1048 } |
| 1041 | 1049 |
| 1042 void BrowserProcessImpl::OnAutoupdateTimer() { | 1050 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 1043 if (CanAutorestartForUpdate()) { | 1051 if (CanAutorestartForUpdate()) { |
| 1044 DLOG(WARNING) << "Detected update. Restarting browser."; | 1052 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 1045 RestartBackgroundInstance(); | 1053 RestartBackgroundInstance(); |
| 1046 } | 1054 } |
| 1047 } | 1055 } |
| 1048 | 1056 |
| 1049 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1057 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |