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 27 matching lines...) Expand all Loading... |
38 #include "core/dom/MessagePort.h" | 38 #include "core/dom/MessagePort.h" |
39 #include "core/inspector/ConsoleMessage.h" | 39 #include "core/inspector/ConsoleMessage.h" |
40 #include "core/origin_trials/OriginTrials.h" | 40 #include "core/origin_trials/OriginTrials.h" |
41 #include "core/workers/WorkerGlobalScope.h" | 41 #include "core/workers/WorkerGlobalScope.h" |
42 #include "core/workers/WorkerThread.h" | 42 #include "core/workers/WorkerThread.h" |
43 #include "modules/background_sync/SyncEvent.h" | 43 #include "modules/background_sync/SyncEvent.h" |
44 #include "modules/fetch/Headers.h" | 44 #include "modules/fetch/Headers.h" |
45 #include "modules/notifications/Notification.h" | 45 #include "modules/notifications/Notification.h" |
46 #include "modules/notifications/NotificationEvent.h" | 46 #include "modules/notifications/NotificationEvent.h" |
47 #include "modules/notifications/NotificationEventInit.h" | 47 #include "modules/notifications/NotificationEventInit.h" |
| 48 #include "modules/payments/PaymentAppRequestData.h" |
| 49 #include "modules/payments/PaymentAppRequestDataConversion.h" |
| 50 #include "modules/payments/PaymentRequestEvent.h" |
48 #include "modules/push_messaging/PushEvent.h" | 51 #include "modules/push_messaging/PushEvent.h" |
49 #include "modules/push_messaging/PushMessageData.h" | 52 #include "modules/push_messaging/PushMessageData.h" |
50 #include "modules/serviceworkers/ExtendableEvent.h" | 53 #include "modules/serviceworkers/ExtendableEvent.h" |
51 #include "modules/serviceworkers/ExtendableMessageEvent.h" | 54 #include "modules/serviceworkers/ExtendableMessageEvent.h" |
52 #include "modules/serviceworkers/FetchEvent.h" | 55 #include "modules/serviceworkers/FetchEvent.h" |
53 #include "modules/serviceworkers/ForeignFetchEvent.h" | 56 #include "modules/serviceworkers/ForeignFetchEvent.h" |
54 #include "modules/serviceworkers/InstallEvent.h" | 57 #include "modules/serviceworkers/InstallEvent.h" |
55 #include "modules/serviceworkers/ServiceWorkerClient.h" | 58 #include "modules/serviceworkers/ServiceWorkerClient.h" |
56 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" | 59 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" |
57 #include "modules/serviceworkers/ServiceWorkerWindowClient.h" | 60 #include "modules/serviceworkers/ServiceWorkerWindowClient.h" |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 WTF::currentTime()); | 322 WTF::currentTime()); |
320 return; | 323 return; |
321 } | 324 } |
322 WaitUntilObserver* observer = WaitUntilObserver::create( | 325 WaitUntilObserver* observer = WaitUntilObserver::create( |
323 workerGlobalScope(), WaitUntilObserver::Sync, eventID); | 326 workerGlobalScope(), WaitUntilObserver::Sync, eventID); |
324 Event* event = SyncEvent::create(EventTypeNames::sync, tag, | 327 Event* event = SyncEvent::create(EventTypeNames::sync, tag, |
325 lastChance == IsLastChance, observer); | 328 lastChance == IsLastChance, observer); |
326 workerGlobalScope()->dispatchExtendableEvent(event, observer); | 329 workerGlobalScope()->dispatchExtendableEvent(event, observer); |
327 } | 330 } |
328 | 331 |
| 332 void ServiceWorkerGlobalScopeProxy::dispatchPaymentRequestEvent( |
| 333 int eventID, |
| 334 const WebPaymentAppRequestData& webData) { |
| 335 WaitUntilObserver* observer = WaitUntilObserver::create( |
| 336 workerGlobalScope(), WaitUntilObserver::PaymentRequest, eventID); |
| 337 Event* event = PaymentRequestEvent::create( |
| 338 EventTypeNames::paymentrequest, |
| 339 PaymentAppRequestDataConversion::toPaymentAppRequestData( |
| 340 workerGlobalScope()->scriptController()->getScriptState(), webData), |
| 341 observer); |
| 342 workerGlobalScope()->dispatchExtendableEvent(event, observer); |
| 343 } |
| 344 |
329 bool ServiceWorkerGlobalScopeProxy::hasFetchEventHandler() { | 345 bool ServiceWorkerGlobalScopeProxy::hasFetchEventHandler() { |
330 DCHECK(m_workerGlobalScope); | 346 DCHECK(m_workerGlobalScope); |
331 return m_workerGlobalScope->hasEventListeners(EventTypeNames::fetch); | 347 return m_workerGlobalScope->hasEventListeners(EventTypeNames::fetch); |
332 } | 348 } |
333 | 349 |
334 void ServiceWorkerGlobalScopeProxy::reportException( | 350 void ServiceWorkerGlobalScopeProxy::reportException( |
335 const String& errorMessage, | 351 const String& errorMessage, |
336 std::unique_ptr<SourceLocation> location, | 352 std::unique_ptr<SourceLocation> location, |
337 int exceptionId) { | 353 int exceptionId) { |
338 client().reportException(errorMessage, location->lineNumber(), | 354 client().reportException(errorMessage, location->lineNumber(), |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 return *m_document; | 451 return *m_document; |
436 } | 452 } |
437 | 453 |
438 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() | 454 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() |
439 const { | 455 const { |
440 DCHECK(m_workerGlobalScope); | 456 DCHECK(m_workerGlobalScope); |
441 return m_workerGlobalScope; | 457 return m_workerGlobalScope; |
442 } | 458 } |
443 | 459 |
444 } // namespace blink | 460 } // namespace blink |
OLD | NEW |