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

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

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 NET_EXPORT std::string GetDomainAndRegistry(const std::string& host, 181 NET_EXPORT std::string GetDomainAndRegistry(const std::string& host,
182 PrivateRegistryFilter filter); 182 PrivateRegistryFilter filter);
183 183
184 // This convenience function returns true if the two GURLs both have hosts 184 // This convenience function returns true if the two GURLs both have hosts
185 // and one of the following is true: 185 // and one of the following is true:
186 // * They each have a known domain and registry, and it is the same for both 186 // * They each have a known domain and registry, and it is the same for both
187 // URLs. Note that this means the trailing dot, if any, must match too. 187 // URLs. Note that this means the trailing dot, if any, must match too.
188 // * They don't have known domains/registries, but the hosts are identical. 188 // * They don't have known domains/registries, but the hosts are identical.
189 // Effectively, callers can use this function to check whether the input URLs 189 // Effectively, callers can use this function to check whether the input URLs
190 // represent hosts "on the same site". 190 // represent hosts "on the same site".
191 NET_EXPORT bool SameDomainOrHost(const GURL& gurl1, const GURL& gurl2, 191 NET_EXPORT bool SameDomainOrHost(const GURL& gurl1,
192 const GURL& gurl2,
192 PrivateRegistryFilter filter); 193 PrivateRegistryFilter filter);
193 194
194 // Finds the length in bytes of the registrar portion of the host in the 195 // Finds the length in bytes of the registrar portion of the host in the
195 // given GURL. Returns std::string::npos if the GURL is invalid or has no 196 // given GURL. Returns std::string::npos if the GURL is invalid or has no
196 // host (e.g. a file: URL). Returns 0 if the GURL has multiple trailing dots, 197 // host (e.g. a file: URL). Returns 0 if the GURL has multiple trailing dots,
197 // is an IP address, has no subcomponents, or is itself a recognized registry 198 // is an IP address, has no subcomponents, or is itself a recognized registry
198 // identifier. The result is also dependent on the UnknownRegistryFilter. 199 // identifier. The result is also dependent on the UnknownRegistryFilter.
199 // If no matching rule is found in the effective-TLD data (or in 200 // If no matching rule is found in the effective-TLD data (or in
200 // the default data, if the resource failed to load), returns 0 if 201 // the default data, if the resource failed to load), returns 0 if
201 // |unknown_filter| is EXCLUDE_UNKNOWN_REGISTRIES, or the length of the last 202 // |unknown_filter| is EXCLUDE_UNKNOWN_REGISTRIES, or the length of the last
(...skipping 15 matching lines...) Expand all
217 NET_EXPORT size_t GetRegistryLength(const GURL& gurl, 218 NET_EXPORT size_t GetRegistryLength(const GURL& gurl,
218 UnknownRegistryFilter unknown_filter, 219 UnknownRegistryFilter unknown_filter,
219 PrivateRegistryFilter private_filter); 220 PrivateRegistryFilter private_filter);
220 221
221 // Like the GURL version, but takes a host (which is canonicalized internally) 222 // Like the GURL version, but takes a host (which is canonicalized internally)
222 // instead of a full GURL. 223 // instead of a full GURL.
223 NET_EXPORT size_t GetRegistryLength(const std::string& host, 224 NET_EXPORT size_t GetRegistryLength(const std::string& host,
224 UnknownRegistryFilter unknown_filter, 225 UnknownRegistryFilter unknown_filter,
225 PrivateRegistryFilter private_filter); 226 PrivateRegistryFilter private_filter);
226 227
227 typedef const struct DomainRule* (*FindDomainPtr)(const char *, unsigned int); 228 typedef const struct DomainRule* (*FindDomainPtr)(const char*, unsigned int);
228 229
229 // Used for unit tests, so that a different perfect hash map from the full 230 // Used for unit tests, so that a different perfect hash map from the full
230 // list is used. Set to NULL to use the Default function. 231 // list is used. Set to NULL to use the Default function.
231 NET_EXPORT_PRIVATE void SetFindDomainFunctionAndStringPoolForTesting( 232 NET_EXPORT_PRIVATE void SetFindDomainFunctionAndStringPoolForTesting(
232 FindDomainPtr fn, const char* stringpool); 233 FindDomainPtr fn,
234 const char* stringpool);
233 235
234 } // namespace registry_controlled_domains 236 } // namespace registry_controlled_domains
235 } // namespace net 237 } // namespace net
236 238
237 #endif // NET_BASE_REGISTRY_CONTROLLED_DOMAINS_REGISTRY_CONTROLLED_DOMAIN_H_ 239 #endif // NET_BASE_REGISTRY_CONTROLLED_DOMAINS_REGISTRY_CONTROLLED_DOMAIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698