| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 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 file. |
| 4 |
| 5 #ifndef NotificationManager_h |
| 6 #define NotificationManager_h |
| 7 |
| 8 #include "core/dom/ContextLifecycleObserver.h" |
| 9 #include "core/dom/ExecutionContext.h" |
| 10 #include "public/platform/modules/notifications/notification_service.mojom-blink
.h" |
| 11 #include "wtf/Noncopyable.h" |
| 12 #include "wtf/text/WTFString.h" |
| 13 |
| 14 namespace blink { |
| 15 |
| 16 namespace mojom { |
| 17 namespace blink { |
| 18 enum class PermissionStatus; |
| 19 } |
| 20 } |
| 21 |
| 22 // The notification manager, unique to the execution context, is responsible for |
| 23 // connecting and communicating with the Mojo notification service. |
| 24 // |
| 25 // TODO(peter): Make the NotificationManager responsible for resource loading. |
| 26 class NotificationManager final |
| 27 : public GarbageCollectedFinalized<NotificationManager> |
| 28 , public ContextLifecycleObserver |
| 29 , public Supplement<ExecutionContext> { |
| 30 USING_GARBAGE_COLLECTED_MIXIN(NotificationManager); |
| 31 WTF_MAKE_NONCOPYABLE(NotificationManager); |
| 32 public: |
| 33 static NotificationManager* from(ExecutionContext*); |
| 34 static const char* supplementName(); |
| 35 |
| 36 ~NotificationManager(); |
| 37 |
| 38 // Returns the notification permission status of the current origin. This |
| 39 // method is synchronous to support the Notification.permission getter. |
| 40 mojom::blink::PermissionStatus permissionStatus() const; |
| 41 |
| 42 // ContextLifecycleObserver implementation. |
| 43 void contextDestroyed() override; |
| 44 |
| 45 DECLARE_VIRTUAL_TRACE(); |
| 46 |
| 47 private: |
| 48 explicit NotificationManager(ExecutionContext*); |
| 49 |
| 50 mojom::blink::NotificationServicePtr m_service; |
| 51 }; |
| 52 |
| 53 } // namespace blink |
| 54 |
| 55 #endif // NotificationManager_h |
| OLD | NEW |