Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: net/base/registry_controlled_domains/registry_controlled_domain.h

Issue 2497753002: Invert host/domain checks in SameDomainOrHost (Closed)
Patch Set: pkasting review Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/base/registry_controlled_domains/registry_controlled_domain.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 NET_EXPORT std::string GetDomainAndRegistry(const GURL& gurl, 183 NET_EXPORT std::string GetDomainAndRegistry(const GURL& gurl,
184 PrivateRegistryFilter filter); 184 PrivateRegistryFilter filter);
185 185
186 // Like the GURL version, but takes a host (which is canonicalized internally) 186 // Like the GURL version, but takes a host (which is canonicalized internally)
187 // instead of a full GURL. 187 // instead of a full GURL.
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 // * 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
194 // 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.
Peter Kasting 2016/11/14 23:21:03 This comment reordering makes me wonder if the fun
Charlie Harrison 2016/11/14 23:48:23 Yeah I don't think the rename is necessary, though
195 // * They don't have known domains/registries, but the hosts are identical.
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(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,
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 NET_EXPORT_PRIVATE void SetFindDomainGraph(); 291 NET_EXPORT_PRIVATE void SetFindDomainGraph();
292 292
293 // Used for unit tests, so that a frozen list of domains is used. 293 // Used for unit tests, so that a frozen list of domains is used.
294 NET_EXPORT_PRIVATE void SetFindDomainGraph(const unsigned char* domains, 294 NET_EXPORT_PRIVATE void SetFindDomainGraph(const unsigned char* domains,
295 size_t length); 295 size_t length);
296 296
297 } // namespace registry_controlled_domains 297 } // namespace registry_controlled_domains
298 } // namespace net 298 } // namespace net
299 299
300 #endif // NET_BASE_REGISTRY_CONTROLLED_DOMAINS_REGISTRY_CONTROLLED_DOMAIN_H_ 300 #endif // NET_BASE_REGISTRY_CONTROLLED_DOMAINS_REGISTRY_CONTROLLED_DOMAIN_H_
OLDNEW
« no previous file with comments | « no previous file | net/base/registry_controlled_domains/registry_controlled_domain.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698