Index: content/renderer/p2p/socket_client.h |
diff --git a/content/renderer/p2p/socket_client.h b/content/renderer/p2p/socket_client.h |
index e15d813509756ae33d45790c063bcd6f7430804f..43f710d361c92dbc16cc46143a5399f5d61f42e8 100644 |
--- a/content/renderer/p2p/socket_client.h |
+++ b/content/renderer/p2p/socket_client.h |
@@ -8,7 +8,8 @@ |
#include <vector> |
#include "base/memory/ref_counted.h" |
-#include "content/common/p2p_sockets.h" |
+#include "content/public/common/p2p_sockets.h" |
+#include "content/public/renderer/socket_client.h" |
#include "net/base/ip_endpoint.h" |
namespace base { |
@@ -25,49 +26,35 @@ class P2PSocketDispatcher; |
// IPC thread is used to interact with P2PSocketDispatcher. All |
// callbacks to the user of this class are called on the delegate |
// thread which is specified in Init(). |
-class P2PSocketClient : public base::RefCountedThreadSafe<P2PSocketClient> { |
+class P2PSocketClient : public P2PSocketClientInterface { |
public: |
- // Delegate is called on the the same thread on which P2PSocketCLient is |
- // created. |
- class Delegate { |
- public: |
- virtual ~Delegate() { } |
- |
- virtual void OnOpen(const net::IPEndPoint& address) = 0; |
- virtual void OnIncomingTcpConnection(const net::IPEndPoint& address, |
- P2PSocketClient* client) = 0; |
- virtual void OnSendComplete() = 0; |
- virtual void OnError() = 0; |
- virtual void OnDataReceived(const net::IPEndPoint& address, |
- const std::vector<char>& data) = 0; |
- }; |
- |
explicit P2PSocketClient(P2PSocketDispatcher* dispatcher); |
// Initialize socket of the specified |type| and connected to the |
// specified |address|. |address| matters only when |type| is set to |
// P2P_SOCKET_TCP_CLIENT. |
- void Init(P2PSocketType type, |
- const net::IPEndPoint& local_address, |
- const net::IPEndPoint& remote_address, |
- Delegate* delegate); |
+ virtual void Init(P2PSocketType type, |
+ const net::IPEndPoint& local_address, |
+ const net::IPEndPoint& remote_address, |
+ Delegate* delegate) OVERRIDE; |
// Send the |data| to the |address|. |
- void Send(const net::IPEndPoint& address, const std::vector<char>& data); |
+ virtual void Send(const net::IPEndPoint& address, |
+ const std::vector<char>& data) OVERRIDE; |
// Send the |data| to the |address| using Differentiated Services Code Point |
// |dscp|. |
- void SendWithDscp(const net::IPEndPoint& address, |
- const std::vector<char>& data, |
- net::DiffServCodePoint dscp); |
+ virtual void SendWithDscp(const net::IPEndPoint& address, |
+ const std::vector<char>& data, |
+ net::DiffServCodePoint dscp) OVERRIDE; |
// Must be called before the socket is destroyed. The delegate may |
// not be called after |closed_task| is executed. |
- void Close(); |
+ virtual void Close() OVERRIDE; |
- int socket_id() const { return socket_id_; } |
+ virtual int socket_id() const OVERRIDE; |
- void set_delegate(Delegate* delegate); |
+ virtual void set_delegate(Delegate* delegate) OVERRIDE; |
private: |
enum State { |
@@ -80,9 +67,6 @@ class P2PSocketClient : public base::RefCountedThreadSafe<P2PSocketClient> { |
friend class P2PSocketDispatcher; |
- // Calls destructor. |
- friend class base::RefCountedThreadSafe<P2PSocketClient>; |
- |
virtual ~P2PSocketClient(); |
// Message handlers that run on IPC thread. |