| 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 | 11 |
| 12 // Mirror of net::ProxyServer::Scheme. | 12 // Mirror of net::ProxyServer::Scheme. |
| 13 enum ProxyScheme { | 13 enum ProxyScheme { |
| 14 INVALID, | 14 INVALID, |
| 15 DIRECT, | 15 DIRECT, |
| 16 HTTP, | 16 HTTP, |
| 17 SOCKS4, | 17 SOCKS4, |
| 18 SOCKS5, | 18 SOCKS5, |
| 19 HTTPS, | 19 HTTPS, |
| 20 QUIC, | 20 QUIC, |
| 21 }; | 21 }; |
| 22 | 22 |
| 23 // Mirror of net::ProxyServer. | 23 // Mirror of net::ProxyServer. |
| 24 struct ProxyServer { | 24 struct ProxyServer { |
| 25 ProxyScheme scheme; | 25 ProxyScheme scheme; |
| 26 string host; | 26 |
| 27 // |host| and |port| are only valid if |scheme| is not INVALID or DIRECT. |
| 28 string? host; |
| 27 uint16 port; | 29 uint16 port; |
| 28 }; | 30 }; |
| 29 | 31 |
| 30 interface ProxyResolver { | 32 interface ProxyResolver { |
| 31 SetPacScript(string data) => (int32 result); | 33 SetPacScript(string data) => (int32 result); |
| 32 | 34 |
| 33 // Use a ProxyResolverRequestClient instead of returning a result so we can | 35 // Use a ProxyResolverRequestClient instead of returning a result so we can |
| 34 // receive load state updates and cancel in-flight requests by destroying the | 36 // receive load state updates and cancel in-flight requests by destroying the |
| 35 // client. | 37 // client. |
| 36 // TODO(amistry): Add BoundNetLog. | 38 // TODO(amistry): Add BoundNetLog. |
| 37 GetProxyForUrl(string url, ProxyResolverRequestClient client); | 39 GetProxyForUrl(string url, ProxyResolverRequestClient client); |
| 38 }; | 40 }; |
| 39 | 41 |
| 40 interface ProxyResolverRequestClient { | 42 interface ProxyResolverRequestClient { |
| 41 ReportResult(int32 error, array<ProxyServer>? proxy_servers); | 43 ReportResult(int32 error, array<ProxyServer>? proxy_servers); |
| 42 }; | 44 }; |
| 43 | 45 |
| 44 interface ProxyResolverFactory { | 46 interface ProxyResolverFactory { |
| 45 // TODO(amistry): Add NetLog and ProxyResolverErrorObserver. | 47 // TODO(amistry): Add NetLog and ProxyResolverErrorObserver. |
| 46 CreateResolver(ProxyResolver& resolver, | 48 CreateResolver(ProxyResolver& resolver, |
| 47 HostResolver host_resolver); | 49 HostResolver host_resolver); |
| 48 }; | 50 }; |
| OLD | NEW |