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 // NB: Modelled after Mozilla's code (originally written by Pamela Greene, | 5 // NB: Modelled after Mozilla's code (originally written by Pamela Greene, |
6 // later modified by others), but almost entirely rewritten for Chrome. | 6 // later modified by others), but almost entirely rewritten for Chrome. |
7 // (netwerk/dns/src/nsEffectiveTLDService.cpp) | 7 // (netwerk/dns/src/nsEffectiveTLDService.cpp) |
8 /* ***** BEGIN LICENSE BLOCK ***** | 8 /* ***** BEGIN LICENSE BLOCK ***** |
9 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 9 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
10 * | 10 * |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 if ((host1.len <= 0) || (host1.len != host2.len)) | 212 if ((host1.len <= 0) || (host1.len != host2.len)) |
213 return false; | 213 return false; |
214 return !strncmp(gurl1.possibly_invalid_spec().data() + host1.begin, | 214 return !strncmp(gurl1.possibly_invalid_spec().data() + host1.begin, |
215 gurl2.possibly_invalid_spec().data() + host2.begin, | 215 gurl2.possibly_invalid_spec().data() + host2.begin, |
216 host1.len); | 216 host1.len); |
217 } | 217 } |
218 | 218 |
219 bool SameDomainOrHost(const url::Origin& origin1, | 219 bool SameDomainOrHost(const url::Origin& origin1, |
220 const url::Origin& origin2, | 220 const url::Origin& origin2, |
221 PrivateRegistryFilter filter) { | 221 PrivateRegistryFilter filter) { |
222 return SameDomainOrHost(GURL(origin1.Serialize()), GURL(origin2.Serialize()), | 222 return SameDomainOrHost(origin1.GetURL(), origin2.GetURL(), filter); |
223 filter); | |
224 } | 223 } |
225 | 224 |
226 size_t GetRegistryLength( | 225 size_t GetRegistryLength( |
227 const GURL& gurl, | 226 const GURL& gurl, |
228 UnknownRegistryFilter unknown_filter, | 227 UnknownRegistryFilter unknown_filter, |
229 PrivateRegistryFilter private_filter) { | 228 PrivateRegistryFilter private_filter) { |
230 base::StringPiece host = gurl.host_piece(); | 229 base::StringPiece host = gurl.host_piece(); |
231 if (host.empty()) | 230 if (host.empty()) |
232 return std::string::npos; | 231 return std::string::npos; |
233 if (gurl.HostIsIPAddress()) | 232 if (gurl.HostIsIPAddress()) |
(...skipping 20 matching lines...) Expand all Loading... |
254 | 253 |
255 void SetFindDomainGraph(const unsigned char* domains, size_t length) { | 254 void SetFindDomainGraph(const unsigned char* domains, size_t length) { |
256 CHECK(domains); | 255 CHECK(domains); |
257 CHECK_NE(length, 0u); | 256 CHECK_NE(length, 0u); |
258 g_graph = domains; | 257 g_graph = domains; |
259 g_graph_length = length; | 258 g_graph_length = length; |
260 } | 259 } |
261 | 260 |
262 } // namespace registry_controlled_domains | 261 } // namespace registry_controlled_domains |
263 } // namespace net | 262 } // namespace net |
OLD | NEW |