Commit 3aa38b52 authored by Dylan Cutler's avatar Dylan Cutler Committed by Commit Bot

Use CanonicalCookie::FromStorage instead of bare constructor in

RestrictedCookieManager::SetCanonicalCookie().

This is part of a cleanup effort of cookie code to make
CanonicalCookie's bare constructor private since it does no validation
and its use should be discouraged.

CanonicalCookie::FromStorage is a factory method meant for creating new
CanonicalCookies from those which have already entered the user agent
storage, so it is the appropriate method for this use case IIUC.

Bug: 1102874
Change-Id: I6f25554bff6cffe9427564135116e60af4306c31
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2485292Reviewed-by: default avatarMaksim Orlovich <morlovich@chromium.org>
Commit-Queue: Dylan Cutler <dylancutler@google.com>
Cr-Commit-Position: refs/heads/master@{#818517}
parent 8ebed608
...@@ -385,7 +385,7 @@ void RestrictedCookieManager::SetCanonicalCookie( ...@@ -385,7 +385,7 @@ void RestrictedCookieManager::SetCanonicalCookie(
GURL::SchemeIsCryptographic(origin_.scheme()) GURL::SchemeIsCryptographic(origin_.scheme())
? net::CookieSourceScheme::kSecure ? net::CookieSourceScheme::kSecure
: net::CookieSourceScheme::kNonSecure; : net::CookieSourceScheme::kNonSecure;
auto sanitized_cookie = std::make_unique<net::CanonicalCookie>( auto sanitized_cookie = net::CanonicalCookie::FromStorage(
cookie.Name(), cookie.Value(), cookie.Domain(), cookie.Path(), now, cookie.Name(), cookie.Value(), cookie.Domain(), cookie.Path(), now,
cookie.ExpiryDate(), now, cookie.IsSecure(), cookie.IsHttpOnly(), cookie.ExpiryDate(), now, cookie.IsSecure(), cookie.IsHttpOnly(),
cookie.SameSite(), cookie.Priority(), source_scheme); cookie.SameSite(), cookie.Priority(), source_scheme);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment