chromium/third_party/blink/renderer/modules/mediastream/capture_controller.idl

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// https://w3c.github.io/mediacapture-screen-share/#dom-capturecontroller

// For APIs marked as RuntimeEnabled = CapturedSurfaceControl, see the spec at:
// https://screen-share.github.io/captured-surface-control/
// TODO(crbug.com/1466247): Measure these APIs.

enum CaptureStartFocusBehavior {
  "focus-capturing-application",
  "focus-captured-surface",
  "no-focus-change"
};

[
  Exposed=Window,
  SecureContext,
  RuntimeEnabled=CaptureController
]
interface CaptureController : EventTarget {
  [CallWith=ExecutionContext] constructor();

  [
    RaisesException,
    MeasureAs=ConditionalFocus
  ]
  void setFocusBehavior(CaptureStartFocusBehavior focusBehavior);

  // https://screen-share.github.io/mouse-events/#capture-controller-extensions
  [RuntimeEnabled=CapturedMouseEvents] attribute EventHandler oncapturedmousechange;

  [
    RuntimeEnabled = CapturedSurfaceControl,
    MeasureAs = CapturedSurfaceControl,
    CallWith = ScriptState
  ]
  Promise<undefined> captureWheel(HTMLElement? element);

  [
    RuntimeEnabled = CapturedSurfaceControl,
    MeasureAs = CapturedSurfaceControl,
    CallWith = ScriptState
  ]
  Promise<undefined> sendWheel(CapturedWheelAction action);

  [
    RuntimeEnabled = CapturedSurfaceControl,
    MeasureAs = CapturedSurfaceControl
  ]
  static sequence<long> getSupportedZoomLevels();

  [
    RuntimeEnabled = CapturedSurfaceControl,
    MeasureAs = CapturedSurfaceControl,
    RaisesException
  ]
  long getZoomLevel();

  [
    RuntimeEnabled = CapturedSurfaceControl,
    MeasureAs = CapturedSurfaceControl,
    CallWith = ScriptState
  ]
  Promise<undefined> setZoomLevel(long zoomLevel);

  [
    RuntimeEnabled = CapturedSurfaceControl,
    MeasureAs = CapturedSurfaceControl
  ]
  attribute EventHandler oncapturedzoomlevelchange;
};