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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 { | 190 { |
191 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Install, eventID); | 191 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Install, eventID); |
192 Event* event; | 192 Event* event; |
193 if (OriginTrials::foreignFetchEnabled(workerGlobalScope())) | 193 if (OriginTrials::foreignFetchEnabled(workerGlobalScope())) |
194 event = InstallEvent::create(EventTypeNames::install, ExtendableEventIni
t(), observer); | 194 event = InstallEvent::create(EventTypeNames::install, ExtendableEventIni
t(), observer); |
195 else | 195 else |
196 event = ExtendableEvent::create(EventTypeNames::install, ExtendableEvent
Init(), observer); | 196 event = ExtendableEvent::create(EventTypeNames::install, ExtendableEvent
Init(), observer); |
197 workerGlobalScope()->dispatchExtendableEvent(event, observer); | 197 workerGlobalScope()->dispatchExtendableEvent(event, observer); |
198 } | 198 } |
199 | 199 |
200 void ServiceWorkerGlobalScopeProxy::dispatchNotificationClickEvent(int eventID,
int64_t notificationID, const WebNotificationData& data, int actionIndex) | 200 void ServiceWorkerGlobalScopeProxy::dispatchNotificationClickEvent(int eventID,
const WebString& notificationID, const WebNotificationData& data, int actionInde
x) |
201 { | 201 { |
202 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::NotificationClick, eventID); | 202 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::NotificationClick, eventID); |
203 NotificationEventInit eventInit; | 203 NotificationEventInit eventInit; |
204 eventInit.setNotification(Notification::create(workerGlobalScope(), notifica
tionID, data, true /* showing */)); | 204 eventInit.setNotification(Notification::create(workerGlobalScope(), notifica
tionID, data, true /* showing */)); |
205 if (0 <= actionIndex && actionIndex < static_cast<int>(data.actions.size())) | 205 if (0 <= actionIndex && actionIndex < static_cast<int>(data.actions.size())) |
206 eventInit.setAction(data.actions[actionIndex].action); | 206 eventInit.setAction(data.actions[actionIndex].action); |
207 Event* event = NotificationEvent::create(EventTypeNames::notificationclick,
eventInit, observer); | 207 Event* event = NotificationEvent::create(EventTypeNames::notificationclick,
eventInit, observer); |
208 workerGlobalScope()->dispatchExtendableEvent(event, observer); | 208 workerGlobalScope()->dispatchExtendableEvent(event, observer); |
209 } | 209 } |
210 | 210 |
211 void ServiceWorkerGlobalScopeProxy::dispatchNotificationCloseEvent(int eventID,
int64_t notificationID, const WebNotificationData& data) | 211 void ServiceWorkerGlobalScopeProxy::dispatchNotificationCloseEvent(int eventID,
const WebString& notificationID, const WebNotificationData& data) |
212 { | 212 { |
213 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::NotificationClose, eventID); | 213 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::NotificationClose, eventID); |
214 NotificationEventInit eventInit; | 214 NotificationEventInit eventInit; |
215 eventInit.setAction(WTF::String()); // initialize as null. | 215 eventInit.setAction(WTF::String()); // initialize as null. |
216 eventInit.setNotification(Notification::create(workerGlobalScope(), notifica
tionID, data, false /* showing */)); | 216 eventInit.setNotification(Notification::create(workerGlobalScope(), notifica
tionID, data, false /* showing */)); |
217 Event* event = NotificationEvent::create(EventTypeNames::notificationclose,
eventInit, observer); | 217 Event* event = NotificationEvent::create(EventTypeNames::notificationclose,
eventInit, observer); |
218 workerGlobalScope()->dispatchExtendableEvent(event, observer); | 218 workerGlobalScope()->dispatchExtendableEvent(event, observer); |
219 } | 219 } |
220 | 220 |
221 void ServiceWorkerGlobalScopeProxy::dispatchPushEvent(int eventID, const WebStri
ng& data) | 221 void ServiceWorkerGlobalScopeProxy::dispatchPushEvent(int eventID, const WebStri
ng& data) |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 return *m_document; | 323 return *m_document; |
324 } | 324 } |
325 | 325 |
326 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con
st | 326 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con
st |
327 { | 327 { |
328 DCHECK(m_workerGlobalScope); | 328 DCHECK(m_workerGlobalScope); |
329 return m_workerGlobalScope; | 329 return m_workerGlobalScope; |
330 } | 330 } |
331 | 331 |
332 } // namespace blink | 332 } // namespace blink |
OLD | NEW |