2015-03-08 19:37:13 -07:00
|
|
|
// Copyright (c) 2015 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE-CHROMIUM file.
|
|
|
|
|
2021-11-22 08:34:31 +01:00
|
|
|
#ifndef ELECTRON_SHELL_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_H_
|
|
|
|
#define ELECTRON_SHELL_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_H_
|
2015-03-08 19:37:13 -07:00
|
|
|
|
2017-05-18 15:06:57 -07:00
|
|
|
#include <string>
|
|
|
|
|
2023-05-11 16:07:39 -04:00
|
|
|
#include "base/memory/raw_ptr.h"
|
2015-03-08 19:37:13 -07:00
|
|
|
#include "content/public/browser/platform_notification_service.h"
|
|
|
|
|
2018-10-17 20:01:11 +02:00
|
|
|
namespace electron {
|
2015-03-08 19:37:13 -07:00
|
|
|
|
2018-10-17 20:01:11 +02:00
|
|
|
class ElectronBrowserClient;
|
2015-03-08 19:37:13 -07:00
|
|
|
|
2015-12-24 22:20:47 +08:00
|
|
|
class PlatformNotificationService
|
2015-03-08 19:37:13 -07:00
|
|
|
: public content::PlatformNotificationService {
|
|
|
|
public:
|
2018-10-17 20:01:11 +02:00
|
|
|
explicit PlatformNotificationService(ElectronBrowserClient* browser_client);
|
2015-12-24 22:20:47 +08:00
|
|
|
~PlatformNotificationService() override;
|
2015-03-08 19:37:13 -07:00
|
|
|
|
2021-11-03 12:41:45 +01:00
|
|
|
// disable copy
|
|
|
|
PlatformNotificationService(const PlatformNotificationService&) = delete;
|
|
|
|
PlatformNotificationService& operator=(const PlatformNotificationService&) =
|
|
|
|
delete;
|
|
|
|
|
2015-12-24 22:20:47 +08:00
|
|
|
protected:
|
2015-03-08 19:37:13 -07:00
|
|
|
// content::PlatformNotificationService:
|
2017-01-23 17:48:16 +09:00
|
|
|
void DisplayNotification(
|
2021-04-29 11:23:28 -07:00
|
|
|
content::RenderFrameHost* render_frame_host,
|
2017-01-23 17:48:16 +09:00
|
|
|
const std::string& notification_id,
|
2015-03-08 19:37:13 -07:00
|
|
|
const GURL& origin,
|
2021-04-27 14:27:34 -07:00
|
|
|
const GURL& document_url,
|
2019-01-12 06:30:43 +05:30
|
|
|
const blink::PlatformNotificationData& notification_data,
|
|
|
|
const blink::NotificationResources& notification_resources) override;
|
2015-04-21 18:54:57 +08:00
|
|
|
void DisplayPersistentNotification(
|
2017-01-23 17:48:16 +09:00
|
|
|
const std::string& notification_id,
|
|
|
|
const GURL& service_worker_scope,
|
2015-03-08 19:37:13 -07:00
|
|
|
const GURL& origin,
|
2019-01-12 06:30:43 +05:30
|
|
|
const blink::PlatformNotificationData& notification_data,
|
|
|
|
const blink::NotificationResources& notification_resources) override;
|
2019-04-20 13:20:37 -04:00
|
|
|
void ClosePersistentNotification(const std::string& notification_id) override;
|
|
|
|
void CloseNotification(const std::string& notification_id) override;
|
2017-06-17 00:48:59 +03:00
|
|
|
void GetDisplayedNotifications(
|
2019-02-21 13:20:18 +05:30
|
|
|
DisplayedNotificationsCallback callback) override;
|
2023-10-02 18:01:07 -04:00
|
|
|
void GetDisplayedNotificationsForOrigin(
|
|
|
|
const GURL& origin,
|
|
|
|
DisplayedNotificationsCallback callback) override;
|
2019-04-20 13:20:37 -04:00
|
|
|
int64_t ReadNextPersistentNotificationId() override;
|
2018-10-25 22:49:44 +05:30
|
|
|
void RecordNotificationUkmEvent(
|
|
|
|
const content::NotificationDatabaseData& data) override;
|
2019-04-20 13:20:37 -04:00
|
|
|
void ScheduleTrigger(base::Time timestamp) override;
|
|
|
|
base::Time ReadNextTriggerTimestamp() override;
|
2015-03-08 19:37:13 -07:00
|
|
|
|
2015-12-24 22:20:47 +08:00
|
|
|
private:
|
2023-05-11 16:07:39 -04:00
|
|
|
raw_ptr<ElectronBrowserClient> browser_client_;
|
2015-03-08 19:37:13 -07:00
|
|
|
};
|
|
|
|
|
2018-10-17 20:01:11 +02:00
|
|
|
} // namespace electron
|
2015-03-08 19:37:13 -07:00
|
|
|
|
2021-11-22 08:34:31 +01:00
|
|
|
#endif // ELECTRON_SHELL_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_H_
|