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 // Portions of this code based on Mozilla: | 5 // Portions of this code based on Mozilla: |
6 // (netwerk/cookie/src/nsCookieService.cpp) | 6 // (netwerk/cookie/src/nsCookieService.cpp) |
7 /* ***** BEGIN LICENSE BLOCK ***** | 7 /* ***** BEGIN LICENSE BLOCK ***** |
8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
9 * | 9 * |
10 * The contents of this file are subject to the Mozilla Public License Version | 10 * The contents of this file are subject to the Mozilla Public License Version |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 // insecure scheme. | 383 // insecure scheme. |
384 if (IsSecure() && !url.SchemeIsCryptographic()) | 384 if (IsSecure() && !url.SchemeIsCryptographic()) |
385 return false; | 385 return false; |
386 // Don't include cookies for requests that don't apply to the cookie domain. | 386 // Don't include cookies for requests that don't apply to the cookie domain. |
387 if (!IsDomainMatch(url.host())) | 387 if (!IsDomainMatch(url.host())) |
388 return false; | 388 return false; |
389 // Don't include cookies for requests with a url path that does not path | 389 // Don't include cookies for requests with a url path that does not path |
390 // match the cookie-path. | 390 // match the cookie-path. |
391 if (!IsOnPath(url.path())) | 391 if (!IsOnPath(url.path())) |
392 return false; | 392 return false; |
393 | 393 // Don't include first-party-only cookies for non-first-party requests. |
394 // Include first-party-only cookies if: | 394 if (IsFirstPartyOnly() && !options.include_first_party_only()) |
395 // | |
396 // * |options| tells us to include all of them | |
397 // * a first-party origin is set, and they matches the origin of |url| | |
398 if (IsFirstPartyOnly() && !options.include_first_party_only() && | |
399 !options.first_party().IsSameOriginWith(url::Origin(url))) { | |
400 return false; | 395 return false; |
401 } | |
402 | 396 |
403 return true; | 397 return true; |
404 } | 398 } |
405 | 399 |
406 std::string CanonicalCookie::DebugString() const { | 400 std::string CanonicalCookie::DebugString() const { |
407 return base::StringPrintf( | 401 return base::StringPrintf( |
408 "name: %s value: %s domain: %s path: %s creation: %" | 402 "name: %s value: %s domain: %s path: %s creation: %" |
409 PRId64, | 403 PRId64, |
410 name_.c_str(), value_.c_str(), | 404 name_.c_str(), value_.c_str(), |
411 domain_.c_str(), path_.c_str(), | 405 domain_.c_str(), path_.c_str(), |
(...skipping 29 matching lines...) Expand all Loading... |
441 if (IsSecure() != other.IsSecure()) | 435 if (IsSecure() != other.IsSecure()) |
442 return IsSecure(); | 436 return IsSecure(); |
443 | 437 |
444 if (IsHttpOnly() != other.IsHttpOnly()) | 438 if (IsHttpOnly() != other.IsHttpOnly()) |
445 return IsHttpOnly(); | 439 return IsHttpOnly(); |
446 | 440 |
447 return Priority() < other.Priority(); | 441 return Priority() < other.Priority(); |
448 } | 442 } |
449 | 443 |
450 } // namespace net | 444 } // namespace net |
OLD | NEW |