Rename InputLatency::ScrollUpdate to Latency::ScrollUpdate
[chromium-blink-merge.git] / net / proxy / proxy_resolver_factory.h
blob67a591c02acab2a5f8bdcd3f1d6a352bcc3aa45c
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 "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "net/base/completion_callback.h"
11 #include "net/base/net_export.h"
12 #include "net/proxy/proxy_resolver_script_data.h"
14 namespace net {
16 class ProxyResolver;
18 // ProxyResolverFactory is an interface for creating ProxyResolver instances.
19 class NET_EXPORT ProxyResolverFactory {
20 public:
21 // A handle to a request. Deleting it will cancel the request.
22 class Request {
23 public:
24 virtual ~Request() {}
27 // See |expects_pac_bytes()| for the meaning of |expects_pac_bytes|.
28 explicit ProxyResolverFactory(bool expects_pac_bytes);
30 virtual ~ProxyResolverFactory();
32 // Creates a new ProxyResolver. If the request will complete asynchronously,
33 // it returns ERR_IO_PENDING and notifies the result by running |callback|.
34 // If the result is OK, then |resolver| contains the ProxyResolver. In the
35 // case of asynchronous completion |*request| is written to, and can be
36 // deleted to cancel the request.
37 virtual int CreateProxyResolver(
38 const scoped_refptr<ProxyResolverScriptData>& pac_script,
39 scoped_ptr<ProxyResolver>* resolver,
40 const net::CompletionCallback& callback,
41 scoped_ptr<Request>* request) = 0;
43 // The PAC script backend can be specified to the ProxyResolverFactory either
44 // via URL, or via the javascript text itself. If |expects_pac_bytes| is true,
45 // then the ProxyResolverScriptData passed to CreateProxyResolver() should
46 // contain the actual script bytes rather than just the URL.
47 bool expects_pac_bytes() const { return expects_pac_bytes_; }
49 private:
50 bool expects_pac_bytes_;
52 DISALLOW_COPY_AND_ASSIGN(ProxyResolverFactory);
55 class NET_EXPORT LegacyProxyResolverFactory : public ProxyResolverFactory {
56 public:
57 explicit LegacyProxyResolverFactory(bool expects_pac_bytes);
59 ~LegacyProxyResolverFactory() override;
61 int CreateProxyResolver(
62 const scoped_refptr<ProxyResolverScriptData>& pac_script,
63 scoped_ptr<ProxyResolver>* resolver,
64 const net::CompletionCallback& callback,
65 scoped_ptr<Request>* request) override;
67 virtual scoped_ptr<ProxyResolver> CreateProxyResolver() = 0;
70 } // namespace net
72 #endif // NET_PROXY_PROXY_RESOLVER_FACTORY_H_