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

Unified Diff: chrome/browser/extensions/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: Include cleanups 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 | « no previous file | remoting/host/DEPS » ('j') | remoting/host/native_messaging/pipe_messaging_channel.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/messaging/native_messaging_channel.h
diff --git a/chrome/browser/extensions/api/messaging/native_messaging_channel.h b/chrome/browser/extensions/api/messaging/native_messaging_channel.h
new file mode 100644
index 0000000000000000000000000000000000000000..c6b560d372e09f44b4563a5075eb987733c2fc39
--- /dev/null
+++ b/chrome/browser/extensions/api/messaging/native_messaging_channel.h
@@ -0,0 +1,40 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
Sergey Ulanov 2014/09/15 19:53:39 I think it's better to add this file under extensi
kelvinp 2014/09/16 00:32:51 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_CHANNEL_H_
+#define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_CHANNEL_H_
+
+#include "base/callback.h"
+
+namespace base {
+class DictionaryValue;
+} // namespace base
+
+namespace extensions {
+
+// Defines an interface to read messages and send responses between a native
+// component and chrome.
+class NativeMessagingChannel {
+ public:
+ // Used to send a message to the other endpoint.
+ typedef base::Callback<void(scoped_ptr<base::DictionaryValue> message)>
Sergey Ulanov 2014/09/15 19:53:39 this should be base::Value instead of DictionaryVa
kelvinp 2014/09/16 00:32:51 Done.
+ SendMessageCallback;
+
+ virtual ~NativeMessagingChannel() {}
+
+ // Starts reading and processing messages.
+ // |received_message| is called whenever a message is received from the other
+ // endpoint.
+ // |quit_closure| is called by the channel to shut down the native component
+ // whenever it encounter failures in sending or receiving a message.
+ virtual void Start(const SendMessageCallback& received_message,
Sergey Ulanov 2014/09/15 19:53:39 I suggest you replace these two callbacks with a c
kelvinp 2014/09/16 00:32:51 Done.
+ const base::Closure& quit_closure) = 0;
+
+ // Sends a message to the other endpoint.
+ virtual void SendMessage(scoped_ptr<base::DictionaryValue> message) = 0;
Sergey Ulanov 2014/09/15 19:53:39 base::Value
kelvinp 2014/09/16 00:32:51 Done.
+};
+
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_CHANNEL_H_
« no previous file with comments | « no previous file | remoting/host/DEPS » ('j') | remoting/host/native_messaging/pipe_messaging_channel.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698