REVIEW: let browser context manage cookie change sub list

This commit is contained in:
deepak1556 2017-11-28 12:53:42 +05:30 committed by Cheng Zhao
parent 9fa08fdbc0
commit 5eb0a89579
7 changed files with 53 additions and 45 deletions

View file

@ -8,8 +8,8 @@
#include <string>
#include "atom/browser/api/trackable_object.h"
#include "atom/browser/net/cookie_details.h"
#include "base/callback.h"
#include "brightray/browser/net/cookie_details.h"
#include "native_mate/handle.h"
#include "net/cookies/canonical_cookie.h"
@ -54,15 +54,17 @@ class Cookies : public mate::TrackableObject<Cookies> {
void Set(const base::DictionaryValue& details, const SetCallback& callback);
void FlushStore(const base::Closure& callback);
// brightray::URLRequestContextGetter subscription:
void OnCookieChanged(const brightray::CookieDetails*);
// AtomBrowserContext::RegisterCookieChangeCallback subscription:
void OnCookieChanged(const CookieDetails*);
private:
net::URLRequestContextGetter* request_context_getter_;
std::unique_ptr<
base::CallbackList<void(const brightray::CookieDetails*)>::Subscription>
// Store a reference to ensure this class gets destroyed before the context.
scoped_refptr<AtomBrowserContext> browser_context_;
std::unique_ptr<base::CallbackList<void(const CookieDetails*)>::Subscription>
cookie_change_subscription_;
net::URLRequestContextGetter* request_context_getter_;
DISALLOW_COPY_AND_ASSIGN(Cookies);
};