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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 static ScriptPromise requestPermission(ScriptState*, NotificationPermissionC
allback*); | 107 static ScriptPromise requestPermission(ScriptState*, NotificationPermissionC
allback*); |
107 | 108 |
108 static size_t maxActions(); | 109 static size_t maxActions(); |
109 | 110 |
110 // EventTarget interface. | 111 // EventTarget interface. |
111 ExecutionContext* getExecutionContext() const final { return ActiveDOMObject
::getExecutionContext(); } | 112 ExecutionContext* getExecutionContext() const final { return ActiveDOMObject
::getExecutionContext(); } |
112 const AtomicString& interfaceName() const override; | 113 const AtomicString& interfaceName() const override; |
113 | 114 |
114 // ActiveDOMObject interface. | 115 // ActiveDOMObject interface. |
115 void stop() override; | 116 void stop() override; |
116 bool hasPendingActivity() const override; | 117 |
| 118 // ActiveScriptWrappable interface. |
| 119 bool hasPendingActivity() const final; |
117 | 120 |
118 DECLARE_VIRTUAL_TRACE(); | 121 DECLARE_VIRTUAL_TRACE(); |
119 | 122 |
120 protected: | 123 protected: |
121 // EventTarget interface. | 124 // EventTarget interface. |
122 DispatchEventResult dispatchEventInternal(PassRefPtrWillBeRawPtr<Event>) fin
al; | 125 DispatchEventResult dispatchEventInternal(PassRefPtrWillBeRawPtr<Event>) fin
al; |
123 | 126 |
124 private: | 127 private: |
125 Notification(ExecutionContext*, const WebNotificationData&); | 128 Notification(ExecutionContext*, const WebNotificationData&); |
126 | 129 |
(...skipping 30 matching lines...) Expand all Loading... |
157 void setState(NotificationState state) { m_state = state; } | 160 void setState(NotificationState state) { m_state = state; } |
158 | 161 |
159 NotificationState m_state; | 162 NotificationState m_state; |
160 | 163 |
161 Member<AsyncMethodRunner<Notification>> m_asyncRunner; | 164 Member<AsyncMethodRunner<Notification>> m_asyncRunner; |
162 }; | 165 }; |
163 | 166 |
164 } // namespace blink | 167 } // namespace blink |
165 | 168 |
166 #endif // Notification_h | 169 #endif // Notification_h |
OLD | NEW |