| 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/io_thread.h" | 5 #include "chrome/browser/io_thread.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 #include "net/socket/ssl_client_socket.h" | 101 #include "net/socket/ssl_client_socket.h" |
| 102 #include "net/socket/tcp_client_socket.h" | 102 #include "net/socket/tcp_client_socket.h" |
| 103 #include "net/ssl/channel_id_service.h" | 103 #include "net/ssl/channel_id_service.h" |
| 104 #include "net/ssl/default_channel_id_store.h" | 104 #include "net/ssl/default_channel_id_store.h" |
| 105 #include "net/url_request/data_protocol_handler.h" | 105 #include "net/url_request/data_protocol_handler.h" |
| 106 #include "net/url_request/file_protocol_handler.h" | 106 #include "net/url_request/file_protocol_handler.h" |
| 107 #include "net/url_request/ftp_protocol_handler.h" | 107 #include "net/url_request/ftp_protocol_handler.h" |
| 108 #include "net/url_request/static_http_user_agent_settings.h" | 108 #include "net/url_request/static_http_user_agent_settings.h" |
| 109 #include "net/url_request/url_fetcher.h" | 109 #include "net/url_request/url_fetcher.h" |
| 110 #include "net/url_request/url_request_context.h" | 110 #include "net/url_request/url_request_context.h" |
| 111 #include "net/url_request/url_request_context_builder.h" | |
| 112 #include "net/url_request/url_request_context_getter.h" | 111 #include "net/url_request/url_request_context_getter.h" |
| 113 #include "net/url_request/url_request_context_storage.h" | 112 #include "net/url_request/url_request_context_storage.h" |
| 114 #include "net/url_request/url_request_job_factory_impl.h" | 113 #include "net/url_request/url_request_job_factory_impl.h" |
| 115 #include "url/url_constants.h" | 114 #include "url/url_constants.h" |
| 116 | 115 |
| 117 #if BUILDFLAG(ENABLE_EXTENSIONS) | 116 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 118 #include "chrome/browser/extensions/event_router_forwarder.h" | 117 #include "chrome/browser/extensions/event_router_forwarder.h" |
| 119 #endif | 118 #endif |
| 120 | 119 |
| 121 #if defined(USE_NSS_CERTS) | 120 #if defined(USE_NSS_CERTS) |
| (...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 | 782 |
| 784 void IOThread::ClearHostCache( | 783 void IOThread::ClearHostCache( |
| 785 const base::Callback<bool(const std::string&)>& host_filter) { | 784 const base::Callback<bool(const std::string&)>& host_filter) { |
| 786 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 785 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 787 | 786 |
| 788 net::HostCache* host_cache = globals_->host_resolver->GetHostCache(); | 787 net::HostCache* host_cache = globals_->host_resolver->GetHostCache(); |
| 789 if (host_cache) | 788 if (host_cache) |
| 790 host_cache->ClearForHosts(host_filter); | 789 host_cache->ClearForHosts(host_filter); |
| 791 } | 790 } |
| 792 | 791 |
| 793 const net::HttpNetworkSession::Params& IOThread::NetworkSessionParams() const { | 792 net::HttpNetworkSession::Params IOThread::NetworkSessionParams() const { |
| 794 return params_; | 793 net::HttpNetworkSession::Params session_params; |
| 794 params_.ConfigureSessionParams(&session_params); |
| 795 return session_params; |
| 795 } | 796 } |
| 796 | 797 |
| 797 void IOThread::DisableQuic() { | 798 void IOThread::DisableQuic() { |
| 798 params_.enable_quic = false; | 799 params_.enable_quic = false; |
| 799 | 800 |
| 800 if (globals_->system_request_context_storage) | 801 if (globals_->system_request_context_storage) |
| 801 globals_->system_request_context_storage->http_network_session() | 802 globals_->system_request_context_storage->http_network_session() |
| 802 ->DisableQuic(); | 803 ->DisableQuic(); |
| 803 } | 804 } |
| 804 | 805 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 context_storage->set_ct_policy_enforcer( | 895 context_storage->set_ct_policy_enforcer( |
| 895 base::MakeUnique<net::CTPolicyEnforcer>()); | 896 base::MakeUnique<net::CTPolicyEnforcer>()); |
| 896 | 897 |
| 897 const base::CommandLine& command_line = | 898 const base::CommandLine& command_line = |
| 898 *base::CommandLine::ForCurrentProcess(); | 899 *base::CommandLine::ForCurrentProcess(); |
| 899 context_storage->set_proxy_service(ProxyServiceFactory::CreateProxyService( | 900 context_storage->set_proxy_service(ProxyServiceFactory::CreateProxyService( |
| 900 net_log_, context, context->network_delegate(), | 901 net_log_, context, context->network_delegate(), |
| 901 std::move(system_proxy_config_service_), command_line, | 902 std::move(system_proxy_config_service_), command_line, |
| 902 WpadQuickCheckEnabled(), PacHttpsUrlStrippingEnabled())); | 903 WpadQuickCheckEnabled(), PacHttpsUrlStrippingEnabled())); |
| 903 | 904 |
| 904 net::HttpNetworkSession::Params system_params(params_); | 905 net::HttpNetworkSession::Params system_params(NetworkSessionParams()); |
| 905 net::URLRequestContextBuilder::SetHttpNetworkSessionComponents( | 906 net::URLRequestContextBuilder::SetHttpNetworkSessionComponents( |
| 906 context, &system_params); | 907 context, &system_params); |
| 907 | 908 |
| 908 context_storage->set_http_network_session( | 909 context_storage->set_http_network_session( |
| 909 base::MakeUnique<net::HttpNetworkSession>(system_params)); | 910 base::MakeUnique<net::HttpNetworkSession>(system_params)); |
| 910 context_storage->set_http_transaction_factory( | 911 context_storage->set_http_transaction_factory( |
| 911 base::MakeUnique<net::HttpNetworkLayer>( | 912 base::MakeUnique<net::HttpNetworkLayer>( |
| 912 context_storage->http_network_session())); | 913 context_storage->http_network_session())); |
| 913 | 914 |
| 914 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory( | 915 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory( |
| (...skipping 14 matching lines...) Expand all Loading... |
| 929 #endif | 930 #endif |
| 930 | 931 |
| 931 context_storage->set_job_factory(std::move(job_factory)); | 932 context_storage->set_job_factory(std::move(job_factory)); |
| 932 } | 933 } |
| 933 | 934 |
| 934 // static | 935 // static |
| 935 void IOThread::ConfigureParamsFromFieldTrialsAndCommandLine( | 936 void IOThread::ConfigureParamsFromFieldTrialsAndCommandLine( |
| 936 const base::CommandLine& command_line, | 937 const base::CommandLine& command_line, |
| 937 bool is_quic_allowed_by_policy, | 938 bool is_quic_allowed_by_policy, |
| 938 bool http_09_on_non_default_ports_enabled, | 939 bool http_09_on_non_default_ports_enabled, |
| 939 net::HttpNetworkSession::Params* params) { | 940 net::URLRequestContextBuilder::HttpNetworkSessionParams* params) { |
| 940 std::string quic_user_agent_id = chrome::GetChannelString(); | 941 std::string quic_user_agent_id = chrome::GetChannelString(); |
| 941 if (!quic_user_agent_id.empty()) | 942 if (!quic_user_agent_id.empty()) |
| 942 quic_user_agent_id.push_back(' '); | 943 quic_user_agent_id.push_back(' '); |
| 943 quic_user_agent_id.append( | 944 quic_user_agent_id.append( |
| 944 version_info::GetProductNameAndVersionForUserAgent()); | 945 version_info::GetProductNameAndVersionForUserAgent()); |
| 945 quic_user_agent_id.push_back(' '); | 946 quic_user_agent_id.push_back(' '); |
| 946 quic_user_agent_id.append(content::BuildOSCpuInfo()); | 947 quic_user_agent_id.append(content::BuildOSCpuInfo()); |
| 947 | 948 |
| 948 bool is_quic_force_disabled = !is_quic_allowed_by_policy || | 949 bool is_quic_force_disabled = !is_quic_allowed_by_policy || |
| 949 command_line.HasSwitch(switches::kDisableQuic); | 950 command_line.HasSwitch(switches::kDisableQuic); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1021 GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpsPort); | 1022 GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpsPort); |
| 1022 } | 1023 } |
| 1023 | 1024 |
| 1024 params->http_09_on_non_default_ports_enabled = | 1025 params->http_09_on_non_default_ports_enabled = |
| 1025 http_09_on_non_default_ports_enabled; | 1026 http_09_on_non_default_ports_enabled; |
| 1026 } | 1027 } |
| 1027 | 1028 |
| 1028 metrics::UpdateUsagePrefCallbackType IOThread::GetMetricsDataUseForwarder() { | 1029 metrics::UpdateUsagePrefCallbackType IOThread::GetMetricsDataUseForwarder() { |
| 1029 return base::Bind(&UpdateMetricsUsagePrefsOnUIThread); | 1030 return base::Bind(&UpdateMetricsUsagePrefsOnUIThread); |
| 1030 } | 1031 } |
| OLD | NEW |