Index: Source/modules/navigatorconnect/ServicePortCollection.cpp |
diff --git a/Source/modules/navigatorconnect/ServicePortCollection.cpp b/Source/modules/navigatorconnect/ServicePortCollection.cpp |
index 142b82e6b2a9ba66d74c1c124ab93f15183ecd10..6ce5ada3946f7c902a27a9f8752035a3f82f40da 100644 |
--- a/Source/modules/navigatorconnect/ServicePortCollection.cpp |
+++ b/Source/modules/navigatorconnect/ServicePortCollection.cpp |
@@ -12,7 +12,10 @@ |
#include "core/dom/MessagePort.h" |
#include "core/events/MessageEvent.h" |
#include "modules/EventTargetModules.h" |
+#include "modules/navigatorconnect/AcceptConnectionObserver.h" |
#include "modules/navigatorconnect/ServicePort.h" |
+#include "modules/navigatorconnect/ServicePortConnectEvent.h" |
+#include "modules/navigatorconnect/ServicePortConnectEventInit.h" |
#include "modules/navigatorconnect/ServicePortConnectOptions.h" |
#include "public/platform/Platform.h" |
#include "public/platform/modules/navigator_services/WebServicePortProvider.h" |
@@ -146,6 +149,17 @@ void ServicePortCollection::postMessage(WebServicePortID portId, const WebString |
dispatchEvent(evt.release(), ASSERT_NO_EXCEPTION); |
} |
+void ServicePortCollection::dispatchConnectEvent(PassOwnPtr<WebServicePortConnectEventCallbacks> callbacks, const WebURL& targetURL, const WebString& origin, WebServicePortID portID) |
+{ |
+ AcceptConnectionObserver* observer = AcceptConnectionObserver::create(this, callbacks, portID, targetURL); |
+ ServicePortConnectEventInit init; |
+ init.setTargetURL(targetURL.string()); |
+ init.setOrigin(origin); |
+ RefPtrWillBeRawPtr<Event> event = ServicePortConnectEvent::create(EventTypeNames::connect, init, observer); |
+ dispatchEvent(event.release()); |
+ observer->didDispatchEvent(); |
+} |
+ |
DEFINE_TRACE(ServicePortCollection) |
{ |
visitor->trace(m_ports); |