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_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 #endif | |
Peter Beverloo
2016/04/20 17:34:08
nit: I think we generally use #if / #else / #endif
sky
2016/04/20 19:51:59
+1 (same comment for notification_bridge()).
Miguel Garcia
2016/04/21 14:32:10
Acknowledged.
Miguel Garcia
2016/04/21 14:32:10
Done.
| |
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(); |
577 } | 584 } |
578 | 585 |
586 NotificationBridge* BrowserProcessImpl::notification_bridge() { | |
587 #if defined(OS_ANDROID) || defined(OS_MACOSX) | |
588 if (!created_notification_bridge_) | |
589 CreateNotificationBridge(); | |
590 return notification_bridge_.get(); | |
591 #endif | |
592 return nullptr; | |
593 } | |
594 | |
579 message_center::MessageCenter* BrowserProcessImpl::message_center() { | 595 message_center::MessageCenter* BrowserProcessImpl::message_center() { |
580 DCHECK(CalledOnValidThread()); | 596 DCHECK(CalledOnValidThread()); |
581 return message_center::MessageCenter::Get(); | 597 return message_center::MessageCenter::Get(); |
582 } | 598 } |
583 | 599 |
584 policy::BrowserPolicyConnector* BrowserProcessImpl::browser_policy_connector() { | 600 policy::BrowserPolicyConnector* BrowserProcessImpl::browser_policy_connector() { |
585 DCHECK(CalledOnValidThread()); | 601 DCHECK(CalledOnValidThread()); |
586 if (!created_browser_policy_connector_) { | 602 if (!created_browser_policy_connector_) { |
587 DCHECK(!browser_policy_connector_); | 603 DCHECK(!browser_policy_connector_); |
588 browser_policy_connector_ = platform_part_->CreateBrowserPolicyConnector(); | 604 browser_policy_connector_ = platform_part_->CreateBrowserPolicyConnector(); |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1051 icon_manager_.reset(new IconManager); | 1067 icon_manager_.reset(new IconManager); |
1052 } | 1068 } |
1053 | 1069 |
1054 void BrowserProcessImpl::CreateIntranetRedirectDetector() { | 1070 void BrowserProcessImpl::CreateIntranetRedirectDetector() { |
1055 DCHECK(intranet_redirect_detector_.get() == NULL); | 1071 DCHECK(intranet_redirect_detector_.get() == NULL); |
1056 std::unique_ptr<IntranetRedirectDetector> intranet_redirect_detector( | 1072 std::unique_ptr<IntranetRedirectDetector> intranet_redirect_detector( |
1057 new IntranetRedirectDetector); | 1073 new IntranetRedirectDetector); |
1058 intranet_redirect_detector_.swap(intranet_redirect_detector); | 1074 intranet_redirect_detector_.swap(intranet_redirect_detector); |
1059 } | 1075 } |
1060 | 1076 |
1077 void BrowserProcessImpl::CreateNotificationBridge() { | |
1078 #if (defined(OS_ANDROID) || defined(OS_MACOSX)) && defined(ENABLE_NOTIFICATIONS) | |
1079 DCHECK(notification_bridge_.get() == NULL); | |
1080 notification_bridge_.reset(NotificationBridge::Create()); | |
1081 created_notification_bridge_ = true; | |
1082 #endif | |
1083 } | |
1084 | |
1061 void BrowserProcessImpl::CreateNotificationUIManager() { | 1085 void BrowserProcessImpl::CreateNotificationUIManager() { |
1062 #if defined(ENABLE_NOTIFICATIONS) | 1086 // Android does not use the NotificationUIManager anuymore |
1087 // All notification traffic is routed through NotificationBridge. | |
1088 #if defined(ENABLE_NOTIFICATIONS) && !defined(OS_ANDROID) | |
1063 DCHECK(notification_ui_manager_.get() == NULL); | 1089 DCHECK(notification_ui_manager_.get() == NULL); |
1064 notification_ui_manager_.reset(NotificationUIManager::Create(local_state())); | 1090 notification_ui_manager_.reset(NotificationUIManager::Create(local_state())); |
1065 created_notification_ui_manager_ = true; | 1091 created_notification_ui_manager_ = true; |
1066 #endif | 1092 #endif |
1067 } | 1093 } |
1068 | 1094 |
1069 void BrowserProcessImpl::CreateBackgroundModeManager() { | 1095 void BrowserProcessImpl::CreateBackgroundModeManager() { |
1070 #if BUILDFLAG(ENABLE_BACKGROUND) | 1096 #if BUILDFLAG(ENABLE_BACKGROUND) |
1071 DCHECK(background_mode_manager_.get() == NULL); | 1097 DCHECK(background_mode_manager_.get() == NULL); |
1072 background_mode_manager_.reset( | 1098 background_mode_manager_.reset( |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1283 } | 1309 } |
1284 | 1310 |
1285 void BrowserProcessImpl::OnAutoupdateTimer() { | 1311 void BrowserProcessImpl::OnAutoupdateTimer() { |
1286 if (CanAutorestartForUpdate()) { | 1312 if (CanAutorestartForUpdate()) { |
1287 DLOG(WARNING) << "Detected update. Restarting browser."; | 1313 DLOG(WARNING) << "Detected update. Restarting browser."; |
1288 RestartBackgroundInstance(); | 1314 RestartBackgroundInstance(); |
1289 } | 1315 } |
1290 } | 1316 } |
1291 | 1317 |
1292 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1318 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |