| 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 print_job_manager_.reset(new printing::PrintJobManager); | 214 print_job_manager_.reset(new printing::PrintJobManager); |
| 215 #endif | 215 #endif |
| 216 | 216 |
| 217 base::FilePath net_log_path; | 217 base::FilePath net_log_path; |
| 218 if (command_line.HasSwitch(switches::kLogNetLog)) | 218 if (command_line.HasSwitch(switches::kLogNetLog)) |
| 219 net_log_path = command_line.GetSwitchValuePath(switches::kLogNetLog); | 219 net_log_path = command_line.GetSwitchValuePath(switches::kLogNetLog); |
| 220 net_log_.reset(new net_log::ChromeNetLog( | 220 net_log_.reset(new net_log::ChromeNetLog( |
| 221 net_log_path, GetNetCaptureModeFromCommandLine(command_line), | 221 net_log_path, GetNetCaptureModeFromCommandLine(command_line), |
| 222 command_line.GetCommandLineString(), chrome::GetChannelString())); | 222 command_line.GetCommandLineString(), chrome::GetChannelString())); |
| 223 | 223 |
| 224 #if defined(ENABLE_EXTENSIONS) | |
| 225 if (extensions::IsIsolateExtensionsEnabled()) { | |
| 226 // chrome-extension:// URLs are safe to request anywhere, but may only | |
| 227 // commit (including in iframes) in extension processes. | |
| 228 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeIsolatedScheme( | |
| 229 extensions::kExtensionScheme, true); | |
| 230 // TODO(nick): Kill off kExtensionResourceScheme. | |
| 231 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeIsolatedScheme( | |
| 232 extensions::kExtensionResourceScheme, false); | |
| 233 } else { | |
| 234 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme( | |
| 235 extensions::kExtensionScheme); | |
| 236 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme( | |
| 237 extensions::kExtensionResourceScheme); | |
| 238 } | |
| 239 #endif | |
| 240 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme( | 224 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme( |
| 241 chrome::kChromeSearchScheme); | 225 chrome::kChromeSearchScheme); |
| 242 | 226 |
| 243 #if defined(OS_MACOSX) | 227 #if defined(OS_MACOSX) |
| 244 ui::InitIdleMonitor(); | 228 ui::InitIdleMonitor(); |
| 245 #endif | 229 #endif |
| 246 | 230 |
| 247 device_client_.reset(new ChromeDeviceClient); | 231 device_client_.reset(new ChromeDeviceClient); |
| 248 | 232 |
| 249 #if defined(ENABLE_EXTENSIONS) | 233 #if defined(ENABLE_EXTENSIONS) |
| (...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1025 | 1009 |
| 1026 int max_per_proxy = local_state_->GetInteger(prefs::kMaxConnectionsPerProxy); | 1010 int max_per_proxy = local_state_->GetInteger(prefs::kMaxConnectionsPerProxy); |
| 1027 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server( | 1011 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server( |
| 1028 net::HttpNetworkSession::NORMAL_SOCKET_POOL, | 1012 net::HttpNetworkSession::NORMAL_SOCKET_POOL, |
| 1029 std::max(std::min(max_per_proxy, 99), | 1013 std::max(std::min(max_per_proxy, 99), |
| 1030 net::ClientSocketPoolManager::max_sockets_per_group( | 1014 net::ClientSocketPoolManager::max_sockets_per_group( |
| 1031 net::HttpNetworkSession::NORMAL_SOCKET_POOL))); | 1015 net::HttpNetworkSession::NORMAL_SOCKET_POOL))); |
| 1032 } | 1016 } |
| 1033 | 1017 |
| 1034 void BrowserProcessImpl::PreCreateThreads() { | 1018 void BrowserProcessImpl::PreCreateThreads() { |
| 1019 #if defined(ENABLE_EXTENSIONS) |
| 1020 // Register the chrome-extension scheme to reflect the extension process |
| 1021 // model. Controlled by a field trial, so we can't do this earlier. |
| 1022 base::FieldTrialList::FindFullName("SiteIsolationExtensions"); |
| 1023 if (extensions::IsIsolateExtensionsEnabled()) { |
| 1024 // chrome-extension:// URLs are safe to request anywhere, but may only |
| 1025 // commit (including in iframes) in extension processes. |
| 1026 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeIsolatedScheme( |
| 1027 extensions::kExtensionScheme, true); |
| 1028 // TODO(nick): Kill off kExtensionResourceScheme. |
| 1029 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeIsolatedScheme( |
| 1030 extensions::kExtensionResourceScheme, false); |
| 1031 } else { |
| 1032 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme( |
| 1033 extensions::kExtensionScheme); |
| 1034 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme( |
| 1035 extensions::kExtensionResourceScheme); |
| 1036 } |
| 1037 #endif |
| 1038 |
| 1035 io_thread_.reset( | 1039 io_thread_.reset( |
| 1036 new IOThread(local_state(), policy_service(), net_log_.get(), | 1040 new IOThread(local_state(), policy_service(), net_log_.get(), |
| 1037 extension_event_router_forwarder())); | 1041 extension_event_router_forwarder())); |
| 1038 } | 1042 } |
| 1039 | 1043 |
| 1040 void BrowserProcessImpl::PreMainMessageLoopRun() { | 1044 void BrowserProcessImpl::PreMainMessageLoopRun() { |
| 1041 TRACE_EVENT0("startup", "BrowserProcessImpl::PreMainMessageLoopRun"); | 1045 TRACE_EVENT0("startup", "BrowserProcessImpl::PreMainMessageLoopRun"); |
| 1042 SCOPED_UMA_HISTOGRAM_TIMER( | 1046 SCOPED_UMA_HISTOGRAM_TIMER( |
| 1043 "Startup.BrowserProcessImpl_PreMainMessageLoopRunTime"); | 1047 "Startup.BrowserProcessImpl_PreMainMessageLoopRunTime"); |
| 1044 | 1048 |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1358 } | 1362 } |
| 1359 | 1363 |
| 1360 void BrowserProcessImpl::OnAutoupdateTimer() { | 1364 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 1361 if (CanAutorestartForUpdate()) { | 1365 if (CanAutorestartForUpdate()) { |
| 1362 DLOG(WARNING) << "Detected update. Restarting browser."; | 1366 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 1363 RestartBackgroundInstance(); | 1367 RestartBackgroundInstance(); |
| 1364 } | 1368 } |
| 1365 } | 1369 } |
| 1366 | 1370 |
| 1367 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1371 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |