OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_NET_UTILITY_PROCESS_MOJO_PROXY_RESOLVER_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_NET_MOJO_APP_PROXY_RESOLVER_FACTORY_H_ |
6 #define CHROME_BROWSER_NET_UTILITY_PROCESS_MOJO_PROXY_RESOLVER_FACTORY_H_ | 6 #define CHROME_BROWSER_NET_MOJO_APP_PROXY_RESOLVER_FACTORY_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "net/interfaces/proxy_resolver_service.mojom.h" | 9 #include "net/interfaces/proxy_resolver_service.mojom.h" |
10 | 10 |
11 template <typename Type> | 11 template <typename Type> |
12 struct DefaultSingletonTraits; | 12 struct DefaultSingletonTraits; |
13 | 13 |
| 14 namespace content { |
| 15 class MojoShellProxy; |
| 16 } |
| 17 |
| 18 namespace mojo { |
| 19 class ApplicationConnection; |
| 20 } |
| 21 |
14 // A factory used to create connections to Mojo proxy resolver services run in a | 22 // 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 | 23 // Mojo application. |
16 // utility process. Utility process crashes are detected and the utility | 24 class MojoAppProxyResolverFactory |
17 // process is automatically restarted. | |
18 class UtilityProcessMojoProxyResolverFactory | |
19 : public net::interfaces::ProxyResolverFactory, | 25 : public net::interfaces::ProxyResolverFactory, |
20 public mojo::ErrorHandler { | 26 public mojo::ErrorHandler { |
21 public: | 27 public: |
22 static UtilityProcessMojoProxyResolverFactory* GetInstance(); | 28 static MojoAppProxyResolverFactory* GetInstance(); |
23 | 29 |
24 // Overridden from net::interfaces::ProxyResolverFactory: | 30 // Overridden from net::interfaces::ProxyResolverFactory: |
25 void CreateResolver( | 31 void CreateResolver( |
26 const mojo::String& pac_script, | 32 const mojo::String& pac_script, |
27 mojo::InterfaceRequest<net::interfaces::ProxyResolver> req, | 33 mojo::InterfaceRequest<net::interfaces::ProxyResolver> req, |
28 net::interfaces::HostResolverPtr host_resolver, | 34 net::interfaces::HostResolverPtr host_resolver, |
29 net::interfaces::ProxyResolverFactoryRequestClientPtr client) override; | 35 net::interfaces::ProxyResolverFactoryRequestClientPtr client) override; |
30 | 36 |
31 private: | 37 private: |
32 friend struct DefaultSingletonTraits<UtilityProcessMojoProxyResolverFactory>; | 38 friend struct DefaultSingletonTraits<MojoAppProxyResolverFactory>; |
33 UtilityProcessMojoProxyResolverFactory(); | 39 MojoAppProxyResolverFactory(); |
34 ~UtilityProcessMojoProxyResolverFactory() override; | 40 ~MojoAppProxyResolverFactory() override; |
35 | 41 |
36 // Overridden from mojo::ErrorHandler: | 42 // Overridden from mojo::ErrorHandler: |
37 void OnConnectionError() override; | 43 void OnConnectionError() override; |
38 | 44 |
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_; | 45 net::interfaces::ProxyResolverFactoryPtr resolver_factory_; |
44 | 46 |
45 DISALLOW_COPY_AND_ASSIGN(UtilityProcessMojoProxyResolverFactory); | 47 DISALLOW_COPY_AND_ASSIGN(MojoAppProxyResolverFactory); |
46 }; | 48 }; |
47 | 49 |
48 #endif // CHROME_BROWSER_NET_UTILITY_PROCESS_MOJO_PROXY_RESOLVER_FACTORY_H_ | 50 #endif // CHROME_BROWSER_NET_MOJO_APP_PROXY_RESOLVER_FACTORY_H_ |
OLD | NEW |