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" |
19 #include "chrome/browser/browser_main.h" | 20 #include "chrome/browser/browser_main.h" |
20 #include "chrome/browser/browser_process_sub_thread.h" | 21 #include "chrome/browser/browser_process_sub_thread.h" |
21 #include "chrome/browser/browser_trial.h" | 22 #include "chrome/browser/browser_trial.h" |
22 #include "chrome/browser/debugger/browser_list_tabcontents_provider.h" | 23 #include "chrome/browser/debugger/browser_list_tabcontents_provider.h" |
23 #include "chrome/browser/debugger/devtools_http_protocol_handler.h" | 24 #include "chrome/browser/debugger/devtools_http_protocol_handler.h" |
24 #include "chrome/browser/debugger/devtools_manager.h" | 25 #include "chrome/browser/debugger/devtools_manager.h" |
25 #include "chrome/browser/debugger/devtools_protocol_handler.h" | 26 #include "chrome/browser/debugger/devtools_protocol_handler.h" |
26 #include "chrome/browser/download/download_file_manager.h" | 27 #include "chrome/browser/download/download_file_manager.h" |
27 #include "chrome/browser/download/save_file_manager.h" | 28 #include "chrome/browser/download/save_file_manager.h" |
28 #include "chrome/browser/extensions/extension_event_router_forwarder.h" | 29 #include "chrome/browser/extensions/extension_event_router_forwarder.h" |
(...skipping 16 matching lines...) Expand all Loading... |
45 #include "chrome/browser/prefs/browser_prefs.h" | 46 #include "chrome/browser/prefs/browser_prefs.h" |
46 #include "chrome/browser/prefs/pref_service.h" | 47 #include "chrome/browser/prefs/pref_service.h" |
47 #include "chrome/browser/printing/background_printing_manager.h" | 48 #include "chrome/browser/printing/background_printing_manager.h" |
48 #include "chrome/browser/printing/print_job_manager.h" | 49 #include "chrome/browser/printing/print_job_manager.h" |
49 #include "chrome/browser/printing/print_preview_tab_controller.h" | 50 #include "chrome/browser/printing/print_preview_tab_controller.h" |
50 #include "chrome/browser/profiles/profile_manager.h" | 51 #include "chrome/browser/profiles/profile_manager.h" |
51 #include "chrome/browser/safe_browsing/client_side_detection_service.h" | 52 #include "chrome/browser/safe_browsing/client_side_detection_service.h" |
52 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 53 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
53 #include "chrome/browser/shell_integration.h" | 54 #include "chrome/browser/shell_integration.h" |
54 #include "chrome/browser/sidebar/sidebar_manager.h" | 55 #include "chrome/browser/sidebar/sidebar_manager.h" |
| 56 #include "chrome/browser/status_icons/status_tray.h" |
55 #include "chrome/browser/tab_closeable_state_watcher.h" | 57 #include "chrome/browser/tab_closeable_state_watcher.h" |
56 #include "chrome/browser/ui/browser_list.h" | 58 #include "chrome/browser/ui/browser_list.h" |
57 #include "chrome/common/chrome_constants.h" | 59 #include "chrome/common/chrome_constants.h" |
58 #include "chrome/common/chrome_paths.h" | 60 #include "chrome/common/chrome_paths.h" |
59 #include "chrome/common/chrome_switches.h" | 61 #include "chrome/common/chrome_switches.h" |
60 #include "chrome/common/default_plugin.h" | 62 #include "chrome/common/default_plugin.h" |
61 #include "chrome/common/extensions/extension_l10n_util.h" | 63 #include "chrome/common/extensions/extension_l10n_util.h" |
62 #include "chrome/common/extensions/extension_resource.h" | 64 #include "chrome/common/extensions/extension_resource.h" |
63 #include "chrome/common/json_pref_store.h" | 65 #include "chrome/common/json_pref_store.h" |
64 #include "chrome/common/pref_names.h" | 66 #include "chrome/common/pref_names.h" |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 return shutdown_event_.get(); | 629 return shutdown_event_.get(); |
628 } | 630 } |
629 | 631 |
630 TabCloseableStateWatcher* BrowserProcessImpl::tab_closeable_state_watcher() { | 632 TabCloseableStateWatcher* BrowserProcessImpl::tab_closeable_state_watcher() { |
631 DCHECK(CalledOnValidThread()); | 633 DCHECK(CalledOnValidThread()); |
632 if (!tab_closeable_state_watcher_.get()) | 634 if (!tab_closeable_state_watcher_.get()) |
633 CreateTabCloseableStateWatcher(); | 635 CreateTabCloseableStateWatcher(); |
634 return tab_closeable_state_watcher_.get(); | 636 return tab_closeable_state_watcher_.get(); |
635 } | 637 } |
636 | 638 |
| 639 BackgroundModeManager* BrowserProcessImpl::background_mode_manager() { |
| 640 DCHECK(CalledOnValidThread()); |
| 641 if (!background_mode_manager_.get()) |
| 642 CreateBackgroundModeManager(); |
| 643 return background_mode_manager_.get(); |
| 644 } |
| 645 |
| 646 StatusTray* BrowserProcessImpl::status_tray() { |
| 647 DCHECK(CalledOnValidThread()); |
| 648 if (!status_tray_.get()) |
| 649 CreateStatusTray(); |
| 650 return status_tray_.get(); |
| 651 } |
| 652 |
637 safe_browsing::ClientSideDetectionService* | 653 safe_browsing::ClientSideDetectionService* |
638 BrowserProcessImpl::safe_browsing_detection_service() { | 654 BrowserProcessImpl::safe_browsing_detection_service() { |
639 DCHECK(CalledOnValidThread()); | 655 DCHECK(CalledOnValidThread()); |
640 if (!created_safe_browsing_detection_service_) { | 656 if (!created_safe_browsing_detection_service_) { |
641 CreateSafeBrowsingDetectionService(); | 657 CreateSafeBrowsingDetectionService(); |
642 } | 658 } |
643 return safe_browsing_detection_service_.get(); | 659 return safe_browsing_detection_service_.get(); |
644 } | 660 } |
645 | 661 |
646 bool BrowserProcessImpl::plugin_finder_disabled() const { | 662 bool BrowserProcessImpl::plugin_finder_disabled() const { |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 notification_ui_manager_.reset(NotificationUIManager::Create(local_state())); | 978 notification_ui_manager_.reset(NotificationUIManager::Create(local_state())); |
963 | 979 |
964 created_notification_ui_manager_ = true; | 980 created_notification_ui_manager_ = true; |
965 } | 981 } |
966 | 982 |
967 void BrowserProcessImpl::CreateTabCloseableStateWatcher() { | 983 void BrowserProcessImpl::CreateTabCloseableStateWatcher() { |
968 DCHECK(tab_closeable_state_watcher_.get() == NULL); | 984 DCHECK(tab_closeable_state_watcher_.get() == NULL); |
969 tab_closeable_state_watcher_.reset(TabCloseableStateWatcher::Create()); | 985 tab_closeable_state_watcher_.reset(TabCloseableStateWatcher::Create()); |
970 } | 986 } |
971 | 987 |
| 988 void BrowserProcessImpl::CreateBackgroundModeManager() { |
| 989 DCHECK(background_mode_manager_.get() == NULL); |
| 990 background_mode_manager_.reset( |
| 991 new BackgroundModeManager(CommandLine::ForCurrentProcess())); |
| 992 } |
| 993 |
| 994 void BrowserProcessImpl::CreateStatusTray() { |
| 995 DCHECK(status_tray_.get() == NULL); |
| 996 status_tray_.reset(StatusTray::Create()); |
| 997 } |
| 998 |
972 void BrowserProcessImpl::CreatePrintPreviewTabController() { | 999 void BrowserProcessImpl::CreatePrintPreviewTabController() { |
973 DCHECK(print_preview_tab_controller_.get() == NULL); | 1000 DCHECK(print_preview_tab_controller_.get() == NULL); |
974 print_preview_tab_controller_ = new printing::PrintPreviewTabController(); | 1001 print_preview_tab_controller_ = new printing::PrintPreviewTabController(); |
975 } | 1002 } |
976 | 1003 |
977 void BrowserProcessImpl::CreateBackgroundPrintingManager() { | 1004 void BrowserProcessImpl::CreateBackgroundPrintingManager() { |
978 DCHECK(background_printing_manager_.get() == NULL); | 1005 DCHECK(background_printing_manager_.get() == NULL); |
979 background_printing_manager_.reset(new printing::BackgroundPrintingManager()); | 1006 background_printing_manager_.reset(new printing::BackgroundPrintingManager()); |
980 } | 1007 } |
981 | 1008 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 } | 1146 } |
1120 | 1147 |
1121 void BrowserProcessImpl::OnAutoupdateTimer() { | 1148 void BrowserProcessImpl::OnAutoupdateTimer() { |
1122 if (CanAutorestartForUpdate()) { | 1149 if (CanAutorestartForUpdate()) { |
1123 DLOG(WARNING) << "Detected update. Restarting browser."; | 1150 DLOG(WARNING) << "Detected update. Restarting browser."; |
1124 RestartPersistentInstance(); | 1151 RestartPersistentInstance(); |
1125 } | 1152 } |
1126 } | 1153 } |
1127 | 1154 |
1128 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1155 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |