| // Copyright 2017 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; |
| |
| // Corresponds to Fetch request's "mode" and "use-CORS-preflight flag": |
| // https://fetch.spec.whatwg.org/#concept-request-mode |
| // |
| // This enum is also used in histograms. Append-only. |
| // See the "FetchRequestMode" enum in enums.xml. |
| enum FetchRequestMode { |
| kSameOrigin, |
| kNoCors, |
| kCors, |
| kCorsWithForcedPreflight, |
| kNavigate, |
| // Add a new type here, then update enums.xml. |
| }; |
| |
| // Corresponds to Fetch request's "redirect mode": |
| // https://fetch.spec.whatwg.org/#concept-request-redirect-mode |
| enum FetchRedirectMode { |
| kFollow, |
| kError, |
| kManual, |
| }; |
| |
| // Corresponds to Fetch request's "credentials mode": |
| // https://fetch.spec.whatwg.org/#concept-request-credentials-mode |
| enum FetchCredentialsMode { |
| kOmit, |
| kSameOrigin, |
| kInclude, |
| }; |
| |
| // Corresponds to response types from the Fetch spec: |
| // https://fetch.spec.whatwg.org/#concept-response-type |
| // |
| // This enum is also used in histograms. Append-only. |
| // See the "FetchResponseType" enum in enums.xml. |
| enum FetchResponseType { |
| kBasic, |
| kCors, |
| kDefault, |
| kError, |
| kOpaque, |
| kOpaqueRedirect, |
| // Add a new type here, then update enums.xml. |
| }; |
| |
| // Indicates the source of a response. |
| // This represents the source of the outmost response of a request. |
| // This is used only for histograms and isn't web-exposed. |
| enum FetchResponseSource { |
| // The source is unspecified: e.g. "new Response('hi')" or a response from |
| // a service worker. |
| kUnspecified, |
| // The response came from network: e.g. "fetch(req)". |
| kNetwork, |
| // The response came from HttpCache: e.g. "fetch(req)" and there is an entry |
| // in HttpCache. |
| kHttpCache, |
| // The response came from CacheStorage: e.g. "cache.match(req)" in a fetch |
| // event handler. |
| kCacheStorage, |
| }; |