Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Side by Side Diff: jingle/notifier/base/proxy_resolving_client_socket.h

Issue 6833031: Changed the jingle network code in ChromeAsyncSocket to use the client socket pool. This also all... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Review comments Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(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 // TODO(sanjeevr): Move this to net/
30 namespace notifier {
31
32 class ProxyResolvingClientSocket : public net::ClientSocket {
33 public:
34 ProxyResolvingClientSocket(
35 const scoped_refptr<net::URLRequestContextGetter>&
36 request_context_getter,
37 const net::SSLConfig& ssl_config,
38 const net::HostPortPair& dest_host_port_pair,
39 net::NetLog* net_log);
40 virtual ~ProxyResolvingClientSocket();
41
42 // net::ClientSocket implementation.
43 virtual int Read(net::IOBuffer* buf, int buf_len,
44 net::CompletionCallback* callback) OVERRIDE;
45 virtual int Write(net::IOBuffer* buf, int buf_len,
46 net::CompletionCallback* callback) OVERRIDE;
47 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE;
48 virtual bool SetSendBufferSize(int32 size) OVERRIDE;
49 virtual int Connect(net::CompletionCallback* callback) OVERRIDE;
50 virtual void Disconnect() OVERRIDE;
51 virtual bool IsConnected() const OVERRIDE;
52 virtual bool IsConnectedAndIdle() const OVERRIDE;
53 virtual int GetPeerAddress(net::AddressList* address) const OVERRIDE;
54 virtual const net::BoundNetLog& NetLog() const OVERRIDE;
55 virtual void SetSubresourceSpeculation() OVERRIDE;
56 virtual void SetOmniboxSpeculation() OVERRIDE;
57 virtual bool WasEverUsed() const OVERRIDE;
58 virtual bool UsingTCPFastOpen() const OVERRIDE;
59
60 private:
61 // Proxy resolution and connection functions.
62 void ProcessProxyResolveDone(int status);
63 void ProcessConnectDone(int status);
64
65 void CloseTransportSocket();
66 void RunUserConnectCallback(int status);
67 int ReconsiderProxyAfterError(int error);
68
69 // Callbacks passed to net APIs.
70 net::CompletionCallbackImpl<ProxyResolvingClientSocket>
71 proxy_resolve_callback_;
72 net::CompletionCallbackImpl<ProxyResolvingClientSocket> connect_callback_;
73
74 scoped_refptr<net::HttpNetworkSession> network_session_;
75
76 // The transport socket.
77 scoped_ptr<net::ClientSocketHandle> transport_;
78
79 const net::SSLConfig ssl_config_;
80 net::ProxyService::PacRequest* pac_request_;
81 net::ProxyInfo proxy_info_;
82 net::HostPortPair dest_host_port_pair_;
83 bool tried_direct_connect_fallback_;
84 net::BoundNetLog bound_net_log_;
85 ScopedRunnableMethodFactory<ProxyResolvingClientSocket>
86 scoped_runnable_method_factory_;
87
88 // The callback passed to Connect().
89 net::CompletionCallback* user_connect_callback_;
90 };
91
92 } // namespace notifier
93
94 #endif // JINGLE_NOTIFIER_BASE_PROXY_RESOLVING_CLIENT_SOCKET_H_
OLDNEW
« no previous file with comments | « jingle/notifier/base/chrome_async_socket_unittest.cc ('k') | jingle/notifier/base/proxy_resolving_client_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698