Add a method to override all the cookies in CookieMonster
commitd5d1278c27a9964ace098aa3717a84a301bb19c7
authordroger <droger@chromium.org>
Tue, 17 Mar 2015 19:21:51 +0000 (17 12:21 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 17 Mar 2015 19:22:33 +0000 (17 19:22 +0000)
tree72cc391211cf4e44246c426d8850f0f2260004f5
parent8a244ea4bd4547fa7481b548b6997f3412f6c215
Add a method to override all the cookies in CookieMonster

This method is required in order to upstream CookieStoreIOS.

CookieStoreIOS can periodically synchronize the iOS system
cookie store (NSHTTPCookieStorage) to CookieMonster.

It is not possible to simply delete all the cookies and re-add
the new version of the cookies, because this can lead to cookie
loss if the application crashes right after deleting all cookies.
For this reason, this CL introduces a new SetAllCookies method
that computes the exact difference between the exiting cookies and
the new cookies, and does only the minimum of operations needed.

Review URL: https://codereview.chromium.org/1000103002

Cr-Commit-Position: refs/heads/master@{#320954}
net/cookies/canonical_cookie.cc
net/cookies/canonical_cookie.h
net/cookies/canonical_cookie_unittest.cc
net/cookies/cookie_monster.cc
net/cookies/cookie_monster.h
net/cookies/cookie_monster_unittest.cc