| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ServiceWorkerRegistrationNotifications_h | 5 #ifndef ServiceWorkerRegistrationNotifications_h |
| 6 #define ServiceWorkerRegistrationNotifications_h | 6 #define ServiceWorkerRegistrationNotifications_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "core/dom/ContextLifecycleObserver.h" | 9 #include "core/dom/ContextLifecycleObserver.h" |
| 10 #include "platform/Supplementable.h" | 10 #include "platform/Supplementable.h" |
| 11 #include "platform/heap/GarbageCollected.h" | 11 #include "platform/heap/GarbageCollected.h" |
| 12 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
| 13 #include "platform/heap/HeapAllocator.h" | 13 #include "platform/heap/HeapAllocator.h" |
| 14 #include "platform/heap/Visitor.h" | 14 #include "platform/heap/Visitor.h" |
| 15 #include "public/platform/modules/notifications/WebNotificationManager.h" | 15 #include "public/platform/modules/notifications/notification.mojom-blink.h" |
| 16 #include "public/platform/modules/notifications/notification_service.mojom-blink
.h" |
| 16 #include "wtf/Noncopyable.h" | 17 #include "wtf/Noncopyable.h" |
| 17 #include "wtf/OwnPtr.h" | |
| 18 #include "wtf/PassOwnPtr.h" | |
| 19 #include "wtf/PassRefPtr.h" | |
| 20 | 18 |
| 21 namespace blink { | 19 namespace blink { |
| 22 | 20 |
| 23 class ExecutionContext; | 21 class ExecutionContext; |
| 24 class ExceptionState; | 22 class ExceptionState; |
| 25 class GetNotificationOptions; | 23 class GetNotificationOptions; |
| 26 class NotificationOptions; | 24 class NotificationOptions; |
| 27 class NotificationResourcesLoader; | 25 class NotificationResourcesLoader; |
| 28 class ScriptState; | 26 class ScriptState; |
| 29 class SecurityOrigin; | |
| 30 class ServiceWorkerRegistration; | 27 class ServiceWorkerRegistration; |
| 31 struct WebNotificationData; | |
| 32 | 28 |
| 33 class ServiceWorkerRegistrationNotifications final : public GarbageCollectedFina
lized<ServiceWorkerRegistrationNotifications>, public Supplement<ServiceWorkerRe
gistration>, public ContextLifecycleObserver { | 29 class ServiceWorkerRegistrationNotifications final : public GarbageCollectedFina
lized<ServiceWorkerRegistrationNotifications>, public Supplement<ServiceWorkerRe
gistration>, public ContextLifecycleObserver { |
| 34 USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerRegistrationNotifications); | 30 USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerRegistrationNotifications); |
| 35 WTF_MAKE_NONCOPYABLE(ServiceWorkerRegistrationNotifications); | 31 WTF_MAKE_NONCOPYABLE(ServiceWorkerRegistrationNotifications); |
| 32 |
| 36 public: | 33 public: |
| 37 ~ServiceWorkerRegistrationNotifications(); | 34 ~ServiceWorkerRegistrationNotifications(); |
| 38 static ScriptPromise showNotification(ScriptState*, ServiceWorkerRegistratio
n&, const String& title, const NotificationOptions&, ExceptionState&); | 35 static ScriptPromise showNotification(ScriptState*, ServiceWorkerRegistratio
n&, const String& title, const NotificationOptions&, ExceptionState&); |
| 39 static ScriptPromise getNotifications(ScriptState*, ServiceWorkerRegistratio
n&, const GetNotificationOptions&); | 36 static ScriptPromise getNotifications(ScriptState*, ServiceWorkerRegistratio
n&, const GetNotificationOptions&); |
| 40 | 37 |
| 41 // ContextLifecycleObserver interface. | 38 // ContextLifecycleObserver interface. |
| 42 void contextDestroyed() override; | 39 void contextDestroyed() override; |
| 43 | 40 |
| 44 DECLARE_VIRTUAL_TRACE(); | 41 DECLARE_VIRTUAL_TRACE(); |
| 45 | 42 |
| 46 private: | 43 private: |
| 47 ServiceWorkerRegistrationNotifications(ExecutionContext*, ServiceWorkerRegis
tration*); | 44 ServiceWorkerRegistrationNotifications(ExecutionContext*, ServiceWorkerRegis
tration*); |
| 48 | 45 |
| 49 static const char* supplementName(); | 46 static const char* supplementName(); |
| 50 static ServiceWorkerRegistrationNotifications& from(ExecutionContext*, Servi
ceWorkerRegistration&); | 47 static ServiceWorkerRegistrationNotifications& from(ExecutionContext*, Servi
ceWorkerRegistration&); |
| 51 | 48 |
| 52 void prepareShow(const WebNotificationData&, PassOwnPtr<WebNotificationShowC
allbacks>); | 49 void prepareShow(mojom::blink::NotificationPtr, const mojom::blink::Notifica
tionService::DisplayPersistentCallback& callback); |
| 53 void didLoadResources(PassRefPtr<SecurityOrigin>, const WebNotificationData&
, PassOwnPtr<WebNotificationShowCallbacks>, NotificationResourcesLoader*); | 50 void didLoadResources(const mojom::blink::NotificationService::DisplayPersis
tentCallback& callback, NotificationResourcesLoader*, mojom::blink::Notification
Ptr notification); |
| 54 | 51 |
| 55 Member<ServiceWorkerRegistration> m_registration; | 52 Member<ServiceWorkerRegistration> m_registration; |
| 56 HeapHashSet<Member<NotificationResourcesLoader>> m_loaders; | 53 HeapHashSet<Member<NotificationResourcesLoader>> m_loaders; |
| 57 }; | 54 }; |
| 58 | 55 |
| 59 } // namespace blink | 56 } // namespace blink |
| 60 | 57 |
| 61 #endif // ServiceWorkerRegistrationNotifications_h | 58 #endif // ServiceWorkerRegistrationNotifications_h |
| OLD | NEW |