diff --git a/atom/browser/api/atom_api_cookies.cc b/atom/browser/api/atom_api_cookies.cc index 9c4f2e97f22a..d1d75b7f64f0 100644 --- a/atom/browser/api/atom_api_cookies.cc +++ b/atom/browser/api/atom_api_cookies.cc @@ -14,7 +14,6 @@ #include "content/public/browser/browser_thread.h" #include "native_mate/dictionary.h" #include "native_mate/object_template_builder.h" -#include "net/cookies/cookie_monster.h" #include "net/cookies/cookie_store.h" #include "net/cookies/cookie_util.h" #include "net/url_request/url_request_context.h" @@ -55,24 +54,24 @@ struct Converter { }; template <> -struct Converter { +struct Converter { static v8::Local ToV8(v8::Isolate* isolate, - const net::CookieStore::ChangeCause& val) { + const net::CookieChangeCause& val) { switch (val) { - case net::CookieStore::ChangeCause::INSERTED: - case net::CookieStore::ChangeCause::EXPLICIT: - case net::CookieStore::ChangeCause::EXPLICIT_DELETE_BETWEEN: - case net::CookieStore::ChangeCause::EXPLICIT_DELETE_PREDICATE: - case net::CookieStore::ChangeCause::EXPLICIT_DELETE_SINGLE: - case net::CookieStore::ChangeCause::EXPLICIT_DELETE_CANONICAL: + case net::CookieChangeCause::INSERTED: + case net::CookieChangeCause::EXPLICIT: + case net::CookieChangeCause::EXPLICIT_DELETE_BETWEEN: + case net::CookieChangeCause::EXPLICIT_DELETE_PREDICATE: + case net::CookieChangeCause::EXPLICIT_DELETE_SINGLE: + case net::CookieChangeCause::EXPLICIT_DELETE_CANONICAL: return mate::StringToV8(isolate, "explicit"); - case net::CookieStore::ChangeCause::OVERWRITE: + case net::CookieChangeCause::OVERWRITE: return mate::StringToV8(isolate, "overwrite"); - case net::CookieStore::ChangeCause::EXPIRED: + case net::CookieChangeCause::EXPIRED: return mate::StringToV8(isolate, "expired"); - case net::CookieStore::ChangeCause::EVICTED: + case net::CookieChangeCause::EVICTED: return mate::StringToV8(isolate, "evicted"); - case net::CookieStore::ChangeCause::EXPIRED_OVERWRITE: + case net::CookieChangeCause::EXPIRED_OVERWRITE: return mate::StringToV8(isolate, "expired-overwrite"); default: return mate::StringToV8(isolate, "unknown"); diff --git a/atom/browser/atom_browser_context.cc b/atom/browser/atom_browser_context.cc index 1cc741e2f406..f4d6d5149c6f 100644 --- a/atom/browser/atom_browser_context.cc +++ b/atom/browser/atom_browser_context.cc @@ -203,10 +203,9 @@ std::vector AtomBrowserContext::GetCookieableSchemes() { return default_schemes; } -void AtomBrowserContext::NotifyCookieChange( - const net::CanonicalCookie& cookie, - bool removed, - net::CookieStore::ChangeCause cause) { +void AtomBrowserContext::NotifyCookieChange(const net::CanonicalCookie& cookie, + bool removed, + net::CookieChangeCause cause) { CookieDetails cookie_details(&cookie, removed, cause); cookie_change_sub_list_.Notify(&cookie_details); } diff --git a/atom/browser/atom_browser_context.h b/atom/browser/atom_browser_context.h index f825413a96c6..b60a4e682b0a 100644 --- a/atom/browser/atom_browser_context.h +++ b/atom/browser/atom_browser_context.h @@ -48,7 +48,7 @@ class AtomBrowserContext : public brightray::BrowserContext { std::vector GetCookieableSchemes() override; void NotifyCookieChange(const net::CanonicalCookie& cookie, bool removed, - net::CookieStore::ChangeCause cause) override; + net::CookieChangeCause cause) override; // content::BrowserContext: content::DownloadManagerDelegate* GetDownloadManagerDelegate() override; diff --git a/atom/browser/net/cookie_details.h b/atom/browser/net/cookie_details.h index 5103836dcb6c..9e361f199c6c 100644 --- a/atom/browser/net/cookie_details.h +++ b/atom/browser/net/cookie_details.h @@ -6,7 +6,7 @@ #define ATOM_BROWSER_NET_COOKIE_DETAILS_H_ #include "base/macros.h" -#include "net/cookies/cookie_store.h" +#include "net/cookies/cookie_change_dispatcher.h" namespace atom { @@ -14,12 +14,12 @@ struct CookieDetails { public: CookieDetails(const net::CanonicalCookie* cookie_copy, bool is_removed, - net::CookieStore::ChangeCause cause) + net::CookieChangeCause cause) : cookie(cookie_copy), removed(is_removed), cause(cause) {} const net::CanonicalCookie* cookie; bool removed; - net::CookieStore::ChangeCause cause; + net::CookieChangeCause cause; }; } // namespace atom diff --git a/brightray/browser/url_request_context_getter.cc b/brightray/browser/url_request_context_getter.cc index 5ad6f28da330..20dc9928248e 100644 --- a/brightray/browser/url_request_context_getter.cc +++ b/brightray/browser/url_request_context_getter.cc @@ -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( new net::DefaultChannelIDStore(nullptr))); diff --git a/brightray/browser/url_request_context_getter.h b/brightray/browser/url_request_context_getter.h index 0cfd921babe5..b990d479a06c 100644 --- a/brightray/browser/url_request_context_getter.h +++ b/brightray/browser/url_request_context_getter.h @@ -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 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 host_mapping_rules_; std::unique_ptr http_auth_preferences_; std::unique_ptr http_network_session_; - std::unique_ptr - cookie_change_sub_; + std::unique_ptr cookie_change_sub_; content::ProtocolHandlerMap protocol_handlers_; content::URLRequestInterceptorScopedVector protocol_interceptors_;