| 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 enum class PermissionStatus; |
| 18 } |
| 19 |
| 20 // The notification manager, unique to the execution context, is responsible for |
| 21 // connecting and communicating with the Mojo notification service. |
| 22 // |
| 23 // TODO(peter): Make the NotificationManager responsible for resource loading. |
| 24 class NotificationManager final |
| 25 : public GarbageCollectedFinalized<NotificationManager> |
| 26 , public ContextLifecycleObserver |
| 27 , public Supplement<ExecutionContext> { |
| 28 USING_GARBAGE_COLLECTED_MIXIN(NotificationManager); |
| 29 WTF_MAKE_NONCOPYABLE(NotificationManager); |
| 30 public: |
| 31 static NotificationManager* from(ExecutionContext*); |
| 32 static const char* supplementName(); |
| 33 |
| 34 ~NotificationManager(); |
| 35 |
| 36 // Returns the notification permission status of the current origin. This |
| 37 // method is synchronous to support the Notification.permission getter. |
| 38 mojom::PermissionStatus permissionStatus() const; |
| 39 |
| 40 // ContextLifecycleObserver implementation. |
| 41 void contextDestroyed() override; |
| 42 |
| 43 DECLARE_VIRTUAL_TRACE(); |
| 44 |
| 45 private: |
| 46 explicit NotificationManager(ExecutionContext*); |
| 47 |
| 48 // Returns a string containing the security origin of the execution |
| 49 // context this NotificationManager has been associated with. |
| 50 String getOriginString() const; |
| 51 |
| 52 mojom::blink::NotificationServicePtr m_service; |
| 53 }; |
| 54 |
| 55 } // namespace blink |
| 56 |
| 57 #endif // NotificationManager_h |
| OLD | NEW |