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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 25 matching lines...) Expand all Loading... | |
36 #include "chrome/browser/net/pref_proxy_config_tracker.h" | 36 #include "chrome/browser/net/pref_proxy_config_tracker.h" |
37 #include "chrome/browser/net/proxy_service_factory.h" | 37 #include "chrome/browser/net/proxy_service_factory.h" |
38 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | 38 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
39 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" | 39 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" |
40 #include "chrome/common/chrome_content_client.h" | 40 #include "chrome/common/chrome_content_client.h" |
41 #include "chrome/common/chrome_switches.h" | 41 #include "chrome/common/chrome_switches.h" |
42 #include "chrome/common/chrome_version_info.h" | 42 #include "chrome/common/chrome_version_info.h" |
43 #include "chrome/common/pref_names.h" | 43 #include "chrome/common/pref_names.h" |
44 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_auth _request_handler.h" | 44 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_auth _request_handler.h" |
45 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_dele gate.h" | 45 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_dele gate.h" |
46 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_netw ork_delegate.h" | |
46 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref s.h" | 47 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref s.h" |
47 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_prot ocol.h" | 48 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_prot ocol.h" |
48 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.h" | 49 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.h" |
49 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" | 50 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" |
50 #include "components/policy/core/common/policy_service.h" | 51 #include "components/policy/core/common/policy_service.h" |
51 #include "components/variations/variations_associated_data.h" | 52 #include "components/variations/variations_associated_data.h" |
52 #include "content/public/browser/browser_thread.h" | 53 #include "content/public/browser/browser_thread.h" |
53 #include "content/public/browser/cookie_store_factory.h" | 54 #include "content/public/browser/cookie_store_factory.h" |
54 #include "net/base/host_mapping_rules.h" | 55 #include "net/base/host_mapping_rules.h" |
55 #include "net/base/net_util.h" | 56 #include "net/base/net_util.h" |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
575 new LoggingNetworkChangeObserver(net_log_)); | 576 new LoggingNetworkChangeObserver(net_log_)); |
576 | 577 |
577 // Setup the HistogramWatcher to run on the IO thread. | 578 // Setup the HistogramWatcher to run on the IO thread. |
578 net::NetworkChangeNotifier::InitHistogramWatcher(); | 579 net::NetworkChangeNotifier::InitHistogramWatcher(); |
579 | 580 |
580 #if defined(ENABLE_EXTENSIONS) | 581 #if defined(ENABLE_EXTENSIONS) |
581 globals_->extension_event_router_forwarder = | 582 globals_->extension_event_router_forwarder = |
582 extension_event_router_forwarder_; | 583 extension_event_router_forwarder_; |
583 #endif | 584 #endif |
584 | 585 |
585 ChromeNetworkDelegate* network_delegate = | 586 scoped_ptr<ChromeNetworkDelegate> chrome_network_delegate( |
586 new ChromeNetworkDelegate(extension_event_router_forwarder(), | 587 new ChromeNetworkDelegate(extension_event_router_forwarder(), |
587 &system_enable_referrers_); | 588 &system_enable_referrers_)); |
588 | 589 |
589 if (command_line.HasSwitch(switches::kEnableClientHints)) | 590 if (command_line.HasSwitch(switches::kEnableClientHints)) |
590 network_delegate->SetEnableClientHints(); | 591 chrome_network_delegate->SetEnableClientHints(); |
591 | 592 |
592 #if defined(ENABLE_EXTENSIONS) | 593 #if defined(ENABLE_EXTENSIONS) |
593 if (command_line.HasSwitch(switches::kDisableExtensionsHttpThrottling)) | 594 if (command_line.HasSwitch(switches::kDisableExtensionsHttpThrottling)) |
594 network_delegate->NeverThrottleRequests(); | 595 chrome_network_delegate->NeverThrottleRequests(); |
595 #endif | 596 #endif |
596 | 597 |
598 data_reduction_proxy::DataReductionProxyNetworkDelegate* network_delegate = | |
599 new data_reduction_proxy::DataReductionProxyNetworkDelegate( | |
600 chrome_network_delegate.Pass()); | |
601 | |
597 globals_->system_network_delegate.reset(network_delegate); | 602 globals_->system_network_delegate.reset(network_delegate); |
598 globals_->host_resolver = CreateGlobalHostResolver(net_log_); | 603 globals_->host_resolver = CreateGlobalHostResolver(net_log_); |
599 UpdateDnsClientEnabled(); | 604 UpdateDnsClientEnabled(); |
600 #if defined(OS_CHROMEOS) | 605 #if defined(OS_CHROMEOS) |
601 // Creates a CertVerifyProc that doesn't allow any profile-provided certs. | 606 // Creates a CertVerifyProc that doesn't allow any profile-provided certs. |
602 globals_->cert_verifier.reset(new net::MultiThreadedCertVerifier( | 607 globals_->cert_verifier.reset(new net::MultiThreadedCertVerifier( |
603 new chromeos::CertVerifyProcChromeOS())); | 608 new chromeos::CertVerifyProcChromeOS())); |
604 #else | 609 #else |
605 globals_->cert_verifier.reset(new net::MultiThreadedCertVerifier( | 610 globals_->cert_verifier.reset(new net::MultiThreadedCertVerifier( |
606 net::CertVerifyProc::CreateDefault())); | 611 net::CertVerifyProc::CreateDefault())); |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1127 base::FieldTrialList::FindFullName(kQuicFieldTrialName); | 1132 base::FieldTrialList::FindFullName(kQuicFieldTrialName); |
1128 VariationParameters params; | 1133 VariationParameters params; |
1129 if (!variations::GetVariationParams(kQuicFieldTrialName, ¶ms)) { | 1134 if (!variations::GetVariationParams(kQuicFieldTrialName, ¶ms)) { |
1130 params.clear(); | 1135 params.clear(); |
1131 } | 1136 } |
1132 | 1137 |
1133 ConfigureQuicGlobals(command_line, group, params, globals_); | 1138 ConfigureQuicGlobals(command_line, group, params, globals_); |
1134 } | 1139 } |
1135 | 1140 |
1136 void IOThread::SetupDataReductionProxy( | 1141 void IOThread::SetupDataReductionProxy( |
1137 ChromeNetworkDelegate* network_delegate) { | 1142 data_reduction_proxy::DataReductionProxyNetworkDelegate* network_delegate) { |
1138 // TODO(kundaji): Move flags initialization to DataReductionProxyParams and | 1143 // TODO(kundaji): Move flags initialization to DataReductionProxyParams and |
1139 // merge with flag initialization in | 1144 // merge with flag initialization in |
1140 // data_reduction_proxy_chrome_settings_factory.cc. | 1145 // data_reduction_proxy_chrome_settings_factory.cc. |
1141 int flags = data_reduction_proxy::DataReductionProxyParams::kAllowed | | 1146 int flags = data_reduction_proxy::DataReductionProxyParams::kAllowed | |
1142 data_reduction_proxy::DataReductionProxyParams::kFallbackAllowed | | 1147 data_reduction_proxy::DataReductionProxyParams::kFallbackAllowed | |
1143 data_reduction_proxy::DataReductionProxyParams::kAlternativeAllowed; | 1148 data_reduction_proxy::DataReductionProxyParams::kAlternativeAllowed; |
1144 if (data_reduction_proxy::DataReductionProxyParams:: | 1149 if (data_reduction_proxy::DataReductionProxyParams:: |
1145 IsIncludedInPromoFieldTrial()) { | 1150 IsIncludedInPromoFieldTrial()) { |
1146 flags |= data_reduction_proxy::DataReductionProxyParams::kPromoAllowed; | 1151 flags |= data_reduction_proxy::DataReductionProxyParams::kPromoAllowed; |
1147 } | 1152 } |
1148 if (data_reduction_proxy::DataReductionProxyParams:: | 1153 if (data_reduction_proxy::DataReductionProxyParams:: |
1149 IsIncludedInHoldbackFieldTrial()) { | 1154 IsIncludedInHoldbackFieldTrial()) { |
1150 flags |= data_reduction_proxy::DataReductionProxyParams::kHoldback; | 1155 flags |= data_reduction_proxy::DataReductionProxyParams::kHoldback; |
1151 } | 1156 } |
1152 globals_->data_reduction_proxy_params.reset( | 1157 globals_->data_reduction_proxy_params.reset( |
1153 new data_reduction_proxy::DataReductionProxyParams(flags)); | 1158 new data_reduction_proxy::DataReductionProxyParams(flags)); |
1154 globals_->data_reduction_proxy_auth_request_handler.reset( | 1159 globals_->data_reduction_proxy_auth_request_handler.reset( |
1155 new data_reduction_proxy::DataReductionProxyAuthRequestHandler( | 1160 new data_reduction_proxy::DataReductionProxyAuthRequestHandler( |
1156 DataReductionProxyChromeSettings::GetClient(), | 1161 DataReductionProxyChromeSettings::GetClient(), |
1157 globals_->data_reduction_proxy_params.get(), | 1162 globals_->data_reduction_proxy_params.get(), |
1158 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); | 1163 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); |
1159 globals_->data_reduction_proxy_delegate.reset( | 1164 globals_->data_reduction_proxy_delegate.reset( |
1160 new data_reduction_proxy::DataReductionProxyDelegate( | 1165 new data_reduction_proxy::DataReductionProxyDelegate( |
1161 globals_->data_reduction_proxy_auth_request_handler.get(), | 1166 globals_->data_reduction_proxy_auth_request_handler.get(), |
1162 globals_->data_reduction_proxy_params.get())); | 1167 globals_->data_reduction_proxy_params.get())); |
1163 // This is the same as in ProfileImplIOData except that we do not collect | 1168 // This is the same as in ProfileImplIOData except that we do not collect |
1164 // usage stats. | 1169 // usage stats. |
1165 network_delegate->set_data_reduction_proxy_params( | 1170 network_delegate->set_data_reduction_proxy_params( |
bengr
2014/11/18 19:30:55
Likewise, this stuff should all be part of the DRP
megjablon
2014/11/19 19:23:40
Done.
| |
1166 globals_->data_reduction_proxy_params.get()); | 1171 globals_->data_reduction_proxy_params.get()); |
1167 network_delegate->set_data_reduction_proxy_auth_request_handler( | 1172 network_delegate->set_data_reduction_proxy_auth_request_handler( |
1168 globals_->data_reduction_proxy_auth_request_handler.get()); | 1173 globals_->data_reduction_proxy_auth_request_handler.get()); |
1169 network_delegate->set_on_resolve_proxy_handler( | 1174 network_delegate->set_on_resolve_proxy_handler( |
1170 base::Bind(data_reduction_proxy::OnResolveProxyHandler)); | 1175 base::Bind(data_reduction_proxy::OnResolveProxyHandler)); |
1171 } | 1176 } |
1172 | 1177 |
1173 // static | 1178 // static |
1174 void IOThread::ConfigureQuicGlobals( | 1179 void IOThread::ConfigureQuicGlobals( |
1175 const base::CommandLine& command_line, | 1180 const base::CommandLine& command_line, |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1414 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); | 1419 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); |
1415 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1420 for (size_t i = 0; i < supported_versions.size(); ++i) { |
1416 net::QuicVersion version = supported_versions[i]; | 1421 net::QuicVersion version = supported_versions[i]; |
1417 if (net::QuicVersionToString(version) == quic_version) { | 1422 if (net::QuicVersionToString(version) == quic_version) { |
1418 return version; | 1423 return version; |
1419 } | 1424 } |
1420 } | 1425 } |
1421 | 1426 |
1422 return net::QUIC_VERSION_UNSUPPORTED; | 1427 return net::QUIC_VERSION_UNSUPPORTED; |
1423 } | 1428 } |
OLD | NEW |