| 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) | 
 |   95 #include "ui/message_center/message_center.h" | 
 |   96 #endif | 
 |   97  | 
|   94 #if defined(OS_WIN) |   98 #if defined(OS_WIN) | 
|   95 #include "base/win/windows_version.h" |   99 #include "base/win/windows_version.h" | 
|   96 #include "ui/views/focus/view_storage.h" |  100 #include "ui/views/focus/view_storage.h" | 
|   97 #if defined(USE_AURA) |  101 #if defined(USE_AURA) | 
|   98 #include "chrome/browser/metro_viewer/metro_viewer_process_host_win.h" |  102 #include "chrome/browser/metro_viewer/metro_viewer_process_host_win.h" | 
|   99 #endif |  103 #endif | 
|  100 #elif defined(OS_MACOSX) |  104 #elif defined(OS_MACOSX) | 
|  101 #include "chrome/browser/chrome_browser_main_mac.h" |  105 #include "chrome/browser/chrome_browser_main_mac.h" | 
|  102 #endif |  106 #endif | 
|  103  |  107  | 
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  142 BrowserProcessImpl::BrowserProcessImpl( |  146 BrowserProcessImpl::BrowserProcessImpl( | 
|  143     base::SequencedTaskRunner* local_state_task_runner, |  147     base::SequencedTaskRunner* local_state_task_runner, | 
|  144     const CommandLine& command_line) |  148     const CommandLine& command_line) | 
|  145     : created_metrics_service_(false), |  149     : created_metrics_service_(false), | 
|  146       created_watchdog_thread_(false), |  150       created_watchdog_thread_(false), | 
|  147       created_browser_policy_connector_(false), |  151       created_browser_policy_connector_(false), | 
|  148       created_profile_manager_(false), |  152       created_profile_manager_(false), | 
|  149       created_local_state_(false), |  153       created_local_state_(false), | 
|  150       created_icon_manager_(false), |  154       created_icon_manager_(false), | 
|  151       created_notification_ui_manager_(false), |  155       created_notification_ui_manager_(false), | 
 |  156       created_message_center_(false), | 
|  152       created_safe_browsing_service_(false), |  157       created_safe_browsing_service_(false), | 
|  153       module_ref_count_(0), |  158       module_ref_count_(0), | 
|  154       did_start_(false), |  159       did_start_(false), | 
|  155       checked_for_new_frames_(false), |  160       checked_for_new_frames_(false), | 
|  156       using_new_frames_(false), |  161       using_new_frames_(false), | 
|  157       render_widget_snapshot_taker_(new RenderWidgetSnapshotTaker), |  162       render_widget_snapshot_taker_(new RenderWidgetSnapshotTaker), | 
|  158       download_status_updater_(new DownloadStatusUpdater), |  163       download_status_updater_(new DownloadStatusUpdater), | 
|  159       local_state_task_runner_(local_state_task_runner) { |  164       local_state_task_runner_(local_state_task_runner) { | 
|  160   g_browser_process = this; |  165   g_browser_process = this; | 
|  161  |  166  | 
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  435   return extension_event_router_forwarder_.get(); |  440   return extension_event_router_forwarder_.get(); | 
|  436 } |  441 } | 
|  437  |  442  | 
|  438 NotificationUIManager* BrowserProcessImpl::notification_ui_manager() { |  443 NotificationUIManager* BrowserProcessImpl::notification_ui_manager() { | 
|  439   DCHECK(CalledOnValidThread()); |  444   DCHECK(CalledOnValidThread()); | 
|  440   if (!created_notification_ui_manager_) |  445   if (!created_notification_ui_manager_) | 
|  441     CreateNotificationUIManager(); |  446     CreateNotificationUIManager(); | 
|  442   return notification_ui_manager_.get(); |  447   return notification_ui_manager_.get(); | 
|  443 } |  448 } | 
|  444  |  449  | 
 |  450 message_center::MessageCenter* BrowserProcessImpl::message_center() { | 
 |  451 #ifdef ENABLE_MESSAGE_CENTER | 
 |  452   DCHECK(CalledOnValidThread()); | 
 |  453   if (!created_message_center_) | 
 |  454     CreateMessageCenter(); | 
 |  455   return message_center_.get(); | 
 |  456 #else | 
 |  457   return NULL; | 
 |  458 #endif | 
 |  459 } | 
 |  460  | 
