Index: components/copresence_sockets/public/copresence_socket.h |
diff --git a/components/copresence_sockets/public/copresence_socket.h b/components/copresence_sockets/public/copresence_socket.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0c7c105a63f7d17983de01306e05f258e4cb4060 |
--- /dev/null |
+++ b/components/copresence_sockets/public/copresence_socket.h |
@@ -0,0 +1,37 @@ |
+// 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 COMPONENTS_COPRESENCE_SOCKETS_COPRESENCE_SOCKET_H_ |
+#define COMPONENTS_COPRESENCE_SOCKETS_COPRESENCE_SOCKET_H_ |
+ |
+#include <string> |
+ |
+#include "base/macros.h" |
+ |
+namespace copresence_sockets { |
+ |
+// A CopresenceSocket is an object that is used to send receive data. Currently |
+// this object is only created by a CopresencePeer once it receives a |
+// connection request. This class is currently just a pure interface. |
+// TODO(rkc): Add the ability to connect to a remote CopresencePeer. |
+class CopresenceSocket { |
+ public: |
+ CopresenceSocket() {} |
+ virtual ~CopresenceSocket() {} |
+ |
+ // Attempt to send data on this socket. If we were unable to send the data, |
+ // the method returns false. |
+ // TODO(rkc): Expand the bool into more a more detailed failures enum. |
+ virtual bool Send(const std::string& data) = 0; |
+ |
+ typedef base::Callback<void(const std::string&)> ReceiveCallback; |
Cait (Slow)
2014/09/30 17:56:01
nit: typedef declarations should come before f'ns.
rkc
2014/10/01 19:08:24
Done.
|
+ virtual void Receive(ReceiveCallback callback) = 0; |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(CopresenceSocket); |
+}; |
+ |
+} // namespace copresence_sockets |
+ |
+#endif // COMPONENTS_COPRESENCE_SOCKETS_COPRESENCE_SOCKET_H_ |