Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_COPRESENCE_SOCKETS_COPRESENCE_SOCKET_H_ | |
| 6 #define COMPONENTS_COPRESENCE_SOCKETS_COPRESENCE_SOCKET_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 | |
| 12 namespace copresence_sockets { | |
| 13 | |
| 14 // A CopresenceSocket is an object that is used to send receive data. Currently | |
| 15 // this object is only created by a CopresencePeer once it receives a | |
| 16 // connection request. This class is currently just a pure interface. | |
| 17 // TODO(rkc): Add the ability to connect to a remote CopresencePeer. | |
| 18 class CopresenceSocket { | |
| 19 public: | |
| 20 CopresenceSocket() {} | |
| 21 virtual ~CopresenceSocket() {} | |
| 22 | |
| 23 // Attempt to send data on this socket. If we were unable to send the data, | |
| 24 // the method returns false. | |
| 25 // TODO(rkc): Expand the bool into more a more detailed failures enum. | |
| 26 virtual bool Send(const std::string& data) = 0; | |
| 27 | |
| 28 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.
| |
| 29 virtual void Receive(ReceiveCallback callback) = 0; | |
| 30 | |
| 31 private: | |
| 32 DISALLOW_COPY_AND_ASSIGN(CopresenceSocket); | |
| 33 }; | |
| 34 | |
| 35 } // namespace copresence_sockets | |
| 36 | |
| 37 #endif // COMPONENTS_COPRESENCE_SOCKETS_COPRESENCE_SOCKET_H_ | |
| OLD | NEW |