blob: 91bb0b0e9cc73dc3e29f6f246e490d9388445e3c [file] [log] [blame]
// Copyright 2021 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 crosapi.mojom;
import "ui/gfx/geometry/mojom/geometry.mojom";
// The structs in this file are copied from
// extensions/common/api/system_display.idl,
// with explicit versioning added to allow skew. Some simplifications (e.g.,
// using gfx.mojom classes) are taken from
// ash/public/mojom/cros_display_config.mojom.
// However, the two mojoms operate at different layers and have different
// version stability requirements, so should not be mixed.
struct DisplayMode {
// The display mode sizes in device independent (user visible) pixels.
gfx.mojom.Size size@0;
// The display mode size in native pixels.
gfx.mojom.Size size_in_native_pixels@1;
// double? |ui_scale| is long deprecated, and therefore excluded.
// The display mode device scale factor.
double device_scale_factor@2;
// The display mode refresh rate in hertz.
double refresh_rate@3;
// True if the mode is the display's native mode.
bool is_native@4;
// True if the display mode is currently selected.
bool is_selected@5;
// Whether |is_interlaced| is defined.
bool has_is_interlaced@6;
// True if this mode is interlaced, false if not provided.
bool is_interlaced@7;
// EDID extracted parameters. Field description refers to "VESA ENHANCED
// Version 1, Revision 4)" Release A, Revision 2 September 25, 2006.
struct Edid {
// Three character manufacturer code, Sec. 3.4.1 page 21.
string manufacturer_id@0;
// Two byte manufacturer-assigned code, Sec. 3.4.2 page 21.
string product_id@1;
// Year of manufacture. Sec. 3.4.4 page 22.
int32 year_of_manufacture@2;
// Struct to transmit extensions::api::system_display::DisplayUnitInfo.
struct DisplayUnitInfo {
// The unique identifier of the display.
string id@0;
// The user-friendly name (e.g. "Acme LCD monitor").
string name@1;
// EDID properties when available.
Edid? edid@2;
// Identifier of the display that is being mirrored if mirroring is enabled,
// otherwise empty. This will be set for all displays (including the display
// being mirrored).
string mirroring_source_id@3;
// Identifiers of the displays to which the source display is being mirrored.
// Empty if no displays are being mirrored. This will be set to the same value
// for all displays. This must not include |mirroringSourceId|.
array<string> mirroring_destination_ids@4;
// True if this is the primary display.
bool is_primary@5;
// True if this is an internal display.
bool is_internal@6;
// True if this display is enabled.
bool is_enabled@7;
// True for all displays when in unified desktop mode. See documentation
// for $(ref:enableUnifiedDesktop).
bool is_unified@8;
// Whether |is_auto_rotation_allowed| is defined.
bool has_is_auto_rotation_allowed@9;
// Optional: True when the auto-rotation is allowed in the device.
bool is_auto_rotation_allowed@10;
// The number of pixels per inch along the x-axis.
double dpi_x@11;
// The number of pixels per inch along the y-axis.
double dpi_y@12;
// The display's clockwise rotation in degrees relative to the vertical
// position. A value of -1 will be interpreted as auto-rotate when the device
// is in a physical tablet state.
int32 rotation@13;
// The display's logical bounds, represented using Rect.
gfx.mojom.Rect bounds_as_rect@14;
// The display's ovserscan insets within its screen's bounds.
gfx.mojom.Insets overscan@15;
// The usable work area of the display within the display bounds, represented
// using Rect. Excludes areas of the display reserved for the OS, e.g. the
// taskbar and launcher.
gfx.mojom.Rect work_area_as_rect@16;
// The list of available display modes. The current mode will have
// is_selected=true.
array<DisplayMode> modes@17;
// True if this display has a touch input device associated with it.
bool has_touch_support@18;
// True if this display has an accelerometer associated with it.
bool has_accelerometer_support@19;
// The list of allowed zoom factor values for the display.
array<double> available_display_zoom_factors@20;
// The ratio between the display's current and default zoom. i.e. 1.0 is
// is equivalent to 100% zoom, and value 1.5 is equivalent to 150% zoom.
double display_zoom_factor@21;
// Interface for display change observer. Implemented by lacros-chrome. Used by
// ash-chrome to send display change event.
[Stable, Uuid="5c1e28fd-2f79-4b47-ab7c-780ef0cd2b0a"]
interface DisplayChangeObserver {
// Called by ash-chrome when display changes.
// Crosapi support for chrome.system.display extensions API.
[Stable, Uuid="07f25a88-9762-4876-a8ce-2c1e6ad9f797"]
interface SystemDisplay {
// Returns the properties for all displays. If |single_unified| is true, a
// single display will be returned if the display layout is in unifed mode.
GetDisplayUnitInfoList@0(bool single_unified) =>
(array<DisplayUnitInfo> info_list);
// Adds an observer for display change. Multiple observers may be registered.
[MinVersion=1] AddDisplayChangeObserver@1(
pending_remote<DisplayChangeObserver> observer);