2015-11-04 18:13:52 +00:00
|
|
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
2015-11-08 06:11:15 +00:00
|
|
|
// Copyright (c) 2015 Felix Rieseberg <feriese@microsoft.com> and Jason Poon <jason.poon@microsoft.com>. All rights reserved.
|
2015-11-04 18:13:52 +00:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE-CHROMIUM file.
|
|
|
|
|
2015-11-08 03:41:29 +00:00
|
|
|
// Usage Example (JavaScript:
|
|
|
|
// var windowsNotification = new Notification("Test Title", {
|
|
|
|
// body: "Hi, I'm an example body. How are you?",
|
|
|
|
// icon: "file:///C:/Path/To/Your/Image.png"
|
|
|
|
// });
|
|
|
|
|
|
|
|
// windowsNotification.onshow = function () { console.log("Notification shown") };
|
|
|
|
// windowsNotification.onclick = function () { console.log("Notification clicked") };
|
|
|
|
// windowsNotification.onclose = function () { console.log("Notification dismissed") };
|
|
|
|
|
2015-11-10 10:27:18 +00:00
|
|
|
#ifndef BRIGHTRAY_BROWSER_WIN_NOTIFICATION_PRESENTER_WIN_H_
|
|
|
|
#define BRIGHTRAY_BROWSER_WIN_NOTIFICATION_PRESENTER_WIN_H_
|
2015-11-04 18:13:52 +00:00
|
|
|
|
|
|
|
#include "base/compiler_specific.h"
|
|
|
|
#include "browser/notification_presenter.h"
|
2015-11-08 06:11:15 +00:00
|
|
|
#include "windows_toast_notification.h"
|
2015-11-04 18:13:52 +00:00
|
|
|
|
|
|
|
#include <windows.h>
|
2015-11-08 06:11:15 +00:00
|
|
|
#include <windows.ui.notifications.h>
|
|
|
|
#include <wrl/client.h>
|
|
|
|
#include <wrl/implements.h>
|
2015-11-04 18:13:52 +00:00
|
|
|
|
|
|
|
namespace brightray {
|
|
|
|
|
|
|
|
class NotificationPresenterWin : public NotificationPresenter {
|
|
|
|
public:
|
|
|
|
NotificationPresenterWin();
|
|
|
|
~NotificationPresenterWin();
|
|
|
|
|
|
|
|
void ShowNotification(
|
|
|
|
const content::PlatformNotificationData&,
|
|
|
|
const SkBitmap& icon,
|
|
|
|
scoped_ptr<content::DesktopNotificationDelegate> delegate,
|
|
|
|
base::Closure* cancel_callback) override;
|
2015-11-10 10:27:18 +00:00
|
|
|
|
2015-11-04 18:13:52 +00:00
|
|
|
void RemoveNotification();
|
|
|
|
|
|
|
|
private:
|
2015-11-08 06:11:15 +00:00
|
|
|
WinToasts::WindowsToastNotification* wtn;
|
|
|
|
Microsoft::WRL::ComPtr<ABI::Windows::UI::Notifications::IToastNotification> m_lastNotification;
|
2015-11-04 18:13:52 +00:00
|
|
|
};
|
|
|
|
|
2015-11-08 06:11:15 +00:00
|
|
|
} // namespace
|
2015-11-04 18:13:52 +00:00
|
|
|
|
2015-11-10 10:27:18 +00:00
|
|
|
#endif // BRIGHTRAY_BROWSER_WIN_NOTIFICATION_PRESENTER_WIN_H_
|