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

Unified Diff: remoting/host/native_messaging/native_messaging_pipe.h

Issue 591463003: Remote Assistance on Chrome OS Part III - NativeMessageHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@native_messaging
Patch Set: Fix NativeMessagingBasic test on Release builds Created 6 years, 2 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: remoting/host/native_messaging/native_messaging_pipe.h
diff --git a/remoting/host/native_messaging/native_messaging_pipe.h b/remoting/host/native_messaging/native_messaging_pipe.h
new file mode 100644
index 0000000000000000000000000000000000000000..24a16f702bbe83965b8494d9995ace10bc15fd98
--- /dev/null
+++ b/remoting/host/native_messaging/native_messaging_pipe.h
@@ -0,0 +1,50 @@
+// 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 REMOTING_HOST_NATIVE_MESSAGING_NATIVE_MESSAGING_PIPE_H_
+#define REMOTING_HOST_NATIVE_MESSAGING_NATIVE_MESSAGING_PIPE_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "extensions/browser/api/messaging/native_message_host.h"
+#include "extensions/browser/api/messaging/native_messaging_channel.h"
+
+namespace base {
+class Value;
+}
+
+namespace remoting {
+
+// Connects a extensions::NativeMessageHost to a PipeMessagingChannel.
+class NativeMessagingPipe
+ : public extensions::NativeMessagingChannel::EventHandler,
+ public extensions::NativeMessageHost::Client {
+ public:
+ NativeMessagingPipe();
+ virtual ~NativeMessagingPipe();
+
+ // Starts processing messages from the pipe.
+ void Start(scoped_ptr<extensions::NativeMessageHost> host,
+ scoped_ptr<extensions::NativeMessagingChannel> channel,
+ const base::Closure& quit_closure);
+
+ // extensions::NativeMessageHost::Client implementation.
+ virtual void PostMessageFromNativeHost(const std::string& message) override;
+ virtual void CloseChannel(const std::string& error_message) override;
+
+ // extensions::NativeMessagingChannel::EventHandler implementation.
+ virtual void OnMessage(scoped_ptr<base::Value> message) override;
+ virtual void OnDisconnect() override;
+
+ private:
+ base::Closure quit_closure_;
+ scoped_ptr<extensions::NativeMessagingChannel> channel_;
+ scoped_ptr<extensions::NativeMessageHost> host_;
+
+ DISALLOW_COPY_AND_ASSIGN(NativeMessagingPipe);
+};
+
+} // namespace remoting
+
+#endif // REMOTING_HOST_NATIVE_MESSAGING_NATIVE_MESSAGING_PIPE_H_
« no previous file with comments | « remoting/host/it2me/it2me_native_messaging_host_unittest.cc ('k') | remoting/host/native_messaging/native_messaging_pipe.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698