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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/threading/non_thread_safe.h" | 12 #include "base/threading/non_thread_safe.h" |
| 13 #include "net/base/completion_callback.h" |
13 #include "net/base/net_log.h" | 14 #include "net/base/net_log.h" |
14 #include "net/socket/stream_socket.h" | 15 #include "net/socket/stream_socket.h" |
15 #include "ppapi/c/pp_stdint.h" | 16 #include "ppapi/c/pp_stdint.h" |
16 #include "ppapi/cpp/completion_callback.h" | 17 #include "ppapi/cpp/completion_callback.h" |
17 | 18 |
18 namespace pp { | 19 namespace pp { |
19 class Transport_Dev; | 20 class Transport_Dev; |
20 } // namespace pp | 21 } // namespace pp |
21 | 22 |
22 namespace remoting { | 23 namespace remoting { |
(...skipping 20 matching lines...) Expand all Loading... |
43 virtual ~PepperTransportSocketAdapter(); | 44 virtual ~PepperTransportSocketAdapter(); |
44 | 45 |
45 const std::string& name() { return name_; } | 46 const std::string& name() { return name_; } |
46 | 47 |
47 // Adds candidate received from the peer. | 48 // Adds candidate received from the peer. |
48 void AddRemoteCandidate(const std::string& candidate); | 49 void AddRemoteCandidate(const std::string& candidate); |
49 | 50 |
50 // net::Socket implementation. | 51 // net::Socket implementation. |
51 virtual int Read(net::IOBuffer* buf, int buf_len, | 52 virtual int Read(net::IOBuffer* buf, int buf_len, |
52 net::OldCompletionCallback* callback) OVERRIDE; | 53 net::OldCompletionCallback* callback) OVERRIDE; |
| 54 virtual int Read(net::IOBuffer* buf, int buf_len, |
| 55 const net::CompletionCallback& callback) OVERRIDE; |
53 virtual int Write(net::IOBuffer* buf, int buf_len, | 56 virtual int Write(net::IOBuffer* buf, int buf_len, |
54 net::OldCompletionCallback* callback) OVERRIDE; | 57 net::OldCompletionCallback* callback) OVERRIDE; |
55 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; | 58 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; |
56 virtual bool SetSendBufferSize(int32 size) OVERRIDE; | 59 virtual bool SetSendBufferSize(int32 size) OVERRIDE; |
57 | 60 |
58 // net::StreamSocket implementation. | 61 // net::StreamSocket implementation. |
59 virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE; | 62 virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE; |
60 virtual int Connect(const net::CompletionCallback& callback) OVERRIDE; | 63 virtual int Connect(const net::CompletionCallback& callback) OVERRIDE; |
61 virtual void Disconnect() OVERRIDE; | 64 virtual void Disconnect() OVERRIDE; |
62 virtual bool IsConnected() const OVERRIDE; | 65 virtual bool IsConnected() const OVERRIDE; |
(...skipping 21 matching lines...) Expand all Loading... |
84 Observer* observer_; | 87 Observer* observer_; |
85 | 88 |
86 scoped_ptr<pp::Transport_Dev> transport_; | 89 scoped_ptr<pp::Transport_Dev> transport_; |
87 | 90 |
88 net::OldCompletionCallback* old_connect_callback_; | 91 net::OldCompletionCallback* old_connect_callback_; |
89 net::CompletionCallback connect_callback_; | 92 net::CompletionCallback connect_callback_; |
90 bool connected_; | 93 bool connected_; |
91 | 94 |
92 bool get_address_pending_; | 95 bool get_address_pending_; |
93 | 96 |
94 net::OldCompletionCallback* read_callback_; | 97 net::OldCompletionCallback* old_read_callback_; |
| 98 net::CompletionCallback read_callback_; |
95 scoped_refptr<net::IOBuffer> read_buffer_; | 99 scoped_refptr<net::IOBuffer> read_buffer_; |
96 | 100 |
97 net::OldCompletionCallback* write_callback_; | 101 net::OldCompletionCallback* write_callback_; |
98 scoped_refptr<net::IOBuffer> write_buffer_; | 102 scoped_refptr<net::IOBuffer> write_buffer_; |
99 | 103 |
100 net::BoundNetLog net_log_; | 104 net::BoundNetLog net_log_; |
101 | 105 |
102 pp::CompletionCallbackFactory<PepperTransportSocketAdapter> callback_factory_; | 106 pp::CompletionCallbackFactory<PepperTransportSocketAdapter> callback_factory_; |
103 | 107 |
104 DISALLOW_COPY_AND_ASSIGN(PepperTransportSocketAdapter); | 108 DISALLOW_COPY_AND_ASSIGN(PepperTransportSocketAdapter); |
105 }; | 109 }; |
106 | 110 |
107 } // namespace protocol | 111 } // namespace protocol |
108 } // namespace remoting | 112 } // namespace remoting |
109 | 113 |
110 #endif // REMOTING_PROTOCOL_PEPPER_TRANSPORT_SOCKET_ADAPTER_H_ | 114 #endif // REMOTING_PROTOCOL_PEPPER_TRANSPORT_SOCKET_ADAPTER_H_ |
OLD | NEW |