Chromium Code Reviews| 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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(origin1.GetURL(), origin2.GetURL(), filter); | 222 return SameDomainOrHost(origin1.GetURL(), origin2.GetURL(), filter); |
| 223 } | 223 } |
| 224 | 224 |
| 225 bool SameDomainOrHost(const url::Origin& origin1, | |
| 226 const base::Optional<url::Origin>& origin2, | |
| 227 PrivateRegistryFilter filter) { | |
| 228 return SameDomainOrHost( | |
| 229 origin1, origin2.has_value() ? origin2.value() : url::Origin(), filter); | |
|
Mike West
2016/10/14 13:05:59
Rather than passing in `url::Origin()`, could you
clamy
2016/10/19 16:00:43
Done.
| |
| 230 } | |
| 231 | |
| 225 size_t GetRegistryLength( | 232 size_t GetRegistryLength( |
| 226 const GURL& gurl, | 233 const GURL& gurl, |
| 227 UnknownRegistryFilter unknown_filter, | 234 UnknownRegistryFilter unknown_filter, |
| 228 PrivateRegistryFilter private_filter) { | 235 PrivateRegistryFilter private_filter) { |
| 229 base::StringPiece host = gurl.host_piece(); | 236 base::StringPiece host = gurl.host_piece(); |
| 230 if (host.empty()) | 237 if (host.empty()) |
| 231 return std::string::npos; | 238 return std::string::npos; |
| 232 if (gurl.HostIsIPAddress()) | 239 if (gurl.HostIsIPAddress()) |
| 233 return 0; | 240 return 0; |
| 234 return GetRegistryLengthImpl(host, unknown_filter, private_filter); | 241 return GetRegistryLengthImpl(host, unknown_filter, private_filter); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 253 | 260 |
| 254 void SetFindDomainGraph(const unsigned char* domains, size_t length) { | 261 void SetFindDomainGraph(const unsigned char* domains, size_t length) { |
| 255 CHECK(domains); | 262 CHECK(domains); |
| 256 CHECK_NE(length, 0u); | 263 CHECK_NE(length, 0u); |
| 257 g_graph = domains; | 264 g_graph = domains; |
| 258 g_graph_length = length; | 265 g_graph_length = length; |
| 259 } | 266 } |
| 260 | 267 |
| 261 } // namespace registry_controlled_domains | 268 } // namespace registry_controlled_domains |
| 262 } // namespace net | 269 } // namespace net |
| OLD | NEW |