Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: chrome/browser/io_thread.cc

Issue 382313003: Add data reduction functionality to all platforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 22 matching lines...) Expand all
33 #include "chrome/browser/net/chrome_network_delegate.h" 33 #include "chrome/browser/net/chrome_network_delegate.h"
34 #include "chrome/browser/net/chrome_url_request_context.h" 34 #include "chrome/browser/net/chrome_url_request_context.h"
35 #include "chrome/browser/net/connect_interceptor.h" 35 #include "chrome/browser/net/connect_interceptor.h"
36 #include "chrome/browser/net/dns_probe_service.h" 36 #include "chrome/browser/net/dns_probe_service.h"
37 #include "chrome/browser/net/pref_proxy_config_tracker.h" 37 #include "chrome/browser/net/pref_proxy_config_tracker.h"
38 #include "chrome/browser/net/proxy_service_factory.h" 38 #include "chrome/browser/net/proxy_service_factory.h"
39 #include "chrome/common/chrome_content_client.h" 39 #include "chrome/common/chrome_content_client.h"
40 #include "chrome/common/chrome_switches.h" 40 #include "chrome/common/chrome_switches.h"
41 #include "chrome/common/chrome_version_info.h" 41 #include "chrome/common/chrome_version_info.h"
42 #include "chrome/common/pref_names.h" 42 #include "chrome/common/pref_names.h"
43 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ est_handler.h"
44 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
43 #include "components/data_reduction_proxy/browser/data_reduction_proxy_prefs.h" 45 #include "components/data_reduction_proxy/browser/data_reduction_proxy_prefs.h"
46 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol. h"
47 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h"
44 #include "components/policy/core/common/policy_service.h" 48 #include "components/policy/core/common/policy_service.h"
45 #include "components/variations/variations_associated_data.h" 49 #include "components/variations/variations_associated_data.h"
46 #include "content/public/browser/browser_thread.h" 50 #include "content/public/browser/browser_thread.h"
47 #include "content/public/browser/cookie_store_factory.h" 51 #include "content/public/browser/cookie_store_factory.h"
48 #include "net/base/host_mapping_rules.h" 52 #include "net/base/host_mapping_rules.h"
49 #include "net/base/net_util.h" 53 #include "net/base/net_util.h"
50 #include "net/cert/cert_verifier.h" 54 #include "net/cert/cert_verifier.h"
51 #include "net/cert/cert_verify_proc.h" 55 #include "net/cert/cert_verify_proc.h"
52 #include "net/cert/ct_known_logs.h" 56 #include "net/cert/ct_known_logs.h"
53 #include "net/cert/ct_verifier.h" 57 #include "net/cert/ct_verifier.h"
(...skipping 30 matching lines...) Expand all
84 88
85 #if !defined(USE_OPENSSL) 89 #if !defined(USE_OPENSSL)
86 #include "net/cert/ct_log_verifier.h" 90 #include "net/cert/ct_log_verifier.h"
87 #include "net/cert/multi_log_ct_verifier.h" 91 #include "net/cert/multi_log_ct_verifier.h"
88 #endif 92 #endif
89 93
90 #if defined(USE_NSS) || defined(OS_IOS) 94 #if defined(USE_NSS) || defined(OS_IOS)
91 #include "net/ocsp/nss_ocsp.h" 95 #include "net/ocsp/nss_ocsp.h"
92 #endif 96 #endif
93 97
94 #if defined(OS_ANDROID) || defined(OS_IOS)
95 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ est_handler.h"
96 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
97 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol. h"
98 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h"
99 #endif
100
101 #if defined(OS_CHROMEOS) 98 #if defined(OS_CHROMEOS)
102 #include "chrome/browser/chromeos/login/users/user_manager.h" 99 #include "chrome/browser/chromeos/login/users/user_manager.h"
103 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h" 100 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h"
104 #include "chromeos/network/host_resolver_impl_chromeos.h" 101 #include "chromeos/network/host_resolver_impl_chromeos.h"
105 #endif 102 #endif
106 103
107 using content::BrowserThread; 104 using content::BrowserThread;
108
109 #if defined(OS_ANDROID) || defined(OS_IOS)
110 using data_reduction_proxy::DataReductionProxyAuthRequestHandler; 105 using data_reduction_proxy::DataReductionProxyAuthRequestHandler;
111 using data_reduction_proxy::DataReductionProxyParams; 106 using data_reduction_proxy::DataReductionProxyParams;
112 using data_reduction_proxy::DataReductionProxyUsageStats; 107 using data_reduction_proxy::DataReductionProxyUsageStats;
113 using data_reduction_proxy::DataReductionProxySettings; 108 using data_reduction_proxy::DataReductionProxySettings;
114 #endif
115 109
116 class SafeBrowsingURLRequestContext; 110 class SafeBrowsingURLRequestContext;
117 111
118 // The IOThread object must outlive any tasks posted to the IO thread before the 112 // The IOThread object must outlive any tasks posted to the IO thread before the
119 // Quit task, so base::Bind() calls are not refcounted. 113 // Quit task, so base::Bind() calls are not refcounted.
120 114
121 namespace { 115 namespace {
122 116
123 const char kQuicFieldTrialName[] = "QUIC"; 117 const char kQuicFieldTrialName[] = "QUIC";
124 const char kQuicFieldTrialEnabledGroupName[] = "Enabled"; 118 const char kQuicFieldTrialEnabledGroupName[] = "Enabled";
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 ct_verifier->AddLog(external_log_verifier.Pass()); 612 ct_verifier->AddLog(external_log_verifier.Pass());
619 } 613 }
620 } 614 }
621 #else 615 #else
622 if (command_line.HasSwitch(switches::kCertificateTransparencyLog)) { 616 if (command_line.HasSwitch(switches::kCertificateTransparencyLog)) {
623 LOG(DFATAL) << "Certificate Transparency is not yet supported in Chrome " 617 LOG(DFATAL) << "Certificate Transparency is not yet supported in Chrome "
624 "builds using OpenSSL."; 618 "builds using OpenSSL.";
625 } 619 }
626 #endif 620 #endif
627 globals_->ssl_config_service = GetSSLConfigService(); 621 globals_->ssl_config_service = GetSSLConfigService();
628 #if defined(OS_ANDROID) || defined(OS_IOS) 622 int drp_flags = 0;
629 #if defined(SPDY_PROXY_AUTH_ORIGIN)
630 int drp_flags = DataReductionProxyParams::kFallbackAllowed;
631 if (DataReductionProxyParams::IsIncludedInFieldTrial()) 623 if (DataReductionProxyParams::IsIncludedInFieldTrial())
bengr 2014/07/11 20:42:53 All of this stuff should be part of a data reducti
Not at Google. Contact bengr 2014/07/16 22:41:33 We are creating instances of 3 different classes h
632 drp_flags |= DataReductionProxyParams::kAllowed; 624 drp_flags = DataReductionProxyParams::kAllowed |
625 DataReductionProxyParams::kFallbackAllowed;
633 if (DataReductionProxyParams::IsIncludedInAlternativeFieldTrial()) 626 if (DataReductionProxyParams::IsIncludedInAlternativeFieldTrial())
634 drp_flags |= DataReductionProxyParams::kAlternativeAllowed; 627 drp_flags |= DataReductionProxyParams::kAlternativeAllowed;
635 if (DataReductionProxyParams::IsIncludedInPromoFieldTrial()) 628 if (DataReductionProxyParams::IsIncludedInPromoFieldTrial())
636 drp_flags |= DataReductionProxyParams::kPromoAllowed; 629 drp_flags |= DataReductionProxyParams::kPromoAllowed;
637 DataReductionProxyParams* proxy_params = 630 DataReductionProxyParams* proxy_params =
638 new DataReductionProxyParams(drp_flags); 631 new DataReductionProxyParams(drp_flags);
639 globals_->data_reduction_proxy_params.reset(proxy_params); 632 globals_->data_reduction_proxy_params.reset(proxy_params);
640 globals_->data_reduction_proxy_auth_request_handler.reset( 633 globals_->data_reduction_proxy_auth_request_handler.reset(
641 new DataReductionProxyAuthRequestHandler(proxy_params)); 634 new DataReductionProxyAuthRequestHandler(proxy_params));
642 globals_->on_resolve_proxy_handler = 635 globals_->on_resolve_proxy_handler =
643 ChromeNetworkDelegate::OnResolveProxyHandler( 636 ChromeNetworkDelegate::OnResolveProxyHandler(
644 base::Bind(data_reduction_proxy::OnResolveProxyHandler)); 637 base::Bind(data_reduction_proxy::OnResolveProxyHandler));
645 DataReductionProxyUsageStats* proxy_usage_stats = 638 DataReductionProxyUsageStats* proxy_usage_stats =
646 new DataReductionProxyUsageStats(proxy_params, 639 new DataReductionProxyUsageStats(proxy_params,
647 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), 640 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
648 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 641 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
649 network_delegate->set_data_reduction_proxy_params(proxy_params); 642 network_delegate->set_data_reduction_proxy_params(proxy_params);
650 globals_->data_reduction_proxy_usage_stats.reset(proxy_usage_stats); 643 globals_->data_reduction_proxy_usage_stats.reset(proxy_usage_stats);
651 network_delegate->set_data_reduction_proxy_usage_stats(proxy_usage_stats); 644 network_delegate->set_data_reduction_proxy_usage_stats(proxy_usage_stats);
652 network_delegate->set_data_reduction_proxy_auth_request_handler( 645 network_delegate->set_data_reduction_proxy_auth_request_handler(
653 globals_->data_reduction_proxy_auth_request_handler.get()); 646 globals_->data_reduction_proxy_auth_request_handler.get());
647
654 network_delegate->set_on_resolve_proxy_handler( 648 network_delegate->set_on_resolve_proxy_handler(
655 globals_->on_resolve_proxy_handler); 649 globals_->on_resolve_proxy_handler);
656 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) 650
657 #endif // defined(OS_ANDROID) || defined(OS_IOS)
658 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( 651 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory(
659 globals_->host_resolver.get())); 652 globals_->host_resolver.get()));
660 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl()); 653 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl());
661 // For the ProxyScriptFetcher, we use a direct ProxyService. 654 // For the ProxyScriptFetcher, we use a direct ProxyService.
662 globals_->proxy_script_fetcher_proxy_service.reset( 655 globals_->proxy_script_fetcher_proxy_service.reset(
663 net::ProxyService::CreateDirectWithNetLog(net_log_)); 656 net::ProxyService::CreateDirectWithNetLog(net_log_));
664 // In-memory cookie store. 657 // In-memory cookie store.
665 globals_->system_cookie_store = 658 globals_->system_cookie_store =
666 content::CreateCookieStore(content::CookieStoreConfig()); 659 content::CreateCookieStore(content::CookieStoreConfig());
667 // In-memory server bound cert store. 660 // In-memory server bound cert store.
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); 1360 net::QuicVersionVector supported_versions = net::QuicSupportedVersions();
1368 for (size_t i = 0; i < supported_versions.size(); ++i) { 1361 for (size_t i = 0; i < supported_versions.size(); ++i) {
1369 net::QuicVersion version = supported_versions[i]; 1362 net::QuicVersion version = supported_versions[i];
1370 if (net::QuicVersionToString(version) == quic_version) { 1363 if (net::QuicVersionToString(version) == quic_version) {
1371 return version; 1364 return version;
1372 } 1365 }
1373 } 1366 }
1374 1367
1375 return net::QUIC_VERSION_UNSUPPORTED; 1368 return net::QUIC_VERSION_UNSUPPORTED;
1376 } 1369 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698