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.h) | 7 // (netwerk/dns/src/nsEffectiveTLDService.h) |
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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 // represent hosts "on the same site". | 197 // represent hosts "on the same site". |
198 NET_EXPORT bool SameDomainOrHost(const GURL& gurl1, const GURL& gurl2, | 198 NET_EXPORT bool SameDomainOrHost(const GURL& gurl1, const GURL& gurl2, |
199 PrivateRegistryFilter filter); | 199 PrivateRegistryFilter filter); |
200 NET_EXPORT bool SameDomainOrHost(const url::Origin& origin1, | 200 NET_EXPORT bool SameDomainOrHost(const url::Origin& origin1, |
201 const url::Origin& origin2, | 201 const url::Origin& origin2, |
202 PrivateRegistryFilter filter); | 202 PrivateRegistryFilter filter); |
203 // Note: this returns false if |origin2| is not set. | 203 // Note: this returns false if |origin2| is not set. |
204 NET_EXPORT bool SameDomainOrHost(const url::Origin& origin1, | 204 NET_EXPORT bool SameDomainOrHost(const url::Origin& origin1, |
205 const base::Optional<url::Origin>& origin2, | 205 const base::Optional<url::Origin>& origin2, |
206 PrivateRegistryFilter filter); | 206 PrivateRegistryFilter filter); |
| 207 NET_EXPORT bool SameDomainOrHost(const GURL& gurl, |
| 208 const url::Origin& origin, |
| 209 PrivateRegistryFilter filter); |
207 | 210 |
208 // Finds the length in bytes of the registrar portion of the host in the | 211 // Finds the length in bytes of the registrar portion of the host in the |
209 // given GURL. Returns std::string::npos if the GURL is invalid or has no | 212 // given GURL. Returns std::string::npos if the GURL is invalid or has no |
210 // host (e.g. a file: URL). Returns 0 if the GURL has multiple trailing dots, | 213 // host (e.g. a file: URL). Returns 0 if the GURL has multiple trailing dots, |
211 // is an IP address, has no subcomponents, or is itself a recognized registry | 214 // is an IP address, has no subcomponents, or is itself a recognized registry |
212 // identifier. The result is also dependent on the UnknownRegistryFilter. | 215 // identifier. The result is also dependent on the UnknownRegistryFilter. |
213 // If no matching rule is found in the effective-TLD data (or in | 216 // If no matching rule is found in the effective-TLD data (or in |
214 // the default data, if the resource failed to load), returns 0 if | 217 // the default data, if the resource failed to load), returns 0 if |
215 // |unknown_filter| is EXCLUDE_UNKNOWN_REGISTRIES, or the length of the last | 218 // |unknown_filter| is EXCLUDE_UNKNOWN_REGISTRIES, or the length of the last |
216 // subcomponent if |unknown_filter| is INCLUDE_UNKNOWN_REGISTRIES. | 219 // subcomponent if |unknown_filter| is INCLUDE_UNKNOWN_REGISTRIES. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 NET_EXPORT_PRIVATE void SetFindDomainGraph(); | 294 NET_EXPORT_PRIVATE void SetFindDomainGraph(); |
292 | 295 |
293 // Used for unit tests, so that a frozen list of domains is used. | 296 // Used for unit tests, so that a frozen list of domains is used. |
294 NET_EXPORT_PRIVATE void SetFindDomainGraph(const unsigned char* domains, | 297 NET_EXPORT_PRIVATE void SetFindDomainGraph(const unsigned char* domains, |
295 size_t length); | 298 size_t length); |
296 | 299 |
297 } // namespace registry_controlled_domains | 300 } // namespace registry_controlled_domains |
298 } // namespace net | 301 } // namespace net |
299 | 302 |
300 #endif // NET_BASE_REGISTRY_CONTROLLED_DOMAINS_REGISTRY_CONTROLLED_DOMAIN_H_ | 303 #endif // NET_BASE_REGISTRY_CONTROLLED_DOMAINS_REGISTRY_CONTROLLED_DOMAIN_H_ |
OLD | NEW |