2016-09-21 23:24:03 +00:00
|
|
|
// Copyright (c) 2016 GitHub, Inc.
|
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#include "atom/browser/net/atom_cookie_delegate.h"
|
|
|
|
|
|
|
|
#include "content/public/browser/browser_thread.h"
|
|
|
|
|
|
|
|
namespace atom {
|
|
|
|
|
|
|
|
AtomCookieDelegate::AtomCookieDelegate() {
|
|
|
|
}
|
|
|
|
|
|
|
|
AtomCookieDelegate::~AtomCookieDelegate() {
|
|
|
|
}
|
|
|
|
|
|
|
|
void AtomCookieDelegate::AddObserver(Observer* observer) {
|
|
|
|
observers_.AddObserver(observer);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AtomCookieDelegate::RemoveObserver(Observer* observer) {
|
|
|
|
observers_.RemoveObserver(observer);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AtomCookieDelegate::NotifyObservers(
|
2017-01-23 09:53:05 +00:00
|
|
|
const net::CanonicalCookie& cookie,
|
|
|
|
bool removed,
|
|
|
|
net::CookieStore::ChangeCause cause) {
|
2017-01-24 03:34:39 +00:00
|
|
|
for (Observer& observer : observers_)
|
|
|
|
observer.OnCookieChanged(cookie, removed, cause);
|
2016-09-21 23:24:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void AtomCookieDelegate::OnCookieChanged(
|
2017-01-23 09:53:05 +00:00
|
|
|
const net::CanonicalCookie& cookie,
|
|
|
|
bool removed,
|
|
|
|
net::CookieStore::ChangeCause cause) {
|
2016-09-21 23:24:03 +00:00
|
|
|
content::BrowserThread::PostTask(
|
|
|
|
content::BrowserThread::UI,
|
|
|
|
FROM_HERE,
|
|
|
|
base::Bind(&AtomCookieDelegate::NotifyObservers,
|
|
|
|
this, cookie, removed, cause));
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace atom
|