| 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 CreateHttpNetworkSession(*profile_params)); | 244 CreateHttpNetworkSession(*profile_params)); |
| 245 main_context_storage->set_http_transaction_factory( | 245 main_context_storage->set_http_transaction_factory( |
| 246 CreateMainHttpFactory(main_context_storage->http_network_session(), | 246 CreateMainHttpFactory(main_context_storage->http_network_session(), |
| 247 net::HttpCache::DefaultBackend::InMemory(0))); | 247 net::HttpCache::DefaultBackend::InMemory(0))); |
| 248 | 248 |
| 249 #if !defined(DISABLE_FTP_SUPPORT) | 249 #if !defined(DISABLE_FTP_SUPPORT) |
| 250 ftp_factory_.reset( | 250 ftp_factory_.reset( |
| 251 new net::FtpNetworkLayer(main_context->host_resolver())); | 251 new net::FtpNetworkLayer(main_context->host_resolver())); |
| 252 #endif // !defined(DISABLE_FTP_SUPPORT) | 252 #endif // !defined(DISABLE_FTP_SUPPORT) |
| 253 | 253 |
| 254 std::unique_ptr<net::URLRequestJobFactoryImpl> main_job_factory( | 254 std::unique_ptr<net::URLRequestJobFactoryImpl> main_job_factory = |
| 255 new net::URLRequestJobFactoryImpl()); | 255 net::URLRequestJobFactoryImpl::CreateWithHttpProtocolHandlers(); |
| 256 | 256 |
| 257 InstallProtocolHandlers(main_job_factory.get(), protocol_handlers); | 257 InstallProtocolHandlers(main_job_factory.get(), protocol_handlers); |
| 258 main_context_storage->set_job_factory(SetUpJobFactoryDefaults( | 258 main_context_storage->set_job_factory(SetUpJobFactoryDefaults( |
| 259 std::move(main_job_factory), std::move(request_interceptors), | 259 std::move(main_job_factory), std::move(request_interceptors), |
| 260 std::move(profile_params->protocol_handler_interceptor), | 260 std::move(profile_params->protocol_handler_interceptor), |
| 261 main_context->network_delegate(), ftp_factory_.get())); | 261 main_context->network_delegate(), ftp_factory_.get())); |
| 262 | 262 |
| 263 // Setup SDCH for this profile. | 263 // Setup SDCH for this profile. |
| 264 main_context_storage->set_sdch_manager(base::MakeUnique<net::SdchManager>()); | 264 main_context_storage->set_sdch_manager(base::MakeUnique<net::SdchManager>()); |
| 265 sdch_policy_.reset( | 265 sdch_policy_.reset( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 287 io_thread_globals->cert_transparency_verifier.get()); | 287 io_thread_globals->cert_transparency_verifier.get()); |
| 288 | 288 |
| 289 // All we care about for extensions is the cookie store. For incognito, we | 289 // All we care about for extensions is the cookie store. For incognito, we |
| 290 // use a non-persistent cookie store. | 290 // use a non-persistent cookie store. |
| 291 content::CookieStoreConfig cookie_config; | 291 content::CookieStoreConfig cookie_config; |
| 292 // Enable cookies for chrome-extension URLs. | 292 // Enable cookies for chrome-extension URLs. |
| 293 cookie_config.cookieable_schemes.push_back(extensions::kExtensionScheme); | 293 cookie_config.cookieable_schemes.push_back(extensions::kExtensionScheme); |
| 294 extensions_cookie_store_ = content::CreateCookieStore(cookie_config); | 294 extensions_cookie_store_ = content::CreateCookieStore(cookie_config); |
| 295 extensions_context->set_cookie_store(extensions_cookie_store_.get()); | 295 extensions_context->set_cookie_store(extensions_cookie_store_.get()); |
| 296 | 296 |
| 297 std::unique_ptr<net::URLRequestJobFactoryImpl> extensions_job_factory( | 297 std::unique_ptr<net::URLRequestJobFactoryImpl> extensions_job_factory = |
| 298 new net::URLRequestJobFactoryImpl()); | 298 net::URLRequestJobFactoryImpl::CreateWithHttpProtocolHandlers(); |
| 299 // TODO(shalev): The extensions_job_factory has a NULL NetworkDelegate. | 299 // TODO(shalev): The extensions_job_factory has a NULL NetworkDelegate. |
| 300 // Without a network_delegate, this protocol handler will never | 300 // Without a network_delegate, this protocol handler will never |
| 301 // handle file: requests, but as a side effect it makes | 301 // handle file: requests, but as a side effect it makes |
| 302 // job_factory::IsHandledProtocol return true, which prevents attempts to | 302 // job_factory::IsHandledProtocol return true, which prevents attempts to |
| 303 // handle the protocol externally. We pass NULL in to | 303 // handle the protocol externally. We pass NULL in to |
| 304 // SetUpJobFactoryDefaults() to get this effect. | 304 // SetUpJobFactoryDefaults() to get this effect. |
| 305 extensions_job_factory_ = SetUpJobFactoryDefaults( | 305 extensions_job_factory_ = SetUpJobFactoryDefaults( |
| 306 std::move(extensions_job_factory), | 306 std::move(extensions_job_factory), |
| 307 content::URLRequestInterceptorScopedVector(), | 307 content::URLRequestInterceptorScopedVector(), |
| 308 std::unique_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>(), NULL, | 308 std::unique_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>(), NULL, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 new net::HttpNetworkSession(network_params)); | 341 new net::HttpNetworkSession(network_params)); |
| 342 | 342 |
| 343 // Use a separate in-memory cache for the app. | 343 // Use a separate in-memory cache for the app. |
| 344 std::unique_ptr<net::HttpCache> app_http_cache = CreateHttpFactory( | 344 std::unique_ptr<net::HttpCache> app_http_cache = CreateHttpFactory( |
| 345 http_network_session.get(), net::HttpCache::DefaultBackend::InMemory(0)); | 345 http_network_session.get(), net::HttpCache::DefaultBackend::InMemory(0)); |
| 346 | 346 |
| 347 context->SetChannelIDService(std::move(channel_id_service)); | 347 context->SetChannelIDService(std::move(channel_id_service)); |
| 348 context->SetHttpNetworkSession(std::move(http_network_session)); | 348 context->SetHttpNetworkSession(std::move(http_network_session)); |
| 349 context->SetHttpTransactionFactory(std::move(app_http_cache)); | 349 context->SetHttpTransactionFactory(std::move(app_http_cache)); |
| 350 | 350 |
| 351 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory( | 351 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory = |
| 352 new net::URLRequestJobFactoryImpl()); | 352 net::URLRequestJobFactoryImpl::CreateWithHttpProtocolHandlers(); |
| 353 InstallProtocolHandlers(job_factory.get(), protocol_handlers); | 353 InstallProtocolHandlers(job_factory.get(), protocol_handlers); |
| 354 std::unique_ptr<net::URLRequestJobFactory> top_job_factory; | 354 std::unique_ptr<net::URLRequestJobFactory> top_job_factory; |
| 355 top_job_factory = SetUpJobFactoryDefaults( | 355 top_job_factory = SetUpJobFactoryDefaults( |
| 356 std::move(job_factory), std::move(request_interceptors), | 356 std::move(job_factory), std::move(request_interceptors), |
| 357 std::move(protocol_handler_interceptor), main_context->network_delegate(), | 357 std::move(protocol_handler_interceptor), main_context->network_delegate(), |
| 358 ftp_factory_.get()); | 358 ftp_factory_.get()); |
| 359 context->SetJobFactory(std::move(top_job_factory)); | 359 context->SetJobFactory(std::move(top_job_factory)); |
| 360 return context; | 360 return context; |
| 361 } | 361 } |
| 362 | 362 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 391 return app_request_context; | 391 return app_request_context; |
| 392 } | 392 } |
| 393 | 393 |
| 394 net::URLRequestContext* | 394 net::URLRequestContext* |
| 395 OffTheRecordProfileIOData::AcquireIsolatedMediaRequestContext( | 395 OffTheRecordProfileIOData::AcquireIsolatedMediaRequestContext( |
| 396 net::URLRequestContext* app_context, | 396 net::URLRequestContext* app_context, |
| 397 const StoragePartitionDescriptor& partition_descriptor) const { | 397 const StoragePartitionDescriptor& partition_descriptor) const { |
| 398 NOTREACHED(); | 398 NOTREACHED(); |
| 399 return NULL; | 399 return NULL; |
| 400 } | 400 } |
| OLD | NEW |