Chromium Code Reviews| 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 "platform/Supplementable.h" | |
| 10 #include "platform/heap/GarbageCollected.h" | |
| 11 #include "platform/heap/Handle.h" | |
| 12 #include "platform/heap/HeapAllocator.h" | |
| 13 #include "platform/heap/Visitor.h" | |
| 14 #include "public/platform/modules/notifications/WebNotificationManager.h" | |
| 15 #include "wtf/Noncopyable.h" | |
| 16 #include "wtf/OwnPtr.h" | |
| 17 #include "wtf/PassOwnPtr.h" | |
| 18 #include "wtf/PassRefPtr.h" | |
| 9 | 19 |
| 10 namespace blink { | 20 namespace blink { |
| 11 | 21 |
| 12 class ExceptionState; | 22 class ExceptionState; |
| 13 class GetNotificationOptions; | 23 class GetNotificationOptions; |
| 14 class NotificationOptions; | 24 class NotificationOptions; |
| 25 class NotificationResourcesLoader; | |
| 15 class ScriptState; | 26 class ScriptState; |
| 27 class SecurityOrigin; | |
| 16 class ServiceWorkerRegistration; | 28 class ServiceWorkerRegistration; |
| 29 struct WebNotificationData; | |
| 17 | 30 |
| 18 class ServiceWorkerRegistrationNotifications { | 31 class ServiceWorkerRegistrationNotifications final |
| 19 STATIC_ONLY(ServiceWorkerRegistrationNotifications); | 32 : public GarbageCollectedFinalized<ServiceWorkerRegistrationNotifications> |
| 33 , public Supplement<ServiceWorkerRegistration> { | |
| 34 USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerRegistrationNotifications); | |
| 35 WTF_MAKE_NONCOPYABLE(ServiceWorkerRegistrationNotifications); | |
| 20 public: | 36 public: |
| 37 virtual ~ServiceWorkerRegistrationNotifications(); | |
| 21 static ScriptPromise showNotification(ScriptState*, ServiceWorkerRegistratio n&, const String& title, const NotificationOptions&, ExceptionState&); | 38 static ScriptPromise showNotification(ScriptState*, ServiceWorkerRegistratio n&, const String& title, const NotificationOptions&, ExceptionState&); |
| 22 static ScriptPromise getNotifications(ScriptState*, ServiceWorkerRegistratio n&, const GetNotificationOptions&); | 39 static ScriptPromise getNotifications(ScriptState*, ServiceWorkerRegistratio n&, const GetNotificationOptions&); |
| 40 | |
| 41 DECLARE_VIRTUAL_TRACE(); | |
| 42 | |
| 43 private: | |
| 44 explicit ServiceWorkerRegistrationNotifications(ServiceWorkerRegistration*); | |
| 45 static const char* supplementName(); | |
| 46 static ServiceWorkerRegistrationNotifications& from(ServiceWorkerRegistratio n&); | |
| 47 void prepareShow(ExecutionContext*, const WebNotificationData&, PassOwnPtr<W ebNotificationShowCallbacks>); | |
|
Peter Beverloo
2016/04/13 18:32:28
micro nit: It would be nice to logically separate
Michael van Ouwerkerk
2016/04/14 13:42:12
Done.
| |
| 48 void didLoadResources(PassRefPtr<SecurityOrigin>, const WebNotificationData& , PassOwnPtr<WebNotificationShowCallbacks>, NotificationResourcesLoader*); | |
| 49 | |
| 50 Member<ServiceWorkerRegistration> m_registration; | |
| 51 HeapHashSet<Member<NotificationResourcesLoader>> m_loaders; | |
| 23 }; | 52 }; |
| 24 | 53 |
| 25 } // namespace blink | 54 } // namespace blink |
| 26 | 55 |
| 27 #endif // ServiceWorkerRegistrationNotifications_h | 56 #endif // ServiceWorkerRegistrationNotifications_h |
| OLD | NEW |