| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 #include "net/socket/client_socket_pool_manager.h" | 84 #include "net/socket/client_socket_pool_manager.h" |
| 85 #include "net/url_request/url_request_context_getter.h" | 85 #include "net/url_request/url_request_context_getter.h" |
| 86 #include "ui/base/l10n/l10n_util.h" | 86 #include "ui/base/l10n/l10n_util.h" |
| 87 | 87 |
| 88 #if defined(ENABLE_CONFIGURATION_POLICY) | 88 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 89 #include "chrome/browser/policy/browser_policy_connector.h" | 89 #include "chrome/browser/policy/browser_policy_connector.h" |
| 90 #else | 90 #else |
| 91 #include "chrome/browser/policy/policy_service_stub.h" | 91 #include "chrome/browser/policy/policy_service_stub.h" |
| 92 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 92 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
| 93 | 93 |
| 94 #if defined(ENABLE_MESSAGE_CENTER) && defined(USE_ASH) |
| 95 #include "ash/shell.h" |
| 96 #endif |
| 97 |
| 98 #if defined(ENABLE_MESSAGE_CENTER) |
| 99 #include "ui/message_center/message_center.h" |
| 100 #endif |
| 101 |
| 94 #if defined(OS_WIN) | 102 #if defined(OS_WIN) |
| 95 #include "base/win/windows_version.h" | 103 #include "base/win/windows_version.h" |
| 96 #include "ui/views/focus/view_storage.h" | 104 #include "ui/views/focus/view_storage.h" |
| 97 #if defined(USE_AURA) | 105 #if defined(USE_AURA) |
| 98 #include "chrome/browser/metro_viewer/metro_viewer_process_host_win.h" | 106 #include "chrome/browser/metro_viewer/metro_viewer_process_host_win.h" |
| 99 #endif | 107 #endif |
| 100 #elif defined(OS_MACOSX) | 108 #elif defined(OS_MACOSX) |
| 101 #include "chrome/browser/chrome_browser_main_mac.h" | 109 #include "chrome/browser/chrome_browser_main_mac.h" |
| 102 #endif | 110 #endif |
| 103 | 111 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 BrowserProcessImpl::BrowserProcessImpl( | 150 BrowserProcessImpl::BrowserProcessImpl( |
| 143 base::SequencedTaskRunner* local_state_task_runner, | 151 base::SequencedTaskRunner* local_state_task_runner, |
| 144 const CommandLine& command_line) | 152 const CommandLine& command_line) |
| 145 : created_metrics_service_(false), | 153 : created_metrics_service_(false), |
| 146 created_watchdog_thread_(false), | 154 created_watchdog_thread_(false), |
| 147 created_browser_policy_connector_(false), | 155 created_browser_policy_connector_(false), |
| 148 created_profile_manager_(false), | 156 created_profile_manager_(false), |
| 149 created_local_state_(false), | 157 created_local_state_(false), |
| 150 created_icon_manager_(false), | 158 created_icon_manager_(false), |
| 151 created_notification_ui_manager_(false), | 159 created_notification_ui_manager_(false), |
| 160 #if defined(ENABLE_MESSAGE_CENTER) && !defined(USE_ASH) |
| 161 created_message_center_(false), |
| 162 #endif |
| 152 created_safe_browsing_service_(false), | 163 created_safe_browsing_service_(false), |
| 153 module_ref_count_(0), | 164 module_ref_count_(0), |
| 154 did_start_(false), | 165 did_start_(false), |
| 155 checked_for_new_frames_(false), | 166 checked_for_new_frames_(false), |
| 156 using_new_frames_(false), | 167 using_new_frames_(false), |
| 157 render_widget_snapshot_taker_(new RenderWidgetSnapshotTaker), | 168 render_widget_snapshot_taker_(new RenderWidgetSnapshotTaker), |
| 158 download_status_updater_(new DownloadStatusUpdater), | 169 download_status_updater_(new DownloadStatusUpdater), |
| 159 local_state_task_runner_(local_state_task_runner) { | 170 local_state_task_runner_(local_state_task_runner) { |
| 160 g_browser_process = this; | 171 g_browser_process = this; |
| 161 | 172 |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 return extension_event_router_forwarder_.get(); | 446 return extension_event_router_forwarder_.get(); |
| 436 } | 447 } |
| 437 | 448 |
| 438 NotificationUIManager* BrowserProcessImpl::notification_ui_manager() { | 449 NotificationUIManager* BrowserProcessImpl::notification_ui_manager() { |
| 439 DCHECK(CalledOnValidThread()); | 450 DCHECK(CalledOnValidThread()); |
| 440 if (!created_notification_ui_manager_) | 451 if (!created_notification_ui_manager_) |
| 441 CreateNotificationUIManager(); | 452 CreateNotificationUIManager(); |
| 442 return notification_ui_manager_.get(); | 453 return notification_ui_manager_.get(); |
| 443 } | 454 } |
| 444 | 455 |
| 456 #if defined(ENABLE_MESSAGE_CENTER) |
| 457 message_center::MessageCenter* BrowserProcessImpl::message_center() { |
| 458 DCHECK(CalledOnValidThread()); |
| 459 #if defined(USE_ASH) |
| 460 return ash::Shell::GetInstance()->message_center(); |
| 461 #else |
| 462 if (!created_message_center_) |
| 463 CreateMessageCenter(); |
| 464 return message_center_.get(); |
| 465 #endif |
| 466 } |
| 467 #endif |
| 468 |
| 445 policy::BrowserPolicyConnector* BrowserProcessImpl::browser_policy_connector() { | 469 policy::BrowserPolicyConnector* BrowserProcessImpl::browser_policy_connector() { |
| 446 DCHECK(CalledOnValidThread()); | 470 DCHECK(CalledOnValidThread()); |
| 447 #if defined(ENABLE_CONFIGURATION_POLICY) | 471 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 448 if (!created_browser_policy_connector_) { | 472 if (!created_browser_policy_connector_) { |
| 449 // Init() should not reenter this function. If it does this will DCHECK. | 473 // Init() should not reenter this function. If it does this will DCHECK. |
| 450 DCHECK(!browser_policy_connector_); | 474 DCHECK(!browser_policy_connector_); |
| 451 browser_policy_connector_.reset(new policy::BrowserPolicyConnector()); | 475 browser_policy_connector_.reset(new policy::BrowserPolicyConnector()); |
| 452 browser_policy_connector_->Init(); | 476 browser_policy_connector_->Init(); |
| 453 created_browser_policy_connector_ = true; | 477 created_browser_policy_connector_ = true; |
| 454 } | 478 } |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 } | 865 } |
| 842 | 866 |
| 843 void BrowserProcessImpl::CreateNotificationUIManager() { | 867 void BrowserProcessImpl::CreateNotificationUIManager() { |
| 844 #if defined(ENABLE_NOTIFICATIONS) | 868 #if defined(ENABLE_NOTIFICATIONS) |
| 845 DCHECK(notification_ui_manager_.get() == NULL); | 869 DCHECK(notification_ui_manager_.get() == NULL); |
| 846 notification_ui_manager_.reset(NotificationUIManager::Create(local_state())); | 870 notification_ui_manager_.reset(NotificationUIManager::Create(local_state())); |
| 847 created_notification_ui_manager_ = true; | 871 created_notification_ui_manager_ = true; |
| 848 #endif | 872 #endif |
| 849 } | 873 } |
| 850 | 874 |
| 875 #if defined(ENABLE_MESSAGE_CENTER) && !defined(USE_ASH) |
| 876 void BrowserProcessImpl::CreateMessageCenter() { |
| 877 DCHECK(message_center_.get() == NULL); |
| 878 message_center_.reset(new message_center::MessageCenter()); |
| 879 created_message_center_ = true; |
| 880 } |
| 881 #endif |
| 882 |
| 851 void BrowserProcessImpl::CreateBackgroundModeManager() { | 883 void BrowserProcessImpl::CreateBackgroundModeManager() { |
| 852 DCHECK(background_mode_manager_.get() == NULL); | 884 DCHECK(background_mode_manager_.get() == NULL); |
| 853 background_mode_manager_.reset( | 885 background_mode_manager_.reset( |
| 854 new BackgroundModeManager(CommandLine::ForCurrentProcess(), | 886 new BackgroundModeManager(CommandLine::ForCurrentProcess(), |
| 855 &profile_manager()->GetProfileInfoCache())); | 887 &profile_manager()->GetProfileInfoCache())); |
| 856 } | 888 } |
| 857 | 889 |
| 858 void BrowserProcessImpl::CreateStatusTray() { | 890 void BrowserProcessImpl::CreateStatusTray() { |
| 859 DCHECK(status_tray_.get() == NULL); | 891 DCHECK(status_tray_.get() == NULL); |
| 860 status_tray_.reset(StatusTray::Create()); | 892 status_tray_.reset(StatusTray::Create()); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 } | 998 } |
| 967 | 999 |
| 968 void BrowserProcessImpl::OnAutoupdateTimer() { | 1000 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 969 if (CanAutorestartForUpdate()) { | 1001 if (CanAutorestartForUpdate()) { |
| 970 DLOG(WARNING) << "Detected update. Restarting browser."; | 1002 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 971 RestartBackgroundInstance(); | 1003 RestartBackgroundInstance(); |
| 972 } | 1004 } |
| 973 } | 1005 } |
| 974 | 1006 |
| 975 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1007 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |