network_settings_service.mojom 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. // Copyright 2021 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. module crosapi.mojom;
  5. import "url/mojom/url.mojom";
  6. [Stable]
  7. struct ProxyLocation {
  8. // Host (or IP address) to use for proxy.
  9. string host;
  10. int32 port;
  11. [Stable,Extensible]
  12. enum Scheme {
  13. [Default] kUnknown,
  14. kInvalid,
  15. kDirect,
  16. kHttp,
  17. kSocks4,
  18. kSocks5,
  19. kHttps,
  20. kQuic,
  21. };
  22. // Identifies the scheme which is used to connect to the proxy. This is
  23. // independent of the type of the transmitted requests, e.g. it does not
  24. // have to be kHttps for a proxy which handles https requests. That's why
  25. // it has to be transmitted.
  26. [MinVersion=1] Scheme scheme;
  27. };
  28. // Description of the extension in the primary profile which is controlling the
  29. // OS proxy configuration. It is sent from Lacros' primary profile to Ash and
  30. // from Ash to all profiles in Lacros, the PlayStore and Chrome OS system
  31. // services.
  32. // Note: In the Lacros primary profile, the extension set proxy has priority so
  33. // proxy updates coming from the OS are ignored.
  34. [Stable]
  35. struct ExtensionControllingProxy {
  36. string name;
  37. string id;
  38. [MinVersion=1] bool can_be_disabled;
  39. };
  40. [Stable]
  41. struct ProxySettingsDirect {};
  42. [Stable]
  43. struct ProxySettingsManual {
  44. array<ProxyLocation> http_proxies;
  45. array<ProxyLocation> secure_http_proxies;
  46. array<ProxyLocation> socks_proxies;
  47. // Domains and hosts for which to exclude proxy settings.
  48. array<string> exclude_domains;
  49. };
  50. [Stable]
  51. struct ProxySettingsPac {
  52. url.mojom.Url pac_url;
  53. // If true, network traffic does not fall back to direct connections in
  54. // case the PAC script is not available.
  55. bool pac_mandatory;
  56. };
  57. [Stable]
  58. struct ProxySettingsWpad {
  59. url.mojom.Url pac_url;
  60. };
  61. [Stable]
  62. union ProxySettings {
  63. ProxySettingsDirect direct;
  64. ProxySettingsManual manual;
  65. ProxySettingsPac pac;
  66. ProxySettingsWpad wpad;
  67. };
  68. [Stable]
  69. struct ProxyConfig {
  70. ProxySettings proxy_settings;
  71. // Identifies the extension controlling the proxy.
  72. ExtensionControllingProxy? extension;
  73. };
  74. // Implemented by Lacros-Chrome.
  75. [Stable]
  76. interface NetworkSettingsObserver {
  77. // This methods is called when:
  78. // - the observer is added to the `NetworkSettingsService`;
  79. // - the proxy configuration in Ash is updated;
  80. // - the WPAD URL on the default network is updated.
  81. OnProxyChanged@0(ProxyConfig proxy_config);
  82. };
  83. // Implemented by Ash-Chrome.
  84. [Stable, Uuid="e8916037-b993-454a-96ef-20f269cace54"]
  85. interface NetworkSettingsService {
  86. // Add an Ash network settings service observer.
  87. AddNetworkSettingsObserver@0(
  88. pending_remote<NetworkSettingsObserver> observer);
  89. // Used by the Lacros browser to forward proxy configurations set via
  90. // extensions in the primary profile to Ash. `proxy_config` must specify the
  91. // extension setting the proxy.
  92. [MinVersion=1]
  93. SetExtensionProxy@1(ProxyConfig proxy_config);
  94. // Used by the Lacros browser to clear proxy configurations set via
  95. // extensions in the primary profile to Ash.
  96. [MinVersion=1]
  97. ClearExtensionProxy@2();
  98. };