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 // Put Mojo definitions into their own namespace to avoid collisions with C++ | 5 // Put Mojo definitions into their own namespace to avoid collisions with C++ |
6 // definitions. | 6 // definitions. |
7 // TODO(amistry): Resolve the conflict between these two sets of definitions. | 7 // TODO(amistry): Resolve the conflict between these two sets of definitions. |
8 module net.interfaces; | 8 module net.interfaces; |
9 | 9 |
10 import "host_resolver_service.mojom"; | 10 import "host_resolver_service.mojom"; |
11 import "url/mojo/url.mojom"; | 11 import "url/mojo/url.mojom"; |
12 | 12 |
13 // Mirror of net::ProxyServer::Scheme. | 13 // Mirror of net::ProxyServer::Scheme. |
14 enum ProxyScheme { | 14 enum ProxyScheme { |
15 INVALID, | 15 INVALID, |
16 DIRECT, | 16 DIRECT, |
17 HTTP, | 17 HTTP, |
18 SOCKS4, | 18 SOCKS4, |
19 SOCKS5, | 19 SOCKS5, |
20 HTTPS, | 20 HTTPS, |
21 QUIC, | 21 QUIC, |
22 }; | 22 }; |
23 | 23 |
24 // Mirror of net::ProxyServer. | 24 // Mirror of net::ProxyServer. |
25 struct ProxyServer { | 25 struct ProxyServer { |
26 ProxyScheme scheme; | 26 ProxyScheme scheme; |
27 | 27 |
28 // |host| and |port| are only valid if |scheme| is not INVALID or DIRECT. | 28 // |host| and |port| are only valid if |scheme| is not INVALID or DIRECT. |
29 string? host; | 29 string host; |
30 uint16 port; | 30 uint16 port; |
31 }; | 31 }; |
32 | 32 |
| 33 struct ProxyInfo { |
| 34 array<ProxyServer> proxy_servers; |
| 35 }; |
| 36 |
33 interface ProxyResolver { | 37 interface ProxyResolver { |
34 // Use a ProxyResolverRequestClient instead of returning a result so we can | 38 // Use a ProxyResolverRequestClient instead of returning a result so we can |
35 // cancel in-flight requests by destroying the client. | 39 // cancel in-flight requests by destroying the client. |
36 GetProxyForUrl(url.mojom.Url url, ProxyResolverRequestClient client); | 40 GetProxyForUrl(url.mojom.Url url, ProxyResolverRequestClient client); |
37 }; | 41 }; |
38 | 42 |
39 interface ProxyResolverRequestClient { | 43 interface ProxyResolverRequestClient { |
40 ReportResult(int32 error, array<ProxyServer>? proxy_servers); | 44 ReportResult(int32 error, ProxyInfo proxy_info); |
41 | 45 |
42 Alert(string error); | 46 Alert(string error); |
43 OnError(int32 line_number, string error); | 47 OnError(int32 line_number, string error); |
44 | 48 |
45 ResolveDns(HostResolverRequestInfo request_info, | 49 ResolveDns(HostResolverRequestInfo request_info, |
46 HostResolverRequestClient client); | 50 HostResolverRequestClient client); |
47 }; | 51 }; |
48 | 52 |
49 interface ProxyResolverFactory { | 53 interface ProxyResolverFactory { |
50 CreateResolver(string pac_script, | 54 CreateResolver(string pac_script, |
51 ProxyResolver& resolver, | 55 ProxyResolver& resolver, |
52 ProxyResolverFactoryRequestClient client); | 56 ProxyResolverFactoryRequestClient client); |
53 }; | 57 }; |
54 | 58 |
55 interface ProxyResolverFactoryRequestClient { | 59 interface ProxyResolverFactoryRequestClient { |
56 ReportResult(int32 error); | 60 ReportResult(int32 error); |
57 | 61 |
58 Alert(string error); | 62 Alert(string error); |
59 OnError(int32 line_number, string error); | 63 OnError(int32 line_number, string error); |
60 | 64 |
61 ResolveDns(HostResolverRequestInfo request_info, | 65 ResolveDns(HostResolverRequestInfo request_info, |
62 HostResolverRequestClient client); | 66 HostResolverRequestClient client); |
63 }; | 67 }; |
OLD | NEW |