| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 http_network_session_ = CreateHttpNetworkSession(*profile_params); | 246 http_network_session_ = CreateHttpNetworkSession(*profile_params); |
| 247 main_http_factory_ = CreateMainHttpFactory( | 247 main_http_factory_ = CreateMainHttpFactory( |
| 248 http_network_session_.get(), net::HttpCache::DefaultBackend::InMemory(0)); | 248 http_network_session_.get(), net::HttpCache::DefaultBackend::InMemory(0)); |
| 249 | 249 |
| 250 main_context->set_http_transaction_factory(main_http_factory_.get()); | 250 main_context->set_http_transaction_factory(main_http_factory_.get()); |
| 251 #if !defined(DISABLE_FTP_SUPPORT) | 251 #if !defined(DISABLE_FTP_SUPPORT) |
| 252 ftp_factory_.reset( | 252 ftp_factory_.reset( |
| 253 new net::FtpNetworkLayer(main_context->host_resolver())); | 253 new net::FtpNetworkLayer(main_context->host_resolver())); |
| 254 #endif // !defined(DISABLE_FTP_SUPPORT) | 254 #endif // !defined(DISABLE_FTP_SUPPORT) |
| 255 | 255 |
| 256 std::unique_ptr<net::URLRequestJobFactoryImpl> main_job_factory( | 256 std::unique_ptr<net::URLRequestJobFactoryImpl> main_job_factory = |
| 257 new net::URLRequestJobFactoryImpl()); | 257 net::URLRequestJobFactoryImpl::CreateWithDefaultProtocolHandlers(); |
| 258 | 258 |
| 259 InstallProtocolHandlers(main_job_factory.get(), protocol_handlers); | 259 InstallProtocolHandlers(main_job_factory.get(), protocol_handlers); |
| 260 main_job_factory_ = SetUpJobFactoryDefaults( | 260 main_job_factory_ = SetUpJobFactoryDefaults( |
| 261 std::move(main_job_factory), std::move(request_interceptors), | 261 std::move(main_job_factory), std::move(request_interceptors), |
| 262 std::move(profile_params->protocol_handler_interceptor), | 262 std::move(profile_params->protocol_handler_interceptor), |
| 263 main_context->network_delegate(), ftp_factory_.get()); | 263 main_context->network_delegate(), ftp_factory_.get()); |
| 264 main_context->set_job_factory(main_job_factory_.get()); | 264 main_context->set_job_factory(main_job_factory_.get()); |
| 265 | 265 |
| 266 // Setup SDCH for this profile. | 266 // Setup SDCH for this profile. |
| 267 sdch_manager_.reset(new net::SdchManager); | 267 sdch_manager_.reset(new net::SdchManager); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 292 extensions_context->set_backoff_manager( | 292 extensions_context->set_backoff_manager( |
| 293 io_thread_globals->url_request_backoff_manager.get()); | 293 io_thread_globals->url_request_backoff_manager.get()); |
| 294 // All we care about for extensions is the cookie store. For incognito, we | 294 // All we care about for extensions is the cookie store. For incognito, we |
| 295 // use a non-persistent cookie store. | 295 // use a non-persistent cookie store. |
| 296 content::CookieStoreConfig cookie_config; | 296 content::CookieStoreConfig cookie_config; |
| 297 // Enable cookies for chrome-extension URLs. | 297 // Enable cookies for chrome-extension URLs. |
| 298 cookie_config.cookieable_schemes.push_back(extensions::kExtensionScheme); | 298 cookie_config.cookieable_schemes.push_back(extensions::kExtensionScheme); |
| 299 extensions_cookie_store_ = content::CreateCookieStore(cookie_config); | 299 extensions_cookie_store_ = content::CreateCookieStore(cookie_config); |
| 300 extensions_context->set_cookie_store(extensions_cookie_store_.get()); | 300 extensions_context->set_cookie_store(extensions_cookie_store_.get()); |
| 301 | 301 |
| 302 std::unique_ptr<net::URLRequestJobFactoryImpl> extensions_job_factory( | 302 std::unique_ptr<net::URLRequestJobFactoryImpl> extensions_job_factory = |
| 303 new net::URLRequestJobFactoryImpl()); | 303 net::URLRequestJobFactoryImpl::CreateWithDefaultProtocolHandlers(); |
| 304 // TODO(shalev): The extensions_job_factory has a NULL NetworkDelegate. | 304 // TODO(shalev): The extensions_job_factory has a NULL NetworkDelegate. |
| 305 // Without a network_delegate, this protocol handler will never | 305 // Without a network_delegate, this protocol handler will never |
| 306 // handle file: requests, but as a side effect it makes | 306 // handle file: requests, but as a side effect it makes |
| 307 // job_factory::IsHandledProtocol return true, which prevents attempts to | 307 // job_factory::IsHandledProtocol return true, which prevents attempts to |
| 308 // handle the protocol externally. We pass NULL in to | 308 // handle the protocol externally. We pass NULL in to |
| 309 // SetUpJobFactoryDefaults() to get this effect. | 309 // SetUpJobFactoryDefaults() to get this effect. |
| 310 extensions_job_factory_ = SetUpJobFactoryDefaults( | 310 extensions_job_factory_ = SetUpJobFactoryDefaults( |
| 311 std::move(extensions_job_factory), | 311 std::move(extensions_job_factory), |
| 312 content::URLRequestInterceptorScopedVector(), | 312 content::URLRequestInterceptorScopedVector(), |
| 313 std::unique_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>(), NULL, | 313 std::unique_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>(), NULL, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 332 // extensions API, but we need to update it to understand isolated apps first. | 332 // extensions API, but we need to update it to understand isolated apps first. |
| 333 context->SetCookieStore( | 333 context->SetCookieStore( |
| 334 content::CreateCookieStore(content::CookieStoreConfig())); | 334 content::CreateCookieStore(content::CookieStoreConfig())); |
| 335 | 335 |
| 336 // Use a separate in-memory cache for the app. | 336 // Use a separate in-memory cache for the app. |
| 337 std::unique_ptr<net::HttpCache> app_http_cache = CreateHttpFactory( | 337 std::unique_ptr<net::HttpCache> app_http_cache = CreateHttpFactory( |
| 338 http_network_session_.get(), net::HttpCache::DefaultBackend::InMemory(0)); | 338 http_network_session_.get(), net::HttpCache::DefaultBackend::InMemory(0)); |
| 339 | 339 |
| 340 context->SetHttpTransactionFactory(std::move(app_http_cache)); | 340 context->SetHttpTransactionFactory(std::move(app_http_cache)); |
| 341 | 341 |
| 342 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory( | 342 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory = |
| 343 new net::URLRequestJobFactoryImpl()); | 343 net::URLRequestJobFactoryImpl::CreateWithDefaultProtocolHandlers(); |
| 344 InstallProtocolHandlers(job_factory.get(), protocol_handlers); | 344 InstallProtocolHandlers(job_factory.get(), protocol_handlers); |
| 345 std::unique_ptr<net::URLRequestJobFactory> top_job_factory; | 345 std::unique_ptr<net::URLRequestJobFactory> top_job_factory; |
| 346 top_job_factory = SetUpJobFactoryDefaults( | 346 top_job_factory = SetUpJobFactoryDefaults( |
| 347 std::move(job_factory), std::move(request_interceptors), | 347 std::move(job_factory), std::move(request_interceptors), |
| 348 std::move(protocol_handler_interceptor), main_context->network_delegate(), | 348 std::move(protocol_handler_interceptor), main_context->network_delegate(), |
| 349 ftp_factory_.get()); | 349 ftp_factory_.get()); |
| 350 context->SetJobFactory(std::move(top_job_factory)); | 350 context->SetJobFactory(std::move(top_job_factory)); |
| 351 return context; | 351 return context; |
| 352 } | 352 } |
| 353 | 353 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 382 return app_request_context; | 382 return app_request_context; |
| 383 } | 383 } |
| 384 | 384 |
| 385 net::URLRequestContext* | 385 net::URLRequestContext* |
| 386 OffTheRecordProfileIOData::AcquireIsolatedMediaRequestContext( | 386 OffTheRecordProfileIOData::AcquireIsolatedMediaRequestContext( |
| 387 net::URLRequestContext* app_context, | 387 net::URLRequestContext* app_context, |
| 388 const StoragePartitionDescriptor& partition_descriptor) const { | 388 const StoragePartitionDescriptor& partition_descriptor) const { |
| 389 NOTREACHED(); | 389 NOTREACHED(); |
| 390 return NULL; | 390 return NULL; |
| 391 } | 391 } |
| OLD | NEW |