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

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

Issue 2568133007: Allow CrossSiteDocumentClassifier to operate on Origins (Closed)
Patch Set: pkasting review Created 3 years, 11 months 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 | « net/base/registry_controlled_domains/registry_controlled_domain.h ('k') | no next file » | 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.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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 return SameDomainOrHost(origin1.host(), origin2.host(), filter); 358 return SameDomainOrHost(origin1.host(), origin2.host(), filter);
359 } 359 }
360 360
361 bool SameDomainOrHost(const url::Origin& origin1, 361 bool SameDomainOrHost(const url::Origin& origin1,
362 const base::Optional<url::Origin>& origin2, 362 const base::Optional<url::Origin>& origin2,
363 PrivateRegistryFilter filter) { 363 PrivateRegistryFilter filter) {
364 return origin2.has_value() && 364 return origin2.has_value() &&
365 SameDomainOrHost(origin1, origin2.value(), filter); 365 SameDomainOrHost(origin1, origin2.value(), filter);
366 } 366 }
367 367
368 bool SameDomainOrHost(const GURL& gurl,
369 const url::Origin& origin,
370 PrivateRegistryFilter filter) {
371 return SameDomainOrHost(gurl.host_piece(), origin.host(), filter);
372 }
373
368 size_t GetRegistryLength( 374 size_t GetRegistryLength(
369 const GURL& gurl, 375 const GURL& gurl,
370 UnknownRegistryFilter unknown_filter, 376 UnknownRegistryFilter unknown_filter,
371 PrivateRegistryFilter private_filter) { 377 PrivateRegistryFilter private_filter) {
372 return GetRegistryLengthImpl(gurl.host_piece(), unknown_filter, 378 return GetRegistryLengthImpl(gurl.host_piece(), unknown_filter,
373 private_filter); 379 private_filter);
374 } 380 }
375 381
376 bool HostHasRegistryControlledDomain(base::StringPiece host, 382 bool HostHasRegistryControlledDomain(base::StringPiece host,
377 UnknownRegistryFilter unknown_filter, 383 UnknownRegistryFilter unknown_filter,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 441
436 void SetFindDomainGraph(const unsigned char* domains, size_t length) { 442 void SetFindDomainGraph(const unsigned char* domains, size_t length) {
437 CHECK(domains); 443 CHECK(domains);
438 CHECK_NE(length, 0u); 444 CHECK_NE(length, 0u);
439 g_graph = domains; 445 g_graph = domains;
440 g_graph_length = length; 446 g_graph_length = length;
441 } 447 }
442 448
443 } // namespace registry_controlled_domains 449 } // namespace registry_controlled_domains
444 } // namespace net 450 } // namespace net
OLDNEW
« no previous file with comments | « net/base/registry_controlled_domains/registry_controlled_domain.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698