platform_notification_service.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // Copyright (c) 2015 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE-CHROMIUM file.
  4. #ifndef ELECTRON_SHELL_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_H_
  5. #define ELECTRON_SHELL_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_H_
  6. #include <string>
  7. #include "base/memory/raw_ptr.h"
  8. #include "content/public/browser/platform_notification_service.h"
  9. namespace electron {
  10. class ElectronBrowserClient;
  11. class PlatformNotificationService
  12. : public content::PlatformNotificationService {
  13. public:
  14. explicit PlatformNotificationService(ElectronBrowserClient* browser_client);
  15. ~PlatformNotificationService() override;
  16. // disable copy
  17. PlatformNotificationService(const PlatformNotificationService&) = delete;
  18. PlatformNotificationService& operator=(const PlatformNotificationService&) =
  19. delete;
  20. protected:
  21. // content::PlatformNotificationService:
  22. void DisplayNotification(
  23. content::RenderFrameHost* render_frame_host,
  24. const std::string& notification_id,
  25. const GURL& origin,
  26. const GURL& document_url,
  27. const blink::PlatformNotificationData& notification_data,
  28. const blink::NotificationResources& notification_resources) override;
  29. void DisplayPersistentNotification(
  30. const std::string& notification_id,
  31. const GURL& service_worker_scope,
  32. const GURL& origin,
  33. const blink::PlatformNotificationData& notification_data,
  34. const blink::NotificationResources& notification_resources) override {}
  35. void ClosePersistentNotification(
  36. const std::string& notification_id) override {}
  37. void CloseNotification(const std::string& notification_id) override;
  38. void GetDisplayedNotifications(
  39. DisplayedNotificationsCallback callback) override;
  40. void GetDisplayedNotificationsForOrigin(
  41. const GURL& origin,
  42. DisplayedNotificationsCallback callback) override;
  43. int64_t ReadNextPersistentNotificationId() override;
  44. void RecordNotificationUkmEvent(
  45. const content::NotificationDatabaseData& data) override;
  46. void ScheduleTrigger(base::Time timestamp) override;
  47. base::Time ReadNextTriggerTimestamp() override;
  48. private:
  49. raw_ptr<ElectronBrowserClient> browser_client_;
  50. };
  51. } // namespace electron
  52. #endif // ELECTRON_SHELL_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_H_