| 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 | 15 |
| 16 namespace net { |
| 17 class LoadLog; |
| 18 } // namespace net |
| 19 |
| 16 namespace notifier { | 20 namespace notifier { |
| 17 | 21 |
| 18 class SSLSocketAdapter; | 22 class SSLSocketAdapter; |
| 19 | 23 |
| 20 // This class provides a wrapper to libjingle's talk_base::AsyncSocket that | 24 // This class provides a wrapper to libjingle's talk_base::AsyncSocket that |
| 21 // implements Chromium's net::ClientSocket interface. It's used by | 25 // implements Chromium's net::ClientSocket interface. It's used by |
| 22 // SSLSocketAdapter to enable Chromium's SSL implementation to work over | 26 // SSLSocketAdapter to enable Chromium's SSL implementation to work over |
| 23 // libjingle's socket class. | 27 // libjingle's socket class. |
| 24 class TransportSocket : public net::ClientSocket, public sigslot::has_slots<> { | 28 class TransportSocket : public net::ClientSocket, public sigslot::has_slots<> { |
| 25 public: | 29 public: |
| 26 TransportSocket(talk_base::AsyncSocket* socket, | 30 TransportSocket(talk_base::AsyncSocket* socket, |
| 27 SSLSocketAdapter *ssl_adapter); | 31 SSLSocketAdapter *ssl_adapter); |
| 28 | 32 |
| 29 void set_addr(const talk_base::SocketAddress& addr) { | 33 void set_addr(const talk_base::SocketAddress& addr) { |
| 30 addr_ = addr; | 34 addr_ = addr; |
| 31 } | 35 } |
| 32 | 36 |
| 33 // net::ClientSocket implementation | 37 // net::ClientSocket implementation |
| 34 | 38 |
| 35 virtual int Connect(net::CompletionCallback* callback); | 39 virtual int Connect(net::CompletionCallback* callback, |
| 40 net::LoadLog* /* load_log */); |
| 36 virtual void Disconnect(); | 41 virtual void Disconnect(); |
| 37 virtual bool IsConnected() const; | 42 virtual bool IsConnected() const; |
| 38 virtual bool IsConnectedAndIdle() const; | 43 virtual bool IsConnectedAndIdle() const; |
| 39 | 44 |
| 40 #if defined(OS_LINUX) || defined(OS_MACOSX) | 45 #if defined(OS_LINUX) || defined(OS_MACOSX) |
| 41 virtual int GetPeerName(struct sockaddr *name, socklen_t *namelen); | 46 virtual int GetPeerName(struct sockaddr *name, socklen_t *namelen); |
| 42 #endif | 47 #endif |
| 43 | 48 |
| 44 // net::Socket implementation | 49 // net::Socket implementation |
| 45 | 50 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 State state_; | 126 State state_; |
| 122 scoped_refptr<net::IOBuffer> transport_buf_; | 127 scoped_refptr<net::IOBuffer> transport_buf_; |
| 123 int data_transferred_; | 128 int data_transferred_; |
| 124 | 129 |
| 125 DISALLOW_COPY_AND_ASSIGN(SSLSocketAdapter); | 130 DISALLOW_COPY_AND_ASSIGN(SSLSocketAdapter); |
| 126 }; | 131 }; |
| 127 | 132 |
| 128 } // namespace notifier | 133 } // namespace notifier |
| 129 | 134 |
| 130 #endif // CHROME_BROWSER_SYNC_NOTIFIER_COMMUNICATOR_SSL_SOCKET_ADAPTER_H_ | 135 #endif // CHROME_BROWSER_SYNC_NOTIFIER_COMMUNICATOR_SSL_SOCKET_ADAPTER_H_ |
| OLD | NEW |