// 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 content.mojom;

import "services/network/public/interfaces/mutable_network_traffic_annotation_tag.mojom";
import "url_loader.mojom";

const uint32 kURLLoadOptionNone = 0;
// Sends the net::SSLInfo struct in OnReceiveResponse.
const uint32 kURLLoadOptionSendSSLInfoWithResponse = 1;
// Enables mime sniffing. NOTE: this is only used with the network service.
const uint32 kURLLoadOptionSniffMimeType = 2;
// Indicates that execution is blocking on the completion of the request.
const uint32 kURLLoadOptionSynchronous = 4;
// Sends the net::SSLInfo struct in OnComplete when the connection had a major
// certificate error.
const uint32 kURLLoadOptionSendSSLInfoForCertificateError = 8;

interface URLLoaderFactory {
  // Creats a URLLoader and starts loading with the given |request|. |client|'s
  // method 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 for compatibility with the existing Chrome IPC.
  CreateLoaderAndStart(URLLoader& loader,
                       int32 routing_id,
                       int32 request_id,
                       uint32 options,
                       URLRequest request,
                       URLLoaderClient client,
                       network.mojom.MutableNetworkTrafficAnnotationTag
                           traffic_annotation);

  // Connects a new pipe to this instance of the URLLoaderFactory interface.
  Clone(URLLoaderFactory& factory);
};