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