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 23 matching lines...) Expand all Loading... |
34 #include "bindings/core/v8/WorkerScriptController.h" | 34 #include "bindings/core/v8/WorkerScriptController.h" |
35 #include "core/dom/CrossThreadTask.h" | 35 #include "core/dom/CrossThreadTask.h" |
36 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
37 #include "core/dom/ExecutionContext.h" | 37 #include "core/dom/ExecutionContext.h" |
38 #include "core/dom/MessagePort.h" | 38 #include "core/dom/MessagePort.h" |
39 #include "core/events/MessageEvent.h" | 39 #include "core/events/MessageEvent.h" |
40 #include "core/inspector/ConsoleMessage.h" | 40 #include "core/inspector/ConsoleMessage.h" |
41 #include "core/workers/WorkerGlobalScope.h" | 41 #include "core/workers/WorkerGlobalScope.h" |
42 #include "modules/geofencing/CircularGeofencingRegion.h" | 42 #include "modules/geofencing/CircularGeofencingRegion.h" |
43 #include "modules/geofencing/GeofencingEvent.h" | 43 #include "modules/geofencing/GeofencingEvent.h" |
| 44 #include "modules/notifications/Notification.h" |
44 #include "modules/notifications/NotificationEvent.h" | 45 #include "modules/notifications/NotificationEvent.h" |
45 #include "modules/push_messaging/PushEvent.h" | 46 #include "modules/push_messaging/PushEvent.h" |
46 #include "modules/push_messaging/PushMessageData.h" | 47 #include "modules/push_messaging/PushMessageData.h" |
47 #include "modules/serviceworkers/ExtendableEvent.h" | 48 #include "modules/serviceworkers/ExtendableEvent.h" |
48 #include "modules/serviceworkers/FetchEvent.h" | 49 #include "modules/serviceworkers/FetchEvent.h" |
49 #include "modules/serviceworkers/Headers.h" | 50 #include "modules/serviceworkers/Headers.h" |
50 #include "modules/serviceworkers/InstallEvent.h" | 51 #include "modules/serviceworkers/InstallEvent.h" |
51 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" | 52 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" |
52 #include "modules/serviceworkers/WaitUntilObserver.h" | 53 #include "modules/serviceworkers/WaitUntilObserver.h" |
53 #include "platform/RuntimeEnabledFeatures.h" | 54 #include "platform/RuntimeEnabledFeatures.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 119 |
119 OwnPtrWillBeRawPtr<MessagePortArray> ports = MessagePort::toMessagePortArray
(m_workerGlobalScope, webChannels); | 120 OwnPtrWillBeRawPtr<MessagePortArray> ports = MessagePort::toMessagePortArray
(m_workerGlobalScope, webChannels); |
120 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag
e); | 121 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag
e); |
121 m_workerGlobalScope->dispatchEvent(MessageEvent::create(ports.release(), val
ue)); | 122 m_workerGlobalScope->dispatchEvent(MessageEvent::create(ports.release(), val
ue)); |
122 } | 123 } |
123 | 124 |
124 void ServiceWorkerGlobalScopeProxy::dispatchNotificationClickEvent(int eventID,
const WebString& notificationID, const WebNotificationData& data) | 125 void ServiceWorkerGlobalScopeProxy::dispatchNotificationClickEvent(int eventID,
const WebString& notificationID, const WebNotificationData& data) |
125 { | 126 { |
126 ASSERT(m_workerGlobalScope); | 127 ASSERT(m_workerGlobalScope); |
127 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope,
WaitUntilObserver::NotificationClick, eventID); | 128 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope,
WaitUntilObserver::NotificationClick, eventID); |
128 // FIXME: Initialize a Notification object based on |notificationID| and |da
ta|. | |
129 NotificationEventInit eventInit; | 129 NotificationEventInit eventInit; |
| 130 eventInit.setNotification(Notification::create(m_workerGlobalScope, notifica
tionID, data)); |
130 RefPtrWillBeRawPtr<Event> event(NotificationEvent::create(EventTypeNames::no
tificationclick, eventInit, observer)); | 131 RefPtrWillBeRawPtr<Event> event(NotificationEvent::create(EventTypeNames::no
tificationclick, eventInit, observer)); |
131 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); | 132 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); |
132 } | 133 } |
133 | 134 |
134 void ServiceWorkerGlobalScopeProxy::dispatchPushEvent(int eventID, const WebStri
ng& data) | 135 void ServiceWorkerGlobalScopeProxy::dispatchPushEvent(int eventID, const WebStri
ng& data) |
135 { | 136 { |
136 ASSERT(m_workerGlobalScope); | 137 ASSERT(m_workerGlobalScope); |
137 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope,
WaitUntilObserver::Push, eventID); | 138 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope,
WaitUntilObserver::Push, eventID); |
138 RefPtrWillBeRawPtr<Event> event(PushEvent::create(EventTypeNames::push, Push
MessageData::create(data), observer)); | 139 RefPtrWillBeRawPtr<Event> event(PushEvent::create(EventTypeNames::push, Push
MessageData::create(data), observer)); |
139 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); | 140 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 193 |
193 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) | 194 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) |
194 : m_embeddedWorker(embeddedWorker) | 195 : m_embeddedWorker(embeddedWorker) |
195 , m_document(document) | 196 , m_document(document) |
196 , m_client(client) | 197 , m_client(client) |
197 , m_workerGlobalScope(0) | 198 , m_workerGlobalScope(0) |
198 { | 199 { |
199 } | 200 } |
200 | 201 |
201 } // namespace blink | 202 } // namespace blink |
OLD | NEW |