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

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

Issue 1191393003: Update client side navigator.connect API to use ServicePortCollection [1/3] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@serviceport
Patch Set: address more comments Created 5 years, 6 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/ServicePort.h
diff --git a/Source/modules/navigatorconnect/ServicePort.h b/Source/modules/navigatorconnect/ServicePort.h
new file mode 100644
index 0000000000000000000000000000000000000000..efc27dc35e44853733746f928a34e7622d39b9ea
--- /dev/null
+++ b/Source/modules/navigatorconnect/ServicePort.h
@@ -0,0 +1,53 @@
+// 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 ServicePort_h
+#define ServicePort_h
+
+#include "bindings/core/v8/ScriptWrappable.h"
+#include "core/dom/MessagePort.h"
+#include "modules/ModulesExport.h"
+#include "public/platform/modules/navigator_services/WebServicePort.h"
+
+namespace blink {
+
+class ExceptionState;
+class ExecutionContext;
+class MessagePort;
+class ScriptState;
+class ScriptValue;
+class SerializedScriptValue;
+class ServicePortCollection;
+
+class MODULES_EXPORT ServicePort final
+ : public GarbageCollectedFinalized<ServicePort>, public ScriptWrappable {
+ DEFINE_WRAPPERTYPEINFO();
+ WTF_MAKE_NONCOPYABLE(ServicePort);
+public:
+ static ServicePort* create(ServicePortCollection*, const WebServicePort&);
+ virtual ~ServicePort();
+
+ WebServicePortID id() const { return m_port.id; }
+
+ // ServicePort.idl
+ String targetURL() const;
+ String name() const;
+ ScriptValue data(ScriptState*) const;
+ void postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValue> message, const MessagePortArray*, ExceptionState&);
+ void close();
+
+ DECLARE_VIRTUAL_TRACE();
+
+private:
+ ServicePort(ServicePortCollection*, const WebServicePort&);
+
+ bool m_isOpen;
+ WebServicePort m_port;
+ RefPtr<SerializedScriptValue> m_serializedData;
+ Member<ServicePortCollection> m_collection;
+};
+
+} // namespace blink
+
+#endif // ServicePort_h
« no previous file with comments | « Source/modules/navigatorconnect/NavigatorServices.h ('k') | Source/modules/navigatorconnect/ServicePort.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698