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/intranet_redirect_detector.h" | 5 #include "chrome/browser/intranet_redirect_detector.h" |
6 | 6 |
7 #include "base/rand_util.h" | 7 #include "base/rand_util.h" |
8 #include "base/stl_util-inl.h" | 8 #include "base/stl_util-inl.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 StartFetchesIfPossible(); | 151 StartFetchesIfPossible(); |
152 } | 152 } |
153 | 153 |
154 IntranetRedirectHostResolverProc::IntranetRedirectHostResolverProc( | 154 IntranetRedirectHostResolverProc::IntranetRedirectHostResolverProc( |
155 net::HostResolverProc* previous) | 155 net::HostResolverProc* previous) |
156 : net::HostResolverProc(previous) { | 156 : net::HostResolverProc(previous) { |
157 } | 157 } |
158 | 158 |
159 int IntranetRedirectHostResolverProc::Resolve(const std::string& host, | 159 int IntranetRedirectHostResolverProc::Resolve(const std::string& host, |
160 net::AddressFamily address_family, | 160 net::AddressFamily address_family, |
| 161 net::HostResolverFlags flags, |
161 net::AddressList* addrlist) { | 162 net::AddressList* addrlist) { |
162 // We'd love to just ask the IntranetRedirectDetector, but we may not be on | 163 // We'd love to just ask the IntranetRedirectDetector, but we may not be on |
163 // the same thread. So just use the heuristic that any all-lowercase a-z | 164 // the same thread. So just use the heuristic that any all-lowercase a-z |
164 // hostname with the right number of characters is likely from the detector | 165 // hostname with the right number of characters is likely from the detector |
165 // (and thus should be blocked). | 166 // (and thus should be blocked). |
166 return ((host.length() == IntranetRedirectDetector::kNumCharsInHostnames) && | 167 return ((host.length() == IntranetRedirectDetector::kNumCharsInHostnames) && |
167 (host.find_first_not_of("abcdefghijklmnopqrstuvwxyz") == | 168 (host.find_first_not_of("abcdefghijklmnopqrstuvwxyz") == |
168 std::string::npos)) ? | 169 std::string::npos)) ? |
169 net::ERR_NAME_NOT_RESOLVED : | 170 net::ERR_NAME_NOT_RESOLVED : |
170 ResolveUsingPrevious(host, address_family, addrlist); | 171 ResolveUsingPrevious(host, address_family, flags, addrlist); |
171 } | 172 } |
OLD | NEW |