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