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 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "chrome/browser/prefs/browser_prefs.h" | 44 #include "chrome/browser/prefs/browser_prefs.h" |
45 #include "chrome/browser/prefs/pref_service.h" | 45 #include "chrome/browser/prefs/pref_service.h" |
46 #include "chrome/browser/prerender/prerender_tracker.h" | 46 #include "chrome/browser/prerender/prerender_tracker.h" |
47 #include "chrome/browser/printing/background_printing_manager.h" | 47 #include "chrome/browser/printing/background_printing_manager.h" |
48 #include "chrome/browser/printing/print_job_manager.h" | 48 #include "chrome/browser/printing/print_job_manager.h" |
49 #include "chrome/browser/printing/print_preview_tab_controller.h" | 49 #include "chrome/browser/printing/print_preview_tab_controller.h" |
50 #include "chrome/browser/profiles/profile_manager.h" | 50 #include "chrome/browser/profiles/profile_manager.h" |
51 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.
h" | 51 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.
h" |
52 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 52 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
53 #include "chrome/browser/shell_integration.h" | 53 #include "chrome/browser/shell_integration.h" |
54 #include "chrome/browser/sidebar/sidebar_manager.h" | |
55 #include "chrome/browser/status_icons/status_tray.h" | 54 #include "chrome/browser/status_icons/status_tray.h" |
56 #include "chrome/browser/tab_closeable_state_watcher.h" | 55 #include "chrome/browser/tab_closeable_state_watcher.h" |
57 #include "chrome/browser/tab_contents/thumbnail_generator.h" | 56 #include "chrome/browser/tab_contents/thumbnail_generator.h" |
58 #include "chrome/browser/ui/browser_list.h" | 57 #include "chrome/browser/ui/browser_list.h" |
59 #include "chrome/common/chrome_constants.h" | 58 #include "chrome/common/chrome_constants.h" |
60 #include "chrome/common/chrome_notification_types.h" | 59 #include "chrome/common/chrome_notification_types.h" |
61 #include "chrome/common/chrome_paths.h" | 60 #include "chrome/common/chrome_paths.h" |
62 #include "chrome/common/chrome_switches.h" | 61 #include "chrome/common/chrome_switches.h" |
63 #include "chrome/common/extensions/extension_l10n_util.h" | 62 #include "chrome/common/extensions/extension_l10n_util.h" |
64 #include "chrome/common/extensions/extension_resource.h" | 63 #include "chrome/common/extensions/extension_resource.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 120 |
122 using content::BrowserThread; | 121 using content::BrowserThread; |
123 | 122 |
124 BrowserProcessImpl::BrowserProcessImpl(const CommandLine& command_line) | 123 BrowserProcessImpl::BrowserProcessImpl(const CommandLine& command_line) |
125 : created_resource_dispatcher_host_(false), | 124 : created_resource_dispatcher_host_(false), |
126 created_metrics_service_(false), | 125 created_metrics_service_(false), |
127 created_watchdog_thread_(false), | 126 created_watchdog_thread_(false), |
128 created_profile_manager_(false), | 127 created_profile_manager_(false), |
129 created_local_state_(false), | 128 created_local_state_(false), |
130 created_icon_manager_(false), | 129 created_icon_manager_(false), |
131 created_sidebar_manager_(false), | |
132 created_browser_policy_connector_(false), | 130 created_browser_policy_connector_(false), |
133 created_notification_ui_manager_(false), | 131 created_notification_ui_manager_(false), |
134 created_safe_browsing_service_(false), | 132 created_safe_browsing_service_(false), |
135 module_ref_count_(0), | 133 module_ref_count_(0), |
136 did_start_(false), | 134 did_start_(false), |
137 checked_for_new_frames_(false), | 135 checked_for_new_frames_(false), |
138 using_new_frames_(false), | 136 using_new_frames_(false), |
139 thumbnail_generator_(new ThumbnailGenerator), | 137 thumbnail_generator_(new ThumbnailGenerator), |
140 download_status_updater_(new DownloadStatusUpdater) { | 138 download_status_updater_(new DownloadStatusUpdater) { |
141 g_browser_process = this; | 139 g_browser_process = this; |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 return profile_manager_.get(); | 432 return profile_manager_.get(); |
435 } | 433 } |
436 | 434 |
437 PrefService* BrowserProcessImpl::local_state() { | 435 PrefService* BrowserProcessImpl::local_state() { |
438 DCHECK(CalledOnValidThread()); | 436 DCHECK(CalledOnValidThread()); |
439 if (!created_local_state_) | 437 if (!created_local_state_) |
440 CreateLocalState(); | 438 CreateLocalState(); |
441 return local_state_.get(); | 439 return local_state_.get(); |
442 } | 440 } |
443 | 441 |
444 SidebarManager* BrowserProcessImpl::sidebar_manager() { | |
445 DCHECK(CalledOnValidThread()); | |
446 if (!created_sidebar_manager_) | |
447 CreateSidebarManager(); | |
448 return sidebar_manager_.get(); | |
449 } | |
450 | |
451 ui::Clipboard* BrowserProcessImpl::clipboard() { | 442 ui::Clipboard* BrowserProcessImpl::clipboard() { |
452 DCHECK(CalledOnValidThread()); | 443 DCHECK(CalledOnValidThread()); |
453 return clipboard_.get(); | 444 return clipboard_.get(); |
454 } | 445 } |
455 | 446 |
456 net::URLRequestContextGetter* BrowserProcessImpl::system_request_context() { | 447 net::URLRequestContextGetter* BrowserProcessImpl::system_request_context() { |
457 DCHECK(CalledOnValidThread()); | 448 DCHECK(CalledOnValidThread()); |
458 return io_thread()->system_url_request_context_getter(); | 449 return io_thread()->system_url_request_context_getter(); |
459 } | 450 } |
460 | 451 |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 if (local_state_->IsManagedPreference(prefs::kDefaultBrowserSettingEnabled)) | 835 if (local_state_->IsManagedPreference(prefs::kDefaultBrowserSettingEnabled)) |
845 ApplyDefaultBrowserPolicy(); | 836 ApplyDefaultBrowserPolicy(); |
846 } | 837 } |
847 | 838 |
848 void BrowserProcessImpl::CreateIconManager() { | 839 void BrowserProcessImpl::CreateIconManager() { |
849 DCHECK(!created_icon_manager_ && icon_manager_.get() == NULL); | 840 DCHECK(!created_icon_manager_ && icon_manager_.get() == NULL); |
850 created_icon_manager_ = true; | 841 created_icon_manager_ = true; |
851 icon_manager_.reset(new IconManager); | 842 icon_manager_.reset(new IconManager); |
852 } | 843 } |
853 | 844 |
854 void BrowserProcessImpl::CreateSidebarManager() { | |
855 DCHECK(sidebar_manager_.get() == NULL); | |
856 created_sidebar_manager_ = true; | |
857 sidebar_manager_ = new SidebarManager(); | |
858 } | |
859 | |
860 void BrowserProcessImpl::CreateGoogleURLTracker() { | 845 void BrowserProcessImpl::CreateGoogleURLTracker() { |
861 DCHECK(google_url_tracker_.get() == NULL); | 846 DCHECK(google_url_tracker_.get() == NULL); |
862 scoped_ptr<GoogleURLTracker> google_url_tracker(new GoogleURLTracker); | 847 scoped_ptr<GoogleURLTracker> google_url_tracker(new GoogleURLTracker); |
863 google_url_tracker_.swap(google_url_tracker); | 848 google_url_tracker_.swap(google_url_tracker); |
864 } | 849 } |
865 | 850 |
866 void BrowserProcessImpl::CreateIntranetRedirectDetector() { | 851 void BrowserProcessImpl::CreateIntranetRedirectDetector() { |
867 DCHECK(intranet_redirect_detector_.get() == NULL); | 852 DCHECK(intranet_redirect_detector_.get() == NULL); |
868 scoped_ptr<IntranetRedirectDetector> intranet_redirect_detector( | 853 scoped_ptr<IntranetRedirectDetector> intranet_redirect_detector( |
869 new IntranetRedirectDetector); | 854 new IntranetRedirectDetector); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 } | 974 } |
990 | 975 |
991 void BrowserProcessImpl::OnAutoupdateTimer() { | 976 void BrowserProcessImpl::OnAutoupdateTimer() { |
992 if (CanAutorestartForUpdate()) { | 977 if (CanAutorestartForUpdate()) { |
993 DLOG(WARNING) << "Detected update. Restarting browser."; | 978 DLOG(WARNING) << "Detected update. Restarting browser."; |
994 RestartBackgroundInstance(); | 979 RestartBackgroundInstance(); |
995 } | 980 } |
996 } | 981 } |
997 | 982 |
998 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 983 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |