Add a SetCanonicalCookie method for CookieMonster.
This includes some refactoring of creation time defaulting, as well
as a histogram revision bump because the information about whether a
cookie is being set based on a null URL is no longer available at
the point of histogram creation.
BUG=721395, 723734
[email protected]
Review-Url: https://codereview.chromium.org/2882063002
Cr-Commit-Position: refs/heads/master@{#481227}
diff --git a/net/cookies/cookie_monster.h b/net/cookies/cookie_monster.h
index 42afd9a..9382e935 100644
--- a/net/cookies/cookie_monster.h
+++ b/net/cookies/cookie_monster.h
@@ -176,6 +176,10 @@
CookieSameSite same_site,
CookiePriority priority,
const SetCookiesCallback& callback) override;
+ void SetCanonicalCookieAsync(std::unique_ptr<CanonicalCookie> cookie,
+ bool secure_source,
+ bool modify_http_only,
+ const SetCookiesCallback& callback) override;
void GetCookiesWithOptionsAsync(const GURL& url,
const CookieOptions& options,
const GetCookiesCallback& callback) override;
@@ -247,6 +251,7 @@
class SetAllCookiesTask;
class SetCookieWithDetailsTask;
class SetCookieWithOptionsTask;
+ class SetCanonicalCookieTask;
class DeleteSessionCookiesTask;
// Testing support.
@@ -427,6 +432,15 @@
CookieSameSite same_site,
CookiePriority priority);
+ // Sets a canonical cookie, deletes equivalents and performs garbage
+ // collection. |source_secure| indicates if the cookie is being set
+ // from a secure source (e.g. a cryptographic scheme).
+ // |modify_http_only| indicates if this setting operation is allowed
+ // to affect http_only cookies.
+ bool SetCanonicalCookie(std::unique_ptr<CanonicalCookie> cookie,
+ bool secure_source,
+ bool can_modify_httponly);
+
CookieList GetAllCookies();
CookieList GetCookieListWithOptions(const GURL& url,
@@ -545,15 +559,6 @@
const base::Time& creation_time,
const CookieOptions& options);
- // Sets a canonical cookie, deletes equivalents and performs garbage
- // collection. |source_secure| indicates if the cookie is being set
- // from a secure source (e.g. a cryptographic scheme).
- // |modify_http_only| indicates if this setting operation is allowed
- // to affect http_only cookies.
- bool SetCanonicalCookie(std::unique_ptr<CanonicalCookie> cookie,
- bool secure_source,
- bool can_modify_httponly);
-
// Sets all cookies from |list| after deleting any equivalent cookie.
// For data gathering purposes, this routine is treated as if it is
// restoring saved cookies; some statistics are not gathered in this case.