Chromium Code Reviews| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 175 // http://a.b.co.uk/file.html -> "b.co.uk" (co.uk) | 175 // http://a.b.co.uk/file.html -> "b.co.uk" (co.uk) |
| 176 // file:///C:/bar.html -> "" (no host) | 176 // file:///C:/bar.html -> "" (no host) |
| 177 // http://foo.com../file.html -> "" (multiple trailing dots) | 177 // http://foo.com../file.html -> "" (multiple trailing dots) |
| 178 // http://192.168.0.1/file.html -> "" (IP address) | 178 // http://192.168.0.1/file.html -> "" (IP address) |
| 179 // http://bar/file.html -> "" (no subcomponents) | 179 // http://bar/file.html -> "" (no subcomponents) |
| 180 // http://co.uk/file.html -> "" (host is a registry) | 180 // http://co.uk/file.html -> "" (host is a registry) |
| 181 // http://foo.bar/file.html -> "foo.bar" (no rule; assume bar) | 181 // http://foo.bar/file.html -> "foo.bar" (no rule; assume bar) |
| 182 NET_EXPORT std::string GetDomainAndRegistry(const GURL& gurl, | 182 NET_EXPORT std::string GetDomainAndRegistry(const GURL& gurl, |
| 183 PrivateRegistryFilter filter); | 183 PrivateRegistryFilter filter); |
| 184 | 184 |
| 185 // Same as above, but returns a part of |gurl|'s host in a StringPiece. | |
|
engedy
2016/09/28 17:22:52
Phrasing nit: ... returns the domain and registry
pkalinnikov
2016/10/05 11:51:35
Done.
| |
| 186 // TODO(pkalinnikov): Rename this to GetDomainAndRegistry and get rid of the | |
|
engedy
2016/09/28 17:22:52
As discussed, please run some quick tests to see h
pkalinnikov
2016/10/05 11:51:35
It is used not frequently during normal browsing.
engedy
2016/10/05 11:58:14
Usually it's recommended to leave a TODO only if w
| |
| 187 // std::string-returning version. Update clients. | |
| 188 NET_EXPORT base::StringPiece GetDomainAndRegistryAsStringPiece( | |
| 189 const GURL& gurl, | |
| 190 PrivateRegistryFilter filter); | |
| 191 | |
| 185 // Like the GURL version, but takes a host (which is canonicalized internally) | 192 // Like the GURL version, but takes a host (which is canonicalized internally) |
| 186 // instead of a full GURL. | 193 // instead of a full GURL. |
| 187 NET_EXPORT std::string GetDomainAndRegistry(base::StringPiece host, | 194 NET_EXPORT std::string GetDomainAndRegistry(base::StringPiece host, |
| 188 PrivateRegistryFilter filter); | 195 PrivateRegistryFilter filter); |
| 189 | 196 |
| 190 // These convenience functions return true if the two GURLs or Origins both have | 197 // These convenience functions return true if the two GURLs or Origins both have |
| 191 // hosts and one of the following is true: | 198 // hosts and one of the following is true: |
| 192 // * They each have a known domain and registry, and it is the same for both | 199 // * 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. | 200 // 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. | 201 // * They don't have known domains/registries, but the hosts are identical. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 238 // Used for unit tests. Use default domains. | 245 // Used for unit tests. Use default domains. |
| 239 NET_EXPORT_PRIVATE void SetFindDomainGraph(); | 246 NET_EXPORT_PRIVATE void SetFindDomainGraph(); |
| 240 | 247 |
| 241 // Used for unit tests, so that a frozen list of domains is used. | 248 // Used for unit tests, so that a frozen list of domains is used. |
| 242 NET_EXPORT_PRIVATE void SetFindDomainGraph(const unsigned char* domains, | 249 NET_EXPORT_PRIVATE void SetFindDomainGraph(const unsigned char* domains, |
| 243 size_t length); | 250 size_t length); |
| 244 } // namespace registry_controlled_domains | 251 } // namespace registry_controlled_domains |
| 245 } // namespace net | 252 } // namespace net |
| 246 | 253 |
| 247 #endif // NET_BASE_REGISTRY_CONTROLLED_DOMAINS_REGISTRY_CONTROLLED_DOMAIN_H_ | 254 #endif // NET_BASE_REGISTRY_CONTROLLED_DOMAINS_REGISTRY_CONTROLLED_DOMAIN_H_ |
| OLD | NEW |