|  445 policy::BrowserPolicyConnector* BrowserProcessImpl::browser_policy_connector() { |  461 policy::BrowserPolicyConnector* BrowserProcessImpl::browser_policy_connector() { | 
|  446   DCHECK(CalledOnValidThread()); |  462   DCHECK(CalledOnValidThread()); | 
|  447 #if defined(ENABLE_CONFIGURATION_POLICY) |  463 #if defined(ENABLE_CONFIGURATION_POLICY) | 
|  448   if (!created_browser_policy_connector_) { |  464   if (!created_browser_policy_connector_) { | 
|  449     // Init() should not reenter this function. If it does this will DCHECK. |  465     // Init() should not reenter this function. If it does this will DCHECK. | 
|  450     DCHECK(!browser_policy_connector_); |  466     DCHECK(!browser_policy_connector_); | 
|  451     browser_policy_connector_.reset(new policy::BrowserPolicyConnector()); |  467     browser_policy_connector_.reset(new policy::BrowserPolicyConnector()); | 
|  452     browser_policy_connector_->Init(); |  468     browser_policy_connector_->Init(); | 
|  453     created_browser_policy_connector_ = true; |  469     created_browser_policy_connector_ = true; | 
|  454   } |  470   } | 
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  841 } |  857 } | 
|  842  |  858  | 
|  843 void BrowserProcessImpl::CreateNotificationUIManager() { |  859 void BrowserProcessImpl::CreateNotificationUIManager() { | 
|  844 #if defined(ENABLE_NOTIFICATIONS) |  860 #if defined(ENABLE_NOTIFICATIONS) | 
|  845   DCHECK(notification_ui_manager_.get() == NULL); |  861   DCHECK(notification_ui_manager_.get() == NULL); | 
|  846   notification_ui_manager_.reset(NotificationUIManager::Create(local_state())); |  862   notification_ui_manager_.reset(NotificationUIManager::Create(local_state())); | 
|  847   created_notification_ui_manager_ = true; |  863   created_notification_ui_manager_ = true; | 
|  848 #endif |  864 #endif | 
|  849 } |  865 } | 
|  850  |  866  | 
 |  867 void BrowserProcessImpl::CreateMessageCenter() { | 
 |  868 #if defined(ENABLE_MESSAGE_CENTER) | 
 |  869   DCHECK(message_center_.get() == NULL); | 
 |  870   message_center_.reset(new message_center::MessageCenter()); | 
 |  871   created_message_center_ = true; | 
 |  872 #endif | 
 |  873 } | 
 |  874  | 
|  851 void BrowserProcessImpl::CreateBackgroundModeManager() { |  875 void BrowserProcessImpl::CreateBackgroundModeManager() { | 
|  852   DCHECK(background_mode_manager_.get() == NULL); |  876   DCHECK(background_mode_manager_.get() == NULL); | 
|  853   background_mode_manager_.reset( |  877   background_mode_manager_.reset( | 
|  854       new BackgroundModeManager(CommandLine::ForCurrentProcess(), |  878       new BackgroundModeManager(CommandLine::ForCurrentProcess(), | 
|  855                                 &profile_manager()->GetProfileInfoCache())); |  879                                 &profile_manager()->GetProfileInfoCache())); | 
|  856 } |  880 } | 
|  857  |  881  | 
|  858 void BrowserProcessImpl::CreateStatusTray() { |  882 void BrowserProcessImpl::CreateStatusTray() { | 
|  859   DCHECK(status_tray_.get() == NULL); |  883   DCHECK(status_tray_.get() == NULL); | 
|  860   status_tray_.reset(StatusTray::Create()); |  884   status_tray_.reset(StatusTray::Create()); | 
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  966 } |  990 } | 
|  967  |  991  | 
|  968 void BrowserProcessImpl::OnAutoupdateTimer() { |  992 void BrowserProcessImpl::OnAutoupdateTimer() { | 
|  969   if (CanAutorestartForUpdate()) { |  993   if (CanAutorestartForUpdate()) { | 
|  970     DLOG(WARNING) << "Detected update.  Restarting browser."; |  994     DLOG(WARNING) << "Detected update.  Restarting browser."; | 
|  971     RestartBackgroundInstance(); |  995     RestartBackgroundInstance(); | 
|  972   } |  996   } | 
|  973 } |  997 } | 
|  974  |  998  | 
|  975 #endif  // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |  999 #endif  // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 
| OLD | NEW |