Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Unified Diff: Source/modules/navigatorconnect/ServicePortConnectEvent.h

Issue 1210633002: Update navigator.services API to use the new services.onconnect event [1/3]. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@serviceport-part3
Patch Set: rebase Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/modules/navigatorconnect/ServicePortConnectEvent.h
diff --git a/Source/modules/navigatorconnect/ServicePortConnectEvent.h b/Source/modules/navigatorconnect/ServicePortConnectEvent.h
new file mode 100644
index 0000000000000000000000000000000000000000..a687b6751b5e6e04ea6c0ac6be35e28afb0b0eeb
--- /dev/null
+++ b/Source/modules/navigatorconnect/ServicePortConnectEvent.h
@@ -0,0 +1,50 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ServicePortConnectEvent_h
+#define ServicePortConnectEvent_h
+
+#include "modules/EventModules.h"
+#include "modules/ModulesExport.h"
+#include "modules/serviceworkers/ExtendableEvent.h"
+#include "platform/heap/Handle.h"
+
+namespace blink {
+
+class AcceptConnectionObserver;
+class ExceptionState;
+class ServicePortConnectEventInit;
+
+// A connect event is dispatched by the client to a service worker's script.
+// AcceptConnectionObserver can be used to notify the client about the service
+// worker's response.
+class MODULES_EXPORT ServicePortConnectEvent final : public ExtendableEvent {
+ DEFINE_WRAPPERTYPEINFO();
+public:
+ static PassRefPtrWillBeRawPtr<ServicePortConnectEvent> create();
+ static PassRefPtrWillBeRawPtr<ServicePortConnectEvent> create(const AtomicString& type, const ServicePortConnectEventInit&);
+ static PassRefPtrWillBeRawPtr<ServicePortConnectEvent> create(const AtomicString& type, const ServicePortConnectEventInit&, AcceptConnectionObserver*);
+
+ // ServicePortConnectEvent.idl
+ String targetURL() const { return m_targetURL; }
+ String origin() const { return m_origin; }
+ ScriptPromise respondWith(ScriptState*, const ScriptPromise& response, ExceptionState&);
+
+ const AtomicString& interfaceName() const override;
+
+ DECLARE_VIRTUAL_TRACE();
+
+protected:
+ ServicePortConnectEvent();
+ ServicePortConnectEvent(const AtomicString& type, const ServicePortConnectEventInit&, AcceptConnectionObserver*);
+
+private:
+ PersistentWillBeMember<AcceptConnectionObserver> m_observer;
+ String m_targetURL;
+ String m_origin;
+};
+
+} // namespace blink
+
+#endif // ServicePortConnectEvent_h
« no previous file with comments | « Source/modules/navigatorconnect/ServicePortCollection.idl ('k') | Source/modules/navigatorconnect/ServicePortConnectEvent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698