| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 #include "chrome/browser/gpu/gpu_mode_manager.h" | 46 #include "chrome/browser/gpu/gpu_mode_manager.h" |
| 47 #include "chrome/browser/icon_manager.h" | 47 #include "chrome/browser/icon_manager.h" |
| 48 #include "chrome/browser/intranet_redirect_detector.h" | 48 #include "chrome/browser/intranet_redirect_detector.h" |
| 49 #include "chrome/browser/io_thread.h" | 49 #include "chrome/browser/io_thread.h" |
| 50 #include "chrome/browser/lifetime/application_lifetime.h" | 50 #include "chrome/browser/lifetime/application_lifetime.h" |
| 51 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" | 51 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" |
| 52 #include "chrome/browser/metrics/chrome_metrics_services_manager_client.h" | 52 #include "chrome/browser/metrics/chrome_metrics_services_manager_client.h" |
| 53 #include "chrome/browser/metrics/thread_watcher.h" | 53 #include "chrome/browser/metrics/thread_watcher.h" |
| 54 #include "chrome/browser/net/chrome_net_log_helper.h" | 54 #include "chrome/browser/net/chrome_net_log_helper.h" |
| 55 #include "chrome/browser/net/crl_set_fetcher.h" | 55 #include "chrome/browser/net/crl_set_fetcher.h" |
| 56 #include "chrome/browser/notifications/notification_platform_bridge.h" |
| 56 #include "chrome/browser/notifications/notification_ui_manager.h" | 57 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 57 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" | 58 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
| 58 #include "chrome/browser/plugins/plugin_finder.h" | 59 #include "chrome/browser/plugins/plugin_finder.h" |
| 59 #include "chrome/browser/prefs/browser_prefs.h" | 60 #include "chrome/browser/prefs/browser_prefs.h" |
| 60 #include "chrome/browser/prefs/chrome_pref_service_factory.h" | 61 #include "chrome/browser/prefs/chrome_pref_service_factory.h" |
| 61 #include "chrome/browser/printing/background_printing_manager.h" | 62 #include "chrome/browser/printing/background_printing_manager.h" |
| 62 #include "chrome/browser/printing/print_job_manager.h" | 63 #include "chrome/browser/printing/print_job_manager.h" |
| 63 #include "chrome/browser/printing/print_preview_dialog_controller.h" | 64 #include "chrome/browser/printing/print_preview_dialog_controller.h" |
| 64 #include "chrome/browser/profiles/profile_manager.h" | 65 #include "chrome/browser/profiles/profile_manager.h" |
| 65 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.
h" | 66 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.
h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 184 |
| 184 BrowserProcessImpl::BrowserProcessImpl( | 185 BrowserProcessImpl::BrowserProcessImpl( |
| 185 base::SequencedTaskRunner* local_state_task_runner, | 186 base::SequencedTaskRunner* local_state_task_runner, |
| 186 const base::CommandLine& command_line) | 187 const base::CommandLine& command_line) |
| 187 : created_watchdog_thread_(false), | 188 : created_watchdog_thread_(false), |
| 188 created_browser_policy_connector_(false), | 189 created_browser_policy_connector_(false), |
| 189 created_profile_manager_(false), | 190 created_profile_manager_(false), |
| 190 created_local_state_(false), | 191 created_local_state_(false), |
| 191 created_icon_manager_(false), | 192 created_icon_manager_(false), |
| 192 created_notification_ui_manager_(false), | 193 created_notification_ui_manager_(false), |
| 194 created_notification_bridge_(false), |
| 193 created_safe_browsing_service_(false), | 195 created_safe_browsing_service_(false), |
| 194 shutting_down_(false), | 196 shutting_down_(false), |
| 195 tearing_down_(false), | 197 tearing_down_(false), |
| 196 download_status_updater_(new DownloadStatusUpdater), | 198 download_status_updater_(new DownloadStatusUpdater), |
| 197 local_state_task_runner_(local_state_task_runner), | 199 local_state_task_runner_(local_state_task_runner), |
| 198 cached_default_web_client_state_(shell_integration::UNKNOWN_DEFAULT) { | 200 cached_default_web_client_state_(shell_integration::UNKNOWN_DEFAULT) { |
| 199 g_browser_process = this; | 201 g_browser_process = this; |
| 200 platform_part_.reset(new BrowserProcessPlatformPart()); | 202 platform_part_.reset(new BrowserProcessPlatformPart()); |
| 201 | 203 |
| 202 #if defined(ENABLE_PRINTING) | 204 #if defined(ENABLE_PRINTING) |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 BrowserProcessImpl::extension_event_router_forwarder() { | 566 BrowserProcessImpl::extension_event_router_forwarder() { |
| 565 #if defined(ENABLE_EXTENSIONS) | 567 #if defined(ENABLE_EXTENSIONS) |
| 566 return extension_event_router_forwarder_.get(); | 568 return extension_event_router_forwarder_.get(); |
| 567 #else | 569 #else |
| 568 return NULL; | 570 return NULL; |
| 569 #endif | 571 #endif |
| 570 } | 572 } |
| 571 | 573 |
| 572 NotificationUIManager* BrowserProcessImpl::notification_ui_manager() { | 574 NotificationUIManager* BrowserProcessImpl::notification_ui_manager() { |
| 573 DCHECK(CalledOnValidThread()); | 575 DCHECK(CalledOnValidThread()); |
| 576 // TODO(miguelg) return NULL for MAC as well once native notifications |
| 577 // are enabled by default. |
| 578 #if defined(OS_ANDROID) |
| 579 return nullptr; |
| 580 #else |
| 574 if (!created_notification_ui_manager_) | 581 if (!created_notification_ui_manager_) |
| 575 CreateNotificationUIManager(); | 582 CreateNotificationUIManager(); |
| 576 return notification_ui_manager_.get(); | 583 return notification_ui_manager_.get(); |
| 584 #endif |
| 585 } |
| 586 |
| 587 NotificationPlatformBridge* BrowserProcessImpl::notification_platform_bridge() { |
| 588 #if defined(OS_ANDROID) || defined(OS_MACOSX) |
| 589 if (!created_notification_bridge_) |
| 590 CreateNotificationPlatformBridge(); |
| 591 return notification_bridge_.get(); |
| 592 #else |
| 593 return nullptr; |
| 594 #endif |
| 577 } | 595 } |
| 578 | 596 |
| 579 message_center::MessageCenter* BrowserProcessImpl::message_center() { | 597 message_center::MessageCenter* BrowserProcessImpl::message_center() { |
| 580 DCHECK(CalledOnValidThread()); | 598 DCHECK(CalledOnValidThread()); |
| 581 return message_center::MessageCenter::Get(); | 599 return message_center::MessageCenter::Get(); |
| 582 } | 600 } |
| 583 | 601 |
| 584 policy::BrowserPolicyConnector* BrowserProcessImpl::browser_policy_connector() { | 602 policy::BrowserPolicyConnector* BrowserProcessImpl::browser_policy_connector() { |
| 585 DCHECK(CalledOnValidThread()); | 603 DCHECK(CalledOnValidThread()); |
| 586 if (!created_browser_policy_connector_) { | 604 if (!created_browser_policy_connector_) { |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1051 icon_manager_.reset(new IconManager); | 1069 icon_manager_.reset(new IconManager); |
| 1052 } | 1070 } |
| 1053 | 1071 |
| 1054 void BrowserProcessImpl::CreateIntranetRedirectDetector() { | 1072 void BrowserProcessImpl::CreateIntranetRedirectDetector() { |
| 1055 DCHECK(intranet_redirect_detector_.get() == NULL); | 1073 DCHECK(intranet_redirect_detector_.get() == NULL); |
| 1056 std::unique_ptr<IntranetRedirectDetector> intranet_redirect_detector( | 1074 std::unique_ptr<IntranetRedirectDetector> intranet_redirect_detector( |
| 1057 new IntranetRedirectDetector); | 1075 new IntranetRedirectDetector); |
| 1058 intranet_redirect_detector_.swap(intranet_redirect_detector); | 1076 intranet_redirect_detector_.swap(intranet_redirect_detector); |
| 1059 } | 1077 } |
| 1060 | 1078 |
| 1079 void BrowserProcessImpl::CreateNotificationPlatformBridge() { |
| 1080 #if (defined(OS_ANDROID) || defined(OS_MACOSX)) && defined(ENABLE_NOTIFICATIONS) |
| 1081 DCHECK(notification_bridge_.get() == NULL); |
| 1082 notification_bridge_.reset(NotificationPlatformBridge::Create()); |
| 1083 created_notification_bridge_ = true; |
| 1084 #endif |
| 1085 } |
| 1086 |
| 1061 void BrowserProcessImpl::CreateNotificationUIManager() { | 1087 void BrowserProcessImpl::CreateNotificationUIManager() { |
| 1062 #if defined(ENABLE_NOTIFICATIONS) | 1088 // Android does not use the NotificationUIManager anuymore |
| 1089 // All notification traffic is routed through NotificationPlatformBridge. |
| 1090 #if defined(ENABLE_NOTIFICATIONS) && !defined(OS_ANDROID) |
| 1063 DCHECK(notification_ui_manager_.get() == NULL); | 1091 DCHECK(notification_ui_manager_.get() == NULL); |
| 1064 notification_ui_manager_.reset(NotificationUIManager::Create(local_state())); | 1092 notification_ui_manager_.reset(NotificationUIManager::Create(local_state())); |
| 1065 created_notification_ui_manager_ = true; | 1093 created_notification_ui_manager_ = true; |
| 1066 #endif | 1094 #endif |
| 1067 } | 1095 } |
| 1068 | 1096 |
| 1069 void BrowserProcessImpl::CreateBackgroundModeManager() { | 1097 void BrowserProcessImpl::CreateBackgroundModeManager() { |
| 1070 #if BUILDFLAG(ENABLE_BACKGROUND) | 1098 #if BUILDFLAG(ENABLE_BACKGROUND) |
| 1071 DCHECK(background_mode_manager_.get() == NULL); | 1099 DCHECK(background_mode_manager_.get() == NULL); |
| 1072 background_mode_manager_.reset( | 1100 background_mode_manager_.reset( |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1283 } | 1311 } |
| 1284 | 1312 |
| 1285 void BrowserProcessImpl::OnAutoupdateTimer() { | 1313 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 1286 if (CanAutorestartForUpdate()) { | 1314 if (CanAutorestartForUpdate()) { |
| 1287 DLOG(WARNING) << "Detected update. Restarting browser."; | 1315 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 1288 RestartBackgroundInstance(); | 1316 RestartBackgroundInstance(); |
| 1289 } | 1317 } |
| 1290 } | 1318 } |
| 1291 | 1319 |
| 1292 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1320 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |