| 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/browsing_data_remover.h" | 23 #include "chrome/browser/browsing_data_remover.h" |
| 23 #include "chrome/browser/debugger/browser_list_tabcontents_provider.h" | 24 #include "chrome/browser/debugger/browser_list_tabcontents_provider.h" |
| 24 #include "chrome/browser/debugger/devtools_http_protocol_handler.h" | 25 #include "chrome/browser/debugger/devtools_http_protocol_handler.h" |
| 25 #include "chrome/browser/debugger/devtools_manager.h" | 26 #include "chrome/browser/debugger/devtools_manager.h" |
| 26 #include "chrome/browser/debugger/devtools_protocol_handler.h" | 27 #include "chrome/browser/debugger/devtools_protocol_handler.h" |
| 27 #include "chrome/browser/download/download_file_manager.h" | 28 #include "chrome/browser/download/download_file_manager.h" |
| 28 #include "chrome/browser/download/save_file_manager.h" | 29 #include "chrome/browser/download/save_file_manager.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 46 #include "chrome/browser/prefs/browser_prefs.h" | 47 #include "chrome/browser/prefs/browser_prefs.h" |
| 47 #include "chrome/browser/prefs/pref_service.h" | 48 #include "chrome/browser/prefs/pref_service.h" |
| 48 #include "chrome/browser/printing/background_printing_manager.h" | 49 #include "chrome/browser/printing/background_printing_manager.h" |
| 49 #include "chrome/browser/printing/print_job_manager.h" | 50 #include "chrome/browser/printing/print_job_manager.h" |
| 50 #include "chrome/browser/printing/print_preview_tab_controller.h" | 51 #include "chrome/browser/printing/print_preview_tab_controller.h" |
| 51 #include "chrome/browser/profiles/profile_manager.h" | 52 #include "chrome/browser/profiles/profile_manager.h" |
| 52 #include "chrome/browser/safe_browsing/client_side_detection_service.h" | 53 #include "chrome/browser/safe_browsing/client_side_detection_service.h" |
| 53 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 54 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 54 #include "chrome/browser/shell_integration.h" | 55 #include "chrome/browser/shell_integration.h" |
| 55 #include "chrome/browser/sidebar/sidebar_manager.h" | 56 #include "chrome/browser/sidebar/sidebar_manager.h" |
| 57 #include "chrome/browser/status_icons/status_tray.h" |
| 56 #include "chrome/browser/tab_closeable_state_watcher.h" | 58 #include "chrome/browser/tab_closeable_state_watcher.h" |
| 57 #include "chrome/browser/ui/browser_list.h" | 59 #include "chrome/browser/ui/browser_list.h" |
| 58 #include "chrome/common/chrome_constants.h" | 60 #include "chrome/common/chrome_constants.h" |
| 59 #include "chrome/common/chrome_paths.h" | 61 #include "chrome/common/chrome_paths.h" |
| 60 #include "chrome/common/chrome_switches.h" | 62 #include "chrome/common/chrome_switches.h" |
| 61 #include "chrome/common/default_plugin.h" | 63 #include "chrome/common/default_plugin.h" |
| 62 #include "chrome/common/extensions/extension_l10n_util.h" | 64 #include "chrome/common/extensions/extension_l10n_util.h" |
| 63 #include "chrome/common/extensions/extension_resource.h" | 65 #include "chrome/common/extensions/extension_resource.h" |
| 64 #include "chrome/common/json_pref_store.h" | 66 #include "chrome/common/json_pref_store.h" |
| 65 #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... |
| 628 return shutdown_event_.get(); | 630 return shutdown_event_.get(); |
| 629 } | 631 } |
| 630 | 632 |
| 631 TabCloseableStateWatcher* BrowserProcessImpl::tab_closeable_state_watcher() { | 633 TabCloseableStateWatcher* BrowserProcessImpl::tab_closeable_state_watcher() { |
| 632 DCHECK(CalledOnValidThread()); | 634 DCHECK(CalledOnValidThread()); |
| 633 if (!tab_closeable_state_watcher_.get()) | 635 if (!tab_closeable_state_watcher_.get()) |
| 634 CreateTabCloseableStateWatcher(); | 636 CreateTabCloseableStateWatcher(); |
| 635 return tab_closeable_state_watcher_.get(); | 637 return tab_closeable_state_watcher_.get(); |
| 636 } | 638 } |
| 637 | 639 |
| 640 BackgroundModeManager* BrowserProcessImpl::background_mode_manager() { |
| 641 DCHECK(CalledOnValidThread()); |
| 642 if (!background_mode_manager_.get()) |
| 643 CreateBackgroundModeManager(); |
| 644 return background_mode_manager_.get(); |
| 645 } |
| 646 |
| 647 StatusTray* BrowserProcessImpl::status_tray() { |
| 648 DCHECK(CalledOnValidThread()); |
| 649 if (!status_tray_.get()) |
| 650 CreateStatusTray(); |
| 651 return status_tray_.get(); |
| 652 } |
| 653 |
| 638 safe_browsing::ClientSideDetectionService* | 654 safe_browsing::ClientSideDetectionService* |
| 639 BrowserProcessImpl::safe_browsing_detection_service() { | 655 BrowserProcessImpl::safe_browsing_detection_service() { |
| 640 DCHECK(CalledOnValidThread()); | 656 DCHECK(CalledOnValidThread()); |
| 641 if (!created_safe_browsing_detection_service_) { | 657 if (!created_safe_browsing_detection_service_) { |
| 642 CreateSafeBrowsingDetectionService(); | 658 CreateSafeBrowsingDetectionService(); |
| 643 } | 659 } |
| 644 return safe_browsing_detection_service_.get(); | 660 return safe_browsing_detection_service_.get(); |
| 645 } | 661 } |
| 646 | 662 |
| 647 bool BrowserProcessImpl::plugin_finder_disabled() const { | 663 bool BrowserProcessImpl::plugin_finder_disabled() const { |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 968 notification_ui_manager_.reset(NotificationUIManager::Create(local_state())); | 984 notification_ui_manager_.reset(NotificationUIManager::Create(local_state())); |
| 969 | 985 |
| 970 created_notification_ui_manager_ = true; | 986 created_notification_ui_manager_ = true; |
| 971 } | 987 } |
| 972 | 988 |
| 973 void BrowserProcessImpl::CreateTabCloseableStateWatcher() { | 989 void BrowserProcessImpl::CreateTabCloseableStateWatcher() { |
| 974 DCHECK(tab_closeable_state_watcher_.get() == NULL); | 990 DCHECK(tab_closeable_state_watcher_.get() == NULL); |
| 975 tab_closeable_state_watcher_.reset(TabCloseableStateWatcher::Create()); | 991 tab_closeable_state_watcher_.reset(TabCloseableStateWatcher::Create()); |
| 976 } | 992 } |
| 977 | 993 |
| 994 void BrowserProcessImpl::CreateBackgroundModeManager() { |
| 995 DCHECK(background_mode_manager_.get() == NULL); |
| 996 background_mode_manager_.reset( |
| 997 new BackgroundModeManager(CommandLine::ForCurrentProcess())); |
| 998 } |
| 999 |
| 1000 void BrowserProcessImpl::CreateStatusTray() { |
| 1001 DCHECK(status_tray_.get() == NULL); |
| 1002 status_tray_.reset(StatusTray::Create()); |
| 1003 } |
| 1004 |
| 978 void BrowserProcessImpl::CreatePrintPreviewTabController() { | 1005 void BrowserProcessImpl::CreatePrintPreviewTabController() { |
| 979 DCHECK(print_preview_tab_controller_.get() == NULL); | 1006 DCHECK(print_preview_tab_controller_.get() == NULL); |
| 980 print_preview_tab_controller_ = new printing::PrintPreviewTabController(); | 1007 print_preview_tab_controller_ = new printing::PrintPreviewTabController(); |
| 981 } | 1008 } |
| 982 | 1009 |
| 983 void BrowserProcessImpl::CreateBackgroundPrintingManager() { | 1010 void BrowserProcessImpl::CreateBackgroundPrintingManager() { |
| 984 DCHECK(background_printing_manager_.get() == NULL); | 1011 DCHECK(background_printing_manager_.get() == NULL); |
| 985 background_printing_manager_.reset(new printing::BackgroundPrintingManager()); | 1012 background_printing_manager_.reset(new printing::BackgroundPrintingManager()); |
| 986 } | 1013 } |
| 987 | 1014 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 } | 1156 } |
| 1130 | 1157 |
| 1131 void BrowserProcessImpl::OnAutoupdateTimer() { | 1158 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 1132 if (CanAutorestartForUpdate()) { | 1159 if (CanAutorestartForUpdate()) { |
| 1133 DLOG(WARNING) << "Detected update. Restarting browser."; | 1160 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 1134 RestartPersistentInstance(); | 1161 RestartPersistentInstance(); |
| 1135 } | 1162 } |
| 1136 } | 1163 } |
| 1137 | 1164 |
| 1138 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1165 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |