Cookie Store: Extract change notifications to separate classes.

https://chromium-review.googlesource.com/c/chromium/src/+/919159
This commit is contained in:
deepak1556 2018-04-08 23:20:21 +05:30 committed by Samuel Attard
parent 806acbdf12
commit bf55d856d2
6 changed files with 32 additions and 33 deletions

View file

@ -168,7 +168,7 @@ void URLRequestContextGetter::NotifyContextShutdownOnIO() {
void URLRequestContextGetter::OnCookieChanged(
const net::CanonicalCookie& cookie,
net::CookieStore::ChangeCause cause) {
net::CookieChangeCause cause) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (!delegate_ || context_shutting_down_)
@ -176,9 +176,9 @@ void URLRequestContextGetter::OnCookieChanged(
content::BrowserThread::PostTask(
content::BrowserThread::UI, FROM_HERE,
base::BindOnce(
&Delegate::NotifyCookieChange, base::Unretained(delegate_), cookie,
!(cause == net::CookieStore::ChangeCause::INSERTED), cause));
base::BindOnce(&Delegate::NotifyCookieChange, base::Unretained(delegate_),
cookie, !(cause == net::CookieChangeCause::INSERTED),
cause));
}
net::HostResolver* URLRequestContextGetter::host_resolver() {
@ -223,8 +223,10 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
// Cookie store will outlive notifier by order of declaration
// in the header.
cookie_change_sub_ =
url_request_context_->cookie_store()->AddCallbackForAllChanges(
base::Bind(&URLRequestContextGetter::OnCookieChanged, this));
url_request_context_->cookie_store()
->GetChangeDispatcher()
.AddCallbackForAllChanges(
base::Bind(&URLRequestContextGetter::OnCookieChanged, this));
storage_->set_channel_id_service(std::make_unique<net::ChannelIDService>(
new net::DefaultChannelIDStore(nullptr)));