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

Unified Diff: chromeos/arc/libarcbridge/arc_bridge.h

Issue 1424503002: arc-bridge: Add IPC message definitions (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | chromeos/arc/libarcbridge/arc_bridge.cc » ('j') | chromeos/arc/libarcbridge/arc_bridge.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/arc/libarcbridge/arc_bridge.h
diff --git a/chromeos/arc/libarcbridge/arc_bridge.h b/chromeos/arc/libarcbridge/arc_bridge.h
new file mode 100644
index 0000000000000000000000000000000000000000..32934740c71a1dd4fa250b7e7e6ee0f4298407b9
--- /dev/null
+++ b/chromeos/arc/libarcbridge/arc_bridge.h
@@ -0,0 +1,77 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
satorux1 2015/10/23 05:16:43 Can we drop 'lib' from the directory name? Directo
Luis Héctor Chávez 2015/10/23 17:09:24 The reason for the separation is that I need to ha
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
satorux1 2015/10/23 05:16:43 Because the concept of ARC Bridge is not obvious,
Luis Héctor Chávez 2015/10/23 17:09:24 Done.
+
+#ifndef CHROMEOS_ARC_LIBARCBRIDGE_ARC_ARC_BRIDGE_H_
+#define CHROMEOS_ARC_LIBARCBRIDGE_ARC_ARC_BRIDGE_H_
+
+#include "base/macros.h"
+#include "ipc/ipc_channel_proxy.h"
+#include "ipc/ipc_listener.h"
+#include "ipc/ipc_message.h"
+
+namespace arc {
+
+// Abstract class that represents one of the ARC bridge endpoints.
+class BridgeEndpoint : public IPC::Listener {
+ public:
+ BridgeEndpoint();
+ virtual ~BridgeEndpoint();
+
+ bool Connect(const IPC::ChannelHandle& handle, IPC::Channel::Mode mode);
satorux1 2015/10/23 05:16:43 function comment is missing. Please fix other plac
Luis Héctor Chávez 2015/10/23 17:09:24 Done.
+
+ protected:
+ scoped_ptr<IPC::ChannelProxy> channel_;
+
+ private:
+ base::Thread io_thread_;
satorux1 2015/10/23 05:16:43 "IO thread" in Chrome usually means BrowserThread:
Luis Héctor Chávez 2015/10/23 17:09:24 Done.
+
+ DISALLOW_COPY_AND_ASSIGN(BridgeEndpoint);
+};
+
+// Instance side of the ARC bridge.
+class BridgeInstanceEndpoint : public BridgeEndpoint {
+ public:
+ BridgeInstanceEndpoint();
+ virtual ~BridgeInstanceEndpoint();
+
+ bool SocketConnect(const char* socket_path);
satorux1 2015/10/23 05:16:43 How about const std::string&? I guess NULL is not
Luis Héctor Chávez 2015/10/23 17:09:24 Done.
+
+ // Messages from the instance to the host.
+ bool InstanceReady();
+
+ private:
+ bool OnMessageReceived(const IPC::Message& message) override;
+ void OnPing();
+ virtual void OnRegisterInputDevice(const std::string& name,
+ const std::string& device_type,
+ base::FileDescriptor fd) = 0;
+
+ DISALLOW_COPY_AND_ASSIGN(BridgeInstanceEndpoint);
+};
+
+// Host side of the ARC bridge.
+class BridgeHostEndpoint : public BridgeEndpoint {
+ public:
+ BridgeHostEndpoint();
+ virtual ~BridgeHostEndpoint();
+
+ bool SocketConnect(const char* socket_path);
+
+ // Messages from the host to the instance.
+ bool Ping();
+ bool RegisterInputDevice(const std::string& name,
+ const std::string& device_type,
+ base::ScopedFD fd);
+
+ private:
+ bool OnMessageReceived(const IPC::Message& message) override;
+ virtual void OnInstanceReady() = 0;
+ virtual void OnPong() = 0;
+
+ DISALLOW_COPY_AND_ASSIGN(BridgeHostEndpoint);
+};
+
+} // namespace arc
+
+#endif // CHROMEOS_ARC_LIBARCBRIDGE_ARC_ARC_BRIDGE_H_
« no previous file with comments | « no previous file | chromeos/arc/libarcbridge/arc_bridge.cc » ('j') | chromeos/arc/libarcbridge/arc_bridge.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698