chore: replace absl::optional<T> with std::optional<T> (#40928)

* chore: replace absl::optional<T> with std::optional<T>

* IWYU
This commit is contained in:
Milan Burda 2024-01-10 23:23:35 +01:00 committed by GitHub
parent fac964ac0d
commit 892c9d78a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
129 changed files with 419 additions and 397 deletions

View file

@ -127,13 +127,13 @@ bool MatchesCookie(const base::Value::Dict& filter,
if ((str = filter.FindString("domain")) &&
!MatchesDomain(*str, cookie.Domain()))
return false;
absl::optional<bool> secure_filter = filter.FindBool("secure");
std::optional<bool> secure_filter = filter.FindBool("secure");
if (secure_filter && *secure_filter != cookie.IsSecure())
return false;
absl::optional<bool> session_filter = filter.FindBool("session");
std::optional<bool> session_filter = filter.FindBool("session");
if (session_filter && *session_filter == cookie.IsPersistent())
return false;
absl::optional<bool> httpOnly_filter = filter.FindBool("httpOnly");
std::optional<bool> httpOnly_filter = filter.FindBool("httpOnly");
if (httpOnly_filter && *httpOnly_filter != cookie.IsHttpOnly())
return false;
return true;
@ -161,7 +161,7 @@ void FilterCookieWithStatuses(
}
// Parse dictionary property to CanonicalCookie time correctly.
base::Time ParseTimeProperty(const absl::optional<double>& value) {
base::Time ParseTimeProperty(const std::optional<double>& value) {
if (!value) // empty time means ignoring the parameter
return base::Time();
if (*value == 0) // FromSecondsSinceUnixEpoch would convert 0 to empty Time
@ -321,7 +321,7 @@ v8::Local<v8::Promise> Cookies::Set(v8::Isolate* isolate,
path ? *path : "", ParseTimeProperty(details.FindDouble("creationDate")),
ParseTimeProperty(details.FindDouble("expirationDate")),
ParseTimeProperty(details.FindDouble("lastAccessDate")), secure,
http_only, same_site, net::COOKIE_PRIORITY_DEFAULT, absl::nullopt,
http_only, same_site, net::COOKIE_PRIORITY_DEFAULT, std::nullopt,
&status);
if (!canonical_cookie || !canonical_cookie->IsCanonical()) {