Index: net/cookies/cookie_monster.cc |
diff --git a/net/cookies/cookie_monster.cc b/net/cookies/cookie_monster.cc |
index 78cfda7b8a96c81a9788f21dfe66cace1940f3e6..c81f3cf06dbf53a5ad8ed486c8e527541f10646a 100644 |
--- a/net/cookies/cookie_monster.cc |
+++ b/net/cookies/cookie_monster.cc |
@@ -265,48 +265,48 @@ CookieMonster::CookieItVector::iterator LowerBoundAccessDate( |
LowerBoundAccessDateComparator); |
} |
-// Mapping between DeletionCause and CookieMonsterDelegate::ChangeCause; the |
+// Mapping between DeletionCause and CookieStore::ChangeCause; the |
// mapping also provides a boolean that specifies whether or not an |
// OnCookieChanged notification ought to be generated. |
typedef struct ChangeCausePair_struct { |
- CookieMonsterDelegate::ChangeCause cause; |
+ CookieStore::ChangeCause cause; |
bool notify; |
} ChangeCausePair; |
ChangeCausePair ChangeCauseMapping[] = { |
mmenke
2016/09/26 18:29:26
While you're here, mind fixing this? Should be "c
nharper
2016/09/26 21:09:10
Done.
|
// DELETE_COOKIE_EXPLICIT |
- {CookieMonsterDelegate::CHANGE_COOKIE_EXPLICIT, true}, |
+ {CookieStore::CHANGE_COOKIE_EXPLICIT, true}, |
// DELETE_COOKIE_OVERWRITE |
- {CookieMonsterDelegate::CHANGE_COOKIE_OVERWRITE, true}, |
+ {CookieStore::CHANGE_COOKIE_OVERWRITE, true}, |
// DELETE_COOKIE_EXPIRED |
- {CookieMonsterDelegate::CHANGE_COOKIE_EXPIRED, true}, |
+ {CookieStore::CHANGE_COOKIE_EXPIRED, true}, |
// DELETE_COOKIE_EVICTED |
- {CookieMonsterDelegate::CHANGE_COOKIE_EVICTED, true}, |
+ {CookieStore::CHANGE_COOKIE_EVICTED, true}, |
// DELETE_COOKIE_DUPLICATE_IN_BACKING_STORE |
- {CookieMonsterDelegate::CHANGE_COOKIE_EXPLICIT, false}, |
+ {CookieStore::CHANGE_COOKIE_EXPLICIT, false}, |
// DELETE_COOKIE_DONT_RECORD |
- {CookieMonsterDelegate::CHANGE_COOKIE_EXPLICIT, false}, |
+ {CookieStore::CHANGE_COOKIE_EXPLICIT, false}, |
// DELETE_COOKIE_EVICTED_DOMAIN |
- {CookieMonsterDelegate::CHANGE_COOKIE_EVICTED, true}, |
+ {CookieStore::CHANGE_COOKIE_EVICTED, true}, |
// DELETE_COOKIE_EVICTED_GLOBAL |
- {CookieMonsterDelegate::CHANGE_COOKIE_EVICTED, true}, |
+ {CookieStore::CHANGE_COOKIE_EVICTED, true}, |
// DELETE_COOKIE_EVICTED_DOMAIN_PRE_SAFE |
- {CookieMonsterDelegate::CHANGE_COOKIE_EVICTED, true}, |
+ {CookieStore::CHANGE_COOKIE_EVICTED, true}, |
// DELETE_COOKIE_EVICTED_DOMAIN_POST_SAFE |
- {CookieMonsterDelegate::CHANGE_COOKIE_EVICTED, true}, |
+ {CookieStore::CHANGE_COOKIE_EVICTED, true}, |
// DELETE_COOKIE_EXPIRED_OVERWRITE |
- {CookieMonsterDelegate::CHANGE_COOKIE_EXPIRED_OVERWRITE, true}, |
+ {CookieStore::CHANGE_COOKIE_EXPIRED_OVERWRITE, true}, |
// DELETE_COOKIE_CONTROL_CHAR |
- {CookieMonsterDelegate::CHANGE_COOKIE_EVICTED, true}, |
+ {CookieStore::CHANGE_COOKIE_EVICTED, true}, |
// DELETE_COOKIE_NON_SECURE |
- {CookieMonsterDelegate::CHANGE_COOKIE_EVICTED, true}, |
+ {CookieStore::CHANGE_COOKIE_EVICTED, true}, |
// DELETE_COOKIE_LAST_ENTRY |
- {CookieMonsterDelegate::CHANGE_COOKIE_EXPLICIT, false}}; |
+ {CookieStore::CHANGE_COOKIE_EXPLICIT, false}}; |
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)); |
+ CookieStore::ChangeCause cause) { |
+ proxy->PostTask(FROM_HERE, base::Bind(callback, cookie, cause)); |
} |
bool IsCookieEligibleForEviction(CookiePriority current_priority_level, |
@@ -1685,8 +1685,7 @@ CookieMonster::CookieMap::iterator CookieMonster::InternalInsertCookie( |
CookieMap::iterator inserted = |
cookies_.insert(CookieMap::value_type(key, cc)); |
if (delegate_.get()) { |
- delegate_->OnCookieChanged(*cc, false, |
- CookieMonsterDelegate::CHANGE_COOKIE_EXPLICIT); |
+ delegate_->OnCookieChanged(*cc, false, CookieStore::CHANGE_COOKIE_INSERTED); |
} |
mmenke
2016/09/26 18:29:26
nit: Remove braces
nharper
2016/09/26 21:09:10
Done.
|
// See InitializeHistograms() for details. |
@@ -1717,7 +1716,7 @@ CookieMonster::CookieMap::iterator CookieMonster::InternalInsertCookie( |
histogram_cookie_source_scheme_->Add(cookie_source_sample); |
} |
- RunCookieChangedCallbacks(*cc, false); |
+ RunCookieChangedCallbacks(*cc, CookieStore::CHANGE_COOKIE_INSERTED); |
return inserted; |
} |
@@ -1857,13 +1856,10 @@ void CookieMonster::InternalDeleteCookie(CookieMap::iterator it, |
if ((cc->IsPersistent() || persist_session_cookies_) && store_.get() && |
sync_to_store) |
store_->DeleteCookie(*cc); |
- if (delegate_.get()) { |
- ChangeCausePair mapping = ChangeCauseMapping[deletion_cause]; |
- |
- if (mapping.notify) |
- delegate_->OnCookieChanged(*cc, true, mapping.cause); |
- } |
- RunCookieChangedCallbacks(*cc, true); |
+ ChangeCausePair mapping = ChangeCauseMapping[deletion_cause]; |
+ if (delegate_.get() && mapping.notify) |
+ delegate_->OnCookieChanged(*cc, true, mapping.cause); |
+ RunCookieChangedCallbacks(*cc, mapping.cause); |
cookies_.erase(it); |
delete cc; |
} |
@@ -2375,7 +2371,7 @@ void CookieMonster::RunCallback(const base::Closure& callback) { |
} |
void CookieMonster::RunCookieChangedCallbacks(const CanonicalCookie& cookie, |
- bool removed) { |
+ ChangeCause cause) { |
DCHECK(thread_checker_.CalledOnValidThread()); |
CookieOptions opts; |
@@ -2391,7 +2387,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, cause); |
} |
} |
} |