| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/leak_tracker.h" | 7 #include "base/leak_tracker.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chrome_thread.h" | 10 #include "chrome/browser/chrome_thread.h" |
| 11 #include "chrome/browser/gpu_process_host.h" | 11 #include "chrome/browser/gpu_process_host.h" |
| 12 #include "chrome/browser/net/chrome_net_log.h" | 12 #include "chrome/browser/net/chrome_net_log.h" |
| 13 #include "chrome/browser/net/dns_global.h" | 13 #include "chrome/browser/net/dns_global.h" |
| 14 #include "chrome/browser/net/passive_log_collector.h" | 14 #include "chrome/browser/net/passive_log_collector.h" |
| 15 #include "chrome/browser/net/url_fetcher.h" | 15 #include "chrome/browser/net/url_fetcher.h" |
| 16 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
| 17 #include "net/base/mapped_host_resolver.h" | 17 #include "net/base/mapped_host_resolver.h" |
| 18 #include "net/base/host_cache.h" | 18 #include "net/base/host_cache.h" |
| 19 #include "net/base/host_resolver.h" | 19 #include "net/base/host_resolver.h" |
| 20 #include "net/base/host_resolver_impl.h" | 20 #include "net/base/host_resolver_impl.h" |
| 21 #include "net/base/net_util.h" | 21 #include "net/base/net_util.h" |
| 22 #include "net/base/network_change_notifier.h" | 22 #include "net/base/network_change_notifier.h" |
| 23 #include "net/http/http_auth_filter.h" | 23 #include "net/http/http_auth_filter.h" |
| 24 #include "net/http/http_auth_handler_factory.h" | 24 #include "net/http/http_auth_handler_factory.h" |
| 25 #include "net/http/http_auth_handler_negotiate.h" |
| 25 #include "net/url_request/url_request.h" | 26 #include "net/url_request/url_request.h" |
| 26 | 27 |
| 27 namespace { | 28 namespace { |
| 28 | 29 |
| 29 net::HostResolver* CreateGlobalHostResolver( | 30 net::HostResolver* CreateGlobalHostResolver( |
| 30 net::NetworkChangeNotifier* network_change_notifier) { | 31 net::NetworkChangeNotifier* network_change_notifier) { |
| 31 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 32 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 32 net::HostResolver* global_host_resolver = | 33 net::HostResolver* global_host_resolver = |
| 33 net::CreateSystemHostResolver(network_change_notifier); | 34 net::CreateSystemHostResolver(network_change_notifier); |
| 34 | 35 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 new net::HttpAuthFilterWhitelist(); | 207 new net::HttpAuthFilterWhitelist(); |
| 207 net::HttpAuthFilterWhitelist* negotiate_filter = | 208 net::HttpAuthFilterWhitelist* negotiate_filter = |
| 208 new net::HttpAuthFilterWhitelist(); | 209 new net::HttpAuthFilterWhitelist(); |
| 209 | 210 |
| 210 ntlm_filter->SetWhitelist(auth_server_whitelist); | 211 ntlm_filter->SetWhitelist(auth_server_whitelist); |
| 211 negotiate_filter->SetWhitelist(auth_server_whitelist); | 212 negotiate_filter->SetWhitelist(auth_server_whitelist); |
| 212 registry_factory->SetFilter("ntlm", ntlm_filter); | 213 registry_factory->SetFilter("ntlm", ntlm_filter); |
| 213 registry_factory->SetFilter("negotiate", negotiate_filter); | 214 registry_factory->SetFilter("negotiate", negotiate_filter); |
| 214 } | 215 } |
| 215 | 216 |
| 217 // Configure the Negotiate settings for the Kerberos SPN. |
| 218 // TODO(cbentzel): Read the related IE registry settings on Windows builds. |
| 219 // TODO(cbentzel): Ugly use of static_cast here. |
| 220 net::HttpAuthHandlerNegotiate::Factory* negotiate_factory = |
| 221 static_cast<net::HttpAuthHandlerNegotiate::Factory*>( |
| 222 registry_factory->GetSchemeFactory("negotiate")); |
| 223 DCHECK(negotiate_factory); |
| 224 if (command_line.HasSwitch(switches::kDisableAuthNegotiateCnameLookup)) |
| 225 negotiate_factory->set_disable_cname_lookup(true); |
| 226 if (command_line.HasSwitch(switches::kEnableAuthNegotiatePort)) |
| 227 negotiate_factory->set_use_port(true); |
| 228 |
| 216 return registry_factory; | 229 return registry_factory; |
| 217 } | 230 } |
| 218 | 231 |
| 219 void IOThread::InitDnsMasterOnIOThread( | 232 void IOThread::InitDnsMasterOnIOThread( |
| 220 bool prefetching_enabled, | 233 bool prefetching_enabled, |
| 221 base::TimeDelta max_queue_delay, | 234 base::TimeDelta max_queue_delay, |
| 222 size_t max_concurrent, | 235 size_t max_concurrent, |
| 223 chrome_common_net::NameList hostnames_to_prefetch, | 236 chrome_common_net::NameList hostnames_to_prefetch, |
| 224 ListValue* referral_list) { | 237 ListValue* referral_list) { |
| 225 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); | 238 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 253 net::HostCache* host_cache = | 266 net::HostCache* host_cache = |
| 254 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache(); | 267 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache(); |
| 255 if (host_cache) | 268 if (host_cache) |
| 256 host_cache->clear(); | 269 host_cache->clear(); |
| 257 } | 270 } |
| 258 // Clear all of the passively logged data. | 271 // Clear all of the passively logged data. |
| 259 // TODO(eroman): this is a bit heavy handed, really all we need to do is | 272 // TODO(eroman): this is a bit heavy handed, really all we need to do is |
| 260 // clear the data pertaining to off the record context. | 273 // clear the data pertaining to off the record context. |
| 261 globals_->net_log->passive_collector()->Clear(); | 274 globals_->net_log->passive_collector()->Clear(); |
| 262 } | 275 } |
| OLD | NEW |