OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 #include "chrome/browser/prefs/chrome_pref_service_factory.h" | 55 #include "chrome/browser/prefs/chrome_pref_service_factory.h" |
56 #include "chrome/browser/prerender/prerender_tracker.h" | 56 #include "chrome/browser/prerender/prerender_tracker.h" |
57 #include "chrome/browser/printing/background_printing_manager.h" | 57 #include "chrome/browser/printing/background_printing_manager.h" |
58 #include "chrome/browser/printing/print_job_manager.h" | 58 #include "chrome/browser/printing/print_job_manager.h" |
59 #include "chrome/browser/printing/print_preview_dialog_controller.h" | 59 #include "chrome/browser/printing/print_preview_dialog_controller.h" |
60 #include "chrome/browser/profiles/profile_manager.h" | 60 #include "chrome/browser/profiles/profile_manager.h" |
61 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.
h" | 61 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.
h" |
62 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 62 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
63 #include "chrome/browser/shell_integration.h" | 63 #include "chrome/browser/shell_integration.h" |
64 #include "chrome/browser/status_icons/status_tray.h" | 64 #include "chrome/browser/status_icons/status_tray.h" |
| 65 #include "chrome/browser/storage_monitor/storage_monitor.h" |
65 #include "chrome/browser/thumbnails/render_widget_snapshot_taker.h" | 66 #include "chrome/browser/thumbnails/render_widget_snapshot_taker.h" |
66 #include "chrome/browser/ui/bookmarks/bookmark_prompt_controller.h" | 67 #include "chrome/browser/ui/bookmarks/bookmark_prompt_controller.h" |
67 #include "chrome/browser/ui/browser_finder.h" | 68 #include "chrome/browser/ui/browser_finder.h" |
68 #include "chrome/browser/web_resource/promo_resource_service.h" | 69 #include "chrome/browser/web_resource/promo_resource_service.h" |
69 #include "chrome/common/chrome_constants.h" | 70 #include "chrome/common/chrome_constants.h" |
70 #include "chrome/common/chrome_paths.h" | 71 #include "chrome/common/chrome_paths.h" |
71 #include "chrome/common/chrome_switches.h" | 72 #include "chrome/common/chrome_switches.h" |
72 #include "chrome/common/extensions/chrome_manifest_handlers.h" | 73 #include "chrome/common/extensions/chrome_manifest_handlers.h" |
73 #include "chrome/common/extensions/extension_l10n_util.h" | 74 #include "chrome/common/extensions/extension_l10n_util.h" |
74 #include "chrome/common/extensions/permissions/chrome_api_permissions.h" | 75 #include "chrome/common/extensions/permissions/chrome_api_permissions.h" |
(...skipping 24 matching lines...) Expand all Loading... |
99 #include "base/win/windows_version.h" | 100 #include "base/win/windows_version.h" |
100 #include "ui/views/focus/view_storage.h" | 101 #include "ui/views/focus/view_storage.h" |
101 #elif defined(OS_MACOSX) | 102 #elif defined(OS_MACOSX) |
102 #include "chrome/browser/chrome_browser_main_mac.h" | 103 #include "chrome/browser/chrome_browser_main_mac.h" |
103 #endif | 104 #endif |
104 | 105 |
105 #if defined(USE_AURA) | 106 #if defined(USE_AURA) |
106 #include "ui/aura/env.h" | 107 #include "ui/aura/env.h" |
107 #endif | 108 #endif |
108 | 109 |
109 #if !defined(OS_ANDROID) | 110 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
110 #include "chrome/browser/media_galleries/media_file_system_registry.h" | 111 #include "chrome/browser/media_galleries/media_file_system_registry.h" |
111 #endif | 112 #endif |
112 | 113 |
113 #if defined(ENABLE_PLUGIN_INSTALLATION) | 114 #if defined(ENABLE_PLUGIN_INSTALLATION) |
114 #include "chrome/browser/plugins/plugins_resource_service.h" | 115 #include "chrome/browser/plugins/plugins_resource_service.h" |
115 #endif | 116 #endif |
116 | 117 |
117 #if defined(OS_MACOSX) | 118 #if defined(OS_MACOSX) |
118 #include "apps/app_shim/app_shim_host_manager_mac.h" | 119 #include "apps/app_shim/app_shim_host_manager_mac.h" |
119 #include "chrome/browser/ui/app_list/app_list_service.h" | 120 #include "chrome/browser/ui/app_list/app_list_service.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 // Need to clear profiles (download managers) before the io_thread_. | 245 // Need to clear profiles (download managers) before the io_thread_. |
245 profile_manager_.reset(); | 246 profile_manager_.reset(); |
246 | 247 |
247 #if !defined(OS_ANDROID) | 248 #if !defined(OS_ANDROID) |
248 // Debugger must be cleaned up before IO thread and NotificationService. | 249 // Debugger must be cleaned up before IO thread and NotificationService. |
249 remote_debugging_server_.reset(); | 250 remote_debugging_server_.reset(); |
250 #endif | 251 #endif |
251 | 252 |
252 ExtensionRendererState::GetInstance()->Shutdown(); | 253 ExtensionRendererState::GetInstance()->Shutdown(); |
253 | 254 |
| 255 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 256 media_file_system_registry_.reset(); |
| 257 // Delete |storage_monitor_| now. Otherwise the FILE thread would be gone |
| 258 // when we try to release it in the dtor and Valgrind would report a |
| 259 // leak on almost every single browser_test. |
| 260 // TODO(gbillock): Make this unnecessary. |
| 261 storage_monitor_.reset(); |
| 262 #endif |
| 263 |
254 message_center::MessageCenter::Shutdown(); | 264 message_center::MessageCenter::Shutdown(); |
255 | 265 |
256 #if defined(ENABLE_CONFIGURATION_POLICY) | 266 #if defined(ENABLE_CONFIGURATION_POLICY) |
257 // The policy providers managed by |browser_policy_connector_| need to shut | 267 // The policy providers managed by |browser_policy_connector_| need to shut |
258 // down while the IO and FILE threads are still alive. | 268 // down while the IO and FILE threads are still alive. |
259 if (browser_policy_connector_) | 269 if (browser_policy_connector_) |
260 browser_policy_connector_->Shutdown(); | 270 browser_policy_connector_->Shutdown(); |
261 #endif | 271 #endif |
262 | 272 |
263 // Stop the watchdog thread before stopping other threads. | 273 // Stop the watchdog thread before stopping other threads. |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 } | 622 } |
613 | 623 |
614 BookmarkPromptController* BrowserProcessImpl::bookmark_prompt_controller() { | 624 BookmarkPromptController* BrowserProcessImpl::bookmark_prompt_controller() { |
615 #if defined(OS_ANDROID) | 625 #if defined(OS_ANDROID) |
616 return NULL; | 626 return NULL; |
617 #else | 627 #else |
618 return bookmark_prompt_controller_.get(); | 628 return bookmark_prompt_controller_.get(); |
619 #endif | 629 #endif |
620 } | 630 } |
621 | 631 |
| 632 chrome::StorageMonitor* BrowserProcessImpl::storage_monitor() { |
| 633 #if defined(OS_ANDROID) || defined(OS_IOS) |
| 634 return NULL; |
| 635 #else |
| 636 return storage_monitor_.get(); |
| 637 #endif |
| 638 } |
| 639 |
| 640 void BrowserProcessImpl::set_storage_monitor_for_test( |
| 641 scoped_ptr<chrome::StorageMonitor> monitor) { |
| 642 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 643 storage_monitor_ = monitor.Pass(); |
| 644 #endif |
| 645 } |
| 646 |
622 chrome::MediaFileSystemRegistry* | 647 chrome::MediaFileSystemRegistry* |
623 BrowserProcessImpl::media_file_system_registry() { | 648 BrowserProcessImpl::media_file_system_registry() { |
624 #if defined(OS_ANDROID) | 649 #if defined(OS_ANDROID) || defined(OS_IOS) |
625 return NULL; | 650 return NULL; |
626 #else | 651 #else |
627 if (!media_file_system_registry_) | 652 if (!media_file_system_registry_) |
628 media_file_system_registry_.reset(new chrome::MediaFileSystemRegistry()); | 653 media_file_system_registry_.reset(new chrome::MediaFileSystemRegistry()); |
629 return media_file_system_registry_.get(); | 654 return media_file_system_registry_.get(); |
630 #endif | 655 #endif |
631 } | 656 } |
632 | 657 |
633 bool BrowserProcessImpl::created_local_state() const { | 658 bool BrowserProcessImpl::created_local_state() const { |
634 return created_local_state_; | 659 return created_local_state_; |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
903 promo_resource_service_->StartAfterDelay(); | 928 promo_resource_service_->StartAfterDelay(); |
904 } | 929 } |
905 | 930 |
906 #if !defined(OS_ANDROID) | 931 #if !defined(OS_ANDROID) |
907 if (browser_defaults::bookmarks_enabled && | 932 if (browser_defaults::bookmarks_enabled && |
908 BookmarkPromptController::IsEnabled()) { | 933 BookmarkPromptController::IsEnabled()) { |
909 bookmark_prompt_controller_.reset(new BookmarkPromptController()); | 934 bookmark_prompt_controller_.reset(new BookmarkPromptController()); |
910 } | 935 } |
911 #endif | 936 #endif |
912 | 937 |
| 938 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 939 storage_monitor_.reset(chrome::StorageMonitor::Create()); |
| 940 #endif |
| 941 |
913 #if defined(OS_MACOSX) | 942 #if defined(OS_MACOSX) |
914 app_shim_host_manager_.reset(new AppShimHostManager); | 943 app_shim_host_manager_.reset(new AppShimHostManager); |
915 AppListService::InitAll(NULL); | 944 AppListService::InitAll(NULL); |
916 #endif | 945 #endif |
917 } | 946 } |
918 | 947 |
919 void BrowserProcessImpl::CreateIconManager() { | 948 void BrowserProcessImpl::CreateIconManager() { |
920 DCHECK(!created_icon_manager_ && icon_manager_.get() == NULL); | 949 DCHECK(!created_icon_manager_ && icon_manager_.get() == NULL); |
921 created_icon_manager_ = true; | 950 created_icon_manager_ = true; |
922 icon_manager_.reset(new IconManager); | 951 icon_manager_.reset(new IconManager); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1042 } | 1071 } |
1043 | 1072 |
1044 void BrowserProcessImpl::OnAutoupdateTimer() { | 1073 void BrowserProcessImpl::OnAutoupdateTimer() { |
1045 if (CanAutorestartForUpdate()) { | 1074 if (CanAutorestartForUpdate()) { |
1046 DLOG(WARNING) << "Detected update. Restarting browser."; | 1075 DLOG(WARNING) << "Detected update. Restarting browser."; |
1047 RestartBackgroundInstance(); | 1076 RestartBackgroundInstance(); |
1048 } | 1077 } |
1049 } | 1078 } |
1050 | 1079 |
1051 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1080 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |