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

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

Issue 333113002: Move data reduction proxy to Chrome-Proxy header for authentication (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@flywheel-refactor-net-fake-a-redirect-response-headers-chrome-proxy-auth
Patch Set: errata 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
« no previous file with comments | « chrome/browser/io_thread.h ('k') | chrome/browser/net/chrome_network_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 23 matching lines...) Expand all
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_prefs.h" 43 #include "components/data_reduction_proxy/browser/data_reduction_proxy_prefs.h"
44 #include "components/data_reduction_proxy/browser/http_auth_handler_data_reducti on_proxy.h"
45 #include "components/policy/core/common/policy_service.h" 44 #include "components/policy/core/common/policy_service.h"
46 #include "components/variations/variations_associated_data.h" 45 #include "components/variations/variations_associated_data.h"
47 #include "content/public/browser/browser_thread.h" 46 #include "content/public/browser/browser_thread.h"
48 #include "content/public/browser/cookie_store_factory.h" 47 #include "content/public/browser/cookie_store_factory.h"
49 #include "net/base/host_mapping_rules.h" 48 #include "net/base/host_mapping_rules.h"
50 #include "net/base/net_util.h" 49 #include "net/base/net_util.h"
51 #include "net/cert/cert_verifier.h" 50 #include "net/cert/cert_verifier.h"
52 #include "net/cert/cert_verify_proc.h" 51 #include "net/cert/cert_verify_proc.h"
53 #include "net/cert/ct_known_logs.h" 52 #include "net/cert/ct_known_logs.h"
54 #include "net/cert/ct_verifier.h" 53 #include "net/cert/ct_verifier.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 #if !defined(USE_OPENSSL) 85 #if !defined(USE_OPENSSL)
87 #include "net/cert/ct_log_verifier.h" 86 #include "net/cert/ct_log_verifier.h"
88 #include "net/cert/multi_log_ct_verifier.h" 87 #include "net/cert/multi_log_ct_verifier.h"
89 #endif 88 #endif
90 89
91 #if defined(USE_NSS) || defined(OS_IOS) 90 #if defined(USE_NSS) || defined(OS_IOS)
92 #include "net/ocsp/nss_ocsp.h" 91 #include "net/ocsp/nss_ocsp.h"
93 #endif 92 #endif
94 93
95 #if defined(OS_ANDROID) || defined(OS_IOS) 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" 96 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
97 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h" 97 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h"
98 #endif 98 #endif
99 99
100 #if defined(OS_CHROMEOS) 100 #if defined(OS_CHROMEOS)
101 #include "chrome/browser/chromeos/login/users/user_manager.h" 101 #include "chrome/browser/chromeos/login/users/user_manager.h"
102 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h" 102 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h"
103 #include "chromeos/network/host_resolver_impl_chromeos.h" 103 #include "chromeos/network/host_resolver_impl_chromeos.h"
104 #endif 104 #endif
105 105
106 using content::BrowserThread; 106 using content::BrowserThread;
107 107
108 #if defined(OS_ANDROID) || defined(OS_IOS) 108 #if defined(OS_ANDROID) || defined(OS_IOS)
109 using data_reduction_proxy::DataReductionProxyAuthRequestHandler;
109 using data_reduction_proxy::DataReductionProxyParams; 110 using data_reduction_proxy::DataReductionProxyParams;
110 using data_reduction_proxy::DataReductionProxyUsageStats; 111 using data_reduction_proxy::DataReductionProxyUsageStats;
111 using data_reduction_proxy::DataReductionProxySettings; 112 using data_reduction_proxy::DataReductionProxySettings;
112 #endif 113 #endif
113 114
114 class SafeBrowsingURLRequestContext; 115 class SafeBrowsingURLRequestContext;
115 116
116 // The IOThread object must outlive any tasks posted to the IO thread before the 117 // The IOThread object must outlive any tasks posted to the IO thread before the
117 // Quit task, so base::Bind() calls are not refcounted. 118 // Quit task, so base::Bind() calls are not refcounted.
118 119
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 int drp_flags = DataReductionProxyParams::kFallbackAllowed; 619 int drp_flags = DataReductionProxyParams::kFallbackAllowed;
619 if (DataReductionProxyParams::IsIncludedInFieldTrial()) 620 if (DataReductionProxyParams::IsIncludedInFieldTrial())
620 drp_flags |= DataReductionProxyParams::kAllowed; 621 drp_flags |= DataReductionProxyParams::kAllowed;
621 if (DataReductionProxyParams::IsIncludedInAlternativeFieldTrial()) 622 if (DataReductionProxyParams::IsIncludedInAlternativeFieldTrial())
622 drp_flags |= DataReductionProxyParams::kAlternativeAllowed; 623 drp_flags |= DataReductionProxyParams::kAlternativeAllowed;
623 if (DataReductionProxyParams::IsIncludedInPromoFieldTrial()) 624 if (DataReductionProxyParams::IsIncludedInPromoFieldTrial())
624 drp_flags |= DataReductionProxyParams::kPromoAllowed; 625 drp_flags |= DataReductionProxyParams::kPromoAllowed;
625 DataReductionProxyParams* proxy_params = 626 DataReductionProxyParams* proxy_params =
626 new DataReductionProxyParams(drp_flags); 627 new DataReductionProxyParams(drp_flags);
627 globals_->data_reduction_proxy_params.reset(proxy_params); 628 globals_->data_reduction_proxy_params.reset(proxy_params);
628 network_delegate->set_data_reduction_proxy_params(proxy_params); 629 globals_->data_reduction_proxy_auth_request_handler.reset(
630 new DataReductionProxyAuthRequestHandler(proxy_params));
629 DataReductionProxyUsageStats* proxy_usage_stats = 631 DataReductionProxyUsageStats* proxy_usage_stats =
630 new DataReductionProxyUsageStats(proxy_params, 632 new DataReductionProxyUsageStats(proxy_params,
631 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), 633 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
632 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 634 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
635 network_delegate->set_data_reduction_proxy_params(proxy_params);
633 globals_->data_reduction_proxy_usage_stats.reset(proxy_usage_stats); 636 globals_->data_reduction_proxy_usage_stats.reset(proxy_usage_stats);
634 network_delegate->set_data_reduction_proxy_usage_stats(proxy_usage_stats); 637 network_delegate->set_data_reduction_proxy_usage_stats(proxy_usage_stats);
638 network_delegate->set_data_reduction_proxy_auth_request_handler(
639 globals_->data_reduction_proxy_auth_request_handler.get());
635 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) 640 #endif // defined(SPDY_PROXY_AUTH_ORIGIN)
636 #endif // defined(OS_ANDROID) || defined(OS_IOS) 641 #endif // defined(OS_ANDROID) || defined(OS_IOS)
637 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( 642 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory(
638 globals_->host_resolver.get())); 643 globals_->host_resolver.get()));
639 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl()); 644 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl());
640 // For the ProxyScriptFetcher, we use a direct ProxyService. 645 // For the ProxyScriptFetcher, we use a direct ProxyService.
641 globals_->proxy_script_fetcher_proxy_service.reset( 646 globals_->proxy_script_fetcher_proxy_service.reset(
642 net::ProxyService::CreateDirectWithNetLog(net_log_)); 647 net::ProxyService::CreateDirectWithNetLog(net_log_));
643 // In-memory cookie store. 648 // In-memory cookie store.
644 globals_->system_cookie_store = 649 globals_->system_cookie_store =
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 net::URLSecurityManager::Create(auth_filter_default_credentials, 925 net::URLSecurityManager::Create(auth_filter_default_credentials,
921 auth_filter_delegate)); 926 auth_filter_delegate));
922 std::vector<std::string> supported_schemes; 927 std::vector<std::string> supported_schemes;
923 base::SplitString(auth_schemes_, ',', &supported_schemes); 928 base::SplitString(auth_schemes_, ',', &supported_schemes);
924 929
925 scoped_ptr<net::HttpAuthHandlerRegistryFactory> registry_factory( 930 scoped_ptr<net::HttpAuthHandlerRegistryFactory> registry_factory(
926 net::HttpAuthHandlerRegistryFactory::Create( 931 net::HttpAuthHandlerRegistryFactory::Create(
927 supported_schemes, globals_->url_security_manager.get(), 932 supported_schemes, globals_->url_security_manager.get(),
928 resolver, gssapi_library_name_, negotiate_disable_cname_lookup_, 933 resolver, gssapi_library_name_, negotiate_disable_cname_lookup_,
929 negotiate_enable_port_)); 934 negotiate_enable_port_));
930
931 if (globals_->data_reduction_proxy_params.get()) {
932 std::vector<GURL> data_reduction_proxies =
933 globals_->data_reduction_proxy_params->GetAllowedProxies();
934 if (!data_reduction_proxies.empty()) {
935 registry_factory->RegisterSchemeFactory(
936 "spdyproxy",
937 new data_reduction_proxy::HttpAuthHandlerDataReductionProxy::Factory(
938 data_reduction_proxies));
939 }
940 }
941
942 return registry_factory.release(); 935 return registry_factory.release();
943 } 936 }
944 937
945 void IOThread::ClearHostCache() { 938 void IOThread::ClearHostCache() {
946 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 939 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
947 940
948 net::HostCache* host_cache = globals_->host_resolver->GetHostCache(); 941 net::HostCache* host_cache = globals_->host_resolver->GetHostCache();
949 if (host_cache) 942 if (host_cache)
950 host_cache->clear(); 943 host_cache->clear();
951 } 944 }
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); 1296 net::QuicVersionVector supported_versions = net::QuicSupportedVersions();
1304 for (size_t i = 0; i < supported_versions.size(); ++i) { 1297 for (size_t i = 0; i < supported_versions.size(); ++i) {
1305 net::QuicVersion version = supported_versions[i]; 1298 net::QuicVersion version = supported_versions[i];
1306 if (net::QuicVersionToString(version) == quic_version) { 1299 if (net::QuicVersionToString(version) == quic_version) {
1307 return version; 1300 return version;
1308 } 1301 }
1309 } 1302 }
1310 1303
1311 return net::QUIC_VERSION_UNSUPPORTED; 1304 return net::QUIC_VERSION_UNSUPPORTED;
1312 } 1305 }
OLDNEW
« no previous file with comments | « chrome/browser/io_thread.h ('k') | chrome/browser/net/chrome_network_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698