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