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 21 matching lines...) Expand all Loading... | |
32 #include "chrome/browser/net/chrome_network_delegate.h" | 32 #include "chrome/browser/net/chrome_network_delegate.h" |
33 #include "chrome/browser/net/chrome_url_request_context.h" | 33 #include "chrome/browser/net/chrome_url_request_context.h" |
34 #include "chrome/browser/net/connect_interceptor.h" | 34 #include "chrome/browser/net/connect_interceptor.h" |
35 #include "chrome/browser/net/dns_probe_service.h" | 35 #include "chrome/browser/net/dns_probe_service.h" |
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/common/chrome_content_client.h" | 38 #include "chrome/common/chrome_content_client.h" |
39 #include "chrome/common/chrome_switches.h" | 39 #include "chrome/common/chrome_switches.h" |
40 #include "chrome/common/chrome_version_info.h" | 40 #include "chrome/common/chrome_version_info.h" |
41 #include "chrome/common/pref_names.h" | 41 #include "chrome/common/pref_names.h" |
42 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ est_handler.h" | |
43 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" | |
42 #include "components/data_reduction_proxy/browser/data_reduction_proxy_prefs.h" | 44 #include "components/data_reduction_proxy/browser/data_reduction_proxy_prefs.h" |
45 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol. h" | |
46 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h" | |
43 #include "components/policy/core/common/policy_service.h" | 47 #include "components/policy/core/common/policy_service.h" |
44 #include "components/variations/variations_associated_data.h" | 48 #include "components/variations/variations_associated_data.h" |
45 #include "content/public/browser/browser_thread.h" | 49 #include "content/public/browser/browser_thread.h" |
46 #include "content/public/browser/cookie_store_factory.h" | 50 #include "content/public/browser/cookie_store_factory.h" |
47 #include "net/base/host_mapping_rules.h" | 51 #include "net/base/host_mapping_rules.h" |
48 #include "net/base/net_util.h" | 52 #include "net/base/net_util.h" |
49 #include "net/cert/cert_verifier.h" | 53 #include "net/cert/cert_verifier.h" |
50 #include "net/cert/cert_verify_proc.h" | 54 #include "net/cert/cert_verify_proc.h" |
51 #include "net/cert/ct_known_logs.h" | 55 #include "net/cert/ct_known_logs.h" |
52 #include "net/cert/ct_verifier.h" | 56 #include "net/cert/ct_verifier.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 | 91 |
88 #if !defined(USE_OPENSSL) | 92 #if !defined(USE_OPENSSL) |
89 #include "net/cert/ct_log_verifier.h" | 93 #include "net/cert/ct_log_verifier.h" |
90 #include "net/cert/multi_log_ct_verifier.h" | 94 #include "net/cert/multi_log_ct_verifier.h" |
91 #endif | 95 #endif |
92 | 96 |
93 #if defined(USE_NSS) || defined(OS_IOS) | 97 #if defined(USE_NSS) || defined(OS_IOS) |
94 #include "net/ocsp/nss_ocsp.h" | 98 #include "net/ocsp/nss_ocsp.h" |
95 #endif | 99 #endif |
96 | 100 |
97 #if defined(OS_ANDROID) || defined(OS_IOS) | |
98 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ est_handler.h" | |
99 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" | |
100 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol. h" | |
101 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h" | |
102 #endif | |
103 | |
104 #if defined(OS_CHROMEOS) | 101 #if defined(OS_CHROMEOS) |
105 #include "chrome/browser/chromeos/login/users/user_manager.h" | 102 #include "chrome/browser/chromeos/login/users/user_manager.h" |
106 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h" | 103 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h" |
107 #include "chromeos/network/host_resolver_impl_chromeos.h" | 104 #include "chromeos/network/host_resolver_impl_chromeos.h" |
108 #endif | 105 #endif |
109 | 106 |
110 using content::BrowserThread; | 107 using content::BrowserThread; |
111 | |
112 #if defined(OS_ANDROID) || defined(OS_IOS) | |
113 using data_reduction_proxy::DataReductionProxyAuthRequestHandler; | 108 using data_reduction_proxy::DataReductionProxyAuthRequestHandler; |
114 using data_reduction_proxy::DataReductionProxyParams; | 109 using data_reduction_proxy::DataReductionProxyParams; |
115 using data_reduction_proxy::DataReductionProxyUsageStats; | 110 using data_reduction_proxy::DataReductionProxyUsageStats; |
116 using data_reduction_proxy::DataReductionProxySettings; | 111 using data_reduction_proxy::DataReductionProxySettings; |
117 #endif | |
118 | 112 |
119 class SafeBrowsingURLRequestContext; | 113 class SafeBrowsingURLRequestContext; |
120 | 114 |
121 // The IOThread object must outlive any tasks posted to the IO thread before the | 115 // The IOThread object must outlive any tasks posted to the IO thread before the |
122 // Quit task, so base::Bind() calls are not refcounted. | 116 // Quit task, so base::Bind() calls are not refcounted. |
123 | 117 |
124 namespace { | 118 namespace { |
125 | 119 |
126 const char kQuicFieldTrialName[] = "QUIC"; | 120 const char kQuicFieldTrialName[] = "QUIC"; |
127 const char kQuicFieldTrialEnabledGroupName[] = "Enabled"; | 121 const char kQuicFieldTrialEnabledGroupName[] = "Enabled"; |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
631 ct_verifier->AddLog(external_log_verifier.Pass()); | 625 ct_verifier->AddLog(external_log_verifier.Pass()); |
632 } | 626 } |
633 } | 627 } |
634 #else | 628 #else |
635 if (command_line.HasSwitch(switches::kCertificateTransparencyLog)) { | 629 if (command_line.HasSwitch(switches::kCertificateTransparencyLog)) { |
636 LOG(DFATAL) << "Certificate Transparency is not yet supported in Chrome " | 630 LOG(DFATAL) << "Certificate Transparency is not yet supported in Chrome " |
637 "builds using OpenSSL."; | 631 "builds using OpenSSL."; |
638 } | 632 } |
639 #endif | 633 #endif |
640 globals_->ssl_config_service = GetSSLConfigService(); | 634 globals_->ssl_config_service = GetSSLConfigService(); |
641 #if defined(OS_ANDROID) || defined(OS_IOS) | 635 int drp_flags = 0; |
642 #if defined(SPDY_PROXY_AUTH_ORIGIN) | 636 // TODO(kundaji): Gate instantitation of all data reduction classes based |
643 int drp_flags = DataReductionProxyParams::kFallbackAllowed; | 637 // on this method. |
644 if (DataReductionProxyParams::IsIncludedInFieldTrial()) | 638 if (DataReductionProxyParams::IsIncludedInFieldTrial()) { |
bengr
2014/07/21 22:45:14
Please test that the code works when not part of t
Not at Google. Contact bengr
2014/07/22 00:12:09
Good catch. Made other flags conditional on kAllow
| |
645 drp_flags |= DataReductionProxyParams::kAllowed; | 639 drp_flags = DataReductionProxyParams::kAllowed | |
640 DataReductionProxyParams::kFallbackAllowed; | |
641 } | |
646 if (DataReductionProxyParams::IsIncludedInAlternativeFieldTrial()) | 642 if (DataReductionProxyParams::IsIncludedInAlternativeFieldTrial()) |
bengr
2014/07/21 22:45:14
We are accumulating a lot of code here. Would you
Not at Google. Contact bengr
2014/07/22 00:12:09
Done.
| |
647 drp_flags |= DataReductionProxyParams::kAlternativeAllowed; | 643 drp_flags |= DataReductionProxyParams::kAlternativeAllowed; |
648 if (DataReductionProxyParams::IsIncludedInPromoFieldTrial()) | 644 if (DataReductionProxyParams::IsIncludedInPromoFieldTrial()) |
649 drp_flags |= DataReductionProxyParams::kPromoAllowed; | 645 drp_flags |= DataReductionProxyParams::kPromoAllowed; |
650 DataReductionProxyParams* proxy_params = | 646 DataReductionProxyParams* proxy_params = |
651 new DataReductionProxyParams(drp_flags); | 647 new DataReductionProxyParams(drp_flags); |
652 globals_->data_reduction_proxy_params.reset(proxy_params); | 648 globals_->data_reduction_proxy_params.reset(proxy_params); |
653 globals_->data_reduction_proxy_auth_request_handler.reset( | 649 globals_->data_reduction_proxy_auth_request_handler.reset( |
654 new DataReductionProxyAuthRequestHandler(proxy_params)); | 650 new DataReductionProxyAuthRequestHandler(proxy_params)); |
655 globals_->on_resolve_proxy_handler = | 651 globals_->on_resolve_proxy_handler = |
656 ChromeNetworkDelegate::OnResolveProxyHandler( | 652 ChromeNetworkDelegate::OnResolveProxyHandler( |
657 base::Bind(data_reduction_proxy::OnResolveProxyHandler)); | 653 base::Bind(data_reduction_proxy::OnResolveProxyHandler)); |
658 DataReductionProxyUsageStats* proxy_usage_stats = | 654 DataReductionProxyUsageStats* proxy_usage_stats = |
659 new DataReductionProxyUsageStats(proxy_params, | 655 new DataReductionProxyUsageStats(proxy_params, |
660 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 656 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
661 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 657 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
662 network_delegate->set_data_reduction_proxy_params(proxy_params); | 658 network_delegate->set_data_reduction_proxy_params(proxy_params); |
663 globals_->data_reduction_proxy_usage_stats.reset(proxy_usage_stats); | 659 globals_->data_reduction_proxy_usage_stats.reset(proxy_usage_stats); |
664 network_delegate->set_data_reduction_proxy_usage_stats(proxy_usage_stats); | 660 network_delegate->set_data_reduction_proxy_usage_stats(proxy_usage_stats); |
665 network_delegate->set_data_reduction_proxy_auth_request_handler( | 661 network_delegate->set_data_reduction_proxy_auth_request_handler( |
666 globals_->data_reduction_proxy_auth_request_handler.get()); | 662 globals_->data_reduction_proxy_auth_request_handler.get()); |
667 network_delegate->set_on_resolve_proxy_handler( | 663 network_delegate->set_on_resolve_proxy_handler( |
668 globals_->on_resolve_proxy_handler); | 664 globals_->on_resolve_proxy_handler); |
669 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) | |
670 #endif // defined(OS_ANDROID) || defined(OS_IOS) | |
671 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( | 665 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( |
672 globals_->host_resolver.get())); | 666 globals_->host_resolver.get())); |
673 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl()); | 667 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl()); |
674 // For the ProxyScriptFetcher, we use a direct ProxyService. | 668 // For the ProxyScriptFetcher, we use a direct ProxyService. |
675 globals_->proxy_script_fetcher_proxy_service.reset( | 669 globals_->proxy_script_fetcher_proxy_service.reset( |
676 net::ProxyService::CreateDirectWithNetLog(net_log_)); | 670 net::ProxyService::CreateDirectWithNetLog(net_log_)); |
677 // In-memory cookie store. | 671 // In-memory cookie store. |
678 globals_->system_cookie_store = | 672 globals_->system_cookie_store = |
679 content::CreateCookieStore(content::CookieStoreConfig()); | 673 content::CreateCookieStore(content::CookieStoreConfig()); |
680 // In-memory server bound cert store. | 674 // In-memory server bound cert store. |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1097 | 1091 |
1098 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 1092 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
1099 globals_->system_proxy_service.reset( | 1093 globals_->system_proxy_service.reset( |
1100 ProxyServiceFactory::CreateProxyService( | 1094 ProxyServiceFactory::CreateProxyService( |
1101 net_log_, | 1095 net_log_, |
1102 globals_->proxy_script_fetcher_context.get(), | 1096 globals_->proxy_script_fetcher_context.get(), |
1103 globals_->system_network_delegate.get(), | 1097 globals_->system_network_delegate.get(), |
1104 system_proxy_config_service_.release(), | 1098 system_proxy_config_service_.release(), |
1105 command_line, | 1099 command_line, |
1106 quick_check_enabled_.GetValue())); | 1100 quick_check_enabled_.GetValue())); |
1101 DCHECK(globals_->data_reduction_proxy_params); | |
1102 globals_->system_proxy_service->SetDataReductionProxyOrigins( | |
bengr
2014/07/21 22:45:14
Add a comment that this is temporary until the his
Not at Google. Contact bengr
2014/07/22 00:12:09
Acknowledged.
| |
1103 globals_->data_reduction_proxy_params->GetDefaultOrigin(), | |
1104 globals_->data_reduction_proxy_params->GetDefaultFallbackOrigin()); | |
1107 | 1105 |
1108 net::HttpNetworkSession::Params system_params; | 1106 net::HttpNetworkSession::Params system_params; |
1109 InitializeNetworkSessionParams(&system_params); | 1107 InitializeNetworkSessionParams(&system_params); |
1110 system_params.net_log = net_log_; | 1108 system_params.net_log = net_log_; |
1111 system_params.proxy_service = globals_->system_proxy_service.get(); | 1109 system_params.proxy_service = globals_->system_proxy_service.get(); |
1112 | 1110 |
1113 globals_->system_http_transaction_factory.reset( | 1111 globals_->system_http_transaction_factory.reset( |
1114 new net::HttpNetworkLayer( | 1112 new net::HttpNetworkLayer( |
1115 new net::HttpNetworkSession(system_params))); | 1113 new net::HttpNetworkSession(system_params))); |
1116 globals_->system_url_request_job_factory.reset( | 1114 globals_->system_url_request_job_factory.reset( |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1380 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); | 1378 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); |
1381 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1379 for (size_t i = 0; i < supported_versions.size(); ++i) { |
1382 net::QuicVersion version = supported_versions[i]; | 1380 net::QuicVersion version = supported_versions[i]; |
1383 if (net::QuicVersionToString(version) == quic_version) { | 1381 if (net::QuicVersionToString(version) == quic_version) { |
1384 return version; | 1382 return version; |
1385 } | 1383 } |
1386 } | 1384 } |
1387 | 1385 |
1388 return net::QUIC_VERSION_UNSUPPORTED; | 1386 return net::QUIC_VERSION_UNSUPPORTED; |
1389 } | 1387 } |
OLD | NEW |