| 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 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 | 1080 |
| 1081 // Canonicalize path again to make sure it escapes characters as needed. | 1081 // Canonicalize path again to make sure it escapes characters as needed. |
| 1082 url::Component path_component(0, cookie_path.length()); | 1082 url::Component path_component(0, cookie_path.length()); |
| 1083 url::RawCanonOutputT<char> canon_path; | 1083 url::RawCanonOutputT<char> canon_path; |
| 1084 url::Component canon_path_component; | 1084 url::Component canon_path_component; |
| 1085 url::CanonicalizePath(cookie_path.data(), path_component, &canon_path, | 1085 url::CanonicalizePath(cookie_path.data(), path_component, &canon_path, |
| 1086 &canon_path_component); | 1086 &canon_path_component); |
| 1087 cookie_path = std::string(canon_path.data() + canon_path_component.begin, | 1087 cookie_path = std::string(canon_path.data() + canon_path_component.begin, |
| 1088 canon_path_component.len); | 1088 canon_path_component.len); |
| 1089 | 1089 |
| 1090 std::unique_ptr<CanonicalCookie> cc(CanonicalCookie::Create( | 1090 std::unique_ptr<CanonicalCookie> cc(base::MakeUnique<CanonicalCookie>( |
| 1091 name, value, cookie_domain, cookie_path, actual_creation_time, | 1091 name, value, cookie_domain, cookie_path, actual_creation_time, |
| 1092 expiration_time, last_access_time, secure, http_only, same_site, | 1092 expiration_time, last_access_time, secure, http_only, same_site, |
| 1093 priority)); | 1093 priority)); |
| 1094 | 1094 |
| 1095 if (!cc.get()) | |
| 1096 return false; | |
| 1097 | |
| 1098 CookieOptions options; | 1095 CookieOptions options; |
| 1099 options.set_include_httponly(); | 1096 options.set_include_httponly(); |
| 1100 options.set_same_site_cookie_mode( | 1097 options.set_same_site_cookie_mode( |
| 1101 CookieOptions::SameSiteCookieMode::INCLUDE_STRICT_AND_LAX); | 1098 CookieOptions::SameSiteCookieMode::INCLUDE_STRICT_AND_LAX); |
| 1102 return SetCanonicalCookie(std::move(cc), url, options); | 1099 return SetCanonicalCookie(std::move(cc), url, options); |
| 1103 } | 1100 } |
| 1104 | 1101 |
| 1105 CookieList CookieMonster::GetAllCookies() { | 1102 CookieList CookieMonster::GetAllCookies() { |
| 1106 DCHECK(thread_checker_.CalledOnValidThread()); | 1103 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1107 | 1104 |
| (...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2395 it != hook_map_.end(); ++it) { | 2392 it != hook_map_.end(); ++it) { |
| 2396 std::pair<GURL, std::string> key = it->first; | 2393 std::pair<GURL, std::string> key = it->first; |
| 2397 if (cookie.IncludeForRequestURL(key.first, opts) && | 2394 if (cookie.IncludeForRequestURL(key.first, opts) && |
| 2398 cookie.Name() == key.second) { | 2395 cookie.Name() == key.second) { |
| 2399 it->second->Notify(cookie, cause); | 2396 it->second->Notify(cookie, cause); |
| 2400 } | 2397 } |
| 2401 } | 2398 } |
| 2402 } | 2399 } |
| 2403 | 2400 |
| 2404 } // namespace net | 2401 } // namespace net |
| OLD | NEW |