notification_presenter_win.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
  2. // Copyright (c) 2015 Felix Rieseberg <[email protected]> and
  3. // Jason Poon <[email protected]>. All rights reserved.
  4. // Use of this source code is governed by a BSD-style license that can be
  5. // found in the LICENSE-CHROMIUM file.
  6. // Usage Example (JavaScript:
  7. // var windowsNotification = new Notification("Test Title", {
  8. // body: "Hi, I'm an example body. How are you?",
  9. // icon: "file:///C:/Path/To/Your/Image.png"
  10. // });
  11. // windowsNotification.onshow = function () {
  12. // console.log("Notification shown")
  13. // };
  14. // windowsNotification.onclick = function () {
  15. // console.log("Notification clicked")
  16. // };
  17. // windowsNotification.onclose = function () {
  18. // console.log("Notification dismissed")
  19. // };
  20. #ifndef ELECTRON_SHELL_BROWSER_NOTIFICATIONS_WIN_NOTIFICATION_PRESENTER_WIN_H_
  21. #define ELECTRON_SHELL_BROWSER_NOTIFICATIONS_WIN_NOTIFICATION_PRESENTER_WIN_H_
  22. #include "base/files/scoped_temp_dir.h"
  23. #include "shell/browser/notifications/notification_presenter.h"
  24. class GURL;
  25. class SkBitmap;
  26. namespace electron {
  27. class NotificationPresenterWin : public NotificationPresenter {
  28. public:
  29. NotificationPresenterWin();
  30. ~NotificationPresenterWin() override;
  31. bool Init();
  32. std::wstring SaveIconToFilesystem(const SkBitmap& icon, const GURL& origin);
  33. private:
  34. // NotificationPresenter
  35. Notification* CreateNotificationObject(
  36. NotificationDelegate* delegate) override;
  37. base::ScopedTempDir temp_dir_;
  38. };
  39. } // namespace electron
  40. #endif // ELECTRON_SHELL_BROWSER_NOTIFICATIONS_WIN_NOTIFICATION_PRESENTER_WIN_H_