| 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/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/background_sync/SyncEvent.h" | 42 #include "modules/background_sync/SyncEvent.h" |
| 43 #include "modules/background_sync/SyncRegistration.h" | 43 #include "modules/background_sync/SyncRegistration.h" |
| 44 #include "modules/fetch/Headers.h" | 44 #include "modules/fetch/Headers.h" |
| 45 #include "modules/geofencing/CircularGeofencingRegion.h" | 45 #include "modules/geofencing/CircularGeofencingRegion.h" |
| 46 #include "modules/geofencing/GeofencingEvent.h" | 46 #include "modules/geofencing/GeofencingEvent.h" |
| 47 #include "modules/navigatorconnect/AcceptConnectionObserver.h" | 47 #include "modules/navigatorconnect/AcceptConnectionObserver.h" |
| 48 #include "modules/navigatorconnect/CrossOriginConnectEvent.h" | |
| 49 #include "modules/navigatorconnect/CrossOriginServiceWorkerClient.h" | 48 #include "modules/navigatorconnect/CrossOriginServiceWorkerClient.h" |
| 50 #include "modules/navigatorconnect/ServicePortCollection.h" | 49 #include "modules/navigatorconnect/ServicePortCollection.h" |
| 51 #include "modules/navigatorconnect/WorkerNavigatorServices.h" | 50 #include "modules/navigatorconnect/WorkerNavigatorServices.h" |
| 52 #include "modules/notifications/Notification.h" | 51 #include "modules/notifications/Notification.h" |
| 53 #include "modules/notifications/NotificationEvent.h" | 52 #include "modules/notifications/NotificationEvent.h" |
| 54 #include "modules/push_messaging/PushEvent.h" | 53 #include "modules/push_messaging/PushEvent.h" |
| 55 #include "modules/push_messaging/PushMessageData.h" | 54 #include "modules/push_messaging/PushMessageData.h" |
| 56 #include "modules/serviceworkers/ExtendableEvent.h" | 55 #include "modules/serviceworkers/ExtendableEvent.h" |
| 57 #include "modules/serviceworkers/FetchEvent.h" | 56 #include "modules/serviceworkers/FetchEvent.h" |
| 58 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" | 57 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 ASSERT(m_workerGlobalScope); | 163 ASSERT(m_workerGlobalScope); |
| 165 if (!RuntimeEnabledFeatures::backgroundSyncEnabled()) { | 164 if (!RuntimeEnabledFeatures::backgroundSyncEnabled()) { |
| 166 ServiceWorkerGlobalScopeClient::from(m_workerGlobalScope)->didHandleSync
Event(eventID, WebServiceWorkerEventResultCompleted); | 165 ServiceWorkerGlobalScopeClient::from(m_workerGlobalScope)->didHandleSync
Event(eventID, WebServiceWorkerEventResultCompleted); |
| 167 return; | 166 return; |
| 168 } | 167 } |
| 169 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope,
WaitUntilObserver::Sync, eventID); | 168 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope,
WaitUntilObserver::Sync, eventID); |
| 170 RefPtrWillBeRawPtr<Event> event(SyncEvent::create(EventTypeNames::sync, Sync
Registration::create(registration, m_workerGlobalScope->registration()), observe
r)); | 169 RefPtrWillBeRawPtr<Event> event(SyncEvent::create(EventTypeNames::sync, Sync
Registration::create(registration, m_workerGlobalScope->registration()), observe
r)); |
| 171 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); | 170 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); |
| 172 } | 171 } |
| 173 | 172 |
| 174 void ServiceWorkerGlobalScopeProxy::dispatchCrossOriginConnectEvent(int eventID,
const WebCrossOriginServiceWorkerClient& webClient) | |
| 175 { | |
| 176 ASSERT(m_workerGlobalScope); | |
| 177 AcceptConnectionObserver* observer = AcceptConnectionObserver::create(m_work
erGlobalScope, eventID); | |
| 178 CrossOriginServiceWorkerClient* client = CrossOriginServiceWorkerClient::cre
ate(webClient); | |
| 179 m_workerGlobalScope->dispatchEvent(CrossOriginConnectEvent::create(observer,
client)); | |
| 180 observer->didDispatchEvent(); | |
| 181 } | |
| 182 | |
| 183 void ServiceWorkerGlobalScopeProxy::dispatchCrossOriginMessageEvent(const WebCro
ssOriginServiceWorkerClient& webClient, const WebString& message, const WebMessa
gePortChannelArray& webChannels) | 173 void ServiceWorkerGlobalScopeProxy::dispatchCrossOriginMessageEvent(const WebCro
ssOriginServiceWorkerClient& webClient, const WebString& message, const WebMessa
gePortChannelArray& webChannels) |
| 184 { | 174 { |
| 185 ASSERT(m_workerGlobalScope); | 175 ASSERT(m_workerGlobalScope); |
| 186 MessagePortArray* ports = MessagePort::toMessagePortArray(m_workerGlobalScop
e, webChannels); | 176 MessagePortArray* ports = MessagePort::toMessagePortArray(m_workerGlobalScop
e, webChannels); |
| 187 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag
e); | 177 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag
e); |
| 188 // FIXME: Have proper source for this MessageEvent. | 178 // FIXME: Have proper source for this MessageEvent. |
| 189 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(ports, value,
webClient.origin.string()); | 179 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(ports, value,
webClient.origin.string()); |
| 190 event->setType(EventTypeNames::crossoriginmessage); | 180 event->setType(EventTypeNames::crossoriginmessage); |
| 191 m_workerGlobalScope->dispatchEvent(event); | 181 m_workerGlobalScope->dispatchEvent(event); |
| 192 } | 182 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 | 226 |
| 237 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) | 227 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) |
| 238 : m_embeddedWorker(embeddedWorker) | 228 : m_embeddedWorker(embeddedWorker) |
| 239 , m_document(document) | 229 , m_document(document) |
| 240 , m_client(client) | 230 , m_client(client) |
| 241 , m_workerGlobalScope(0) | 231 , m_workerGlobalScope(0) |
| 242 { | 232 { |
| 243 } | 233 } |
| 244 | 234 |
| 245 } // namespace blink | 235 } // namespace blink |
| OLD | NEW |