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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 DispatchEventResult dispatchResult = workerGlobalScope()->dispatchEvent(fetc
hEvent); | 182 DispatchEventResult dispatchResult = workerGlobalScope()->dispatchEvent(fetc
hEvent); |
183 respondWithObserver->didDispatchEvent(dispatchResult); | 183 respondWithObserver->didDispatchEvent(dispatchResult); |
184 // false is okay because waitUntil for foreign fetch event doesn't care | 184 // false is okay because waitUntil for foreign fetch event doesn't care |
185 // about the promise rejection or an uncaught runtime script error. | 185 // about the promise rejection or an uncaught runtime script error. |
186 waitUntilObserver->didDispatchEvent(false /* errorOccurred */); | 186 waitUntilObserver->didDispatchEvent(false /* errorOccurred */); |
187 } | 187 } |
188 | 188 |
189 void ServiceWorkerGlobalScopeProxy::dispatchInstallEvent(int eventID) | 189 void ServiceWorkerGlobalScopeProxy::dispatchInstallEvent(int eventID) |
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 = InstallEvent::create(EventTypeNames::install, ExtendableEvent
Init(), observer); |
193 if (OriginTrials::foreignFetchEnabled(workerGlobalScope())) | |
194 event = InstallEvent::create(EventTypeNames::install, ExtendableEventIni
t(), observer); | |
195 else | |
196 event = ExtendableEvent::create(EventTypeNames::install, ExtendableEvent
Init(), observer); | |
197 workerGlobalScope()->dispatchExtendableEvent(event, observer); | 193 workerGlobalScope()->dispatchExtendableEvent(event, observer); |
198 } | 194 } |
199 | 195 |
200 void ServiceWorkerGlobalScopeProxy::dispatchNotificationClickEvent(int eventID,
const WebString& notificationID, const WebNotificationData& data, int actionInde
x) | 196 void ServiceWorkerGlobalScopeProxy::dispatchNotificationClickEvent(int eventID,
const WebString& notificationID, const WebNotificationData& data, int actionInde
x) |
201 { | 197 { |
202 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::NotificationClick, eventID); | 198 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::NotificationClick, eventID); |
203 NotificationEventInit eventInit; | 199 NotificationEventInit eventInit; |
204 eventInit.setNotification(Notification::create(workerGlobalScope(), notifica
tionID, data, true /* showing */)); | 200 eventInit.setNotification(Notification::create(workerGlobalScope(), notifica
tionID, data, true /* showing */)); |
205 if (0 <= actionIndex && actionIndex < static_cast<int>(data.actions.size())) | 201 if (0 <= actionIndex && actionIndex < static_cast<int>(data.actions.size())) |
206 eventInit.setAction(data.actions[actionIndex].action); | 202 eventInit.setAction(data.actions[actionIndex].action); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 return *m_document; | 327 return *m_document; |
332 } | 328 } |
333 | 329 |
334 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con
st | 330 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con
st |
335 { | 331 { |
336 DCHECK(m_workerGlobalScope); | 332 DCHECK(m_workerGlobalScope); |
337 return m_workerGlobalScope; | 333 return m_workerGlobalScope; |
338 } | 334 } |
339 | 335 |
340 } // namespace blink | 336 } // namespace blink |
OLD | NEW |