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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 #include "content/public/browser/notification_details.h" | 112 #include "content/public/browser/notification_details.h" |
113 #include "content/public/browser/plugin_service.h" | 113 #include "content/public/browser/plugin_service.h" |
114 #include "content/public/browser/render_process_host.h" | 114 #include "content/public/browser/render_process_host.h" |
115 #include "content/public/browser/resource_dispatcher_host.h" | 115 #include "content/public/browser/resource_dispatcher_host.h" |
116 #include "content/public/browser/service_worker_context.h" | 116 #include "content/public/browser/service_worker_context.h" |
117 #include "content/public/browser/storage_partition.h" | 117 #include "content/public/browser/storage_partition.h" |
118 #include "content/public/common/content_switches.h" | 118 #include "content/public/common/content_switches.h" |
119 #include "extensions/common/constants.h" | 119 #include "extensions/common/constants.h" |
120 #include "net/socket/client_socket_pool_manager.h" | 120 #include "net/socket/client_socket_pool_manager.h" |
121 #include "net/url_request/url_request_context_getter.h" | 121 #include "net/url_request/url_request_context_getter.h" |
| 122 #include "printing/features/features.h" |
122 #include "ui/base/idle/idle.h" | 123 #include "ui/base/idle/idle.h" |
123 #include "ui/base/l10n/l10n_util.h" | 124 #include "ui/base/l10n/l10n_util.h" |
124 #include "ui/message_center/message_center.h" | 125 #include "ui/message_center/message_center.h" |
125 | 126 |
126 #if defined(OS_WIN) | 127 #if defined(OS_WIN) |
127 #include "base/win/windows_version.h" | 128 #include "base/win/windows_version.h" |
128 #include "ui/views/focus/view_storage.h" | 129 #include "ui/views/focus/view_storage.h" |
129 #elif defined(OS_MACOSX) | 130 #elif defined(OS_MACOSX) |
130 #include "chrome/browser/chrome_browser_main_mac.h" | 131 #include "chrome/browser/chrome_browser_main_mac.h" |
131 #endif | 132 #endif |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 created_safe_browsing_service_(false), | 208 created_safe_browsing_service_(false), |
208 created_subresource_filter_ruleset_service_(false), | 209 created_subresource_filter_ruleset_service_(false), |
209 shutting_down_(false), | 210 shutting_down_(false), |
210 tearing_down_(false), | 211 tearing_down_(false), |
211 download_status_updater_(new DownloadStatusUpdater), | 212 download_status_updater_(new DownloadStatusUpdater), |
212 local_state_task_runner_(local_state_task_runner), | 213 local_state_task_runner_(local_state_task_runner), |
213 cached_default_web_client_state_(shell_integration::UNKNOWN_DEFAULT) { | 214 cached_default_web_client_state_(shell_integration::UNKNOWN_DEFAULT) { |
214 g_browser_process = this; | 215 g_browser_process = this; |
215 platform_part_.reset(new BrowserProcessPlatformPart()); | 216 platform_part_.reset(new BrowserProcessPlatformPart()); |
216 | 217 |
217 #if defined(ENABLE_PRINTING) | 218 #if BUILDFLAG(ENABLE_PRINTING) |
218 // Must be created after the NotificationService. | 219 // Must be created after the NotificationService. |
219 print_job_manager_.reset(new printing::PrintJobManager); | 220 print_job_manager_.reset(new printing::PrintJobManager); |
220 #endif | 221 #endif |
221 | 222 |
222 base::FilePath net_log_path; | 223 base::FilePath net_log_path; |
223 if (command_line.HasSwitch(switches::kLogNetLog)) | 224 if (command_line.HasSwitch(switches::kLogNetLog)) |
224 net_log_path = command_line.GetSwitchValuePath(switches::kLogNetLog); | 225 net_log_path = command_line.GetSwitchValuePath(switches::kLogNetLog); |
225 net_log_.reset(new net_log::ChromeNetLog( | 226 net_log_.reset(new net_log::ChromeNetLog( |
226 net_log_path, GetNetCaptureModeFromCommandLine(command_line), | 227 net_log_path, GetNetCaptureModeFromCommandLine(command_line), |
227 command_line.GetCommandLineString(), chrome::GetChannelString())); | 228 command_line.GetCommandLineString(), chrome::GetChannelString())); |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 return shutting_down_ || tearing_down_; | 671 return shutting_down_ || tearing_down_; |
671 } | 672 } |
672 | 673 |
673 printing::PrintJobManager* BrowserProcessImpl::print_job_manager() { | 674 printing::PrintJobManager* BrowserProcessImpl::print_job_manager() { |
674 DCHECK(CalledOnValidThread()); | 675 DCHECK(CalledOnValidThread()); |
675 return print_job_manager_.get(); | 676 return print_job_manager_.get(); |
676 } | 677 } |
677 | 678 |
678 printing::PrintPreviewDialogController* | 679 printing::PrintPreviewDialogController* |
679 BrowserProcessImpl::print_preview_dialog_controller() { | 680 BrowserProcessImpl::print_preview_dialog_controller() { |
680 #if defined(ENABLE_PRINT_PREVIEW) | 681 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
681 DCHECK(CalledOnValidThread()); | 682 DCHECK(CalledOnValidThread()); |
682 if (!print_preview_dialog_controller_.get()) | 683 if (!print_preview_dialog_controller_.get()) |
683 CreatePrintPreviewDialogController(); | 684 CreatePrintPreviewDialogController(); |
684 return print_preview_dialog_controller_.get(); | 685 return print_preview_dialog_controller_.get(); |
685 #else | 686 #else |
686 NOTIMPLEMENTED(); | 687 NOTIMPLEMENTED(); |
687 return NULL; | 688 return NULL; |
688 #endif | 689 #endif |
689 } | 690 } |
690 | 691 |
691 printing::BackgroundPrintingManager* | 692 printing::BackgroundPrintingManager* |
692 BrowserProcessImpl::background_printing_manager() { | 693 BrowserProcessImpl::background_printing_manager() { |
693 #if defined(ENABLE_PRINT_PREVIEW) | 694 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
694 DCHECK(CalledOnValidThread()); | 695 DCHECK(CalledOnValidThread()); |
695 if (!background_printing_manager_.get()) | 696 if (!background_printing_manager_.get()) |
696 CreateBackgroundPrintingManager(); | 697 CreateBackgroundPrintingManager(); |
697 return background_printing_manager_.get(); | 698 return background_printing_manager_.get(); |
698 #else | 699 #else |
699 NOTIMPLEMENTED(); | 700 NOTIMPLEMENTED(); |
700 return NULL; | 701 return NULL; |
701 #endif | 702 #endif |
702 } | 703 } |
703 | 704 |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 &profile_manager()->GetProfileAttributesStorage())); | 1152 &profile_manager()->GetProfileAttributesStorage())); |
1152 #endif | 1153 #endif |
1153 } | 1154 } |
1154 | 1155 |
1155 void BrowserProcessImpl::CreateStatusTray() { | 1156 void BrowserProcessImpl::CreateStatusTray() { |
1156 DCHECK(!status_tray_); | 1157 DCHECK(!status_tray_); |
1157 status_tray_.reset(StatusTray::Create()); | 1158 status_tray_.reset(StatusTray::Create()); |
1158 } | 1159 } |
1159 | 1160 |
1160 void BrowserProcessImpl::CreatePrintPreviewDialogController() { | 1161 void BrowserProcessImpl::CreatePrintPreviewDialogController() { |
1161 #if defined(ENABLE_PRINT_PREVIEW) | 1162 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
1162 DCHECK(!print_preview_dialog_controller_); | 1163 DCHECK(!print_preview_dialog_controller_); |
1163 print_preview_dialog_controller_ = | 1164 print_preview_dialog_controller_ = |
1164 new printing::PrintPreviewDialogController(); | 1165 new printing::PrintPreviewDialogController(); |
1165 #else | 1166 #else |
1166 NOTIMPLEMENTED(); | 1167 NOTIMPLEMENTED(); |
1167 #endif | 1168 #endif |
1168 } | 1169 } |
1169 | 1170 |
1170 void BrowserProcessImpl::CreateBackgroundPrintingManager() { | 1171 void BrowserProcessImpl::CreateBackgroundPrintingManager() { |
1171 #if defined(ENABLE_PRINT_PREVIEW) | 1172 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
1172 DCHECK(!background_printing_manager_); | 1173 DCHECK(!background_printing_manager_); |
1173 background_printing_manager_.reset(new printing::BackgroundPrintingManager()); | 1174 background_printing_manager_.reset(new printing::BackgroundPrintingManager()); |
1174 #else | 1175 #else |
1175 NOTIMPLEMENTED(); | 1176 NOTIMPLEMENTED(); |
1176 #endif | 1177 #endif |
1177 } | 1178 } |
1178 | 1179 |
1179 void BrowserProcessImpl::CreateSafeBrowsingService() { | 1180 void BrowserProcessImpl::CreateSafeBrowsingService() { |
1180 DCHECK(!safe_browsing_service_); | 1181 DCHECK(!safe_browsing_service_); |
1181 // Set this flag to true so that we don't retry indefinitely to | 1182 // Set this flag to true so that we don't retry indefinitely to |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1305 base::debug::Alias(&callstack); | 1306 base::debug::Alias(&callstack); |
1306 CHECK(false); | 1307 CHECK(false); |
1307 } | 1308 } |
1308 } | 1309 } |
1309 | 1310 |
1310 void BrowserProcessImpl::Unpin() { | 1311 void BrowserProcessImpl::Unpin() { |
1311 DCHECK(CalledOnValidThread()); | 1312 DCHECK(CalledOnValidThread()); |
1312 release_last_reference_callstack_ = base::debug::StackTrace(); | 1313 release_last_reference_callstack_ = base::debug::StackTrace(); |
1313 | 1314 |
1314 shutting_down_ = true; | 1315 shutting_down_ = true; |
1315 #if defined(ENABLE_PRINTING) | 1316 #if BUILDFLAG(ENABLE_PRINTING) |
1316 // Wait for the pending print jobs to finish. Don't do this later, since | 1317 // Wait for the pending print jobs to finish. Don't do this later, since |
1317 // this might cause a nested message loop to run, and we don't want pending | 1318 // this might cause a nested message loop to run, and we don't want pending |
1318 // tasks to run once teardown has started. | 1319 // tasks to run once teardown has started. |
1319 print_job_manager_->Shutdown(); | 1320 print_job_manager_->Shutdown(); |
1320 #endif | 1321 #endif |
1321 | 1322 |
1322 #if defined(LEAK_SANITIZER) | 1323 #if defined(LEAK_SANITIZER) |
1323 // Check for memory leaks now, before we start shutting down threads. Doing | 1324 // Check for memory leaks now, before we start shutting down threads. Doing |
1324 // this early means we won't report any shutdown-only leaks (as they have | 1325 // this early means we won't report any shutdown-only leaks (as they have |
1325 // not yet happened at this point). | 1326 // not yet happened at this point). |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1397 } | 1398 } |
1398 | 1399 |
1399 void BrowserProcessImpl::OnAutoupdateTimer() { | 1400 void BrowserProcessImpl::OnAutoupdateTimer() { |
1400 if (CanAutorestartForUpdate()) { | 1401 if (CanAutorestartForUpdate()) { |
1401 DLOG(WARNING) << "Detected update. Restarting browser."; | 1402 DLOG(WARNING) << "Detected update. Restarting browser."; |
1402 RestartBackgroundInstance(); | 1403 RestartBackgroundInstance(); |
1403 } | 1404 } |
1404 } | 1405 } |
1405 | 1406 |
1406 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1407 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |