Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / net / proxy / proxy_resolver_v8_tracing_wrapper.h
blob28343d807363b7b1c925ad6d724d339641e04b6e
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_V8_TRACING_WRAPPER_H_
6 #define NET_PROXY_PROXY_RESOLVER_V8_TRACING_WRAPPER_H_
8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "net/base/net_export.h"
12 #include "net/proxy/proxy_resolver.h"
13 #include "net/proxy/proxy_resolver_factory.h"
14 #include "net/proxy/proxy_resolver_v8_tracing.h"
16 namespace net {
18 class HostResolver;
19 class NetLog;
20 class ProxyResolverErrorObserver;
22 // A wrapper for ProxyResolverV8TracingFactory that implements the
23 // ProxyResolverFactory interface.
24 class NET_EXPORT ProxyResolverFactoryV8TracingWrapper
25 : public ProxyResolverFactory {
26 public:
27 // Note that |host_resolver| and |net_log| are expected to outlive |this| and
28 // any ProxyResolver instances created using |this|. |error_observer_factory|
29 // will be invoked once per CreateProxyResolver() call to create a
30 // ProxyResolverErrorObserver to be used by the ProxyResolver instance
31 // returned by that call.
32 ProxyResolverFactoryV8TracingWrapper(
33 HostResolver* host_resolver,
34 NetLog* net_log,
35 const base::Callback<scoped_ptr<ProxyResolverErrorObserver>()>&
36 error_observer_factory);
37 ~ProxyResolverFactoryV8TracingWrapper() override;
39 // ProxyResolverFactory override.
40 int CreateProxyResolver(
41 const scoped_refptr<ProxyResolverScriptData>& pac_script,
42 scoped_ptr<ProxyResolver>* resolver,
43 const CompletionCallback& callback,
44 scoped_ptr<Request>* request) override;
46 private:
47 void OnProxyResolverCreated(
48 scoped_ptr<scoped_ptr<ProxyResolverV8Tracing>> v8_resolver,
49 scoped_ptr<ProxyResolver>* resolver,
50 const CompletionCallback& callback,
51 scoped_ptr<ProxyResolverErrorObserver> error_observer,
52 int error);
54 scoped_ptr<ProxyResolverV8TracingFactory> factory_impl_;
55 HostResolver* const host_resolver_;
56 NetLog* const net_log_;
57 const base::Callback<scoped_ptr<ProxyResolverErrorObserver>()>
58 error_observer_factory_;
60 DISALLOW_COPY_AND_ASSIGN(ProxyResolverFactoryV8TracingWrapper);
63 } // namespace net
65 #endif // NET_PROXY_PROXY_RESOLVER_V8_TRACING_WRAPPER_H_