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

Side by Side Diff: net/proxy/proxy_resolver.h

Issue 1439053002: Change ProxyResolver::GetProxyForURL() to take a scoped_ptr<Request>* rather than a RequestHandle* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
OLDNEW
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 #ifndef NET_PROXY_PROXY_RESOLVER_H_ 5 #ifndef NET_PROXY_PROXY_RESOLVER_H_
6 #define NET_PROXY_PROXY_RESOLVER_H_ 6 #define NET_PROXY_PROXY_RESOLVER_H_
7 7
8 #include "base/callback_forward.h" 8 #include "base/callback_forward.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
12 #include "net/base/completion_callback.h" 12 #include "net/base/completion_callback.h"
13 #include "net/base/load_states.h" 13 #include "net/base/load_states.h"
14 #include "net/base/net_export.h" 14 #include "net/base/net_export.h"
15 #include "net/proxy/proxy_resolver_script_data.h" 15 #include "net/proxy/proxy_resolver_script_data.h"
16 #include "url/gurl.h" 16 #include "url/gurl.h"
17 17
18 namespace net { 18 namespace net {
19 19
20 class BoundNetLog; 20 class BoundNetLog;
21 class ProxyInfo; 21 class ProxyInfo;
22 22
23 // Interface for "proxy resolvers". A ProxyResolver fills in a list of proxies 23 // Interface for "proxy resolvers". A ProxyResolver fills in a list of proxies
24 // to use for a particular URL. Generally the backend for a ProxyResolver is 24 // to use for a particular URL. Generally the backend for a ProxyResolver is
25 // a PAC script, but it doesn't need to be. ProxyResolver can service multiple 25 // a PAC script, but it doesn't need to be. ProxyResolver can service multiple
26 // requests at a time. 26 // requests at a time.
27 class NET_EXPORT_PRIVATE ProxyResolver { 27 class NET_EXPORT_PRIVATE ProxyResolver {
28 public: 28 public:
29 // Opaque pointer type, to return a handle to cancel outstanding requests. 29 class Request {
30 typedef void* RequestHandle; 30 public:
31 virtual ~Request() {} // <---- Cancels the request
32 virtual LoadState GetLoadState() = 0;
33 };
31 34
32 ProxyResolver() {} 35 ProxyResolver() {}
33 36
34 virtual ~ProxyResolver() {} 37 virtual ~ProxyResolver() {}
35 38
36 // Gets a list of proxy servers to use for |url|. If the request will 39 // Gets a list of proxy servers to use for |url|. If the request will
37 // complete asynchronously returns ERR_IO_PENDING and notifies the result 40 // complete asynchronously returns ERR_IO_PENDING and notifies the result
38 // by running |callback|. If the result code is OK then 41 // by running |callback|. If the result code is OK then
39 // the request was successful and |results| contains the proxy 42 // the request was successful and |results| contains the proxy
40 // resolution information. In the case of asynchronous completion 43 // resolution information. In the case of asynchronous completion
41 // |*request| is written to, and can be passed to CancelRequest(). 44 // |*request| is written to, and can be passed to CancelRequest().
eroman 2015/11/24 01:20:59 Please update this comment.
42 virtual int GetProxyForURL(const GURL& url, 45 virtual int GetProxyForURL(const GURL& url,
43 ProxyInfo* results, 46 ProxyInfo* results,
44 const CompletionCallback& callback, 47 const CompletionCallback& callback,
45 RequestHandle* request, 48 scoped_ptr<Request>* request,
46 const BoundNetLog& net_log) = 0; 49 const BoundNetLog& net_log) = 0;
47 50
48 // Cancels |request|.
49 virtual void CancelRequest(RequestHandle request) = 0;
50
51 // Gets the LoadState for |request|.
52 virtual LoadState GetLoadState(RequestHandle request) const = 0;
53
54 private: 51 private:
55 DISALLOW_COPY_AND_ASSIGN(ProxyResolver); 52 DISALLOW_COPY_AND_ASSIGN(ProxyResolver);
56 }; 53 };
57 54
58 } // namespace net 55 } // namespace net
59 56
60 #endif // NET_PROXY_PROXY_RESOLVER_H_ 57 #endif // NET_PROXY_PROXY_RESOLVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698