| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef REMOTING_PROTOCOL_PEPPER_TRANSPORT_SOCKET_ADAPTER_H_ | 5 #ifndef REMOTING_PROTOCOL_PEPPER_TRANSPORT_SOCKET_ADAPTER_H_ |
| 6 #define REMOTING_PROTOCOL_PEPPER_TRANSPORT_SOCKET_ADAPTER_H_ | 6 #define REMOTING_PROTOCOL_PEPPER_TRANSPORT_SOCKET_ADAPTER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 PepperTransportSocketAdapter(pp::Transport_Dev* transport, | 40 PepperTransportSocketAdapter(pp::Transport_Dev* transport, |
| 41 const std::string& name, | 41 const std::string& name, |
| 42 Observer* observer); | 42 Observer* observer); |
| 43 virtual ~PepperTransportSocketAdapter(); | 43 virtual ~PepperTransportSocketAdapter(); |
| 44 | 44 |
| 45 const std::string& name() { return name_; } | 45 const std::string& name() { return name_; } |
| 46 | 46 |
| 47 // Adds candidate received from the peer. | 47 // Adds candidate received from the peer. |
| 48 void AddRemoteCandidate(const std::string& candidate); | 48 void AddRemoteCandidate(const std::string& candidate); |
| 49 | 49 |
| 50 // net::Socket interface. | 50 // net::Socket implementation. |
| 51 virtual int Read(net::IOBuffer* buf, int buf_len, | 51 virtual int Read(net::IOBuffer* buf, int buf_len, |
| 52 net::OldCompletionCallback* callback) OVERRIDE; | 52 net::OldCompletionCallback* callback) OVERRIDE; |
| 53 virtual int Write(net::IOBuffer* buf, int buf_len, | 53 virtual int Write(net::IOBuffer* buf, int buf_len, |
| 54 net::OldCompletionCallback* callback) OVERRIDE; | 54 net::OldCompletionCallback* callback) OVERRIDE; |
| 55 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; | 55 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; |
| 56 virtual bool SetSendBufferSize(int32 size) OVERRIDE; | 56 virtual bool SetSendBufferSize(int32 size) OVERRIDE; |
| 57 | 57 |
| 58 // net::StreamSocket interface. | 58 // net::StreamSocket implementation. |
| 59 virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE; | 59 virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE; |
| 60 virtual int Connect(const net::CompletionCallback& callback) OVERRIDE; |
| 60 virtual void Disconnect() OVERRIDE; | 61 virtual void Disconnect() OVERRIDE; |
| 61 virtual bool IsConnected() const OVERRIDE; | 62 virtual bool IsConnected() const OVERRIDE; |
| 62 virtual bool IsConnectedAndIdle() const OVERRIDE; | 63 virtual bool IsConnectedAndIdle() const OVERRIDE; |
| 63 virtual int GetPeerAddress(net::AddressList* address) const OVERRIDE; | 64 virtual int GetPeerAddress(net::AddressList* address) const OVERRIDE; |
| 64 virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE; | 65 virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE; |
| 65 virtual const net::BoundNetLog& NetLog() const OVERRIDE; | 66 virtual const net::BoundNetLog& NetLog() const OVERRIDE; |
| 66 virtual void SetSubresourceSpeculation() OVERRIDE; | 67 virtual void SetSubresourceSpeculation() OVERRIDE; |
| 67 virtual void SetOmniboxSpeculation() OVERRIDE; | 68 virtual void SetOmniboxSpeculation() OVERRIDE; |
| 68 virtual bool WasEverUsed() const OVERRIDE; | 69 virtual bool WasEverUsed() const OVERRIDE; |
| 69 virtual bool UsingTCPFastOpen() const OVERRIDE; | 70 virtual bool UsingTCPFastOpen() const OVERRIDE; |
| 70 virtual int64 NumBytesRead() const OVERRIDE; | 71 virtual int64 NumBytesRead() const OVERRIDE; |
| 71 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; | 72 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; |
| 72 | 73 |
| 73 private: | 74 private: |
| 74 // Callbacks for PPAPI calls. | 75 // Callbacks for PPAPI calls. |
| 75 void OnConnect(int result); | 76 void OnConnect(int result); |
| 76 void OnNextAddress(int32_t result); | 77 void OnNextAddress(int32_t result); |
| 77 void OnRead(int32_t result); | 78 void OnRead(int32_t result); |
| 78 void OnWrite(int32_t result); | 79 void OnWrite(int32_t result); |
| 79 | 80 |
| 80 int ProcessCandidates(); | 81 int ProcessCandidates(); |
| 81 | 82 |
| 82 std::string name_; | 83 std::string name_; |
| 83 Observer* observer_; | 84 Observer* observer_; |
| 84 | 85 |
| 85 scoped_ptr<pp::Transport_Dev> transport_; | 86 scoped_ptr<pp::Transport_Dev> transport_; |
| 86 | 87 |
| 87 net::OldCompletionCallback* connect_callback_; | 88 net::OldCompletionCallback* old_connect_callback_; |
| 89 net::CompletionCallback connect_callback_; |
| 88 bool connected_; | 90 bool connected_; |
| 89 | 91 |
| 90 bool get_address_pending_; | 92 bool get_address_pending_; |
| 91 | 93 |
| 92 net::OldCompletionCallback* read_callback_; | 94 net::OldCompletionCallback* read_callback_; |
| 93 scoped_refptr<net::IOBuffer> read_buffer_; | 95 scoped_refptr<net::IOBuffer> read_buffer_; |
| 94 | 96 |
| 95 net::OldCompletionCallback* write_callback_; | 97 net::OldCompletionCallback* write_callback_; |
| 96 scoped_refptr<net::IOBuffer> write_buffer_; | 98 scoped_refptr<net::IOBuffer> write_buffer_; |
| 97 | 99 |
| 98 net::BoundNetLog net_log_; | 100 net::BoundNetLog net_log_; |
| 99 | 101 |
| 100 pp::CompletionCallbackFactory<PepperTransportSocketAdapter> callback_factory_; | 102 pp::CompletionCallbackFactory<PepperTransportSocketAdapter> callback_factory_; |
| 101 | 103 |
| 102 DISALLOW_COPY_AND_ASSIGN(PepperTransportSocketAdapter); | 104 DISALLOW_COPY_AND_ASSIGN(PepperTransportSocketAdapter); |
| 103 }; | 105 }; |
| 104 | 106 |
| 105 } // namespace protocol | 107 } // namespace protocol |
| 106 } // namespace remoting | 108 } // namespace remoting |
| 107 | 109 |
| 108 #endif // REMOTING_PROTOCOL_PEPPER_TRANSPORT_SOCKET_ADAPTER_H_ | 110 #endif // REMOTING_PROTOCOL_PEPPER_TRANSPORT_SOCKET_ADAPTER_H_ |
| OLD | NEW |