electron/brightray/browser/win/notification_presenter_win7.cc

51 lines
1.3 KiB
C++
Raw Normal View History

#include "brightray/browser/win/notification_presenter_win7.h"
#include <string>
#include "brightray/browser/win/win32_notification.h"
namespace brightray {
brightray::Notification* NotificationPresenterWin7::CreateNotificationObject(
NotificationDelegate* delegate) {
2018-04-18 01:56:12 +00:00
return new Win32Notification(delegate, this);
}
Win32Notification* NotificationPresenterWin7::GetNotificationObjectByRef(
const DesktopNotificationController::Notification& ref) {
2018-04-18 01:56:12 +00:00
for (auto n : this->notifications()) {
auto w32n = static_cast<Win32Notification*>(n);
if (w32n->GetRef() == ref)
return w32n;
}
2018-04-18 01:56:12 +00:00
return nullptr;
}
Win32Notification* NotificationPresenterWin7::GetNotificationObjectByTag(
const std::string& tag) {
2018-04-18 01:56:12 +00:00
for (auto n : this->notifications()) {
auto w32n = static_cast<Win32Notification*>(n);
if (w32n->GetTag() == tag)
return w32n;
}
2018-04-18 01:56:12 +00:00
return nullptr;
}
void NotificationPresenterWin7::OnNotificationClicked(
Notification& notification) {
2018-04-18 01:56:12 +00:00
auto n = GetNotificationObjectByRef(notification);
if (n)
n->NotificationClicked();
}
void NotificationPresenterWin7::OnNotificationDismissed(
Notification& notification) {
2018-04-18 01:56:12 +00:00
auto n = GetNotificationObjectByRef(notification);
if (n)
n->NotificationDismissed();
}
2018-04-18 01:56:12 +00:00
} // namespace brightray