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

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

Issue 2405483002: Make the request initiator Optional (Closed)
Patch Set: Fixed compilation error 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
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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 GURL to normalize rules, and validating the rules. 110 GURL to normalize rules, and validating the rules.
111 */ 111 */
112 112
113 #ifndef NET_BASE_REGISTRY_CONTROLLED_DOMAINS_REGISTRY_CONTROLLED_DOMAIN_H_ 113 #ifndef NET_BASE_REGISTRY_CONTROLLED_DOMAINS_REGISTRY_CONTROLLED_DOMAIN_H_
114 #define NET_BASE_REGISTRY_CONTROLLED_DOMAINS_REGISTRY_CONTROLLED_DOMAIN_H_ 114 #define NET_BASE_REGISTRY_CONTROLLED_DOMAINS_REGISTRY_CONTROLLED_DOMAIN_H_
115 115
116 #include <stddef.h> 116 #include <stddef.h>
117 117
118 #include <string> 118 #include <string>
119 119
120 #include "base/optional.h"
120 #include "base/strings/string_piece.h" 121 #include "base/strings/string_piece.h"
121 #include "net/base/net_export.h" 122 #include "net/base/net_export.h"
122 123
123 class GURL; 124 class GURL;
124 125
125 namespace url { 126 namespace url {
126 class Origin; 127 class Origin;
127 }; 128 };
128 129
129 struct DomainRule; 130 struct DomainRule;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // * They each have a known domain and registry, and it is the same for both 193 // * They each have a known domain and registry, and it is the same for both
193 // URLs. Note that this means the trailing dot, if any, must match too. 194 // URLs. Note that this means the trailing dot, if any, must match too.
194 // * They don't have known domains/registries, but the hosts are identical. 195 // * They don't have known domains/registries, but the hosts are identical.
195 // 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
196 // represent hosts "on the same site". 197 // represent hosts "on the same site".
197 NET_EXPORT bool SameDomainOrHost(const GURL& gurl1, const GURL& gurl2, 198 NET_EXPORT bool SameDomainOrHost(const GURL& gurl1, const GURL& gurl2,
198 PrivateRegistryFilter filter); 199 PrivateRegistryFilter filter);
199 NET_EXPORT bool SameDomainOrHost(const url::Origin& origin1, 200 NET_EXPORT bool SameDomainOrHost(const url::Origin& origin1,
200 const url::Origin& origin2, 201 const url::Origin& origin2,
201 PrivateRegistryFilter filter); 202 PrivateRegistryFilter filter);
203 NET_EXPORT bool SameDomainOrHost(const url::Origin& origin1,
204 const base::Optional<url::Origin>& origin2,
205 PrivateRegistryFilter filter);
mmenke 2016/11/03 17:58:58 Mention behavior for a null origin?
clamy 2016/11/04 16:03:50 Done.
202 206
203 // Finds the length in bytes of the registrar portion of the host in the 207 // Finds the length in bytes of the registrar portion of the host in the
204 // given GURL. Returns std::string::npos if the GURL is invalid or has no 208 // given GURL. Returns std::string::npos if the GURL is invalid or has no
205 // host (e.g. a file: URL). Returns 0 if the GURL has multiple trailing dots, 209 // host (e.g. a file: URL). Returns 0 if the GURL has multiple trailing dots,
206 // is an IP address, has no subcomponents, or is itself a recognized registry 210 // is an IP address, has no subcomponents, or is itself a recognized registry
207 // identifier. The result is also dependent on the UnknownRegistryFilter. 211 // identifier. The result is also dependent on the UnknownRegistryFilter.
208 // If no matching rule is found in the effective-TLD data (or in 212 // If no matching rule is found in the effective-TLD data (or in
209 // the default data, if the resource failed to load), returns 0 if 213 // the default data, if the resource failed to load), returns 0 if
210 // |unknown_filter| is EXCLUDE_UNKNOWN_REGISTRIES, or the length of the last 214 // |unknown_filter| is EXCLUDE_UNKNOWN_REGISTRIES, or the length of the last
211 // subcomponent if |unknown_filter| is INCLUDE_UNKNOWN_REGISTRIES. 215 // subcomponent if |unknown_filter| is INCLUDE_UNKNOWN_REGISTRIES.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 NET_EXPORT_PRIVATE void SetFindDomainGraph(); 290 NET_EXPORT_PRIVATE void SetFindDomainGraph();
287 291
288 // Used for unit tests, so that a frozen list of domains is used. 292 // Used for unit tests, so that a frozen list of domains is used.
289 NET_EXPORT_PRIVATE void SetFindDomainGraph(const unsigned char* domains, 293 NET_EXPORT_PRIVATE void SetFindDomainGraph(const unsigned char* domains,
290 size_t length); 294 size_t length);
291 295
292 } // namespace registry_controlled_domains 296 } // namespace registry_controlled_domains
293 } // namespace net 297 } // namespace net
294 298
295 #endif // NET_BASE_REGISTRY_CONTROLLED_DOMAINS_REGISTRY_CONTROLLED_DOMAIN_H_ 299 #endif // NET_BASE_REGISTRY_CONTROLLED_DOMAINS_REGISTRY_CONTROLLED_DOMAIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698