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/profile_impl_io_data.h" | 5 #include "chrome/browser/profiles/profile_impl_io_data.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 // Create a media request context based on the main context, but using a | 558 // Create a media request context based on the main context, but using a |
559 // media cache. It shares the same job factory as the main context. | 559 // media cache. It shares the same job factory as the main context. |
560 StoragePartitionDescriptor details(profile_path_, false); | 560 StoragePartitionDescriptor details(profile_path_, false); |
561 media_request_context_.reset( | 561 media_request_context_.reset( |
562 InitializeMediaRequestContext(main_context, details, "main_media")); | 562 InitializeMediaRequestContext(main_context, details, "main_media")); |
563 lazy_params_.reset(); | 563 lazy_params_.reset(); |
564 } | 564 } |
565 | 565 |
566 void ProfileImplIOData:: | 566 void ProfileImplIOData:: |
567 InitializeExtensionsRequestContext(ProfileParams* profile_params) const { | 567 InitializeExtensionsRequestContext(ProfileParams* profile_params) const { |
| 568 // The extensions context only serves to hold onto the extensions cookie |
| 569 // store. |
568 net::URLRequestContext* extensions_context = extensions_request_context(); | 570 net::URLRequestContext* extensions_context = extensions_request_context(); |
569 IOThread* const io_thread = profile_params->io_thread; | |
570 IOThread::Globals* const io_thread_globals = io_thread->globals(); | |
571 ApplyProfileParamsToContext(extensions_context); | |
572 | |
573 extensions_context->set_transport_security_state(transport_security_state()); | |
574 extensions_context->set_ct_policy_enforcer( | |
575 io_thread_globals->ct_policy_enforcer.get()); | |
576 | |
577 extensions_context->set_net_log(io_thread->net_log()); | |
578 | 571 |
579 content::CookieStoreConfig cookie_config( | 572 content::CookieStoreConfig cookie_config( |
580 lazy_params_->extensions_cookie_path, | 573 lazy_params_->extensions_cookie_path, |
581 lazy_params_->session_cookie_mode, | 574 lazy_params_->session_cookie_mode, |
582 NULL, NULL); | 575 NULL, NULL); |
583 cookie_config.crypto_delegate = cookie_config::GetCookieCryptoDelegate(); | 576 cookie_config.crypto_delegate = cookie_config::GetCookieCryptoDelegate(); |
584 // Enable cookies for chrome-extension URLs. | 577 // Enable cookies for chrome-extension URLs. |
585 cookie_config.cookieable_schemes.push_back(extensions::kExtensionScheme); | 578 cookie_config.cookieable_schemes.push_back(extensions::kExtensionScheme); |
586 extensions_cookie_store_ = content::CreateCookieStore(cookie_config); | 579 extensions_cookie_store_ = content::CreateCookieStore(cookie_config); |
587 extensions_context->set_cookie_store(extensions_cookie_store_.get()); | 580 extensions_context->set_cookie_store(extensions_cookie_store_.get()); |
588 if (extensions_context->channel_id_service()) { | |
589 extensions_cookie_store_->SetChannelIDServiceID( | |
590 extensions_context->channel_id_service()->GetUniqueID()); | |
591 } | |
592 | |
593 std::unique_ptr<net::URLRequestJobFactoryImpl> extensions_job_factory( | |
594 new net::URLRequestJobFactoryImpl()); | |
595 // TODO(shalev): The extensions_job_factory has a NULL NetworkDelegate. | |
596 // Without a network_delegate, this protocol handler will never | |
597 // handle file: requests, but as a side effect it makes | |
598 // job_factory::IsHandledProtocol return true, which prevents attempts to | |
599 // handle the protocol externally. We pass NULL in to | |
600 // SetUpJobFactory() to get this effect. | |
601 extensions_job_factory_ = SetUpJobFactoryDefaults( | |
602 std::move(extensions_job_factory), | |
603 content::URLRequestInterceptorScopedVector(), | |
604 std::unique_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>(), NULL, | |
605 io_thread_globals->host_resolver.get()); | |
606 extensions_context->set_job_factory(extensions_job_factory_.get()); | |
607 } | 581 } |
608 | 582 |
609 net::URLRequestContext* ProfileImplIOData::InitializeAppRequestContext( | 583 net::URLRequestContext* ProfileImplIOData::InitializeAppRequestContext( |
610 net::URLRequestContext* main_context, | 584 net::URLRequestContext* main_context, |
611 const StoragePartitionDescriptor& partition_descriptor, | 585 const StoragePartitionDescriptor& partition_descriptor, |
612 std::unique_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 586 std::unique_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
613 protocol_handler_interceptor, | 587 protocol_handler_interceptor, |
614 content::ProtocolHandlerMap* protocol_handlers, | 588 content::ProtocolHandlerMap* protocol_handlers, |
615 content::URLRequestInterceptorScopedVector request_interceptors) const { | 589 content::URLRequestInterceptorScopedVector request_interceptors) const { |
616 // Copy most state from the main context. | 590 // Copy most state from the main context. |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 const base::Closure& completion) { | 778 const base::Closure& completion) { |
805 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 779 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
806 DCHECK(initialized()); | 780 DCHECK(initialized()); |
807 | 781 |
808 DCHECK(transport_security_state()); | 782 DCHECK(transport_security_state()); |
809 // Completes synchronously. | 783 // Completes synchronously. |
810 transport_security_state()->DeleteAllDynamicDataSince(time); | 784 transport_security_state()->DeleteAllDynamicDataSince(time); |
811 DCHECK(http_server_properties_manager_); | 785 DCHECK(http_server_properties_manager_); |
812 http_server_properties_manager_->Clear(completion); | 786 http_server_properties_manager_->Clear(completion); |
813 } | 787 } |
OLD | NEW |