| 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 print_job_manager_.reset(new printing::PrintJobManager); | 219 print_job_manager_.reset(new printing::PrintJobManager); |
| 220 #endif | 220 #endif |
| 221 | 221 |
| 222 base::FilePath net_log_path; | 222 base::FilePath net_log_path; |
| 223 if (command_line.HasSwitch(switches::kLogNetLog)) | 223 if (command_line.HasSwitch(switches::kLogNetLog)) |
| 224 net_log_path = command_line.GetSwitchValuePath(switches::kLogNetLog); | 224 net_log_path = command_line.GetSwitchValuePath(switches::kLogNetLog); |
| 225 net_log_.reset(new net_log::ChromeNetLog( | 225 net_log_.reset(new net_log::ChromeNetLog( |
| 226 net_log_path, GetNetCaptureModeFromCommandLine(command_line), | 226 net_log_path, GetNetCaptureModeFromCommandLine(command_line), |
| 227 command_line.GetCommandLineString(), chrome::GetChannelString())); | 227 command_line.GetCommandLineString(), chrome::GetChannelString())); |
| 228 | 228 |
| 229 #if defined(ENABLE_EXTENSIONS) | |
| 230 if (extensions::IsIsolateExtensionsEnabled()) { | |
| 231 // chrome-extension:// URLs are safe to request anywhere, but may only | |
| 232 // commit (including in iframes) in extension processes. | |
| 233 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeIsolatedScheme( | |
| 234 extensions::kExtensionScheme, true); | |
| 235 // TODO(nick): Kill off kExtensionResourceScheme. | |
| 236 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeIsolatedScheme( | |
| 237 extensions::kExtensionResourceScheme, false); | |
| 238 } else { | |
| 239 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme( | |
| 240 extensions::kExtensionScheme); | |
| 241 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme( | |
| 242 extensions::kExtensionResourceScheme); | |
| 243 } | |
| 244 #endif | |
| 245 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme( | 229 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme( |
| 246 chrome::kChromeSearchScheme); | 230 chrome::kChromeSearchScheme); |
| 247 | 231 |
| 248 #if defined(OS_MACOSX) | 232 #if defined(OS_MACOSX) |
| 249 ui::InitIdleMonitor(); | 233 ui::InitIdleMonitor(); |
| 250 #endif | 234 #endif |
| 251 | 235 |
| 252 device_client_.reset(new ChromeDeviceClient); | 236 device_client_.reset(new ChromeDeviceClient); |
| 253 | 237 |
| 254 #if defined(ENABLE_EXTENSIONS) | 238 #if defined(ENABLE_EXTENSIONS) |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1043 | 1027 |
| 1044 int max_per_proxy = local_state_->GetInteger(prefs::kMaxConnectionsPerProxy); | 1028 int max_per_proxy = local_state_->GetInteger(prefs::kMaxConnectionsPerProxy); |
| 1045 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server( | 1029 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server( |
| 1046 net::HttpNetworkSession::NORMAL_SOCKET_POOL, | 1030 net::HttpNetworkSession::NORMAL_SOCKET_POOL, |
| 1047 std::max(std::min(max_per_proxy, 99), | 1031 std::max(std::min(max_per_proxy, 99), |
| 1048 net::ClientSocketPoolManager::max_sockets_per_group( | 1032 net::ClientSocketPoolManager::max_sockets_per_group( |
| 1049 net::HttpNetworkSession::NORMAL_SOCKET_POOL))); | 1033 net::HttpNetworkSession::NORMAL_SOCKET_POOL))); |
| 1050 } | 1034 } |
| 1051 | 1035 |
| 1052 void BrowserProcessImpl::PreCreateThreads() { | 1036 void BrowserProcessImpl::PreCreateThreads() { |
| 1037 #if defined(ENABLE_EXTENSIONS) |
| 1038 // Register the chrome-extension scheme to reflect the extension process |
| 1039 // model. Controlled by a field trial, so we can't do this earlier. |
| 1040 base::FieldTrialList::FindFullName("SiteIsolationExtensions"); |
| 1041 if (extensions::IsIsolateExtensionsEnabled()) { |
| 1042 // chrome-extension:// URLs are safe to request anywhere, but may only |
| 1043 // commit (including in iframes) in extension processes. |
| 1044 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeIsolatedScheme( |
| 1045 extensions::kExtensionScheme, true); |
| 1046 // TODO(nick): Kill off kExtensionResourceScheme. |
| 1047 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeIsolatedScheme( |
| 1048 extensions::kExtensionResourceScheme, false); |
| 1049 } else { |
| 1050 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme( |
| 1051 extensions::kExtensionScheme); |
| 1052 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme( |
| 1053 extensions::kExtensionResourceScheme); |
| 1054 } |
| 1055 #endif |
| 1056 |
| 1053 io_thread_.reset( | 1057 io_thread_.reset( |
| 1054 new IOThread(local_state(), policy_service(), net_log_.get(), | 1058 new IOThread(local_state(), policy_service(), net_log_.get(), |
| 1055 extension_event_router_forwarder())); | 1059 extension_event_router_forwarder())); |
| 1056 } | 1060 } |
| 1057 | 1061 |
| 1058 void BrowserProcessImpl::PreMainMessageLoopRun() { | 1062 void BrowserProcessImpl::PreMainMessageLoopRun() { |
| 1059 TRACE_EVENT0("startup", "BrowserProcessImpl::PreMainMessageLoopRun"); | 1063 TRACE_EVENT0("startup", "BrowserProcessImpl::PreMainMessageLoopRun"); |
| 1060 SCOPED_UMA_HISTOGRAM_TIMER( | 1064 SCOPED_UMA_HISTOGRAM_TIMER( |
| 1061 "Startup.BrowserProcessImpl_PreMainMessageLoopRunTime"); | 1065 "Startup.BrowserProcessImpl_PreMainMessageLoopRunTime"); |
| 1062 | 1066 |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1393 } | 1397 } |
| 1394 | 1398 |
| 1395 void BrowserProcessImpl::OnAutoupdateTimer() { | 1399 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 1396 if (CanAutorestartForUpdate()) { | 1400 if (CanAutorestartForUpdate()) { |
| 1397 DLOG(WARNING) << "Detected update. Restarting browser."; | 1401 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 1398 RestartBackgroundInstance(); | 1402 RestartBackgroundInstance(); |
| 1399 } | 1403 } |
| 1400 } | 1404 } |
| 1401 | 1405 |
| 1402 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1406 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |