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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 new ChromeNetworkDelegate(extension_event_router_forwarder_, | 482 new ChromeNetworkDelegate(extension_event_router_forwarder_, |
483 &system_enable_referrers_); | 483 &system_enable_referrers_); |
484 if (command_line.HasSwitch(switches::kDisableExtensionsHttpThrottling)) | 484 if (command_line.HasSwitch(switches::kDisableExtensionsHttpThrottling)) |
485 network_delegate->NeverThrottleRequests(); | 485 network_delegate->NeverThrottleRequests(); |
486 globals_->system_network_delegate.reset(network_delegate); | 486 globals_->system_network_delegate.reset(network_delegate); |
487 globals_->host_resolver = CreateGlobalHostResolver(net_log_); | 487 globals_->host_resolver = CreateGlobalHostResolver(net_log_); |
488 UpdateDnsClientEnabled(); | 488 UpdateDnsClientEnabled(); |
489 globals_->cert_verifier.reset(net::CertVerifier::CreateDefault()); | 489 globals_->cert_verifier.reset(net::CertVerifier::CreateDefault()); |
490 globals_->transport_security_state.reset(new net::TransportSecurityState()); | 490 globals_->transport_security_state.reset(new net::TransportSecurityState()); |
491 globals_->ssl_config_service = GetSSLConfigService(); | 491 globals_->ssl_config_service = GetSSLConfigService(); |
492 if (command_line.HasSwitch(switches::kSpdyProxyOrigin)) { | 492 if (command_line.HasSwitch(switches::kSpdyProxyAuthOrigin)) { |
493 spdyproxy_origin_ = | 493 spdyproxy_auth_origin_ = |
494 command_line.GetSwitchValueASCII(switches::kSpdyProxyOrigin); | 494 command_line.GetSwitchValueASCII(switches::kSpdyProxyAuthOrigin); |
| 495 } else { |
| 496 #if defined(SPDY_PROXY_AUTH_ORIGIN) |
| 497 spdyproxy_auth_origin_ = SPDY_PROXY_AUTH_ORIGIN; |
| 498 #endif |
495 } | 499 } |
496 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( | 500 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( |
497 globals_->host_resolver.get())); | 501 globals_->host_resolver.get())); |
498 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl); | 502 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl); |
499 // For the ProxyScriptFetcher, we use a direct ProxyService. | 503 // For the ProxyScriptFetcher, we use a direct ProxyService. |
500 globals_->proxy_script_fetcher_proxy_service.reset( | 504 globals_->proxy_script_fetcher_proxy_service.reset( |
501 net::ProxyService::CreateDirectWithNetLog(net_log_)); | 505 net::ProxyService::CreateDirectWithNetLog(net_log_)); |
502 // In-memory cookie store. | 506 // In-memory cookie store. |
503 globals_->system_cookie_store = new net::CookieMonster(NULL, NULL); | 507 globals_->system_cookie_store = new net::CookieMonster(NULL, NULL); |
504 // In-memory server bound cert store. | 508 // In-memory server bound cert store. |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 void IOThread::RegisterPrefs(PrefRegistrySimple* registry) { | 748 void IOThread::RegisterPrefs(PrefRegistrySimple* registry) { |
745 registry->RegisterStringPref(prefs::kAuthSchemes, | 749 registry->RegisterStringPref(prefs::kAuthSchemes, |
746 "basic,digest,ntlm,negotiate," | 750 "basic,digest,ntlm,negotiate," |
747 "spdyproxy"); | 751 "spdyproxy"); |
748 registry->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup, | 752 registry->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup, |
749 false); | 753 false); |
750 registry->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false); | 754 registry->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false); |
751 registry->RegisterStringPref(prefs::kAuthServerWhitelist, ""); | 755 registry->RegisterStringPref(prefs::kAuthServerWhitelist, ""); |
752 registry->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, ""); | 756 registry->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, ""); |
753 registry->RegisterStringPref(prefs::kGSSAPILibraryName, ""); | 757 registry->RegisterStringPref(prefs::kGSSAPILibraryName, ""); |
754 registry->RegisterStringPref(prefs::kSpdyProxyOrigin, ""); | 758 registry->RegisterStringPref(prefs::kSpdyProxyAuthOrigin, ""); |
755 registry->RegisterBooleanPref(prefs::kEnableReferrers, true); | 759 registry->RegisterBooleanPref(prefs::kEnableReferrers, true); |
756 registry->RegisterInt64Pref(prefs::kHttpReceivedContentLength, 0); | 760 registry->RegisterInt64Pref(prefs::kHttpReceivedContentLength, 0); |
757 registry->RegisterInt64Pref(prefs::kHttpOriginalContentLength, 0); | 761 registry->RegisterInt64Pref(prefs::kHttpOriginalContentLength, 0); |
758 registry->RegisterBooleanPref( | 762 registry->RegisterBooleanPref( |
759 prefs::kBuiltInDnsClientEnabled, | 763 prefs::kBuiltInDnsClientEnabled, |
760 chrome_browser_net::ConfigureAsyncDnsFieldTrial()); | 764 chrome_browser_net::ConfigureAsyncDnsFieldTrial()); |
761 } | 765 } |
762 | 766 |
763 net::HttpAuthHandlerFactory* IOThread::CreateDefaultAuthHandlerFactory( | 767 net::HttpAuthHandlerFactory* IOThread::CreateDefaultAuthHandlerFactory( |
764 net::HostResolver* resolver) { | 768 net::HostResolver* resolver) { |
(...skipping 12 matching lines...) Expand all Loading... |
777 auth_filter_delegate)); | 781 auth_filter_delegate)); |
778 std::vector<std::string> supported_schemes; | 782 std::vector<std::string> supported_schemes; |
779 base::SplitString(auth_schemes_, ',', &supported_schemes); | 783 base::SplitString(auth_schemes_, ',', &supported_schemes); |
780 | 784 |
781 scoped_ptr<net::HttpAuthHandlerRegistryFactory> registry_factory( | 785 scoped_ptr<net::HttpAuthHandlerRegistryFactory> registry_factory( |
782 net::HttpAuthHandlerRegistryFactory::Create( | 786 net::HttpAuthHandlerRegistryFactory::Create( |
783 supported_schemes, globals_->url_security_manager.get(), | 787 supported_schemes, globals_->url_security_manager.get(), |
784 resolver, gssapi_library_name_, negotiate_disable_cname_lookup_, | 788 resolver, gssapi_library_name_, negotiate_disable_cname_lookup_, |
785 negotiate_enable_port_)); | 789 negotiate_enable_port_)); |
786 | 790 |
787 if (!spdyproxy_origin_.empty()) { | 791 if (!spdyproxy_auth_origin_.empty()) { |
788 GURL origin_url(spdyproxy_origin_); | 792 GURL origin_url(spdyproxy_auth_origin_); |
789 if (origin_url.is_valid()) { | 793 if (origin_url.is_valid()) { |
790 registry_factory->RegisterSchemeFactory( | 794 registry_factory->RegisterSchemeFactory( |
791 "spdyproxy", | 795 "spdyproxy", |
792 new spdyproxy::HttpAuthHandlerSpdyProxy::Factory(origin_url)); | 796 new spdyproxy::HttpAuthHandlerSpdyProxy::Factory(origin_url)); |
793 } else { | 797 } else { |
794 LOG(WARNING) << "Skipping creation of SpdyProxy auth handler since " | 798 LOG(WARNING) << "Skipping creation of SpdyProxy auth handler since " |
795 << "authorized origin is invalid: " | 799 << "authorized origin is invalid: " |
796 << spdyproxy_origin_; | 800 << spdyproxy_auth_origin_; |
797 } | 801 } |
798 } | 802 } |
799 | 803 |
800 return registry_factory.release(); | 804 return registry_factory.release(); |
801 } | 805 } |
802 | 806 |
803 void IOThread::ClearHostCache() { | 807 void IOThread::ClearHostCache() { |
804 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 808 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
805 | 809 |
806 net::HostCache* host_cache = globals_->host_resolver->GetHostCache(); | 810 net::HostCache* host_cache = globals_->host_resolver->GetHostCache(); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 globals_->system_request_context.reset( | 914 globals_->system_request_context.reset( |
911 ConstructSystemRequestContext(globals_, net_log_)); | 915 ConstructSystemRequestContext(globals_, net_log_)); |
912 | 916 |
913 sdch_manager_->set_sdch_fetcher( | 917 sdch_manager_->set_sdch_fetcher( |
914 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); | 918 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); |
915 } | 919 } |
916 | 920 |
917 void IOThread::UpdateDnsClientEnabled() { | 921 void IOThread::UpdateDnsClientEnabled() { |
918 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); | 922 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); |
919 } | 923 } |
OLD | NEW |