Switch some page set from user_agent fields to coresponding shared_state classes
[chromium-blink-merge.git] / net / proxy / proxy_resolver_factory.h
blob282dd24a7e8a018d2667eb3cf321dce06d07b9db
1 // Copyright 2015 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.
5 #ifndef NET_PROXY_PROXY_RESOLVER_FACTORY_H_
6 #define NET_PROXY_PROXY_RESOLVER_FACTORY_H_
8 #include <set>
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "net/base/completion_callback.h"
13 #include "net/base/net_export.h"
14 #include "net/proxy/proxy_resolver_script_data.h"
16 namespace net {
18 class ProxyResolver;
20 // ProxyResolverFactory is an interface for creating ProxyResolver instances.
21 class NET_EXPORT ProxyResolverFactory {
22 public:
23 // A handle to a request. Deleting it will cancel the request.
24 class Request {
25 public:
26 virtual ~Request() {}
29 // See |expects_pac_bytes()| for the meaning of |expects_pac_bytes|.
30 explicit ProxyResolverFactory(bool expects_pac_bytes);
32 virtual ~ProxyResolverFactory();
34 // Creates a new ProxyResolver. If the request will complete asynchronously,
35 // it returns ERR_IO_PENDING and notifies the result by running |callback|.
36 // If the result is OK, then |resolver| contains the ProxyResolver. In the
37 // case of asynchronous completion |*request| is written to, and can be
38 // deleted to cancel the request. All requests in progress are cancelled if
39 // the ProxyResolverFactory is deleted.
40 virtual int CreateProxyResolver(
41 const scoped_refptr<ProxyResolverScriptData>& pac_script,
42 scoped_ptr<ProxyResolver>* resolver,
43 const net::CompletionCallback& callback,
44 scoped_ptr<Request>* request) = 0;
46 // The PAC script backend can be specified to the ProxyResolverFactory either
47 // via URL, or via the javascript text itself. If |expects_pac_bytes| is true,
48 // then the ProxyResolverScriptData passed to CreateProxyResolver() should
49 // contain the actual script bytes rather than just the URL.
50 bool expects_pac_bytes() const { return expects_pac_bytes_; }
52 private:
53 bool expects_pac_bytes_;
55 DISALLOW_COPY_AND_ASSIGN(ProxyResolverFactory);
58 } // namespace net
60 #endif // NET_PROXY_PROXY_RESOLVER_FACTORY_H_