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" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // collected while m_state is Showing, and so this instance stays alive | 121 // collected while m_state is Showing, and so this instance stays alive |
121 // until the operation completes. Otherwise, you need to hold a ref on this | 122 // until the operation completes. Otherwise, you need to hold a ref on this |
122 // instance until the operation completes. | 123 // instance until the operation completes. |
123 void show(); | 124 void show(); |
124 | 125 |
125 void setDir(const String& dir) { m_dir = dir; } | 126 void setDir(const String& dir) { m_dir = dir; } |
126 void setLang(const String& lang) { m_lang = lang; } | 127 void setLang(const String& lang) { m_lang = lang; } |
127 void setBody(const String& body) { m_body = body; } | 128 void setBody(const String& body) { m_body = body; } |
128 void setIconUrl(KURL iconUrl) { m_iconUrl = iconUrl; } | 129 void setIconUrl(KURL iconUrl) { m_iconUrl = iconUrl; } |
129 void setTag(const String& tag) { m_tag = tag; } | 130 void setTag(const String& tag) { m_tag = tag; } |
| 131 void setVibrate(const NavigatorVibration::VibrationPattern& vibrate) { m_vib
rate = vibrate; } |
130 void setSilent(bool silent) { m_silent = silent; } | 132 void setSilent(bool silent) { m_silent = silent; } |
131 void setSerializedData(PassRefPtr<SerializedScriptValue> data) { m_serialize
dData = data; } | 133 void setSerializedData(PassRefPtr<SerializedScriptValue> data) { m_serialize
dData = data; } |
132 | 134 |
133 void setPersistentId(const String& persistentId) { m_persistentId = persiste
ntId; } | 135 void setPersistentId(const String& persistentId) { m_persistentId = persiste
ntId; } |
134 | 136 |
135 private: | 137 private: |
136 String m_title; | 138 String m_title; |
137 String m_dir; | 139 String m_dir; |
138 String m_lang; | 140 String m_lang; |
139 String m_body; | 141 String m_body; |
140 String m_tag; | 142 String m_tag; |
| 143 NavigatorVibration::VibrationPattern m_vibrate; |
141 bool m_silent; | 144 bool m_silent; |
142 RefPtr<SerializedScriptValue> m_serializedData; | 145 RefPtr<SerializedScriptValue> m_serializedData; |
143 | 146 |
144 KURL m_iconUrl; | 147 KURL m_iconUrl; |
145 | 148 |
146 // Notifications can either be bound to the page, which means they're identi
fied by | 149 // Notifications can either be bound to the page, which means they're identi
fied by |
147 // their delegate, or persistent, which means they're identified by a persis
tent Id | 150 // their delegate, or persistent, which means they're identified by a persis
tent Id |
148 // given to us by the embedder. This influences how we close the notificatio
n. | 151 // given to us by the embedder. This influences how we close the notificatio
n. |
149 String m_persistentId; | 152 String m_persistentId; |
150 | 153 |
151 enum NotificationState { | 154 enum NotificationState { |
152 NotificationStateIdle, | 155 NotificationStateIdle, |
153 NotificationStateShowing, | 156 NotificationStateShowing, |
154 NotificationStateClosing, | 157 NotificationStateClosing, |
155 NotificationStateClosed | 158 NotificationStateClosed |
156 }; | 159 }; |
157 | 160 |
158 // Only to be used by the Notification::create() method when notifications w
ere created | 161 // Only to be used by the Notification::create() method when notifications w
ere created |
159 // by the embedder rather than by Blink. | 162 // by the embedder rather than by Blink. |
160 void setState(NotificationState state) { m_state = state; } | 163 void setState(NotificationState state) { m_state = state; } |
161 | 164 |
162 NotificationState m_state; | 165 NotificationState m_state; |
163 | 166 |
164 AsyncMethodRunner<Notification> m_asyncRunner; | 167 AsyncMethodRunner<Notification> m_asyncRunner; |
165 }; | 168 }; |
166 | 169 |
167 } // namespace blink | 170 } // namespace blink |
168 | 171 |
169 #endif // Notification_h | 172 #endif // Notification_h |
OLD | NEW |