summaryrefslogtreecommitdiffstats
path: root/net/interfaces/proxy_resolver_service.mojom
blob: 133fe8b91d018574d27074fbd40b19ead69da5b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Put Mojo definitions into their own namespace to avoid collisions with C++
// definitions.
// TODO(amistry): Resolve the conflict between these two sets of definitions.
module net.interfaces;

import "host_resolver_service.mojom";

// Mirror of net::ProxyServer::Scheme.
enum ProxyScheme {
  INVALID,
  DIRECT,
  HTTP,
  SOCKS4,
  SOCKS5,
  HTTPS,
  QUIC,
};

// Mirror of net::ProxyServer.
struct ProxyServer {
  ProxyScheme scheme;

  // |host| and |port| are only valid if |scheme| is not INVALID or DIRECT.
  string? host;
  uint16 port;
};

interface ProxyResolver {
  // Use a ProxyResolverRequestClient instead of returning a result so we can
  // cancel in-flight requests by destroying the client.
  // TODO(amistry): Add BoundNetLog.
  GetProxyForUrl(string url, ProxyResolverRequestClient client);
};

interface ProxyResolverRequestClient {
  ReportResult(int32 error, array<ProxyServer>? proxy_servers);
};

interface ProxyResolverErrorObserver {
  OnPacScriptError(int32 line_number, string error);
};

interface ProxyResolverFactory {
  // TODO(amistry): Add NetLog.
  CreateResolver(string pac_script,
                 ProxyResolver& resolver,
                 HostResolver host_resolver,
                 ProxyResolverErrorObserver? error_observer,
                 ProxyResolverFactoryRequestClient client);
};

interface ProxyResolverFactoryRequestClient {
  ReportResult(int32 error);
};