| 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/ActiveDOMObject.h" | |
| 39 #include "core/dom/DOMTimeStamp.h" | 38 #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 : public EventTargetWithInlineData, | 60 class MODULES_EXPORT Notification final : public EventTargetWithInlineData, |
| 61 public ActiveScriptWrappable, | 61 public ActiveScriptWrappable, |
| 62 public ActiveDOMObject, | 62 public SuspendableObject, |
| 63 public WebNotificationDelegate { | 63 public WebNotificationDelegate { |
| 64 USING_GARBAGE_COLLECTED_MIXIN(Notification); | 64 USING_GARBAGE_COLLECTED_MIXIN(Notification); |
| 65 DEFINE_WRAPPERTYPEINFO(); | 65 DEFINE_WRAPPERTYPEINFO(); |
| 66 | 66 |
| 67 public: | 67 public: |
| 68 // Used for JavaScript instantiations of non-persistent notifications. Will | 68 // Used for JavaScript instantiations of non-persistent notifications. Will |
| 69 // automatically schedule for the notification to be displayed to the user | 69 // automatically schedule for the notification to be displayed to the user |
| 70 // when the developer-provided data is valid. | 70 // when the developer-provided data is valid. |
| 71 static Notification* create(ExecutionContext*, | 71 static Notification* create(ExecutionContext*, |
| 72 const String& title, | 72 const String& title, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 113 |
| 114 static String permissionString(mojom::blink::PermissionStatus); | 114 static String permissionString(mojom::blink::PermissionStatus); |
| 115 static String permission(ExecutionContext*); | 115 static String permission(ExecutionContext*); |
| 116 static ScriptPromise requestPermission(ScriptState*, | 116 static ScriptPromise requestPermission(ScriptState*, |
| 117 NotificationPermissionCallback*); | 117 NotificationPermissionCallback*); |
| 118 | 118 |
| 119 static size_t maxActions(); | 119 static size_t maxActions(); |
| 120 | 120 |
| 121 // EventTarget interface. | 121 // EventTarget interface. |
| 122 ExecutionContext* getExecutionContext() const final { | 122 ExecutionContext* getExecutionContext() const final { |
| 123 return ActiveDOMObject::getExecutionContext(); | 123 return SuspendableObject::getExecutionContext(); |
| 124 } | 124 } |
| 125 const AtomicString& interfaceName() const override; | 125 const AtomicString& interfaceName() const override; |
| 126 | 126 |
| 127 // ActiveDOMObject interface. | 127 // SuspendableObject interface. |
| 128 void contextDestroyed() override; | 128 void contextDestroyed() override; |
| 129 | 129 |
| 130 // ScriptWrappable interface. | 130 // ScriptWrappable interface. |
| 131 bool hasPendingActivity() const final; | 131 bool hasPendingActivity() const final; |
| 132 | 132 |
| 133 DECLARE_VIRTUAL_TRACE(); | 133 DECLARE_VIRTUAL_TRACE(); |
| 134 | 134 |
| 135 protected: | 135 protected: |
| 136 // EventTarget interface. | 136 // EventTarget interface. |
| 137 DispatchEventResult dispatchEventInternal(Event*) final; | 137 DispatchEventResult dispatchEventInternal(Event*) final; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 String m_notificationId; | 176 String m_notificationId; |
| 177 | 177 |
| 178 Member<AsyncMethodRunner<Notification>> m_prepareShowMethodRunner; | 178 Member<AsyncMethodRunner<Notification>> m_prepareShowMethodRunner; |
| 179 | 179 |
| 180 Member<NotificationResourcesLoader> m_loader; | 180 Member<NotificationResourcesLoader> m_loader; |
| 181 }; | 181 }; |
| 182 | 182 |
| 183 } // namespace blink | 183 } // namespace blink |
| 184 | 184 |
| 185 #endif // Notification_h | 185 #endif // Notification_h |
| OLD | NEW |