| // Copyright 2021 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/request_priority.mojom"; |
| import "url/mojom/url.mojom"; |
| |
| // Represents subset of possible values for `rel` attribute of the Link header. |
| enum LinkRelAttribute { |
| // https://w3c.github.io/resource-hints/#dns-prefetch |
| kDnsPrefetch, |
| // https://w3c.github.io/resource-hints/#dfn-preconnect |
| kPreconnect, |
| // https://w3c.github.io/preload/ |
| kPreload, |
| // https://html.spec.whatwg.org/multipage/links.html#link-type-modulepreload |
| kModulePreload, |
| }; |
| |
| // Represents subset of possible values for `as` attribute of the Link header. |
| // https://fetch.spec.whatwg.org/#concept-potential-destination |
| // https://fetch.spec.whatwg.org/#concept-request-destination |
| enum LinkAsAttribute { |
| kUnspecified, |
| kFont, |
| kImage, |
| kScript, |
| kStyleSheet, |
| kFetch, |
| }; |
| |
| // Represents subset of possible values for `crossorigin` attribute. |
| // https://html.spec.whatwg.org/multipage/urls-and-fetching.html#cors-settings-attributes |
| enum CrossOriginAttribute { |
| kUnspecified, |
| kAnonymous, |
| kUseCredentials, |
| }; |
| |
| // Holds the parsed representation of the Link header. |
| // https://tools.ietf.org/html/rfc8288#section-3 |
| struct LinkHeader { |
| // The resolved `href` attribute. |
| url.mojom.Url href; |
| // The parsed value of `rel` attribute. |
| // TODO(crbug.com/40170852): Change the type when multiple values are need to |
| // be supported. `rel` can contain multiple values but rel=preload is the only |
| // supported value for now. |
| LinkRelAttribute rel; |
| // The parsed value of `as` attribute. |
| LinkAsAttribute as = LinkAsAttribute.kUnspecified; |
| // The parsed value of `crossorigin` attribute. |
| CrossOriginAttribute cross_origin = CrossOriginAttribute.kUnspecified; |
| // The parsed value of `fetchpriority` attribute. |
| FetchPriorityAttribute fetch_priority = FetchPriorityAttribute.kAuto; |
| // The `type` attribute. This is null when `type` attribute is not specified. |
| string? mime_type; |
| }; |