2015-03-09 02:37:13 +00: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 07:34:31 +00:00
|
|
|
#ifndef ELECTRON_SHELL_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_H_
|
|
|
|
#define ELECTRON_SHELL_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_H_
|
2015-03-09 02:37:13 +00:00
|
|
|
|
2017-05-18 22:06:57 +00:00
|
|
|
#include <string>
|
|
|
|
|
2023-05-11 20:07:39 +00:00
|
|
|
#include "base/memory/raw_ptr.h"
|
2015-03-09 02:37:13 +00:00
|
|
|
#include "content/public/browser/platform_notification_service.h"
|
|
|
|
|
2018-10-17 18:01:11 +00:00
|
|
|
namespace electron {
|
2015-03-09 02:37:13 +00:00
|
|
|
|
2018-10-17 18:01:11 +00:00
|
|
|
class ElectronBrowserClient;
|
2015-03-09 02:37:13 +00:00
|
|
|
|
2015-12-24 14:20:47 +00:00
|
|
|
class PlatformNotificationService
|
2015-03-09 02:37:13 +00:00
|
|
|
: public content::PlatformNotificationService {
|
|
|
|
public:
|
2018-10-17 18:01:11 +00:00
|
|
|
explicit PlatformNotificationService(ElectronBrowserClient* browser_client);
|
2015-12-24 14:20:47 +00:00
|
|
|
~PlatformNotificationService() override;
|
2015-03-09 02:37:13 +00:00
|
|
|
|
2021-11-03 11:41:45 +00:00
|
|
|
// disable copy
|
|
|
|
PlatformNotificationService(const PlatformNotificationService&) = delete;
|
|
|
|
PlatformNotificationService& operator=(const PlatformNotificationService&) =
|
|
|
|
delete;
|
|
|
|
|
2015-12-24 14:20:47 +00:00
|
|
|
protected:
|
2015-03-09 02:37:13 +00:00
|
|
|
// content::PlatformNotificationService:
|
2017-01-23 08:48:16 +00:00
|
|
|
void DisplayNotification(
|
2021-04-29 18:23:28 +00:00
|
|
|
content::RenderFrameHost* render_frame_host,
|
2017-01-23 08:48:16 +00:00
|
|
|
const std::string& notification_id,
|
2015-03-09 02:37:13 +00:00
|
|
|
const GURL& origin,
|
2021-04-27 21:27:34 +00:00
|
|
|
const GURL& document_url,
|
2019-01-12 01:00:43 +00:00
|
|
|
const blink::PlatformNotificationData& notification_data,
|
|
|
|
const blink::NotificationResources& notification_resources) override;
|
2015-04-21 10:54:57 +00:00
|
|
|
void DisplayPersistentNotification(
|
2017-01-23 08:48:16 +00:00
|
|
|
const std::string& notification_id,
|
|
|
|
const GURL& service_worker_scope,
|
2015-03-09 02:37:13 +00:00
|
|
|
const GURL& origin,
|
2019-01-12 01:00:43 +00:00
|
|
|
const blink::PlatformNotificationData& notification_data,
|
|
|
|
const blink::NotificationResources& notification_resources) override;
|
2019-04-20 17:20:37 +00:00
|
|
|
void ClosePersistentNotification(const std::string& notification_id) override;
|
|
|
|
void CloseNotification(const std::string& notification_id) override;
|
2017-06-16 21:48:59 +00:00
|
|
|
void GetDisplayedNotifications(
|
2019-02-21 07:50:18 +00:00
|
|
|
DisplayedNotificationsCallback callback) override;
|
2023-10-02 22:01:07 +00:00
|
|
|
void GetDisplayedNotificationsForOrigin(
|
|
|
|
const GURL& origin,
|
|
|
|
DisplayedNotificationsCallback callback) override;
|
2019-04-20 17:20:37 +00:00
|
|
|
int64_t ReadNextPersistentNotificationId() override;
|
2018-10-25 17:19:44 +00:00
|
|
|
void RecordNotificationUkmEvent(
|
|
|
|
const content::NotificationDatabaseData& data) override;
|
2019-04-20 17:20:37 +00:00
|
|
|
void ScheduleTrigger(base::Time timestamp) override;
|
|
|
|
base::Time ReadNextTriggerTimestamp() override;
|
2015-03-09 02:37:13 +00:00
|
|
|
|
2015-12-24 14:20:47 +00:00
|
|
|
private:
|
2023-05-11 20:07:39 +00:00
|
|
|
raw_ptr<ElectronBrowserClient> browser_client_;
|
2015-03-09 02:37:13 +00:00
|
|
|
};
|
|
|
|
|
2018-10-17 18:01:11 +00:00
|
|
|
} // namespace electron
|
2015-03-09 02:37:13 +00:00
|
|
|
|
2021-11-22 07:34:31 +00:00
|
|
|
#endif // ELECTRON_SHELL_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_H_
|