| 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/profiles/off_the_record_profile_io_data.h" | 5 #include "chrome/browser/profiles/off_the_record_profile_io_data.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 std::move(profile_params->protocol_handler_interceptor), | 248 std::move(profile_params->protocol_handler_interceptor), |
| 249 main_context->network_delegate(), main_context->host_resolver())); | 249 main_context->network_delegate(), main_context->host_resolver())); |
| 250 | 250 |
| 251 #if BUILDFLAG(ENABLE_EXTENSIONS) | 251 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 252 InitializeExtensionsRequestContext(profile_params); | 252 InitializeExtensionsRequestContext(profile_params); |
| 253 #endif | 253 #endif |
| 254 } | 254 } |
| 255 | 255 |
| 256 void OffTheRecordProfileIOData:: | 256 void OffTheRecordProfileIOData:: |
| 257 InitializeExtensionsRequestContext(ProfileParams* profile_params) const { | 257 InitializeExtensionsRequestContext(ProfileParams* profile_params) const { |
| 258 // All we care about for extensions is the cookie store. For incognito, we |
| 259 // use a non-persistent cookie store. |
| 258 net::URLRequestContext* extensions_context = extensions_request_context(); | 260 net::URLRequestContext* extensions_context = extensions_request_context(); |
| 259 | 261 |
| 260 IOThread* const io_thread = profile_params->io_thread; | |
| 261 IOThread::Globals* const io_thread_globals = io_thread->globals(); | |
| 262 | |
| 263 ApplyProfileParamsToContext(extensions_context); | |
| 264 | |
| 265 extensions_context->set_transport_security_state(transport_security_state()); | |
| 266 | |
| 267 extensions_context->set_net_log(io_thread->net_log()); | |
| 268 | |
| 269 extensions_context->set_cert_transparency_verifier( | |
| 270 io_thread_globals->cert_transparency_verifier.get()); | |
| 271 | |
| 272 // All we care about for extensions is the cookie store. For incognito, we | |
| 273 // use a non-persistent cookie store. | |
| 274 content::CookieStoreConfig cookie_config; | 262 content::CookieStoreConfig cookie_config; |
| 275 // Enable cookies for chrome-extension URLs. | 263 // Enable cookies for chrome-extension URLs. |
| 276 cookie_config.cookieable_schemes.push_back(extensions::kExtensionScheme); | 264 cookie_config.cookieable_schemes.push_back(extensions::kExtensionScheme); |
| 277 extensions_cookie_store_ = content::CreateCookieStore(cookie_config); | 265 extensions_cookie_store_ = content::CreateCookieStore(cookie_config); |
| 278 extensions_context->set_cookie_store(extensions_cookie_store_.get()); | 266 extensions_context->set_cookie_store(extensions_cookie_store_.get()); |
| 279 | |
| 280 std::unique_ptr<net::URLRequestJobFactoryImpl> extensions_job_factory( | |
| 281 new net::URLRequestJobFactoryImpl()); | |
| 282 // TODO(shalev): The extensions_job_factory has a NULL NetworkDelegate. | |
| 283 // Without a network_delegate, this protocol handler will never | |
| 284 // handle file: requests, but as a side effect it makes | |
| 285 // job_factory::IsHandledProtocol return true, which prevents attempts to | |
| 286 // handle the protocol externally. We pass NULL in to | |
| 287 // SetUpJobFactoryDefaults() to get this effect. | |
| 288 extensions_job_factory_ = SetUpJobFactoryDefaults( | |
| 289 std::move(extensions_job_factory), | |
| 290 content::URLRequestInterceptorScopedVector(), | |
| 291 std::unique_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>(), NULL, | |
| 292 io_thread_globals->host_resolver.get()); | |
| 293 extensions_context->set_job_factory(extensions_job_factory_.get()); | |
| 294 } | 267 } |
| 295 | 268 |
| 296 net::URLRequestContext* OffTheRecordProfileIOData::InitializeAppRequestContext( | 269 net::URLRequestContext* OffTheRecordProfileIOData::InitializeAppRequestContext( |
| 297 net::URLRequestContext* main_context, | 270 net::URLRequestContext* main_context, |
| 298 const StoragePartitionDescriptor& partition_descriptor, | 271 const StoragePartitionDescriptor& partition_descriptor, |
| 299 std::unique_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 272 std::unique_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
| 300 protocol_handler_interceptor, | 273 protocol_handler_interceptor, |
| 301 content::ProtocolHandlerMap* protocol_handlers, | 274 content::ProtocolHandlerMap* protocol_handlers, |
| 302 content::URLRequestInterceptorScopedVector request_interceptors) const { | 275 content::URLRequestInterceptorScopedVector request_interceptors) const { |
| 303 AppRequestContext* context = new AppRequestContext(); | 276 AppRequestContext* context = new AppRequestContext(); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 return app_request_context; | 347 return app_request_context; |
| 375 } | 348 } |
| 376 | 349 |
| 377 net::URLRequestContext* | 350 net::URLRequestContext* |
| 378 OffTheRecordProfileIOData::AcquireIsolatedMediaRequestContext( | 351 OffTheRecordProfileIOData::AcquireIsolatedMediaRequestContext( |
| 379 net::URLRequestContext* app_context, | 352 net::URLRequestContext* app_context, |
| 380 const StoragePartitionDescriptor& partition_descriptor) const { | 353 const StoragePartitionDescriptor& partition_descriptor) const { |
| 381 NOTREACHED(); | 354 NOTREACHED(); |
| 382 return NULL; | 355 return NULL; |
| 383 } | 356 } |
| OLD | NEW |