OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef CHROME_BROWSER_NET_UTILITY_PROCESS_MOJO_PROXY_RESOLVER_FACTORY_H_ | |
6 #define CHROME_BROWSER_NET_UTILITY_PROCESS_MOJO_PROXY_RESOLVER_FACTORY_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "net/interfaces/proxy_resolver_service.mojom.h" | |
10 | |
11 template <typename Type> | |
12 struct DefaultSingletonTraits; | |
13 | |
14 // A factory used to create connections to Mojo proxy resolver services run in a | |
15 // utility process. All Mojo proxy resolver services will be run in the same | |
16 // utility process. Utility process crashes are detected and the utility | |
17 // process is automatically restarted. | |
18 class UtilityProcessMojoProxyResolverFactory | |
19 : public net::interfaces::ProxyResolverFactory, | |
20 public mojo::ErrorHandler { | |
21 public: | |
22 static UtilityProcessMojoProxyResolverFactory* GetInstance(); | |
23 | |
24 // Overridden from net::interfaces::ProxyResolverFactory: | |
25 void CreateResolver( | |
26 const mojo::String& pac_script, | |
27 mojo::InterfaceRequest<net::interfaces::ProxyResolver> req, | |
28 net::interfaces::HostResolverPtr host_resolver, | |
29 net::interfaces::ProxyResolverFactoryRequestClientPtr client) override; | |
30 | |
31 private: | |
32 friend struct DefaultSingletonTraits<UtilityProcessMojoProxyResolverFactory>; | |
33 UtilityProcessMojoProxyResolverFactory(); | |
34 ~UtilityProcessMojoProxyResolverFactory() override; | |
35 | |
36 // Overridden from mojo::ErrorHandler: | |
37 void OnConnectionError() override; | |
38 | |
39 // Creates a new utility process and connects to its Mojo proxy resolver | |
40 // factory. | |
41 void CreateProcessAndConnect(); | |
42 | |
43 net::interfaces::ProxyResolverFactoryPtr resolver_factory_; | |
44 | |
45 DISALLOW_COPY_AND_ASSIGN(UtilityProcessMojoProxyResolverFactory); | |
46 }; | |
47 | |
48 #endif // CHROME_BROWSER_NET_UTILITY_PROCESS_MOJO_PROXY_RESOLVER_FACTORY_H_ | |
OLD | NEW |