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

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: Merge to tip using git pull instead of gclient. 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) 623 // TODO(kundaji): Gate instantitation of all data reduction classes based
630 int drp_flags = DataReductionProxyParams::kFallbackAllowed; 624 // on this method.
631 if (DataReductionProxyParams::IsIncludedInFieldTrial()) 625 if (DataReductionProxyParams::IsIncludedInFieldTrial()) {
632 drp_flags |= DataReductionProxyParams::kAllowed; 626 drp_flags = DataReductionProxyParams::kAllowed |
627 DataReductionProxyParams::kFallbackAllowed;
628 }
633 if (DataReductionProxyParams::IsIncludedInAlternativeFieldTrial()) 629 if (DataReductionProxyParams::IsIncludedInAlternativeFieldTrial())
634 drp_flags |= DataReductionProxyParams::kAlternativeAllowed; 630 drp_flags |= DataReductionProxyParams::kAlternativeAllowed;
635 if (DataReductionProxyParams::IsIncludedInPromoFieldTrial()) 631 if (DataReductionProxyParams::IsIncludedInPromoFieldTrial())
636 drp_flags |= DataReductionProxyParams::kPromoAllowed; 632 drp_flags |= DataReductionProxyParams::kPromoAllowed;
637 DataReductionProxyParams* proxy_params = 633 DataReductionProxyParams* proxy_params =
638 new DataReductionProxyParams(drp_flags); 634 new DataReductionProxyParams(drp_flags);
639 globals_->data_reduction_proxy_params.reset(proxy_params); 635 globals_->data_reduction_proxy_params.reset(proxy_params);
640 globals_->data_reduction_proxy_auth_request_handler.reset( 636 globals_->data_reduction_proxy_auth_request_handler.reset(
641 new DataReductionProxyAuthRequestHandler(proxy_params)); 637 new DataReductionProxyAuthRequestHandler(proxy_params));
642 globals_->on_resolve_proxy_handler = 638 globals_->on_resolve_proxy_handler =
643 ChromeNetworkDelegate::OnResolveProxyHandler( 639 ChromeNetworkDelegate::OnResolveProxyHandler(
644 base::Bind(data_reduction_proxy::OnResolveProxyHandler)); 640 base::Bind(data_reduction_proxy::OnResolveProxyHandler));
645 DataReductionProxyUsageStats* proxy_usage_stats = 641 DataReductionProxyUsageStats* proxy_usage_stats =
646 new DataReductionProxyUsageStats(proxy_params, 642 new DataReductionProxyUsageStats(proxy_params,
647 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), 643 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
648 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 644 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
649 network_delegate->set_data_reduction_proxy_params(proxy_params); 645 network_delegate->set_data_reduction_proxy_params(proxy_params);
650 globals_->data_reduction_proxy_usage_stats.reset(proxy_usage_stats); 646 globals_->data_reduction_proxy_usage_stats.reset(proxy_usage_stats);
651 network_delegate->set_data_reduction_proxy_usage_stats(proxy_usage_stats); 647 network_delegate->set_data_reduction_proxy_usage_stats(proxy_usage_stats);
652 network_delegate->set_data_reduction_proxy_auth_request_handler( 648 network_delegate->set_data_reduction_proxy_auth_request_handler(
653 globals_->data_reduction_proxy_auth_request_handler.get()); 649 globals_->data_reduction_proxy_auth_request_handler.get());
650
Lei Zhang 2014/07/17 19:28:44 nit: no random newlines please
Not at Google. Contact bengr 2014/07/18 17:33:57 Done.
654 network_delegate->set_on_resolve_proxy_handler( 651 network_delegate->set_on_resolve_proxy_handler(
655 globals_->on_resolve_proxy_handler); 652 globals_->on_resolve_proxy_handler);
656 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) 653
657 #endif // defined(OS_ANDROID) || defined(OS_IOS)
658 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( 654 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory(
659 globals_->host_resolver.get())); 655 globals_->host_resolver.get()));
660 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl()); 656 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl());
661 // For the ProxyScriptFetcher, we use a direct ProxyService. 657 // For the ProxyScriptFetcher, we use a direct ProxyService.
662 globals_->proxy_script_fetcher_proxy_service.reset( 658 globals_->proxy_script_fetcher_proxy_service.reset(
663 net::ProxyService::CreateDirectWithNetLog(net_log_)); 659 net::ProxyService::CreateDirectWithNetLog(net_log_));
664 // In-memory cookie store. 660 // In-memory cookie store.
665 globals_->system_cookie_store = 661 globals_->system_cookie_store =
666 content::CreateCookieStore(content::CookieStoreConfig()); 662 content::CreateCookieStore(content::CookieStoreConfig());
667 // In-memory server bound cert store. 663 // In-memory server bound cert store.
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 1080
1085 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 1081 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
1086 globals_->system_proxy_service.reset( 1082 globals_->system_proxy_service.reset(
1087 ProxyServiceFactory::CreateProxyService( 1083 ProxyServiceFactory::CreateProxyService(
1088 net_log_, 1084 net_log_,
1089 globals_->proxy_script_fetcher_context.get(), 1085 globals_->proxy_script_fetcher_context.get(),
1090 globals_->system_network_delegate.get(), 1086 globals_->system_network_delegate.get(),
1091 system_proxy_config_service_.release(), 1087 system_proxy_config_service_.release(),
1092 command_line, 1088 command_line,
1093 quick_check_enabled_.GetValue())); 1089 quick_check_enabled_.GetValue()));
1090 DCHECK(globals_->data_reduction_proxy_params);
1091 globals_->system_proxy_service->SetDataReductionProxyOrigins(
1092 globals_->data_reduction_proxy_params->GetDefaultOrigin(),
1093 globals_->data_reduction_proxy_params->GetDefaultFallbackOrigin());
1094 1094
1095 net::HttpNetworkSession::Params system_params; 1095 net::HttpNetworkSession::Params system_params;
1096 InitializeNetworkSessionParams(&system_params); 1096 InitializeNetworkSessionParams(&system_params);
1097 system_params.net_log = net_log_; 1097 system_params.net_log = net_log_;
1098 system_params.proxy_service = globals_->system_proxy_service.get(); 1098 system_params.proxy_service = globals_->system_proxy_service.get();
1099 1099
1100 globals_->system_http_transaction_factory.reset( 1100 globals_->system_http_transaction_factory.reset(
1101 new net::HttpNetworkLayer( 1101 new net::HttpNetworkLayer(
1102 new net::HttpNetworkSession(system_params))); 1102 new net::HttpNetworkSession(system_params)));
1103 globals_->system_url_request_job_factory.reset( 1103 globals_->system_url_request_job_factory.reset(
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); 1367 net::QuicVersionVector supported_versions = net::QuicSupportedVersions();
1368 for (size_t i = 0; i < supported_versions.size(); ++i) { 1368 for (size_t i = 0; i < supported_versions.size(); ++i) {
1369 net::QuicVersion version = supported_versions[i]; 1369 net::QuicVersion version = supported_versions[i];
1370 if (net::QuicVersionToString(version) == quic_version) { 1370 if (net::QuicVersionToString(version) == quic_version) {
1371 return version; 1371 return version;
1372 } 1372 }
1373 } 1373 }
1374 1374
1375 return net::QUIC_VERSION_UNSUPPORTED; 1375 return net::QUIC_VERSION_UNSUPPORTED;
1376 } 1376 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_field_trials_mobile.cc ('k') | chrome/browser/profiles/profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698