| 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/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "net/base/completion_callback.h" | 16 #include "net/base/completion_callback.h" |
| 17 #include "net/base/host_port_pair.h" | 17 #include "net/base/host_port_pair.h" |
| 18 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
| 19 #include "net/base/net_log.h" | 19 #include "net/base/net_log.h" |
| 20 #include "net/base/ssl_config_service.h" | 20 #include "net/base/ssl_config_service.h" |
| 21 #include "net/proxy/proxy_info.h" | 21 #include "net/proxy/proxy_info.h" |
| 22 #include "net/proxy/proxy_service.h" | 22 #include "net/proxy/proxy_service.h" |
| 23 #include "net/socket/stream_socket.h" | 23 #include "net/socket/stream_socket.h" |
| 24 | 24 |
| 25 namespace net { | 25 namespace net { |
| 26 class ClientSocketFactory; | 26 class ClientSocketFactory; |
| 27 class ClientSocketHandle; | 27 class ClientSocketHandle; |
| 28 class HttpResponseInfo; |
| 29 class HttpAuthController; |
| 28 class HttpNetworkSession; | 30 class HttpNetworkSession; |
| 29 class URLRequestContextGetter; | 31 class URLRequestContextGetter; |
| 30 } // namespace net | 32 } // namespace net |
| 31 | 33 |
| 32 // TODO(sanjeevr): Move this to net/ | 34 // TODO(sanjeevr): Move this to net/ |
| 33 namespace notifier { | 35 namespace notifier { |
| 34 | 36 |
| 35 class ProxyResolvingClientSocket : public net::StreamSocket { | 37 class ProxyResolvingClientSocket : public net::StreamSocket { |
| 36 public: | 38 public: |
| 37 // Constructs a new ProxyResolvingClientSocket. |socket_factory| is the | 39 // Constructs a new ProxyResolvingClientSocket. |socket_factory| is the |
| (...skipping 26 matching lines...) Expand all Loading... |
| 64 virtual bool WasEverUsed() const OVERRIDE; | 66 virtual bool WasEverUsed() const OVERRIDE; |
| 65 virtual bool UsingTCPFastOpen() const OVERRIDE; | 67 virtual bool UsingTCPFastOpen() const OVERRIDE; |
| 66 virtual int64 NumBytesRead() const OVERRIDE; | 68 virtual int64 NumBytesRead() const OVERRIDE; |
| 67 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; | 69 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; |
| 68 | 70 |
| 69 private: | 71 private: |
| 70 // Proxy resolution and connection functions. | 72 // Proxy resolution and connection functions. |
| 71 void ProcessProxyResolveDone(int status); | 73 void ProcessProxyResolveDone(int status); |
| 72 void ProcessConnectDone(int status); | 74 void ProcessConnectDone(int status); |
| 73 | 75 |
| 76 void OnNeedsProxyTunnelAuthCallback( |
| 77 const net::HttpResponseInfo& response_info, |
| 78 net::HttpAuthController* auth_controller, |
| 79 net::CompletionCallback callback); |
| 80 |
| 74 void CloseTransportSocket(); | 81 void CloseTransportSocket(); |
| 75 void RunUserConnectCallback(int status); | 82 void RunUserConnectCallback(int status); |
| 76 int ReconsiderProxyAfterError(int error); | 83 int ReconsiderProxyAfterError(int error); |
| 77 void ReportSuccessfulProxyConnection(); | 84 void ReportSuccessfulProxyConnection(); |
| 78 | 85 |
| 79 // Callbacks passed to net APIs. | 86 // Callbacks passed to net APIs. |
| 80 net::CompletionCallback proxy_resolve_callback_; | 87 net::CompletionCallback proxy_resolve_callback_; |
| 81 net::CompletionCallback connect_callback_; | 88 net::CompletionCallback connect_callback_; |
| 82 | 89 |
| 83 scoped_refptr<net::HttpNetworkSession> network_session_; | 90 scoped_refptr<net::HttpNetworkSession> network_session_; |
| 84 | 91 |
| 85 // The transport socket. | 92 // The transport socket. |
| 86 scoped_ptr<net::ClientSocketHandle> transport_; | 93 scoped_ptr<net::ClientSocketHandle> transport_; |
| 87 | 94 |
| 88 const net::SSLConfig ssl_config_; | 95 const net::SSLConfig ssl_config_; |
| 89 net::ProxyService::PacRequest* pac_request_; | 96 net::ProxyService::PacRequest* pac_request_; |
| 90 net::ProxyInfo proxy_info_; | 97 net::ProxyInfo proxy_info_; |
| 91 net::HostPortPair dest_host_port_pair_; | 98 net::HostPortPair dest_host_port_pair_; |
| 92 bool tried_direct_connect_fallback_; | 99 bool tried_direct_connect_fallback_; |
| 93 net::BoundNetLog bound_net_log_; | 100 net::BoundNetLog bound_net_log_; |
| 94 base::WeakPtrFactory<ProxyResolvingClientSocket> weak_factory_; | 101 base::WeakPtrFactory<ProxyResolvingClientSocket> weak_factory_; |
| 95 | 102 |
| 96 // The callback passed to Connect(). | 103 // The callback passed to Connect(). |
| 97 net::CompletionCallback user_connect_callback_; | 104 net::CompletionCallback user_connect_callback_; |
| 98 }; | 105 }; |
| 99 | 106 |
| 100 } // namespace notifier | 107 } // namespace notifier |
| 101 | 108 |
| 102 #endif // JINGLE_NOTIFIER_BASE_PROXY_RESOLVING_CLIENT_SOCKET_H_ | 109 #endif // JINGLE_NOTIFIER_BASE_PROXY_RESOLVING_CLIENT_SOCKET_H_ |
| OLD | NEW |