| Index: net/cookies/cookie_monster.cc
|
| diff --git a/net/cookies/cookie_monster.cc b/net/cookies/cookie_monster.cc
|
| index 78cfda7b8a96c81a9788f21dfe66cace1940f3e6..139b3fe5e83aeca3047af5150936d544226a3247 100644
|
| --- a/net/cookies/cookie_monster.cc
|
| +++ b/net/cookies/cookie_monster.cc
|
| @@ -302,11 +302,43 @@ ChangeCausePair ChangeCauseMapping[] = {
|
| // DELETE_COOKIE_LAST_ENTRY
|
| {CookieMonsterDelegate::CHANGE_COOKIE_EXPLICIT, false}};
|
|
|
| +CookieStore::RemovalCause RemovalCauseMap[] = {
|
| + // DELETE_COOKIE_EXPLICIT
|
| + CookieStore::RemovalCause::EXPLICIT,
|
| + // DELETE_COOKIE_OVERWRITE
|
| + CookieStore::RemovalCause::OVERWRITE,
|
| + // DELETE_COOKIE_EXPIRED
|
| + CookieStore::RemovalCause::EXPIRED,
|
| + // DELETE_COOKIE_EVICTED
|
| + CookieStore::RemovalCause::EVICTED,
|
| + // DELETE_COOKIE_DUPLICATE_IN_BACKING_STORE
|
| + CookieStore::RemovalCause::EXPLICIT,
|
| + // DELETE_COOKIE_DONT_RECORD
|
| + CookieStore::RemovalCause::EXPLICIT,
|
| + // DELETE_COOKIE_EVICTED_DOMAIN
|
| + CookieStore::RemovalCause::EVICTED,
|
| + // DELETE_COOKIE_EVICTED_GLOBAL
|
| + CookieStore::RemovalCause::EVICTED,
|
| + // DELETE_COOKIE_EVICTED_DOMAIN_PRE_SAFE
|
| + CookieStore::RemovalCause::EVICTED,
|
| + // DELETE_COOKIE_EVICTED_DOMAIN_POST_SAFE
|
| + CookieStore::RemovalCause::EVICTED,
|
| + // DELETE_COOKIE_EXPIRED_OVERWRITE
|
| + CookieStore::RemovalCause::EXPIRED_OVERWRITE,
|
| + // DELETE_COOKIE_CONTROL_CHAR
|
| + CookieStore::RemovalCause::EVICTED,
|
| + // DELETE_COOKIE_NON_SECURE
|
| + CookieStore::RemovalCause::EVICTED,
|
| + // DELETE_COOKIE_LAST_ENTRY
|
| + CookieStore::RemovalCause::EXPLICIT,
|
| +};
|
| +
|
| void RunAsync(scoped_refptr<base::TaskRunner> proxy,
|
| const CookieStore::CookieChangedCallback& callback,
|
| const CanonicalCookie& cookie,
|
| - bool removed) {
|
| - proxy->PostTask(FROM_HERE, base::Bind(callback, cookie, removed));
|
| + bool removed,
|
| + CookieStore::RemovalCause cause) {
|
| + proxy->PostTask(FROM_HERE, base::Bind(callback, cookie, removed, cause));
|
| }
|
|
|
| bool IsCookieEligibleForEviction(CookiePriority current_priority_level,
|
| @@ -1717,7 +1749,7 @@ CookieMonster::CookieMap::iterator CookieMonster::InternalInsertCookie(
|
| histogram_cookie_source_scheme_->Add(cookie_source_sample);
|
| }
|
|
|
| - RunCookieChangedCallbacks(*cc, false);
|
| + RunCookieChangedCallbacks(*cc, false, CookieStore::RemovalCause::NOT_REMOVED);
|
|
|
| return inserted;
|
| }
|
| @@ -1863,7 +1895,7 @@ void CookieMonster::InternalDeleteCookie(CookieMap::iterator it,
|
| if (mapping.notify)
|
| delegate_->OnCookieChanged(*cc, true, mapping.cause);
|
| }
|
| - RunCookieChangedCallbacks(*cc, true);
|
| + RunCookieChangedCallbacks(*cc, true, RemovalCauseMap[deletion_cause]);
|
| cookies_.erase(it);
|
| delete cc;
|
| }
|
| @@ -2375,7 +2407,8 @@ void CookieMonster::RunCallback(const base::Closure& callback) {
|
| }
|
|
|
| void CookieMonster::RunCookieChangedCallbacks(const CanonicalCookie& cookie,
|
| - bool removed) {
|
| + bool removed,
|
| + RemovalCause cause) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|
| CookieOptions opts;
|
| @@ -2391,7 +2424,7 @@ void CookieMonster::RunCookieChangedCallbacks(const CanonicalCookie& cookie,
|
| std::pair<GURL, std::string> key = it->first;
|
| if (cookie.IncludeForRequestURL(key.first, opts) &&
|
| cookie.Name() == key.second) {
|
| - it->second->Notify(cookie, removed);
|
| + it->second->Notify(cookie, removed, cause);
|
| }
|
| }
|
| }
|
|
|