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

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

Issue 2405483002: Make the request initiator Optional (Closed)
Patch Set: Introduce NullableOrigin to use for request initiator Created 4 years, 2 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
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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 host1.len); 216 host1.len);
217 } 217 }
218 218
219 bool SameDomainOrHost(const url::Origin& origin1, 219 bool SameDomainOrHost(const url::Origin& origin1,
220 const url::Origin& origin2, 220 const url::Origin& origin2,
221 PrivateRegistryFilter filter) { 221 PrivateRegistryFilter filter) {
222 return SameDomainOrHost(GURL(origin1.Serialize()), GURL(origin2.Serialize()), 222 return SameDomainOrHost(GURL(origin1.Serialize()), GURL(origin2.Serialize()),
223 filter); 223 filter);
224 } 224 }
225 225
226 bool SameDomainOrHost(const url::Origin& origin1,
227 url::NullableOrigin* origin2,
228 PrivateRegistryFilter filter) {
229 if (!origin2)
230 return false;
231 return SameDomainOrHost(origin1, *origin2, filter);
232 }
233
226 size_t GetRegistryLength( 234 size_t GetRegistryLength(
227 const GURL& gurl, 235 const GURL& gurl,
228 UnknownRegistryFilter unknown_filter, 236 UnknownRegistryFilter unknown_filter,
229 PrivateRegistryFilter private_filter) { 237 PrivateRegistryFilter private_filter) {
230 base::StringPiece host = gurl.host_piece(); 238 base::StringPiece host = gurl.host_piece();
231 if (host.empty()) 239 if (host.empty())
232 return std::string::npos; 240 return std::string::npos;
233 if (gurl.HostIsIPAddress()) 241 if (gurl.HostIsIPAddress())
234 return 0; 242 return 0;
235 return GetRegistryLengthImpl(host, unknown_filter, private_filter); 243 return GetRegistryLengthImpl(host, unknown_filter, private_filter);
(...skipping 18 matching lines...) Expand all
254 262
255 void SetFindDomainGraph(const unsigned char* domains, size_t length) { 263 void SetFindDomainGraph(const unsigned char* domains, size_t length) {
256 CHECK(domains); 264 CHECK(domains);
257 CHECK_NE(length, 0u); 265 CHECK_NE(length, 0u);
258 g_graph = domains; 266 g_graph = domains;
259 g_graph_length = length; 267 g_graph_length = length;
260 } 268 }
261 269
262 } // namespace registry_controlled_domains 270 } // namespace registry_controlled_domains
263 } // namespace net 271 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698