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

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: Created 6 years, 6 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 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 "content/public/browser/browser_thread.h" 45 #include "content/public/browser/browser_thread.h"
47 #include "content/public/browser/cookie_store_factory.h" 46 #include "content/public/browser/cookie_store_factory.h"
48 #include "net/base/host_mapping_rules.h" 47 #include "net/base/host_mapping_rules.h"
49 #include "net/base/net_util.h" 48 #include "net/base/net_util.h"
50 #include "net/cert/cert_verifier.h" 49 #include "net/cert/cert_verifier.h"
51 #include "net/cert/cert_verify_proc.h" 50 #include "net/cert/cert_verify_proc.h"
52 #include "net/cert/ct_known_logs.h" 51 #include "net/cert/ct_known_logs.h"
53 #include "net/cert/ct_verifier.h" 52 #include "net/cert/ct_verifier.h"
54 #include "net/cert/multi_threaded_cert_verifier.h" 53 #include "net/cert/multi_threaded_cert_verifier.h"
(...skipping 30 matching lines...) Expand all
85 #if !defined(USE_OPENSSL) 84 #if !defined(USE_OPENSSL)
86 #include "net/cert/ct_log_verifier.h" 85 #include "net/cert/ct_log_verifier.h"
87 #include "net/cert/multi_log_ct_verifier.h" 86 #include "net/cert/multi_log_ct_verifier.h"
88 #endif 87 #endif
89 88
90 #if defined(USE_NSS) || defined(OS_IOS) 89 #if defined(USE_NSS) || defined(OS_IOS)
91 #include "net/ocsp/nss_ocsp.h" 90 #include "net/ocsp/nss_ocsp.h"
92 #endif 91 #endif
93 92
94 #if defined(OS_ANDROID) || defined(OS_IOS) 93 #if defined(OS_ANDROID) || defined(OS_IOS)
94 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ est_handler.h"
95 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" 95 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
96 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h" 96 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h"
97 #endif 97 #endif
98 98
99 #if defined(OS_CHROMEOS) 99 #if defined(OS_CHROMEOS)
100 #include "chrome/browser/chromeos/login/users/user_manager.h" 100 #include "chrome/browser/chromeos/login/users/user_manager.h"
101 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h" 101 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h"
102 #include "chromeos/network/host_resolver_impl_chromeos.h" 102 #include "chromeos/network/host_resolver_impl_chromeos.h"
103 #endif 103 #endif
104 104
105 using content::BrowserThread; 105 using content::BrowserThread;
106 106
107 #if defined(OS_ANDROID) || defined(OS_IOS) 107 #if defined(OS_ANDROID) || defined(OS_IOS)
108 using data_reduction_proxy::DataReductionProxyAuthRequestHandler;
108 using data_reduction_proxy::DataReductionProxyParams; 109 using data_reduction_proxy::DataReductionProxyParams;
109 using data_reduction_proxy::DataReductionProxySettings; 110 using data_reduction_proxy::DataReductionProxySettings;
110 #endif 111 #endif
111 112
112 class SafeBrowsingURLRequestContext; 113 class SafeBrowsingURLRequestContext;
113 114
114 // 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
115 // Quit task, so base::Bind() calls are not refcounted. 116 // Quit task, so base::Bind() calls are not refcounted.
116 117
117 namespace { 118 namespace {
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 #if defined(SPDY_PROXY_AUTH_ORIGIN) 606 #if defined(SPDY_PROXY_AUTH_ORIGIN)
606 int drp_flags = DataReductionProxyParams::kFallbackAllowed; 607 int drp_flags = DataReductionProxyParams::kFallbackAllowed;
607 if (DataReductionProxyParams::IsIncludedInFieldTrial()) 608 if (DataReductionProxyParams::IsIncludedInFieldTrial())
608 drp_flags |= DataReductionProxyParams::kAllowed; 609 drp_flags |= DataReductionProxyParams::kAllowed;
609 if (DataReductionProxyParams::IsIncludedInAlternativeFieldTrial()) 610 if (DataReductionProxyParams::IsIncludedInAlternativeFieldTrial())
610 drp_flags |= DataReductionProxyParams::kAlternativeAllowed; 611 drp_flags |= DataReductionProxyParams::kAlternativeAllowed;
611 if (DataReductionProxyParams::IsIncludedInPromoFieldTrial()) 612 if (DataReductionProxyParams::IsIncludedInPromoFieldTrial())
612 drp_flags |= DataReductionProxyParams::kPromoAllowed; 613 drp_flags |= DataReductionProxyParams::kPromoAllowed;
613 globals_->data_reduction_proxy_params.reset( 614 globals_->data_reduction_proxy_params.reset(
614 new DataReductionProxyParams(drp_flags)); 615 new DataReductionProxyParams(drp_flags));
615 network_delegate->set_data_reduction_proxy_params( 616 globals_->data_reduction_proxy_auth_request_handler.reset(
616 globals_->data_reduction_proxy_params.get()); 617 new DataReductionProxyAuthRequestHandler(
618 globals_->data_reduction_proxy_params.get()));
617 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) 619 #endif // defined(SPDY_PROXY_AUTH_ORIGIN)
618 #endif // defined(OS_ANDROID) || defined(OS_IOS) 620 #endif // defined(OS_ANDROID) || defined(OS_IOS)
619 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( 621 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory(
620 globals_->host_resolver.get())); 622 globals_->host_resolver.get()));
621 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl()); 623 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl());
622 // For the ProxyScriptFetcher, we use a direct ProxyService. 624 // For the ProxyScriptFetcher, we use a direct ProxyService.
623 globals_->proxy_script_fetcher_proxy_service.reset( 625 globals_->proxy_script_fetcher_proxy_service.reset(
624 net::ProxyService::CreateDirectWithNetLog(net_log_)); 626 net::ProxyService::CreateDirectWithNetLog(net_log_));
625 // In-memory cookie store. 627 // In-memory cookie store.
626 globals_->system_cookie_store = 628 globals_->system_cookie_store =
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 net::URLSecurityManager::Create(auth_filter_default_credentials, 904 net::URLSecurityManager::Create(auth_filter_default_credentials,
903 auth_filter_delegate)); 905 auth_filter_delegate));
904 std::vector<std::string> supported_schemes; 906 std::vector<std::string> supported_schemes;
905 base::SplitString(auth_schemes_, ',', &supported_schemes); 907 base::SplitString(auth_schemes_, ',', &supported_schemes);
906 908
907 scoped_ptr<net::HttpAuthHandlerRegistryFactory> registry_factory( 909 scoped_ptr<net::HttpAuthHandlerRegistryFactory> registry_factory(
908 net::HttpAuthHandlerRegistryFactory::Create( 910 net::HttpAuthHandlerRegistryFactory::Create(
909 supported_schemes, globals_->url_security_manager.get(), 911 supported_schemes, globals_->url_security_manager.get(),
910 resolver, gssapi_library_name_, negotiate_disable_cname_lookup_, 912 resolver, gssapi_library_name_, negotiate_disable_cname_lookup_,
911 negotiate_enable_port_)); 913 negotiate_enable_port_));
912
913 if (globals_->data_reduction_proxy_params.get()) {
914 std::vector<GURL> data_reduction_proxies =
915 globals_->data_reduction_proxy_params->GetAllowedProxies();
916 if (!data_reduction_proxies.empty()) {
917 registry_factory->RegisterSchemeFactory(
918 "spdyproxy",
919 new data_reduction_proxy::HttpAuthHandlerDataReductionProxy::Factory(
920 data_reduction_proxies));
921 }
922 }
923
924 return registry_factory.release(); 914 return registry_factory.release();
925 } 915 }
926 916
927 void IOThread::ClearHostCache() { 917 void IOThread::ClearHostCache() {
928 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 918 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
929 919
930 net::HostCache* host_cache = globals_->host_resolver->GetHostCache(); 920 net::HostCache* host_cache = globals_->host_resolver->GetHostCache();
931 if (host_cache) 921 if (host_cache)
932 host_cache->clear(); 922 host_cache->clear();
933 } 923 }
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 std::string version_flag = 1205 std::string version_flag =
1216 command_line.GetSwitchValueASCII(switches::kQuicVersion); 1206 command_line.GetSwitchValueASCII(switches::kQuicVersion);
1217 for (size_t i = 0; i < supported_versions.size(); ++i) { 1207 for (size_t i = 0; i < supported_versions.size(); ++i) {
1218 net::QuicVersion version = supported_versions[i]; 1208 net::QuicVersion version = supported_versions[i];
1219 if (net::QuicVersionToString(version) == version_flag) { 1209 if (net::QuicVersionToString(version) == version_flag) {
1220 return version; 1210 return version;
1221 } 1211 }
1222 } 1212 }
1223 return net::QUIC_VERSION_UNSUPPORTED; 1213 return net::QUIC_VERSION_UNSUPPORTED;
1224 } 1214 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698