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

Unified Diff: extensions/browser/api/messaging/native_messaging_channel.h

Issue 558403002: Remote Assistance on Chrome OS Part II - Native Messaging renaming (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase on ToT Created 6 years, 3 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
« no previous file with comments | « extensions/browser/api/messaging/OWNERS ('k') | remoting/host/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/messaging/native_messaging_channel.h
diff --git a/extensions/browser/api/messaging/native_messaging_channel.h b/extensions/browser/api/messaging/native_messaging_channel.h
new file mode 100644
index 0000000000000000000000000000000000000000..90425ba5099a86dac2cbfe2173d1a8d3b64fe2e4
--- /dev/null
+++ b/extensions/browser/api/messaging/native_messaging_channel.h
@@ -0,0 +1,45 @@
+// Copyright 2014 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 EXTENSIONS_BROWSER_API_MESSAGING_NATIVE_MESSAGING_CHANNEL_H_
+#define EXTENSIONS_BROWSER_API_MESSAGING_NATIVE_MESSAGING_CHANNEL_H_
+
+#include "base/callback.h"
+
+namespace base {
+class Value;
+} // namespace base
+
+namespace extensions {
+
+// An interface to receive and send messages between a native component and
+// chrome.
+class NativeMessagingChannel {
+ public:
+ // Callback interface for the channel. EventHandler must outlive
+ // NativeMessagingChannel.
+ class EventHandler {
+ public:
+ // Called when a message is received from the other endpoint.
+ virtual void OnMessage(scoped_ptr<base::Value> message) = 0;
+
+ // Called when the channel is disconnected.
+ // EventHandler is guaranteed not to be called after OnDisconnect().
+ virtual void OnDisconnect() = 0;
+
+ virtual ~EventHandler() {}
+ };
+
+ virtual ~NativeMessagingChannel() {}
+
+ // Starts reading and processing messages.
+ virtual void Start(EventHandler* event_handler) = 0;
+
+ // Sends a message to the other endpoint.
+ virtual void SendMessage(scoped_ptr<base::Value> message) = 0;
+};
+
+} // namespace extensions
+
+#endif // EXTENSIONS_BROWSER_API_MESSAGING_NATIVE_MESSAGING_CHANNEL_H_
« no previous file with comments | « extensions/browser/api/messaging/OWNERS ('k') | remoting/host/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698