// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module network.mojom;
import "services/network/public/mojom/mutable_network_traffic_annotation_tag.mojom";
import "services/network/public/mojom/proxy_config.mojom";
// These fields mirror those of net::ProxyConfigWithAnnotation.
struct ProxyConfigWithAnnotation {
ProxyConfig value;
MutableNetworkTrafficAnnotationTag traffic_annotation;
};
// Interface for pushing proxy configuration updates to a NetworkContext.
interface ProxyConfigClient {
OnProxyConfigUpdated(ProxyConfigWithAnnotation proxy_config);
// Flush the ProxyConfig
FlushProxyConfig() => ();
};
// Called periodically when the current ProxyConfig is in use, as a hint that
// it might be a good time to double-check the proxy configuration.
interface ProxyConfigPollerClient {
OnLazyProxyConfigPoll();
};
// Called to notify error related to the configured proxy settings.
interface ProxyErrorClient {
// Called when the PAC script being used by the NetworkContext throws a
// JavaScript error or fails to execute. This error is not necessarily
// fatal for URL loading, since by default errors in a PAC script
// result in a fallback to DIRECT connections.
OnPACScriptError(int32 line_number, string details);
// This is a best effort notification that a URL request failed due to
// a problem with the proxy settings. |net_error| is the error code that the
// request failed with.
//
// This only surfaces failures for an entire URL load, and not from
// individual proxy servers. For instance if a PAC script returned 4 proxy
// servers, and sending the request through the first three failed before
// successfully sending through the fourth, this method is NOT called.
//
// There is some ambiguity with how errors are classified as being a
// "proxy error". The current implementation includes a mix of
// connection and protocol errors.
OnRequestMaybeFailedDueToProxySettings(int32 net_error);
};