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 16 matching lines...) Expand all Loading... |
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/SerializedScriptValue.h" | 34 #include "bindings/core/v8/SerializedScriptValue.h" |
35 #include "core/dom/ActiveDOMObject.h" | 35 #include "core/dom/ActiveDOMObject.h" |
36 #include "modules/EventTargetModules.h" | 36 #include "modules/EventTargetModules.h" |
| 37 #include "modules/vibration/NavigatorVibration.h" |
37 #include "platform/AsyncMethodRunner.h" | 38 #include "platform/AsyncMethodRunner.h" |
38 #include "platform/heap/Handle.h" | 39 #include "platform/heap/Handle.h" |
39 #include "platform/text/TextDirection.h" | 40 #include "platform/text/TextDirection.h" |
40 #include "platform/weborigin/KURL.h" | 41 #include "platform/weborigin/KURL.h" |
41 #include "public/platform/modules/notifications/WebNotificationDelegate.h" | 42 #include "public/platform/modules/notifications/WebNotificationDelegate.h" |
42 #include "public/platform/modules/notifications/WebNotificationPermission.h" | 43 #include "public/platform/modules/notifications/WebNotificationPermission.h" |
43 #include "wtf/PassOwnPtr.h" | 44 #include "wtf/PassOwnPtr.h" |
44 #include "wtf/PassRefPtr.h" | 45 #include "wtf/PassRefPtr.h" |
45 #include "wtf/RefCounted.h" | 46 #include "wtf/RefCounted.h" |
46 #include "wtf/RefPtr.h" | 47 #include "wtf/RefPtr.h" |
47 | 48 |
48 namespace blink { | 49 namespace blink { |
49 | 50 |
50 class ExecutionContext; | 51 class ExecutionContext; |
51 class NotificationOptions; | 52 class NotificationOptions; |
52 class NotificationPermissionCallback; | 53 class NotificationPermissionCallback; |
53 class ScriptState; | 54 class ScriptState; |
54 class ScriptValue; | 55 class ScriptValue; |
| 56 class UnsignedLongOrUnsignedLongSequence; |
55 struct WebNotificationData; | 57 struct WebNotificationData; |
56 | 58 |
57 class Notification final : public RefCountedGarbageCollectedEventTargetWithInlin
eData<Notification>, public ActiveDOMObject, public WebNotificationDelegate { | 59 class Notification final : public RefCountedGarbageCollectedEventTargetWithInlin
eData<Notification>, public ActiveDOMObject, public WebNotificationDelegate { |
58 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<N
otification>); | 60 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<N
otification>); |
59 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Notification); | 61 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Notification); |
60 DEFINE_WRAPPERTYPEINFO(); | 62 DEFINE_WRAPPERTYPEINFO(); |
61 public: | 63 public: |
62 // Used for JavaScript instantiations of the Notification object. Will autom
atically schedule for | 64 // Used for JavaScript instantiations of the Notification object. Will autom
atically schedule for |
63 // the notification to be displayed to the user. | 65 // the notification to be displayed to the user. |
64 static Notification* create(ExecutionContext*, const String& title, const No
tificationOptions&, ExceptionState&); | 66 static Notification* create(ExecutionContext*, const String& title, const No
tificationOptions&, ExceptionState&); |
(...skipping 17 matching lines...) Expand all Loading... |
82 void dispatchClickEvent() override; | 84 void dispatchClickEvent() override; |
83 void dispatchErrorEvent() override; | 85 void dispatchErrorEvent() override; |
84 void dispatchCloseEvent() override; | 86 void dispatchCloseEvent() override; |
85 | 87 |
86 String title() const { return m_title; } | 88 String title() const { return m_title; } |
87 String dir() const { return m_dir; } | 89 String dir() const { return m_dir; } |
88 String lang() const { return m_lang; } | 90 String lang() const { return m_lang; } |
89 String body() const { return m_body; } | 91 String body() const { return m_body; } |
90 String tag() const { return m_tag; } | 92 String tag() const { return m_tag; } |
91 String icon() const { return m_iconUrl; } | 93 String icon() const { return m_iconUrl; } |
| 94 NavigatorVibration::VibrationPattern vibrate(bool& isNull) const; |
92 bool silent() const { return m_silent; } | 95 bool silent() const { return m_silent; } |
93 ScriptValue data(ScriptState*) const; | 96 ScriptValue data(ScriptState*) const; |
94 | 97 |
95 TextDirection direction() const; | 98 TextDirection direction() const; |
96 KURL iconURL() const { return m_iconUrl; } | 99 KURL iconURL() const { return m_iconUrl; } |
97 SerializedScriptValue* serializedData() const { return m_serializedData.get(
); } | 100 SerializedScriptValue* serializedData() const { return m_serializedData.get(
); } |
98 | 101 |
99 static String permissionString(WebNotificationPermission); | 102 static String permissionString(WebNotificationPermission); |
100 static String permission(ExecutionContext*); | 103 static String permission(ExecutionContext*); |
101 static WebNotificationPermission checkPermission(ExecutionContext*); | 104 static WebNotificationPermission checkPermission(ExecutionContext*); |
(...skipping 20 matching lines...) Expand all Loading... |
122 // collected while m_state is Showing, and so this instance stays alive | 125 // collected while m_state is Showing, and so this instance stays alive |
123 // until the operation completes. Otherwise, you need to hold a ref on this | 126 // until the operation completes. Otherwise, you need to hold a ref on this |
124 // instance until the operation completes. | 127 // instance until the operation completes. |
125 void show(); | 128 void show(); |
126 | 129 |
127 void setDir(const String& dir) { m_dir = dir; } | 130 void setDir(const String& dir) { m_dir = dir; } |
128 void setLang(const String& lang) { m_lang = lang; } | 131 void setLang(const String& lang) { m_lang = lang; } |
129 void setBody(const String& body) { m_body = body; } | 132 void setBody(const String& body) { m_body = body; } |
130 void setIconUrl(KURL iconUrl) { m_iconUrl = iconUrl; } | 133 void setIconUrl(KURL iconUrl) { m_iconUrl = iconUrl; } |
131 void setTag(const String& tag) { m_tag = tag; } | 134 void setTag(const String& tag) { m_tag = tag; } |
| 135 void setVibrate(const NavigatorVibration::VibrationPattern& vibrate) { m_vib
rate = vibrate; } |
132 void setSilent(bool silent) { m_silent = silent; } | 136 void setSilent(bool silent) { m_silent = silent; } |
133 void setSerializedData(PassRefPtr<SerializedScriptValue> data) { m_serialize
dData = data; } | 137 void setSerializedData(PassRefPtr<SerializedScriptValue> data) { m_serialize
dData = data; } |
134 | 138 |
135 void setPersistentId(int64_t persistentId) { m_persistentId = persistentId;
} | 139 void setPersistentId(int64_t persistentId) { m_persistentId = persistentId;
} |
136 void setPersistentIdString(const String& persistentId) { m_persistentIdStrin
g = persistentId; } | 140 void setPersistentIdString(const String& persistentId) { m_persistentIdStrin
g = persistentId; } |
137 | 141 |
138 private: | 142 private: |
139 String m_title; | 143 String m_title; |
140 String m_dir; | 144 String m_dir; |
141 String m_lang; | 145 String m_lang; |
142 String m_body; | 146 String m_body; |
143 String m_tag; | 147 String m_tag; |
| 148 NavigatorVibration::VibrationPattern m_vibrate; |
144 bool m_silent; | 149 bool m_silent; |
145 RefPtr<SerializedScriptValue> m_serializedData; | 150 RefPtr<SerializedScriptValue> m_serializedData; |
146 | 151 |
147 KURL m_iconUrl; | 152 KURL m_iconUrl; |
148 | 153 |
149 // Notifications can either be bound to the page, which means they're identi
fied by | 154 // Notifications can either be bound to the page, which means they're identi
fied by |
150 // their delegate, or persistent, which means they're identified by a persis
tent Id | 155 // their delegate, or persistent, which means they're identified by a persis
tent Id |
151 // given to us by the embedder. This influences how we close the notificatio
n. | 156 // given to us by the embedder. This influences how we close the notificatio
n. |
152 int64_t m_persistentId; | 157 int64_t m_persistentId; |
153 String m_persistentIdString; | 158 String m_persistentIdString; |
(...skipping 10 matching lines...) Expand all Loading... |
164 void setState(NotificationState state) { m_state = state; } | 169 void setState(NotificationState state) { m_state = state; } |
165 | 170 |
166 NotificationState m_state; | 171 NotificationState m_state; |
167 | 172 |
168 AsyncMethodRunner<Notification> m_asyncRunner; | 173 AsyncMethodRunner<Notification> m_asyncRunner; |
169 }; | 174 }; |
170 | 175 |
171 } // namespace blink | 176 } // namespace blink |
172 | 177 |
173 #endif // Notification_h | 178 #endif // Notification_h |
OLD | NEW |