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