OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // An implementation of buzz::AsyncSocket that uses Chrome sockets. | 5 // An implementation of buzz::AsyncSocket that uses Chrome sockets. |
6 | 6 |
7 #ifndef JINGLE_NOTIFIER_BASE_CHROME_ASYNC_SOCKET_H_ | 7 #ifndef JINGLE_NOTIFIER_BASE_CHROME_ASYNC_SOCKET_H_ |
8 #define JINGLE_NOTIFIER_BASE_CHROME_ASYNC_SOCKET_H_ | 8 #define JINGLE_NOTIFIER_BASE_CHROME_ASYNC_SOCKET_H_ |
9 | 9 |
10 #if !defined(FEATURE_ENABLE_SSL) | 10 #if !defined(FEATURE_ENABLE_SSL) |
(...skipping 17 matching lines...) Expand all Loading... |
28 class CertVerifier; | 28 class CertVerifier; |
29 class ClientSocket; | 29 class ClientSocket; |
30 class ClientSocketFactory; | 30 class ClientSocketFactory; |
31 class IOBufferWithSize; | 31 class IOBufferWithSize; |
32 } // namespace net | 32 } // namespace net |
33 | 33 |
34 namespace notifier { | 34 namespace notifier { |
35 | 35 |
36 class ChromeAsyncSocket : public buzz::AsyncSocket { | 36 class ChromeAsyncSocket : public buzz::AsyncSocket { |
37 public: | 37 public: |
38 // Takes ownership of |client_socket_factory| but not |cert_verifier| and | 38 // Takes ownership of |client_socket_factory| but not |cert_verifier| nor |
39 // |net_log|. |cert_verifier| may not be NULL. |net_log| may be NULL. | 39 // |net_log|. |cert_verifier| may not be NULL. |net_log| may be NULL. |
40 ChromeAsyncSocket(net::ClientSocketFactory* client_socket_factory, | 40 ChromeAsyncSocket(net::ClientSocketFactory* client_socket_factory, |
41 const net::SSLConfig& ssl_config, | 41 const net::SSLConfig& ssl_config, |
42 net::CertVerifier* cert_verifier, | 42 net::CertVerifier* cert_verifier, |
43 size_t read_buf_size, | 43 size_t read_buf_size, |
44 size_t write_buf_size, | 44 size_t write_buf_size, |
45 net::NetLog* net_log); | 45 net::NetLog* net_log); |
46 | 46 |
47 // Does not raise any signals. | 47 // Does not raise any signals. |
48 virtual ~ChromeAsyncSocket(); | 48 virtual ~ChromeAsyncSocket(); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 void DoClose(); | 182 void DoClose(); |
183 | 183 |
184 // Callbacks passed to |transport_socket_|. | 184 // Callbacks passed to |transport_socket_|. |
185 net::CompletionCallbackImpl<ChromeAsyncSocket> connect_callback_; | 185 net::CompletionCallbackImpl<ChromeAsyncSocket> connect_callback_; |
186 net::CompletionCallbackImpl<ChromeAsyncSocket> read_callback_; | 186 net::CompletionCallbackImpl<ChromeAsyncSocket> read_callback_; |
187 net::CompletionCallbackImpl<ChromeAsyncSocket> write_callback_; | 187 net::CompletionCallbackImpl<ChromeAsyncSocket> write_callback_; |
188 net::CompletionCallbackImpl<ChromeAsyncSocket> ssl_connect_callback_; | 188 net::CompletionCallbackImpl<ChromeAsyncSocket> ssl_connect_callback_; |
189 | 189 |
190 scoped_ptr<net::ClientSocketFactory> client_socket_factory_; | 190 scoped_ptr<net::ClientSocketFactory> client_socket_factory_; |
191 const net::SSLConfig ssl_config_; | 191 const net::SSLConfig ssl_config_; |
192 net::CertVerifier* cert_verifier_; | 192 net::CertVerifier* const cert_verifier_; |
193 net::BoundNetLog bound_net_log_; | 193 net::BoundNetLog bound_net_log_; |
194 | 194 |
195 // buzz::AsyncSocket state. | 195 // buzz::AsyncSocket state. |
196 buzz::AsyncSocket::State state_; | 196 buzz::AsyncSocket::State state_; |
197 buzz::AsyncSocket::Error error_; | 197 buzz::AsyncSocket::Error error_; |
198 net::Error net_error_; | 198 net::Error net_error_; |
199 | 199 |
200 // Used by read/write loops. | 200 // Used by read/write loops. |
201 ScopedRunnableMethodFactory<ChromeAsyncSocket> | 201 ScopedRunnableMethodFactory<ChromeAsyncSocket> |
202 scoped_runnable_method_factory_; | 202 scoped_runnable_method_factory_; |
(...skipping 16 matching lines...) Expand all Loading... |
219 AsyncIOState write_state_; | 219 AsyncIOState write_state_; |
220 scoped_refptr<net::IOBufferWithSize> write_buf_; | 220 scoped_refptr<net::IOBufferWithSize> write_buf_; |
221 size_t write_end_; | 221 size_t write_end_; |
222 | 222 |
223 DISALLOW_COPY_AND_ASSIGN(ChromeAsyncSocket); | 223 DISALLOW_COPY_AND_ASSIGN(ChromeAsyncSocket); |
224 }; | 224 }; |
225 | 225 |
226 } // namespace notifier | 226 } // namespace notifier |
227 | 227 |
228 #endif // JINGLE_NOTIFIER_BASE_CHROME_ASYNC_SOCKET_H_ | 228 #endif // JINGLE_NOTIFIER_BASE_CHROME_ASYNC_SOCKET_H_ |
OLD | NEW |