| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/synchronization/waitable_event.h" | 14 #include "base/synchronization/waitable_event.h" |
| 15 #include "base/task.h" | 15 #include "base/task.h" |
| 16 #include "base/threading/thread.h" | 16 #include "base/threading/thread.h" |
| 17 #include "base/threading/thread_restrictions.h" | 17 #include "base/threading/thread_restrictions.h" |
| 18 #include "chrome/browser/automation/automation_provider_list.h" | 18 #include "chrome/browser/automation/automation_provider_list.h" |
| 19 #include "chrome/browser/background_mode_manager.h" | |
| 20 #include "chrome/browser/browser_main.h" | 19 #include "chrome/browser/browser_main.h" |
| 21 #include "chrome/browser/browser_process_sub_thread.h" | 20 #include "chrome/browser/browser_process_sub_thread.h" |
| 22 #include "chrome/browser/browser_trial.h" | 21 #include "chrome/browser/browser_trial.h" |
| 23 #include "chrome/browser/browsing_data_remover.h" | 22 #include "chrome/browser/browsing_data_remover.h" |
| 24 #include "chrome/browser/debugger/browser_list_tabcontents_provider.h" | 23 #include "chrome/browser/debugger/browser_list_tabcontents_provider.h" |
| 25 #include "chrome/browser/debugger/devtools_http_protocol_handler.h" | 24 #include "chrome/browser/debugger/devtools_http_protocol_handler.h" |
| 26 #include "chrome/browser/debugger/devtools_manager.h" | 25 #include "chrome/browser/debugger/devtools_manager.h" |
| 27 #include "chrome/browser/debugger/devtools_protocol_handler.h" | 26 #include "chrome/browser/debugger/devtools_protocol_handler.h" |
| 28 #include "chrome/browser/download/download_file_manager.h" | 27 #include "chrome/browser/download/download_file_manager.h" |
| 29 #include "chrome/browser/download/save_file_manager.h" | 28 #include "chrome/browser/download/save_file_manager.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 49 #include "chrome/browser/prerender/prerender_tracker.h" | 48 #include "chrome/browser/prerender/prerender_tracker.h" |
| 50 #include "chrome/browser/printing/background_printing_manager.h" | 49 #include "chrome/browser/printing/background_printing_manager.h" |
| 51 #include "chrome/browser/printing/print_job_manager.h" | 50 #include "chrome/browser/printing/print_job_manager.h" |
| 52 #include "chrome/browser/printing/print_preview_tab_controller.h" | 51 #include "chrome/browser/printing/print_preview_tab_controller.h" |
| 53 #include "chrome/browser/profiles/profile_manager.h" | 52 #include "chrome/browser/profiles/profile_manager.h" |
| 54 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_observer.
h" | 53 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_observer.
h" |
| 55 #include "chrome/browser/safe_browsing/client_side_detection_service.h" | 54 #include "chrome/browser/safe_browsing/client_side_detection_service.h" |
| 56 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 55 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 57 #include "chrome/browser/shell_integration.h" | 56 #include "chrome/browser/shell_integration.h" |
| 58 #include "chrome/browser/sidebar/sidebar_manager.h" | 57 #include "chrome/browser/sidebar/sidebar_manager.h" |
| 59 #include "chrome/browser/status_icons/status_tray.h" | |
| 60 #include "chrome/browser/tab_closeable_state_watcher.h" | 58 #include "chrome/browser/tab_closeable_state_watcher.h" |
| 61 #include "chrome/browser/ui/browser_list.h" | 59 #include "chrome/browser/ui/browser_list.h" |
| 62 #include "chrome/common/chrome_constants.h" | 60 #include "chrome/common/chrome_constants.h" |
| 63 #include "chrome/common/chrome_paths.h" | 61 #include "chrome/common/chrome_paths.h" |
| 64 #include "chrome/common/chrome_switches.h" | 62 #include "chrome/common/chrome_switches.h" |
| 65 #include "chrome/common/default_plugin.h" | 63 #include "chrome/common/default_plugin.h" |
| 66 #include "chrome/common/extensions/extension_l10n_util.h" | 64 #include "chrome/common/extensions/extension_l10n_util.h" |
| 67 #include "chrome/common/extensions/extension_resource.h" | 65 #include "chrome/common/extensions/extension_resource.h" |
| 68 #include "chrome/common/json_pref_store.h" | 66 #include "chrome/common/json_pref_store.h" |
| 69 #include "chrome/common/pref_names.h" | 67 #include "chrome/common/pref_names.h" |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 return shutdown_event_.get(); | 630 return shutdown_event_.get(); |
| 633 } | 631 } |
| 634 | 632 |
| 635 TabCloseableStateWatcher* BrowserProcessImpl::tab_closeable_state_watcher() { | 633 TabCloseableStateWatcher* BrowserProcessImpl::tab_closeable_state_watcher() { |
| 636 DCHECK(CalledOnValidThread()); | 634 DCHECK(CalledOnValidThread()); |
| 637 if (!tab_closeable_state_watcher_.get()) | 635 if (!tab_closeable_state_watcher_.get()) |
| 638 CreateTabCloseableStateWatcher(); | 636 CreateTabCloseableStateWatcher(); |
| 639 return tab_closeable_state_watcher_.get(); | 637 return tab_closeable_state_watcher_.get(); |
| 640 } | 638 } |
| 641 | 639 |
| 642 BackgroundModeManager* BrowserProcessImpl::background_mode_manager() { | |
| 643 DCHECK(CalledOnValidThread()); | |
| 644 if (!background_mode_manager_.get()) | |
| 645 CreateBackgroundModeManager(); | |
| 646 return background_mode_manager_.get(); | |
| 647 } | |
| 648 | |
| 649 StatusTray* BrowserProcessImpl::status_tray() { | |
| 650 DCHECK(CalledOnValidThread()); | |
| 651 if (!status_tray_.get()) | |
| 652 CreateStatusTray(); | |
| 653 return status_tray_.get(); | |
| 654 } | |
| 655 | |
| 656 safe_browsing::ClientSideDetectionService* | 640 safe_browsing::ClientSideDetectionService* |
| 657 BrowserProcessImpl::safe_browsing_detection_service() { | 641 BrowserProcessImpl::safe_browsing_detection_service() { |
| 658 DCHECK(CalledOnValidThread()); | 642 DCHECK(CalledOnValidThread()); |
| 659 if (!created_safe_browsing_detection_service_) { | 643 if (!created_safe_browsing_detection_service_) { |
| 660 CreateSafeBrowsingDetectionService(); | 644 CreateSafeBrowsingDetectionService(); |
| 661 } | 645 } |
| 662 return safe_browsing_detection_service_.get(); | 646 return safe_browsing_detection_service_.get(); |
| 663 } | 647 } |
| 664 | 648 |
| 665 bool BrowserProcessImpl::plugin_finder_disabled() const { | 649 bool BrowserProcessImpl::plugin_finder_disabled() const { |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 notification_ui_manager_.reset(NotificationUIManager::Create(local_state())); | 982 notification_ui_manager_.reset(NotificationUIManager::Create(local_state())); |
| 999 | 983 |
| 1000 created_notification_ui_manager_ = true; | 984 created_notification_ui_manager_ = true; |
| 1001 } | 985 } |
| 1002 | 986 |
| 1003 void BrowserProcessImpl::CreateTabCloseableStateWatcher() { | 987 void BrowserProcessImpl::CreateTabCloseableStateWatcher() { |
| 1004 DCHECK(tab_closeable_state_watcher_.get() == NULL); | 988 DCHECK(tab_closeable_state_watcher_.get() == NULL); |
| 1005 tab_closeable_state_watcher_.reset(TabCloseableStateWatcher::Create()); | 989 tab_closeable_state_watcher_.reset(TabCloseableStateWatcher::Create()); |
| 1006 } | 990 } |
| 1007 | 991 |
| 1008 void BrowserProcessImpl::CreateBackgroundModeManager() { | |
| 1009 DCHECK(background_mode_manager_.get() == NULL); | |
| 1010 background_mode_manager_.reset( | |
| 1011 new BackgroundModeManager(CommandLine::ForCurrentProcess())); | |
| 1012 } | |
| 1013 | |
| 1014 void BrowserProcessImpl::CreateStatusTray() { | |
| 1015 DCHECK(status_tray_.get() == NULL); | |
| 1016 status_tray_.reset(StatusTray::Create()); | |
| 1017 } | |
| 1018 | |
| 1019 void BrowserProcessImpl::CreatePrintPreviewTabController() { | 992 void BrowserProcessImpl::CreatePrintPreviewTabController() { |
| 1020 DCHECK(print_preview_tab_controller_.get() == NULL); | 993 DCHECK(print_preview_tab_controller_.get() == NULL); |
| 1021 print_preview_tab_controller_ = new printing::PrintPreviewTabController(); | 994 print_preview_tab_controller_ = new printing::PrintPreviewTabController(); |
| 1022 } | 995 } |
| 1023 | 996 |
| 1024 void BrowserProcessImpl::CreateBackgroundPrintingManager() { | 997 void BrowserProcessImpl::CreateBackgroundPrintingManager() { |
| 1025 DCHECK(background_printing_manager_.get() == NULL); | 998 DCHECK(background_printing_manager_.get() == NULL); |
| 1026 background_printing_manager_.reset(new printing::BackgroundPrintingManager()); | 999 background_printing_manager_.reset(new printing::BackgroundPrintingManager()); |
| 1027 } | 1000 } |
| 1028 | 1001 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1170 } | 1143 } |
| 1171 | 1144 |
| 1172 void BrowserProcessImpl::OnAutoupdateTimer() { | 1145 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 1173 if (CanAutorestartForUpdate()) { | 1146 if (CanAutorestartForUpdate()) { |
| 1174 DLOG(WARNING) << "Detected update. Restarting browser."; | 1147 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 1175 RestartPersistentInstance(); | 1148 RestartPersistentInstance(); |
| 1176 } | 1149 } |
| 1177 } | 1150 } |
| 1178 | 1151 |
| 1179 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1152 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |