Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: chrome/browser/browser_process_impl.cc

Issue 6914021: Modifying the BackgroundModeManager to handle multiple profiles. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 notification_ui_manager_.reset(NotificationUIManager::Create(local_state())); 980 notification_ui_manager_.reset(NotificationUIManager::Create(local_state()));
965 981
966 created_notification_ui_manager_ = true; 982 created_notification_ui_manager_ = true;
967 } 983 }
968 984
969 void BrowserProcessImpl::CreateTabCloseableStateWatcher() { 985 void BrowserProcessImpl::CreateTabCloseableStateWatcher() {
970 DCHECK(tab_closeable_state_watcher_.get() == NULL); 986 DCHECK(tab_closeable_state_watcher_.get() == NULL);
971 tab_closeable_state_watcher_.reset(TabCloseableStateWatcher::Create()); 987 tab_closeable_state_watcher_.reset(TabCloseableStateWatcher::Create());
972 } 988 }
973 989
990 void BrowserProcessImpl::CreateBackgroundModeManager() {
991 DCHECK(background_mode_manager_.get() == NULL);
992 background_mode_manager_.reset(
993 new BackgroundModeManager(CommandLine::ForCurrentProcess(), false));
994 }
995
996 void BrowserProcessImpl::CreateStatusTray() {
997 DCHECK(status_tray_.get() == NULL);
998 status_tray_.reset(StatusTray::Create());
999 }
1000
974 void BrowserProcessImpl::CreatePrintPreviewTabController() { 1001 void BrowserProcessImpl::CreatePrintPreviewTabController() {
975 DCHECK(print_preview_tab_controller_.get() == NULL); 1002 DCHECK(print_preview_tab_controller_.get() == NULL);
976 print_preview_tab_controller_ = new printing::PrintPreviewTabController(); 1003 print_preview_tab_controller_ = new printing::PrintPreviewTabController();
977 } 1004 }
978 1005
979 void BrowserProcessImpl::CreateBackgroundPrintingManager() { 1006 void BrowserProcessImpl::CreateBackgroundPrintingManager() {
980 DCHECK(background_printing_manager_.get() == NULL); 1007 DCHECK(background_printing_manager_.get() == NULL);
981 background_printing_manager_.reset(new printing::BackgroundPrintingManager()); 1008 background_printing_manager_.reset(new printing::BackgroundPrintingManager());
982 } 1009 }
983 1010
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 } 1148 }
1122 1149
1123 void BrowserProcessImpl::OnAutoupdateTimer() { 1150 void BrowserProcessImpl::OnAutoupdateTimer() {
1124 if (CanAutorestartForUpdate()) { 1151 if (CanAutorestartForUpdate()) {
1125 DLOG(WARNING) << "Detected update. Restarting browser."; 1152 DLOG(WARNING) << "Detected update. Restarting browser.";
1126 RestartPersistentInstance(); 1153 RestartPersistentInstance();
1127 } 1154 }
1128 } 1155 }
1129 1156
1130 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 1157 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698