blob: e8bb8cfea7b8e348eb6b879c893b1ac54e68697a [file] [log] [blame]
// Copyright 2016 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.
module network.mojom;
import "services/network/public/mojom/mutable_network_traffic_annotation_tag.mojom";
import "services/network/public/mojom/url_loader.mojom";
const uint32 kURLLoadOptionNone = 0;
// Sends the net::SSLInfo struct in OnReceiveResponse.
const uint32 kURLLoadOptionSendSSLInfoWithResponse = 1;
// Enables mime sniffing.
const uint32 kURLLoadOptionSniffMimeType = 2;
// Indicates that execution is blocking on the completion of the request.
const uint32 kURLLoadOptionSynchronous = 4;
// Sends the net::SSLInfo on request completion when the connection had a major
// certificate error. The SSLInfo can be retrieved from the OnComplete struct
// when the connection failed due to the certificate error, or from the
// OnReceiveResponse struct if the connection proceeded despite the certificate
// error.
const uint32 kURLLoadOptionSendSSLInfoForCertificateError = 8;
// Uses the header client set in URLLoaderFactoryParams for this request.
const uint32 kURLLoadOptionUseHeaderClient = 16;
// Disallow the request from sending cookies. Disallow the response from writing
// cookies.
const uint32 kURLLoadOptionBlockAllCookies = 32;
// Similar to |kURLLoadOptionBlockAllCookies|, but only for third party cookies.
const uint32 kURLLoadOptionBlockThirdPartyCookies = 64;
// This request is for CORS preflight. This is used in the network service.
// This is set and used only in the network service, no callsites outside the
// service must set this.
const uint32 kURLLoadOptionAsCorsPreflight = 128;
// Specifies that the request must not be made to a non-public IP address. This
// option is needed even with CORS-RFC1918 because CORS-RFC1918 is not enabled
// by default, and sometimes the client security state is not known as the time
// of the request, which skips CORS-RFC1918.
//
// This option is supported by the network service, but might not be supported
// by other URLLoaderFactory implementations.
//
// TODO(crbug.com/1115776): This option can be removed if CORS-RFC1918 ships
// without a feature flag, and additionally it changes to block requests by
// default if the security state is unknown.
const uint32 kURLLoadOptionBlockLocalRequest = 256;
// URLLoaderFactory is an interface for requesting URLs. It creates URLLoader
// instances. One URLLoader instance can load one URL.
interface URLLoaderFactory {
// Creates a URLLoader and starts loading with the given |request|. |client|'s
// methods will be called when certain events related to that loading
// (e.g., response arrival) happen.
//
// |routing_id| is the routing_id for subframe requests, and is the
// frame_tree_node_id for frame requests.
// TODO: once MojoLoading is only codepath and we have one factory per frame,
// remove this.
//
// |request_id| is an arbitrary id for the request. The (routing_id,
// request_id) pair must be unique over all calls to CreateLoaderAndStart()
// on this factory.
//
// |options| is a bitfield of the options defined above.
CreateLoaderAndStart(pending_receiver<URLLoader> loader,
int32 routing_id,
int32 request_id,
uint32 options,
URLRequest request,
pending_remote<URLLoaderClient> client,
MutableNetworkTrafficAnnotationTag traffic_annotation);
// Connects a new pipe to this instance of the URLLoaderFactory interface.
Clone(pending_receiver<URLLoaderFactory> factory);
};