| 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 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/ScriptPromise.h" | 35 #include "bindings/core/v8/ScriptPromise.h" |
| 35 #include "bindings/core/v8/ScriptValue.h" | 36 #include "bindings/core/v8/ScriptValue.h" |
| 36 #include "bindings/core/v8/SerializedScriptValue.h" | 37 #include "bindings/core/v8/SerializedScriptValue.h" |
| 37 #include "core/dom/ActiveDOMObject.h" | 38 #include "core/dom/ActiveDOMObject.h" |
| 38 #include "core/dom/DOMTimeStamp.h" | 39 #include "core/dom/DOMTimeStamp.h" |
| 39 #include "modules/EventTargetModules.h" | 40 #include "modules/EventTargetModules.h" |
| 40 #include "modules/ModulesExport.h" | 41 #include "modules/ModulesExport.h" |
| 41 #include "modules/vibration/NavigatorVibration.h" | 42 #include "modules/vibration/NavigatorVibration.h" |
| 42 #include "platform/AsyncMethodRunner.h" | 43 #include "platform/AsyncMethodRunner.h" |
| 43 #include "platform/heap/Handle.h" | 44 #include "platform/heap/Handle.h" |
| 44 #include "platform/weborigin/KURL.h" | 45 #include "platform/weborigin/KURL.h" |
| 45 #include "public/platform/WebVector.h" | 46 #include "public/platform/WebVector.h" |
| 46 #include "public/platform/modules/notifications/WebNotificationData.h" | 47 #include "public/platform/modules/notifications/WebNotificationData.h" |
| 47 #include "public/platform/modules/notifications/WebNotificationDelegate.h" | 48 #include "public/platform/modules/notifications/WebNotificationDelegate.h" |
| 48 #include "public/platform/modules/notifications/WebNotificationPermission.h" | 49 #include "public/platform/modules/notifications/WebNotificationPermission.h" |
| 49 #include "wtf/PassRefPtr.h" | 50 #include "wtf/PassRefPtr.h" |
| 50 #include "wtf/RefCounted.h" | 51 #include "wtf/RefCounted.h" |
| 51 | 52 |
| 52 namespace blink { | 53 namespace blink { |
| 53 | 54 |
| 54 class ExecutionContext; | 55 class ExecutionContext; |
| 55 class NotificationAction; | 56 class NotificationAction; |
| 56 class NotificationOptions; | 57 class NotificationOptions; |
| 57 class NotificationPermissionCallback; | 58 class NotificationPermissionCallback; |
| 58 class ScriptState; | 59 class ScriptState; |
| 59 | 60 |
| 60 class MODULES_EXPORT Notification final : public RefCountedGarbageCollectedEvent
TargetWithInlineData<Notification>, public ActiveDOMObject, public WebNotificati
onDelegate { | 61 class MODULES_EXPORT Notification final : public RefCountedGarbageCollectedEvent
TargetWithInlineData<Notification>, public ActiveScriptWrappable, public ActiveD
OMObject, public WebNotificationDelegate { |
| 61 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(Notification); | 62 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(Notification); |
| 62 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Notification); | 63 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Notification); |
| 63 DEFINE_WRAPPERTYPEINFO(); | 64 DEFINE_WRAPPERTYPEINFO(); |
| 64 public: | 65 public: |
| 65 // Used for JavaScript instantiations of the Notification object. Will autom
atically schedule for | 66 // Used for JavaScript instantiations of the Notification object. Will autom
atically schedule for |
| 66 // the notification to be displayed to the user when the developer-provided
data is valid. | 67 // the notification to be displayed to the user when the developer-provided
data is valid. |
| 67 static Notification* create(ExecutionContext*, const String& title, const No
tificationOptions&, ExceptionState&); | 68 static Notification* create(ExecutionContext*, const String& title, const No
tificationOptions&, ExceptionState&); |
| 68 | 69 |
| 69 // Used for embedder-created Notification objects. If |showing| is true, wil
l initialize the | 70 // Used for embedder-created Notification objects. If |showing| is true, wil
l initialize the |
| 70 // Notification's state as showing, or as closed otherwise. | 71 // Notification's state as showing, or as closed otherwise. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 static ScriptPromise requestPermission(ScriptState*, NotificationPermissionC
allback*); | 106 static ScriptPromise requestPermission(ScriptState*, NotificationPermissionC
allback*); |
| 106 | 107 |
| 107 static size_t maxActions(); | 108 static size_t maxActions(); |
| 108 | 109 |
| 109 // EventTarget interface. | 110 // EventTarget interface. |
| 110 ExecutionContext* getExecutionContext() const final { return ActiveDOMObject
::getExecutionContext(); } | 111 ExecutionContext* getExecutionContext() const final { return ActiveDOMObject
::getExecutionContext(); } |
| 111 const AtomicString& interfaceName() const override; | 112 const AtomicString& interfaceName() const override; |
| 112 | 113 |
| 113 // ActiveDOMObject interface. | 114 // ActiveDOMObject interface. |
| 114 void stop() override; | 115 void stop() override; |
| 115 bool hasPendingActivity() const override; | 116 |
| 117 // ActiveScriptWrappable interface. |
| 118 bool hasPendingActivity() const final; |
| 116 | 119 |
| 117 DECLARE_VIRTUAL_TRACE(); | 120 DECLARE_VIRTUAL_TRACE(); |
| 118 | 121 |
| 119 protected: | 122 protected: |
| 120 // EventTarget interface. | 123 // EventTarget interface. |
| 121 DispatchEventResult dispatchEventInternal(PassRefPtrWillBeRawPtr<Event>) fin
al; | 124 DispatchEventResult dispatchEventInternal(PassRefPtrWillBeRawPtr<Event>) fin
al; |
| 122 | 125 |
| 123 private: | 126 private: |
| 124 Notification(ExecutionContext*, const WebNotificationData&); | 127 Notification(ExecutionContext*, const WebNotificationData&); |
| 125 | 128 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 156 void setState(NotificationState state) { m_state = state; } | 159 void setState(NotificationState state) { m_state = state; } |
| 157 | 160 |
| 158 NotificationState m_state; | 161 NotificationState m_state; |
| 159 | 162 |
| 160 Member<AsyncMethodRunner<Notification>> m_asyncRunner; | 163 Member<AsyncMethodRunner<Notification>> m_asyncRunner; |
| 161 }; | 164 }; |
| 162 | 165 |
| 163 } // namespace blink | 166 } // namespace blink |
| 164 | 167 |
| 165 #endif // Notification_h | 168 #endif // Notification_h |
| OLD | NEW |