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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 NET_EXPORT std::string GetDomainAndRegistry(base::StringPiece host, | 188 NET_EXPORT std::string GetDomainAndRegistry(base::StringPiece host, |
189 PrivateRegistryFilter filter); | 189 PrivateRegistryFilter filter); |
190 | 190 |
191 // These convenience functions return true if the two GURLs or Origins both have | 191 // These convenience functions return true if the two GURLs or Origins both have |
192 // hosts and one of the following is true: | 192 // hosts and one of the following is true: |
193 // * The hosts are identical. | 193 // * The hosts are identical. |
194 // * They each have a known domain and registry, and it is the same for both | 194 // * They each have a known domain and registry, and it is the same for both |
195 // URLs. Note that this means the trailing dot, if any, must match too. | 195 // URLs. Note that this means the trailing dot, if any, must match too. |
196 // Effectively, callers can use this function to check whether the input URLs | 196 // Effectively, callers can use this function to check whether the input URLs |
197 // represent hosts "on the same site". | 197 // represent hosts "on the same site". |
| 198 NET_EXPORT bool SameDomainOrHost(base::StringPiece host1, |
| 199 base::StringPiece host2, |
| 200 PrivateRegistryFilter filter); |
198 NET_EXPORT bool SameDomainOrHost(const GURL& gurl1, const GURL& gurl2, | 201 NET_EXPORT bool SameDomainOrHost(const GURL& gurl1, const GURL& gurl2, |
199 PrivateRegistryFilter filter); | 202 PrivateRegistryFilter filter); |
200 NET_EXPORT bool SameDomainOrHost(const url::Origin& origin1, | 203 NET_EXPORT bool SameDomainOrHost(const url::Origin& origin1, |
201 const url::Origin& origin2, | 204 const url::Origin& origin2, |
202 PrivateRegistryFilter filter); | 205 PrivateRegistryFilter filter); |
203 // Note: this returns false if |origin2| is not set. | 206 // Note: this returns false if |origin2| is not set. |
204 NET_EXPORT bool SameDomainOrHost(const url::Origin& origin1, | 207 NET_EXPORT bool SameDomainOrHost(const url::Origin& origin1, |
205 const base::Optional<url::Origin>& origin2, | 208 const base::Optional<url::Origin>& origin2, |
206 PrivateRegistryFilter filter); | 209 PrivateRegistryFilter filter); |
207 | 210 |
(...skipping 83 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 |