Cookie Store: Extract change notifications to separate classes.
https://chromium-review.googlesource.com/c/chromium/src/+/919159
This commit is contained in:
parent
806acbdf12
commit
bf55d856d2
6 changed files with 32 additions and 33 deletions
|
@ -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)));
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "base/files/file_path.h"
|
||||
#include "content/public/browser/browser_context.h"
|
||||
#include "content/public/browser/content_browser_client.h"
|
||||
#include "net/cookies/cookie_store.h"
|
||||
#include "net/cookies/cookie_change_dispatcher.h"
|
||||
#include "net/http/http_cache.h"
|
||||
#include "net/http/transport_security_state.h"
|
||||
#include "net/http/url_security_manager.h"
|
||||
|
@ -60,7 +60,7 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
|
|||
virtual std::vector<std::string> GetCookieableSchemes();
|
||||
virtual void NotifyCookieChange(const net::CanonicalCookie& cookie,
|
||||
bool removed,
|
||||
net::CookieStore::ChangeCause cause) {}
|
||||
net::CookieChangeCause cause) {}
|
||||
};
|
||||
|
||||
URLRequestContextGetter(
|
||||
|
@ -72,9 +72,9 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
|
|||
content::ProtocolHandlerMap* protocol_handlers,
|
||||
content::URLRequestInterceptorScopedVector protocol_interceptors);
|
||||
|
||||
// net::CookieStore::CookieChangedCallback implementation.
|
||||
// net::CookieChangeDispatcher::CookieChangedCallback implementation.
|
||||
void OnCookieChanged(const net::CanonicalCookie& cookie,
|
||||
net::CookieStore::ChangeCause cause);
|
||||
net::CookieChangeCause cause);
|
||||
|
||||
// net::URLRequestContextGetter:
|
||||
net::URLRequestContext* GetURLRequestContext() override;
|
||||
|
@ -109,8 +109,7 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
|
|||
std::unique_ptr<net::HostMappingRules> host_mapping_rules_;
|
||||
std::unique_ptr<net::HttpAuthPreferences> http_auth_preferences_;
|
||||
std::unique_ptr<net::HttpNetworkSession> http_network_session_;
|
||||
std::unique_ptr<net::CookieStore::CookieChangedSubscription>
|
||||
cookie_change_sub_;
|
||||
std::unique_ptr<net::CookieChangeSubscription> cookie_change_sub_;
|
||||
content::ProtocolHandlerMap protocol_handlers_;
|
||||
content::URLRequestInterceptorScopedVector protocol_interceptors_;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue