blob: ea99f3b99e88b0b116d8c5fc1a3c55306882c512 [file] [log] [blame]
// Copyright 2014 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.
[DartPackage="mojo_services"]
module mojo;
import "mojo/public/interfaces/network/network_error.mojom";
import "mojo/public/interfaces/network/url_request.mojom";
import "mojo/public/interfaces/network/url_response.mojom";
struct URLLoaderStatus {
// If the loader has failed due to a network level error, this field will be
// set.
NetworkError? error;
// Set to true if the URLLoader is still working. Set to false once an error
// is encountered or the response body is completely copied to the response
// body stream.
bool is_loading;
// TODO(darin): Add further details about the stages of loading (e.g.,
// "resolving host") that happen prior to receiving bytes.
};
interface URLLoader {
// Loads the given |request|, asynchronously producing |response|. Consult
// |response| to determine if the request resulted in an error, was
// redirected, or has a response body to be consumed.
Start(URLRequest request) => (URLResponse response);
// If the request passed to |Start| had |auto_follow_redirects| set to false,
// then upon receiving an URLResponse with a non-NULL |redirect_url| field,
// |FollowRedirect| may be called to load the URL indicated by the redirect.
FollowRedirect() => (URLResponse response);
// Query status about the URLLoader.
QueryStatus() => (URLLoaderStatus status);
};