forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathurl_request_context_builder_mojo.h
65 lines (51 loc) · 2.26 KB
/
url_request_context_builder_mojo.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_MOJO_H_
#define NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_MOJO_H_
#include <memory>
#include "base/macros.h"
#include "build/build_config.h"
#include "net/proxy/dhcp_proxy_script_fetcher_factory.h"
#include "net/url_request/url_request_context_builder.h"
namespace net {
class HostResolver;
class NetLog;
class NetworkDelegate;
class MojoProxyResolverFactory;
class ProxyService;
class URLRequestContext;
// Specialization of URLRequestContextBuilder that can create a ProxyService
// that uses a Mojo ProxyResolver. The consumer is responsible for providing
// the MojoProxyResolverFactory. If a PoxyService is set directly via the
// URLRequestContextBuilder API, it will be used instead.
class URLRequestContextBuilderMojo : public URLRequestContextBuilder {
public:
URLRequestContextBuilderMojo();
~URLRequestContextBuilderMojo() override;
// Overrides default DhcpProxyScriptFetcherFactory. Ignored if no
// MojoProxyResolverFactory is provided.
void set_dhcp_fetcher_factory(
std::unique_ptr<DhcpProxyScriptFetcherFactory> dhcp_fetcher_factory) {
dhcp_fetcher_factory_ = std::move(dhcp_fetcher_factory);
}
// Sets Mojo factory used to create ProxyResolvers. If not set, falls back to
// URLRequestContext's default behavior. The passed in factory must outlive
// the URLRequestContext the builder creates.
void set_mojo_proxy_resolver_factory(
MojoProxyResolverFactory* mojo_proxy_resolver_factory) {
mojo_proxy_resolver_factory_ = mojo_proxy_resolver_factory;
}
private:
std::unique_ptr<ProxyService> CreateProxyService(
std::unique_ptr<ProxyConfigService> proxy_config_service,
URLRequestContext* url_request_context,
HostResolver* host_resolver,
NetworkDelegate* network_delegate,
NetLog* net_log) override;
std::unique_ptr<DhcpProxyScriptFetcherFactory> dhcp_fetcher_factory_;
MojoProxyResolverFactory* mojo_proxy_resolver_factory_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilderMojo);
};
} // namespace net
#endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_MOJO_H_