electron/atom/browser/net/atom_cookie_delegate.cc

45 lines
1.1 KiB
C++
Raw Normal View History

// 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);
}
void AtomCookieDelegate::OnCookieChanged(
2017-01-23 09:53:05 +00:00
const net::CanonicalCookie& cookie,
bool removed,
net::CookieStore::ChangeCause cause) {
content::BrowserThread::PostTask(
content::BrowserThread::UI,
FROM_HERE,
base::Bind(&AtomCookieDelegate::NotifyObservers,
this, cookie, removed, cause));
}
} // namespace atom