Chromium Code Reviews
|
| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 // | |
| 5 // This ClientSocket implementation wraps a ClientSocketHandle that is created | |
| 6 // from the client socket pool after resolving proxies. | |
| 7 | |
| 8 #ifndef JINGLE_NOTIFIER_BASE_PROXY_RESOLVING_CLIENT_SOCKET_H_ | |
| 9 #define JINGLE_NOTIFIER_BASE_PROXY_RESOLVING_CLIENT_SOCKET_H_ | |
| 10 #pragma once | |
| 11 | |
| 12 #include "base/basictypes.h" | |
| 13 #include "base/memory/ref_counted.h" | |
| 14 #include "net/base/completion_callback.h" | |
| 15 #include "net/base/host_port_pair.h" | |
| 16 #include "net/base/net_errors.h" | |
| 17 #include "net/base/net_log.h" | |
| 18 #include "net/base/ssl_config_service.h" | |
| 19 #include "net/proxy/proxy_info.h" | |
| 20 #include "net/proxy/proxy_service.h" | |
| 21 #include "net/socket/client_socket.h" | |
| 22 | |
| 23 namespace net { | |
| 24 class ClientSocketHandle; | |
| 25 class HttpNetworkSession; | |
| 26 class URLRequestContextGetter; | |
| 27 } // namespace net | |
| 28 | |
| 29 namespace notifier { | |
| 30 | |
|
akalin
2011/04/14 21:54:50
Add TODO to move this to net/
sanjeevr
2011/04/14 23:15:43
Done.
| |
| 31 class ProxyResolvingClientSocket : public net::ClientSocket { | |
| 32 public: | |
| 33 ProxyResolvingClientSocket( | |
| 34 const scoped_refptr<net::URLRequestContextGetter>& | |
| 35 request_context_getter, | |
| 36 const net::SSLConfig& ssl_config, | |
| 37 const net::HostPortPair& dest_host_port_pair, | |
| 38 net::NetLog* net_log); | |
| 39 virtual ~ProxyResolvingClientSocket(); | |
| 40 | |
| 41 // net::ClientSocket implementation. | |
| 42 virtual int Read(net::IOBuffer* buf, int buf_len, | |
|
akalin
2011/04/14 21:54:50
Add OVERRIDE to overridden methods
sanjeevr
2011/04/14 23:15:43
Done.
| |
| 43 net::CompletionCallback* callback); | |
| 44 virtual int Write(net::IOBuffer* buf, int buf_len, | |
| 45 net::CompletionCallback* callback); | |
| 46 virtual bool SetReceiveBufferSize(int32 size); | |
| 47 virtual bool SetSendBufferSize(int32 size); | |
| 48 virtual int Connect(net::CompletionCallback* callback); | |
| 49 virtual void Disconnect(); | |
| 50 virtual bool IsConnected() const; | |
| 51 virtual bool IsConnectedAndIdle() const; | |
| 52 virtual int GetPeerAddress(net::AddressList* address) const; | |
| 53 virtual const net::BoundNetLog& NetLog() const; | |
| 54 virtual void SetSubresourceSpeculation(); | |
| 55 virtual void SetOmniboxSpeculation(); | |
| 56 virtual bool WasEverUsed() const; | |
| 57 virtual bool UsingTCPFastOpen() const; | |
| 58 | |
| 59 private: | |
| 60 // Proxy resolution and connection functions. | |
| 61 void ProcessProxyResolveDone(int status); | |
| 62 void ProcessConnectDone(int status); | |
| 63 | |
| 64 void CloseTransportSocket(); | |
| 65 void RunUserConnectCallback(int status); | |
| 66 int ReconsiderProxyAfterError(int error); | |
| 67 | |
| 68 // Callbacks passed to net APIs. | |
| 69 net::CompletionCallbackImpl<ProxyResolvingClientSocket> | |
| 70 proxy_resolve_callback_; | |
| 71 net::CompletionCallbackImpl<ProxyResolvingClientSocket> connect_callback_; | |
| 72 | |
| 73 scoped_refptr<net::HttpNetworkSession> network_session_; | |
| 74 | |
| 75 // The transport socket. | |
| 76 const net::SSLConfig ssl_config_; | |
| 77 scoped_ptr<net::ClientSocketHandle> transport_; | |
| 78 net::ProxyService::PacRequest* pac_request_; | |
| 79 net::ProxyInfo proxy_info_; | |
| 80 net::HostPortPair dest_host_port_pair_; | |
| 81 bool tried_direct_connect_fallback_; | |
| 82 net::BoundNetLog bound_net_log_; | |
| 83 ScopedRunnableMethodFactory<ProxyResolvingClientSocket> | |
| 84 scoped_runnable_method_factory_; | |
| 85 | |
| 86 // The callback passed to Connect(). | |
| 87 net::CompletionCallback* user_connect_callback_; | |
| 88 }; | |
| 89 | |
| 90 } // namespace notifier | |
| 91 | |
| 92 #endif // JINGLE_NOTIFIER_BASE_PROXY_RESOLVING_CLIENT_SOCKET_H_ | |
| OLD | NEW |