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 // This StreamSocket implementation wraps a ClientSocketHandle that is created | 5 // This StreamSocket implementation wraps a ClientSocketHandle that is created |
6 // from the client socket pool after resolving proxies. | 6 // from the client socket pool after resolving proxies. |
7 | 7 |
8 #ifndef JINGLE_NOTIFIER_BASE_PROXY_RESOLVING_CLIENT_SOCKET_H_ | 8 #ifndef JINGLE_NOTIFIER_BASE_PROXY_RESOLVING_CLIENT_SOCKET_H_ |
9 #define JINGLE_NOTIFIER_BASE_PROXY_RESOLVING_CLIENT_SOCKET_H_ | 9 #define JINGLE_NOTIFIER_BASE_PROXY_RESOLVING_CLIENT_SOCKET_H_ |
10 #pragma once | 10 #pragma once |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "net/base/completion_callback.h" | 14 #include "net/base/completion_callback.h" |
15 #include "net/base/host_port_pair.h" | 15 #include "net/base/host_port_pair.h" |
16 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
17 #include "net/base/net_log.h" | 17 #include "net/base/net_log.h" |
18 #include "net/base/ssl_config_service.h" | 18 #include "net/base/ssl_config_service.h" |
19 #include "net/proxy/proxy_info.h" | 19 #include "net/proxy/proxy_info.h" |
20 #include "net/proxy/proxy_service.h" | 20 #include "net/proxy/proxy_service.h" |
21 #include "net/socket/stream_socket.h" | 21 #include "net/socket/stream_socket.h" |
22 | 22 |
23 namespace net { | 23 namespace net { |
| 24 class ClientSocketFactory; |
24 class ClientSocketHandle; | 25 class ClientSocketHandle; |
25 class HttpNetworkSession; | 26 class HttpNetworkSession; |
26 class URLRequestContextGetter; | 27 class URLRequestContextGetter; |
27 } // namespace net | 28 } // namespace net |
28 | 29 |
29 // TODO(sanjeevr): Move this to net/ | 30 // TODO(sanjeevr): Move this to net/ |
30 namespace notifier { | 31 namespace notifier { |
31 | 32 |
32 class ProxyResolvingClientSocket : public net::StreamSocket { | 33 class ProxyResolvingClientSocket : public net::StreamSocket { |
33 public: | 34 public: |
| 35 // Constructs a new ProxyResolvingClientSocket. |socket_factory| is the |
| 36 // ClientSocketFactory that will be used by the underlying HttpNetworkSession. |
| 37 // If |socket_factory| is NULL, the default socket factory |
| 38 // (net::ClientSocketFactory::GetDefaultFactory()) will be used. |
34 ProxyResolvingClientSocket( | 39 ProxyResolvingClientSocket( |
35 const scoped_refptr<net::URLRequestContextGetter>& | 40 net::ClientSocketFactory* socket_factory, |
36 request_context_getter, | 41 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, |
37 const net::SSLConfig& ssl_config, | 42 const net::SSLConfig& ssl_config, |
38 const net::HostPortPair& dest_host_port_pair); | 43 const net::HostPortPair& dest_host_port_pair); |
39 virtual ~ProxyResolvingClientSocket(); | 44 virtual ~ProxyResolvingClientSocket(); |
40 | 45 |
41 // net::StreamSocket implementation. | 46 // net::StreamSocket implementation. |
42 virtual int Read(net::IOBuffer* buf, int buf_len, | 47 virtual int Read(net::IOBuffer* buf, int buf_len, |
43 net::CompletionCallback* callback) OVERRIDE; | 48 net::CompletionCallback* callback) OVERRIDE; |
44 virtual int Write(net::IOBuffer* buf, int buf_len, | 49 virtual int Write(net::IOBuffer* buf, int buf_len, |
45 net::CompletionCallback* callback) OVERRIDE; | 50 net::CompletionCallback* callback) OVERRIDE; |
46 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; | 51 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; |
47 virtual bool SetSendBufferSize(int32 size) OVERRIDE; | 52 virtual bool SetSendBufferSize(int32 size) OVERRIDE; |
48 virtual int Connect(net::CompletionCallback* callback) OVERRIDE; | 53 virtual int Connect(net::CompletionCallback* callback) OVERRIDE; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 ScopedRunnableMethodFactory<ProxyResolvingClientSocket> | 93 ScopedRunnableMethodFactory<ProxyResolvingClientSocket> |
89 scoped_runnable_method_factory_; | 94 scoped_runnable_method_factory_; |
90 | 95 |
91 // The callback passed to Connect(). | 96 // The callback passed to Connect(). |
92 net::CompletionCallback* user_connect_callback_; | 97 net::CompletionCallback* user_connect_callback_; |
93 }; | 98 }; |
94 | 99 |
95 } // namespace notifier | 100 } // namespace notifier |
96 | 101 |
97 #endif // JINGLE_NOTIFIER_BASE_PROXY_RESOLVING_CLIENT_SOCKET_H_ | 102 #endif // JINGLE_NOTIFIER_BASE_PROXY_RESOLVING_CLIENT_SOCKET_H_ |
OLD | NEW |