system_display.mojom 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. module crosapi.mojom;
  5. import "ui/gfx/geometry/mojom/geometry.mojom";
  6. // The structs in this file are copied from
  7. // extensions/common/api/system_display.idl,
  8. // with explicit versioning added to allow skew. Some simplifications (e.g.,
  9. // using gfx.mojom classes) are taken from
  10. // ash/public/mojom/cros_display_config.mojom.
  11. // However, the two mojoms operate at different layers and have different
  12. // version stability requirements, so should not be mixed.
  13. [Stable, RenamedFrom="crosapi.mojom.DisplayMode"]
  14. struct SysDisplayMode {
  15. // The display mode sizes in device independent (user visible) pixels.
  16. gfx.mojom.Size size@0;
  17. // The display mode size in native pixels.
  18. gfx.mojom.Size size_in_native_pixels@1;
  19. // double? |ui_scale| is long deprecated, and therefore excluded.
  20. // The display mode device scale factor.
  21. double device_scale_factor@2;
  22. // The display mode refresh rate in hertz.
  23. double refresh_rate@3;
  24. // True if the mode is the display's native mode.
  25. bool is_native@4;
  26. // True if the display mode is currently selected.
  27. bool is_selected@5;
  28. // Whether |is_interlaced| is defined.
  29. bool has_is_interlaced@6;
  30. // True if this mode is interlaced, false if not provided.
  31. bool is_interlaced@7;
  32. };
  33. // EDID extracted parameters. Field description refers to "VESA ENHANCED
  34. // EXTENDED DISPLAY IDENTIFICATION DATA STANDARD (Defines EDID Structure
  35. // Version 1, Revision 4)" Release A, Revision 2 September 25, 2006.
  36. // https://www.vesa.org/vesa-standards
  37. [Stable, RenamedFrom="crosapi.mojom.Edid"]
  38. struct SysDisplayEdid {
  39. // Three character manufacturer code, Sec. 3.4.1 page 21.
  40. string manufacturer_id@0;
  41. // Two byte manufacturer-assigned code, Sec. 3.4.2 page 21.
  42. string product_id@1;
  43. // Year of manufacture. Sec. 3.4.4 page 22.
  44. int32 year_of_manufacture@2;
  45. };
  46. // Struct to transmit extensions::api::system_display::DisplayUnitInfo.
  47. [Stable, RenamedFrom="crosapi.mojom.DisplayUnitInfo"]
  48. struct SysDisplayUnitInfo {
  49. // The unique identifier of the display.
  50. string id@0;
  51. // The user-friendly name (e.g. "Acme LCD monitor").
  52. string name@1;
  53. // EDID properties when available.
  54. SysDisplayEdid? edid@2;
  55. // Identifier of the display that is being mirrored if mirroring is enabled,
  56. // otherwise empty. This will be set for all displays (including the display
  57. // being mirrored).
  58. string mirroring_source_id@3;
  59. // Identifiers of the displays to which the source display is being mirrored.
  60. // Empty if no displays are being mirrored. This will be set to the same value
  61. // for all displays. This must not include |mirroringSourceId|.
  62. array<string> mirroring_destination_ids@4;
  63. // True if this is the primary display.
  64. bool is_primary@5;
  65. // True if this is an internal display.
  66. bool is_internal@6;
  67. // True if this display is enabled.
  68. bool is_enabled@7;
  69. // True for all displays when in unified desktop mode. See documentation
  70. // for $(ref:enableUnifiedDesktop).
  71. bool is_unified@8;
  72. // Whether |is_auto_rotation_allowed| is defined.
  73. bool has_is_auto_rotation_allowed@9;
  74. // Optional: True when the auto-rotation is allowed in the device.
  75. bool is_auto_rotation_allowed@10;
  76. // The number of pixels per inch along the x-axis.
  77. double dpi_x@11;
  78. // The number of pixels per inch along the y-axis.
  79. double dpi_y@12;
  80. // The display's clockwise rotation in degrees relative to the vertical
  81. // position. A value of -1 will be interpreted as auto-rotate when the device
  82. // is in a physical tablet state.
  83. int32 rotation@13;
  84. // The display's logical bounds, represented using Rect.
  85. gfx.mojom.Rect bounds_as_rect@14;
  86. // The display's ovserscan insets within its screen's bounds.
  87. gfx.mojom.Insets overscan@15;
  88. // The usable work area of the display within the display bounds, represented
  89. // using Rect. Excludes areas of the display reserved for the OS, e.g. the
  90. // taskbar and launcher.
  91. gfx.mojom.Rect work_area_as_rect@16;
  92. // The list of available display modes. The current mode will have
  93. // is_selected=true.
  94. array<SysDisplayMode> modes@17;
  95. // True if this display has a touch input device associated with it.
  96. bool has_touch_support@18;
  97. // True if this display has an accelerometer associated with it.
  98. bool has_accelerometer_support@19;
  99. // The list of allowed zoom factor values for the display.
  100. array<double> available_display_zoom_factors@20;
  101. // The ratio between the display's current and default zoom. i.e. 1.0 is
  102. // is equivalent to 100% zoom, and value 1.5 is equivalent to 150% zoom.
  103. double display_zoom_factor@21;
  104. };
  105. // Interface for display change observer. Implemented by lacros-chrome. Used by
  106. // ash-chrome to send display change event.
  107. [Stable, Uuid="5c1e28fd-2f79-4b47-ab7c-780ef0cd2b0a"]
  108. interface DisplayChangeObserver {
  109. // Called by ash-chrome when display changes.
  110. OnCrosapiDisplayChanged@0();
  111. };
  112. // Crosapi support for chrome.system.display extensions API.
  113. [Stable, Uuid="07f25a88-9762-4876-a8ce-2c1e6ad9f797"]
  114. interface SystemDisplay {
  115. // Returns the properties for all displays. If |single_unified| is true, a
  116. // single display will be returned if the display layout is in unifed mode.
  117. GetDisplayUnitInfoList@0(bool single_unified) =>
  118. (array<SysDisplayUnitInfo> info_list);
  119. // Adds an observer for display change. Multiple observers may be registered.
  120. [MinVersion=1] AddDisplayChangeObserver@1(
  121. pending_remote<DisplayChangeObserver> observer);
  122. };