blob: 96d2e2ad46fc318cd286ed88a7c1c3193403fdff [file] [log] [blame]
// 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 blink.mojom;
import "url/mojom/origin.mojom";
// This mirrors blink::WebSandboxFlags enum bitfield.
[Extensible]
enum WebSandboxFlags {
kNone = 0,
kNavigation = 1, // 1 << 0
kPlugins = 2, // 1 << 1
kOrigin = 4, // 1 << 2
kForms = 8, // 1 << 3
kScripts = 16, // 1 << 4
kTopNavigation = 32, // 1 << 5
kPopups = 64, // 1 << 6
kAutomaticFeatures = 128, // 1 << 7
kPointerLock = 256, // 1 << 8
kDocumentDomain = 512, // 1 << 9
kOrientationLock = 1024, // 1 << 10
kPropagatesToAuxiliaryBrowsingContexts = 2048, // 1 << 11
kModals = 4096, // 1 << 12
kPresentationController = 8192, // 1 << 13
kTopNavigationByUserActivation = 16384, // 1 << 14
kDownloads = 32768, // 1 << 15
};
// These values map to the features which can be controlled by Feature Policy.
//
// Features are listed in
// https://github.com/WICG/feature-policy/blob/master/features.md. Not all
// listed features are supported in Blink, and many are gated by runtime flags.
// See renderer/platform/feature_policy/feature_policy.cc for the feature names
// which will be recognized in policy declarations.
enum FeaturePolicyFeature {
kNotFound = 0,
// Controls access to media autoplay.
kAutoplay = 1,
// Controls access to video input devices.
kCamera = 2,
// Controls whether navigator.requestMediaKeySystemAccess is allowed.
kEncryptedMedia = 3,
// Controls whether Element.requestFullscreen is allowed.
kFullscreen = 4,
// Controls access to Geolocation interface.
kGeolocation = 5,
// Controls access to audio input devices.
kMicrophone = 6,
// Controls access to requestMIDIAccess method.
kMidiFeature = 7,
// Controls access to PaymentRequest interface.
kPayment = 8,
// Controls access to audio output devices.
kSpeaker = 9,
// Controls access to document.cookie attribute.
kDocumentCookie = 10,
// Contols access to document.domain attribute.
kDocumentDomain = 11,
// Controls whether synchronous script elements will run.
kSyncScript = 12,
// Controls use of synchronous XMLHTTPRequest API.
kSyncXHR = 13,
// Controls access to the WebUSB API.
kUsb = 14,
// Controls access to AOM event listeners.
kAccessibilityEvents = 15,
// Controls use of WebVR API.
kWebVr = 16,
// The following features control access to the corresponding sensor classes.
// Fusion sensor APIs (e.g. LinearAcceleration, OrientationSensor-based
// classes)require all of the features that are inputs into that API to be
// enabled for the feature to be allowed.
kAccelerometer = 17,
kAmbientLightSensor = 18,
kGyroscope = 19,
kMagnetometer = 20,
// Controls the layout size of intrinsically sized images and videos. When
// disabled, default size (300 x 150) is used to prevent relayout.
kUnsizedMedia = 21,
// Controls which image formats are allowed to be used in the document.
kLegacyImageFormats = 22,
// When disallowed, requires images to have a reasonable byte-to-pixel ratio.
kImageCompression = 23,
kAnimations = 24,
// When disallowed, restricts source image size to be no more 2x larger than
// the image's containing block.
kMaxDownscalingImage = 25,
// Controls access to Picture-in-Picture.
kPictureInPicture = 26,
// Controls the ability to block and interfere with vertical scrolling.
kVerticalScroll = 27,
// Controls the ability of the document to use several dynamic markup API
// which interfere with document's input stream (document.write(),
// document.close(), etc.).
kDocumentWrite = 28,
// Used to enforce lazyloading for a frame and any nested <iframe> or image.
kLazyLoad = 29,
// Don't change assigned numbers of any item, and don't reuse removed slots.
// Also, run update_feature_policy_enum.py in
// chromium/src/tools/metrics/histograms/ to update the UMA mapping.
};
// This struct holds feature policy allowlist data that needs to be replicated
// between a RenderFrame and any of its associated RenderFrameProxies. A list of
// these form a ParsedFeaturePolicy.
// NOTE: These types are used for replication frame state between processes.
struct ParsedFeaturePolicyDeclaration {
FeaturePolicyFeature feature;
bool matches_all_origins;
array<url.mojom.Origin> origins;
};