| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef Notification_h | 31 #ifndef Notification_h |
| 32 #define Notification_h | 32 #define Notification_h |
| 33 | 33 |
| 34 #include "bindings/core/v8/ActiveScriptWrappable.h" | 34 #include "bindings/core/v8/ActiveScriptWrappable.h" |
| 35 #include "bindings/core/v8/ScriptPromise.h" | 35 #include "bindings/core/v8/ScriptPromise.h" |
| 36 #include "bindings/core/v8/ScriptValue.h" | 36 #include "bindings/core/v8/ScriptValue.h" |
| 37 #include "bindings/core/v8/SerializedScriptValue.h" | 37 #include "bindings/core/v8/SerializedScriptValue.h" |
| 38 #include "core/dom/ContextLifecycleObserver.h" |
| 38 #include "core/dom/DOMTimeStamp.h" | 39 #include "core/dom/DOMTimeStamp.h" |
| 39 #include "core/dom/SuspendableObject.h" | |
| 40 #include "modules/EventTargetModules.h" | 40 #include "modules/EventTargetModules.h" |
| 41 #include "modules/ModulesExport.h" | 41 #include "modules/ModulesExport.h" |
| 42 #include "modules/vibration/NavigatorVibration.h" | 42 #include "modules/vibration/NavigatorVibration.h" |
| 43 #include "platform/AsyncMethodRunner.h" | 43 #include "platform/AsyncMethodRunner.h" |
| 44 #include "platform/heap/Handle.h" | 44 #include "platform/heap/Handle.h" |
| 45 #include "platform/weborigin/KURL.h" | 45 #include "platform/weborigin/KURL.h" |
| 46 #include "public/platform/WebVector.h" | 46 #include "public/platform/WebVector.h" |
| 47 #include "public/platform/modules/notifications/WebNotificationData.h" | 47 #include "public/platform/modules/notifications/WebNotificationData.h" |
| 48 #include "public/platform/modules/notifications/WebNotificationDelegate.h" | 48 #include "public/platform/modules/notifications/WebNotificationDelegate.h" |
| 49 #include "public/platform/modules/permissions/permission.mojom-blink.h" | 49 #include "public/platform/modules/permissions/permission.mojom-blink.h" |
| 50 #include "public/platform/modules/permissions/permission_status.mojom-blink.h" | 50 #include "public/platform/modules/permissions/permission_status.mojom-blink.h" |
| 51 | 51 |
| 52 namespace blink { | 52 namespace blink { |
| 53 | 53 |
| 54 class ExecutionContext; | 54 class ExecutionContext; |
| 55 class NotificationOptions; | 55 class NotificationOptions; |
| 56 class NotificationPermissionCallback; | 56 class NotificationPermissionCallback; |
| 57 class NotificationResourcesLoader; | 57 class NotificationResourcesLoader; |
| 58 class ScriptState; | 58 class ScriptState; |
| 59 | 59 |
| 60 class MODULES_EXPORT Notification final | 60 class MODULES_EXPORT Notification final |
| 61 : public EventTargetWithInlineData, | 61 : public EventTargetWithInlineData, |
| 62 public ActiveScriptWrappable<Notification>, | 62 public ActiveScriptWrappable<Notification>, |
| 63 public SuspendableObject, | 63 public ContextLifecycleObserver, |
| 64 public WebNotificationDelegate { | 64 public WebNotificationDelegate { |
| 65 USING_GARBAGE_COLLECTED_MIXIN(Notification); | 65 USING_GARBAGE_COLLECTED_MIXIN(Notification); |
| 66 DEFINE_WRAPPERTYPEINFO(); | 66 DEFINE_WRAPPERTYPEINFO(); |
| 67 | 67 |
| 68 public: | 68 public: |
| 69 // Used for JavaScript instantiations of non-persistent notifications. Will | 69 // Used for JavaScript instantiations of non-persistent notifications. Will |
| 70 // automatically schedule for the notification to be displayed to the user | 70 // automatically schedule for the notification to be displayed to the user |
| 71 // when the developer-provided data is valid. | 71 // when the developer-provided data is valid. |
| 72 static Notification* create(ExecutionContext*, | 72 static Notification* create(ExecutionContext*, |
| 73 const String& title, | 73 const String& title, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 static String permissionString(mojom::blink::PermissionStatus); | 115 static String permissionString(mojom::blink::PermissionStatus); |
| 116 static String permission(ExecutionContext*); | 116 static String permission(ExecutionContext*); |
| 117 static ScriptPromise requestPermission(ScriptState*, | 117 static ScriptPromise requestPermission(ScriptState*, |
| 118 NotificationPermissionCallback*); | 118 NotificationPermissionCallback*); |
| 119 | 119 |
| 120 static size_t maxActions(); | 120 static size_t maxActions(); |
| 121 | 121 |
| 122 // EventTarget interface. | 122 // EventTarget interface. |
| 123 ExecutionContext* getExecutionContext() const final { | 123 ExecutionContext* getExecutionContext() const final { |
| 124 return SuspendableObject::getExecutionContext(); | 124 return ContextLifecycleObserver::getExecutionContext(); |
| 125 } | 125 } |
| 126 const AtomicString& interfaceName() const override; | 126 const AtomicString& interfaceName() const override; |
| 127 | 127 |
| 128 // SuspendableObject interface. | 128 // ContextLifecycleObserver interface. |
| 129 void contextDestroyed() override; | 129 void contextDestroyed() override; |
| 130 | 130 |
| 131 // ScriptWrappable interface. | 131 // ScriptWrappable interface. |
| 132 bool hasPendingActivity() const final; | 132 bool hasPendingActivity() const final; |
| 133 | 133 |
| 134 DECLARE_VIRTUAL_TRACE(); | 134 DECLARE_VIRTUAL_TRACE(); |
| 135 | 135 |
| 136 protected: | 136 protected: |
| 137 // EventTarget interface. | 137 // EventTarget interface. |
| 138 DispatchEventResult dispatchEventInternal(Event*) final; | 138 DispatchEventResult dispatchEventInternal(Event*) final; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 String m_notificationId; | 177 String m_notificationId; |
| 178 | 178 |
| 179 Member<AsyncMethodRunner<Notification>> m_prepareShowMethodRunner; | 179 Member<AsyncMethodRunner<Notification>> m_prepareShowMethodRunner; |
| 180 | 180 |
| 181 Member<NotificationResourcesLoader> m_loader; | 181 Member<NotificationResourcesLoader> m_loader; |
| 182 }; | 182 }; |
| 183 | 183 |
| 184 } // namespace blink | 184 } // namespace blink |
| 185 | 185 |
| 186 #endif // Notification_h | 186 #endif // Notification_h |
| OLD | NEW |