| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 #include "content/public/browser/browser_thread.h" | 82 #include "content/public/browser/browser_thread.h" |
| 83 #include "content/public/browser/child_process_security_policy.h" | 83 #include "content/public/browser/child_process_security_policy.h" |
| 84 #include "content/public/browser/notification_details.h" | 84 #include "content/public/browser/notification_details.h" |
| 85 #include "content/public/browser/plugin_service.h" | 85 #include "content/public/browser/plugin_service.h" |
| 86 #include "content/public/browser/render_process_host.h" | 86 #include "content/public/browser/render_process_host.h" |
| 87 #include "content/public/browser/resource_dispatcher_host.h" | 87 #include "content/public/browser/resource_dispatcher_host.h" |
| 88 #include "extensions/common/constants.h" | 88 #include "extensions/common/constants.h" |
| 89 #include "net/socket/client_socket_pool_manager.h" | 89 #include "net/socket/client_socket_pool_manager.h" |
| 90 #include "net/url_request/url_request_context_getter.h" | 90 #include "net/url_request/url_request_context_getter.h" |
| 91 #include "ui/base/l10n/l10n_util.h" | 91 #include "ui/base/l10n/l10n_util.h" |
| 92 #include "ui/message_center/message_center.h" | |
| 93 | 92 |
| 94 #if defined(ENABLE_CONFIGURATION_POLICY) | 93 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 95 #include "chrome/browser/policy/browser_policy_connector.h" | 94 #include "chrome/browser/policy/browser_policy_connector.h" |
| 96 #else | 95 #else |
| 97 #include "chrome/browser/policy/policy_service_stub.h" | 96 #include "chrome/browser/policy/policy_service_stub.h" |
| 98 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 97 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
| 99 | 98 |
| 99 #if defined(ENABLE_MESSAGE_CENTER) |
| 100 #include "ui/message_center/message_center.h" |
| 101 #endif |
| 102 |
| 100 #if defined(OS_WIN) | 103 #if defined(OS_WIN) |
| 101 #include "base/win/windows_version.h" | 104 #include "base/win/windows_version.h" |
| 102 #include "ui/views/focus/view_storage.h" | 105 #include "ui/views/focus/view_storage.h" |
| 103 #if defined(USE_AURA) | 106 #if defined(USE_AURA) |
| 104 #include "chrome/browser/metro_viewer/metro_viewer_process_host_win.h" | 107 #include "chrome/browser/metro_viewer/metro_viewer_process_host_win.h" |
| 105 #endif | 108 #endif |
| 106 #elif defined(OS_MACOSX) | 109 #elif defined(OS_MACOSX) |
| 107 #include "chrome/browser/chrome_browser_main_mac.h" | 110 #include "chrome/browser/chrome_browser_main_mac.h" |
| 108 #endif | 111 #endif |
| 109 | 112 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 #if defined(OS_MACOSX) | 196 #if defined(OS_MACOSX) |
| 194 InitIdleMonitor(); | 197 InitIdleMonitor(); |
| 195 #endif | 198 #endif |
| 196 | 199 |
| 197 extensions::PermissionsInfo::GetInstance()->InitializeWithDelegate( | 200 extensions::PermissionsInfo::GetInstance()->InitializeWithDelegate( |
| 198 extensions::ChromeAPIPermissions()); | 201 extensions::ChromeAPIPermissions()); |
| 199 extensions::RegisterChromeManifestHandlers(); | 202 extensions::RegisterChromeManifestHandlers(); |
| 200 extension_event_router_forwarder_ = new extensions::EventRouterForwarder; | 203 extension_event_router_forwarder_ = new extensions::EventRouterForwarder; |
| 201 ExtensionRendererState::GetInstance()->Init(); | 204 ExtensionRendererState::GetInstance()->Init(); |
| 202 | 205 |
| 206 #if defined(ENABLE_MESSAGE_CENTER) |
| 203 message_center::MessageCenter::Initialize(); | 207 message_center::MessageCenter::Initialize(); |
| 208 #endif |
| 204 } | 209 } |
| 205 | 210 |
| 206 BrowserProcessImpl::~BrowserProcessImpl() { | 211 BrowserProcessImpl::~BrowserProcessImpl() { |
| 207 tracked_objects::ThreadData::EnsureCleanupWasCalled(4); | 212 tracked_objects::ThreadData::EnsureCleanupWasCalled(4); |
| 208 | 213 |
| 209 g_browser_process = NULL; | 214 g_browser_process = NULL; |
| 210 } | 215 } |
| 211 | 216 |
| 212 void BrowserProcessImpl::StartTearDown() { | 217 void BrowserProcessImpl::StartTearDown() { |
| 213 #if defined(ENABLE_AUTOMATION) | 218 #if defined(ENABLE_AUTOMATION) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 // Need to clear profiles (download managers) before the io_thread_. | 255 // Need to clear profiles (download managers) before the io_thread_. |
| 251 profile_manager_.reset(); | 256 profile_manager_.reset(); |
| 252 | 257 |
| 253 #if !defined(OS_ANDROID) | 258 #if !defined(OS_ANDROID) |
| 254 // Debugger must be cleaned up before IO thread and NotificationService. | 259 // Debugger must be cleaned up before IO thread and NotificationService. |
| 255 remote_debugging_server_.reset(); | 260 remote_debugging_server_.reset(); |
| 256 #endif | 261 #endif |
| 257 | 262 |
| 258 ExtensionRendererState::GetInstance()->Shutdown(); | 263 ExtensionRendererState::GetInstance()->Shutdown(); |
| 259 | 264 |
| 265 #if defined(ENABLE_MESSAGE_CENTER) |
| 260 message_center::MessageCenter::Shutdown(); | 266 message_center::MessageCenter::Shutdown(); |
| 267 #endif |
| 261 | 268 |
| 262 #if defined(ENABLE_CONFIGURATION_POLICY) | 269 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 263 // The policy providers managed by |browser_policy_connector_| need to shut | 270 // The policy providers managed by |browser_policy_connector_| need to shut |
| 264 // down while the IO and FILE threads are still alive. | 271 // down while the IO and FILE threads are still alive. |
| 265 if (browser_policy_connector_) | 272 if (browser_policy_connector_) |
| 266 browser_policy_connector_->Shutdown(); | 273 browser_policy_connector_->Shutdown(); |
| 267 #endif | 274 #endif |
| 268 | 275 |
| 269 // Stop the watchdog thread before stopping other threads. | 276 // Stop the watchdog thread before stopping other threads. |
| 270 watchdog_thread_.reset(); | 277 watchdog_thread_.reset(); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 return extension_event_router_forwarder_.get(); | 471 return extension_event_router_forwarder_.get(); |
| 465 } | 472 } |
| 466 | 473 |
| 467 NotificationUIManager* BrowserProcessImpl::notification_ui_manager() { | 474 NotificationUIManager* BrowserProcessImpl::notification_ui_manager() { |
| 468 DCHECK(CalledOnValidThread()); | 475 DCHECK(CalledOnValidThread()); |
| 469 if (!created_notification_ui_manager_) | 476 if (!created_notification_ui_manager_) |
| 470 CreateNotificationUIManager(); | 477 CreateNotificationUIManager(); |
| 471 return notification_ui_manager_.get(); | 478 return notification_ui_manager_.get(); |
| 472 } | 479 } |
| 473 | 480 |
| 481 #if defined(ENABLE_MESSAGE_CENTER) |
| 474 message_center::MessageCenter* BrowserProcessImpl::message_center() { | 482 message_center::MessageCenter* BrowserProcessImpl::message_center() { |
| 475 DCHECK(CalledOnValidThread()); | 483 DCHECK(CalledOnValidThread()); |
| 476 return message_center::MessageCenter::Get(); | 484 return message_center::MessageCenter::Get(); |
| 477 } | 485 } |
| 486 #endif |
| 478 | 487 |
| 479 policy::BrowserPolicyConnector* BrowserProcessImpl::browser_policy_connector() { | 488 policy::BrowserPolicyConnector* BrowserProcessImpl::browser_policy_connector() { |
| 480 DCHECK(CalledOnValidThread()); | 489 DCHECK(CalledOnValidThread()); |
| 481 #if defined(ENABLE_CONFIGURATION_POLICY) | 490 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 482 if (!created_browser_policy_connector_) { | 491 if (!created_browser_policy_connector_) { |
| 483 DCHECK(!browser_policy_connector_); | 492 DCHECK(!browser_policy_connector_); |
| 484 browser_policy_connector_.reset(new policy::BrowserPolicyConnector()); | 493 browser_policy_connector_.reset(new policy::BrowserPolicyConnector()); |
| 485 created_browser_policy_connector_ = true; | 494 created_browser_policy_connector_ = true; |
| 486 } | 495 } |
| 487 return browser_policy_connector_.get(); | 496 return browser_policy_connector_.get(); |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 } | 1068 } |
| 1060 | 1069 |
| 1061 void BrowserProcessImpl::OnAutoupdateTimer() { | 1070 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 1062 if (CanAutorestartForUpdate()) { | 1071 if (CanAutorestartForUpdate()) { |
| 1063 DLOG(WARNING) << "Detected update. Restarting browser."; | 1072 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 1064 RestartBackgroundInstance(); | 1073 RestartBackgroundInstance(); |
| 1065 } | 1074 } |
| 1066 } | 1075 } |
| 1067 | 1076 |
| 1068 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1077 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |