| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 CHROME_BROWSER_SYNC_NOTIFIER_COMMUNICATOR_SSL_SOCKET_ADAPTER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_NOTIFIER_COMMUNICATOR_SSL_SOCKET_ADAPTER_H_ |
| 6 #define CHROME_BROWSER_SYNC_NOTIFIER_COMMUNICATOR_SSL_SOCKET_ADAPTER_H_ | 6 #define CHROME_BROWSER_SYNC_NOTIFIER_COMMUNICATOR_SSL_SOCKET_ADAPTER_H_ |
| 7 | 7 |
| 8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
| 9 #include "net/base/completion_callback.h" | 9 #include "net/base/completion_callback.h" |
| 10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
| 11 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
| 12 #include "net/socket/client_socket.h" | 12 #include "net/socket/client_socket.h" |
| 13 #include "net/socket/ssl_client_socket.h" | 13 #include "net/socket/ssl_client_socket.h" |
| 14 #include "talk/base/asyncsocket.h" | 14 #include "talk/base/asyncsocket.h" |
| 15 #include "talk/base/ssladapter.h" | 15 #include "talk/base/ssladapter.h" |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 class LoadLog; | 18 class BoundNetLog; |
| 19 } // namespace net | 19 } // namespace net |
| 20 | 20 |
| 21 namespace notifier { | 21 namespace notifier { |
| 22 | 22 |
| 23 class SSLSocketAdapter; | 23 class SSLSocketAdapter; |
| 24 | 24 |
| 25 // This class provides a wrapper to libjingle's talk_base::AsyncSocket that | 25 // This class provides a wrapper to libjingle's talk_base::AsyncSocket that |
| 26 // implements Chromium's net::ClientSocket interface. It's used by | 26 // implements Chromium's net::ClientSocket interface. It's used by |
| 27 // SSLSocketAdapter to enable Chromium's SSL implementation to work over | 27 // SSLSocketAdapter to enable Chromium's SSL implementation to work over |
| 28 // libjingle's socket class. | 28 // libjingle's socket class. |
| 29 class TransportSocket : public net::ClientSocket, public sigslot::has_slots<> { | 29 class TransportSocket : public net::ClientSocket, public sigslot::has_slots<> { |
| 30 public: | 30 public: |
| 31 TransportSocket(talk_base::AsyncSocket* socket, | 31 TransportSocket(talk_base::AsyncSocket* socket, |
| 32 SSLSocketAdapter *ssl_adapter); | 32 SSLSocketAdapter *ssl_adapter); |
| 33 | 33 |
| 34 void set_addr(const talk_base::SocketAddress& addr) { | 34 void set_addr(const talk_base::SocketAddress& addr) { |
| 35 addr_ = addr; | 35 addr_ = addr; |
| 36 } | 36 } |
| 37 | 37 |
| 38 // net::ClientSocket implementation | 38 // net::ClientSocket implementation |
| 39 | 39 |
| 40 virtual int Connect(net::CompletionCallback* callback, | 40 virtual int Connect(net::CompletionCallback* callback, |
| 41 net::LoadLog* /* load_log */); | 41 const net::BoundNetLog& /* net_log */); |
| 42 virtual void Disconnect(); | 42 virtual void Disconnect(); |
| 43 virtual bool IsConnected() const; | 43 virtual bool IsConnected() const; |
| 44 virtual bool IsConnectedAndIdle() const; | 44 virtual bool IsConnectedAndIdle() const; |
| 45 virtual int GetPeerAddress(net::AddressList* address) const; | 45 virtual int GetPeerAddress(net::AddressList* address) const; |
| 46 | 46 |
| 47 // net::Socket implementation | 47 // net::Socket implementation |
| 48 | 48 |
| 49 virtual int Read(net::IOBuffer* buf, int buf_len, | 49 virtual int Read(net::IOBuffer* buf, int buf_len, |
| 50 net::CompletionCallback* callback); | 50 net::CompletionCallback* callback); |
| 51 virtual int Write(net::IOBuffer* buf, int buf_len, | 51 virtual int Write(net::IOBuffer* buf, int buf_len, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 State state_; | 126 State state_; |
| 127 scoped_refptr<net::IOBuffer> transport_buf_; | 127 scoped_refptr<net::IOBuffer> transport_buf_; |
| 128 int data_transferred_; | 128 int data_transferred_; |
| 129 | 129 |
| 130 DISALLOW_COPY_AND_ASSIGN(SSLSocketAdapter); | 130 DISALLOW_COPY_AND_ASSIGN(SSLSocketAdapter); |
| 131 }; | 131 }; |
| 132 | 132 |
| 133 } // namespace notifier | 133 } // namespace notifier |
| 134 | 134 |
| 135 #endif // CHROME_BROWSER_SYNC_NOTIFIER_COMMUNICATOR_SSL_SOCKET_ADAPTER_H_ | 135 #endif // CHROME_BROWSER_SYNC_NOTIFIER_COMMUNICATOR_SSL_SOCKET_ADAPTER_H_ |
| OLD | NEW |