| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Use the <code>system.display</code> API to query display metadata. | 5 // Use the <code>system.display</code> API to query display metadata. |
| 6 namespace system.display { | 6 namespace system.display { |
| 7 | 7 |
| 8 dictionary Bounds { | 8 dictionary Bounds { |
| 9 // The x-coordinate of the upper-left corner. | 9 // The x-coordinate of the upper-left corner. |
| 10 long left; | 10 long left; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // The display mode device scale factor. | 52 // The display mode device scale factor. |
| 53 double deviceScaleFactor; | 53 double deviceScaleFactor; |
| 54 | 54 |
| 55 // True if the mode is the display's native mode. | 55 // True if the mode is the display's native mode. |
| 56 boolean isNative; | 56 boolean isNative; |
| 57 | 57 |
| 58 // True if the display mode is currently selected. | 58 // True if the display mode is currently selected. |
| 59 boolean isSelected; | 59 boolean isSelected; |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 // Layout position, i.e. edge of parent that the display is attached to. |
| 63 enum LayoutPosition { top, right, bottom, left }; |
| 64 |
| 65 dictionary DisplayLayout { |
| 66 // The unique identifier of the display. |
| 67 DOMString id; |
| 68 |
| 69 // The unique identifier of the parent display. Empty if this is the root. |
| 70 DOMString parentId; |
| 71 |
| 72 // The layout position of this display relative to the parent. This will |
| 73 // be ignored for the root. |
| 74 LayoutPosition position; |
| 75 |
| 76 // The offset of the display along the connected edge. 0 indicates that |
| 77 // the topmost or leftmost corners are aligned. |
| 78 long offset; |
| 79 }; |
| 80 |
| 62 dictionary DisplayUnitInfo { | 81 dictionary DisplayUnitInfo { |
| 63 // The unique identifier of the display. | 82 // The unique identifier of the display. |
| 64 DOMString id; | 83 DOMString id; |
| 65 | 84 |
| 66 // The user-friendly name (e.g. "HP LCD monitor"). | 85 // The user-friendly name (e.g. "HP LCD monitor"). |
| 67 DOMString name; | 86 DOMString name; |
| 68 | 87 |
| 69 // Chrome OS only. Identifier of the display that is being mirrored if | 88 // Chrome OS only. Identifier of the display that is being mirrored if |
| 70 // mirroring is enabled, otherwise empty. This will be set for all displays | 89 // mirroring is enabled, otherwise empty. This will be set for all displays |
| 71 // (including the display being mirrored). | 90 // (including the display being mirrored). |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 164 |
| 146 // If set, updates the display's logical bounds origin along y-axis. | 165 // If set, updates the display's logical bounds origin along y-axis. |
| 147 // See documentation for <code>boundsOriginX</code> parameter. | 166 // See documentation for <code>boundsOriginX</code> parameter. |
| 148 long? boundsOriginY; | 167 long? boundsOriginY; |
| 149 | 168 |
| 150 // If set, updates the display mode to the mode matching this value. | 169 // If set, updates the display mode to the mode matching this value. |
| 151 DisplayMode? displayMode; | 170 DisplayMode? displayMode; |
| 152 }; | 171 }; |
| 153 | 172 |
| 154 callback DisplayInfoCallback = void (DisplayUnitInfo[] displayInfo); | 173 callback DisplayInfoCallback = void (DisplayUnitInfo[] displayInfo); |
| 174 callback DisplayLayoutCallback = void (DisplayLayout[] layouts); |
| 155 callback SetDisplayUnitInfoCallback = void(); | 175 callback SetDisplayUnitInfoCallback = void(); |
| 176 callback SetDisplayLayoutCallback = void(); |
| 156 | 177 |
| 157 interface Functions { | 178 interface Functions { |
| 158 // Get the information of all attached display devices. | 179 // Get the information of all attached display devices. |
| 159 static void getInfo(DisplayInfoCallback callback); | 180 static void getInfo(DisplayInfoCallback callback); |
| 160 | 181 |
| 182 // Get the layout info for all displays. |
| 183 // NOTE: This is only available to Chrome OS Kiosk apps and Web UI. |
| 184 static void getDisplayLayout(DisplayLayoutCallback callback); |
| 185 |
| 161 // Updates the properties for the display specified by |id|, according to | 186 // Updates the properties for the display specified by |id|, according to |
| 162 // the information provided in |info|. On failure, $(ref:runtime.lastError) | 187 // the information provided in |info|. On failure, $(ref:runtime.lastError) |
| 163 // will be set. | 188 // will be set. |
| 164 // NOTE: This is only available to Chrome OS Kiosk apps and Web UI. | 189 // NOTE: This is only available to Chrome OS Kiosk apps and Web UI. |
| 165 // |id|: The display's unique identifier. | 190 // |id|: The display's unique identifier. |
| 166 // |info|: The information about display properties that should be changed. | 191 // |info|: The information about display properties that should be changed. |
| 167 // A property will be changed only if a new value for it is specified in | 192 // A property will be changed only if a new value for it is specified in |
| 168 // |info|. | 193 // |info|. |
| 169 // |callback|: Empty function called when the function finishes. To find out | 194 // |callback|: Empty function called when the function finishes. To find out |
| 170 // whether the function succeeded, $(ref:runtime.lastError) should be | 195 // whether the function succeeded, $(ref:runtime.lastError) should be |
| 171 // queried. | 196 // queried. |
| 172 static void setDisplayProperties( | 197 static void setDisplayProperties( |
| 173 DOMString id, | 198 DOMString id, |
| 174 DisplayProperties info, | 199 DisplayProperties info, |
| 175 optional SetDisplayUnitInfoCallback callback); | 200 optional SetDisplayUnitInfoCallback callback); |
| 176 | 201 |
| 202 // Set the layout for all displays. Any display not included will use the |
| 203 // default layout. If a layout would overlap or be otherwise invalid it |
| 204 // will be adjusted to a valid layout. After layout is resolved, an |
| 205 // onDisplayChanged event will be triggered. |
| 206 // NOTE: This is only available to Chrome OS Kiosk apps and Web UI. |
| 207 // |layouts|: The layout information, required for all displays except |
| 208 // the primary display. |
| 209 // |callback|: Empty function called when the function finishes. To find out |
| 210 // whether the function succeeded, $(ref:runtime.lastError) should be |
| 211 // queried. |
| 212 static void setDisplayLayout(DisplayLayout[] layouts, |
| 213 optional SetDisplayLayoutCallback callback); |
| 214 |
| 177 // Enables/disables the unified desktop feature. Note that this simply | 215 // Enables/disables the unified desktop feature. Note that this simply |
| 178 // enables the feature, but will not change the actual desktop mode. | 216 // enables the feature, but will not change the actual desktop mode. |
| 179 // (That is, if the desktop is in mirror mode, it will stay in mirror mode) | 217 // (That is, if the desktop is in mirror mode, it will stay in mirror mode) |
| 180 // NOTE: This is only available to Chrome OS Kiosk apps and Web UI. | 218 // NOTE: This is only available to Chrome OS Kiosk apps and Web UI. |
| 181 // |enabled|: True if unified desktop should be enabled. | 219 // |enabled|: True if unified desktop should be enabled. |
| 182 static void enableUnifiedDesktop(boolean enabled); | 220 static void enableUnifiedDesktop(boolean enabled); |
| 183 | 221 |
| 184 // Starts overscan calibration for a display. This will show an overlay | 222 // Starts overscan calibration for a display. This will show an overlay |
| 185 // on the screen indicating the current overscan insets. If overscan | 223 // on the screen indicating the current overscan insets. If overscan |
| 186 // calibration for display |id| is in progress this will reset calibration. | 224 // calibration for display |id| is in progress this will reset calibration. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 204 // and hiding the overlay. | 242 // and hiding the overlay. |
| 205 // |id|: The display's unique identifier. | 243 // |id|: The display's unique identifier. |
| 206 static void overscanCalibrationComplete(DOMString id); | 244 static void overscanCalibrationComplete(DOMString id); |
| 207 }; | 245 }; |
| 208 | 246 |
| 209 interface Events { | 247 interface Events { |
| 210 // Fired when anything changes to the display configuration. | 248 // Fired when anything changes to the display configuration. |
| 211 static void onDisplayChanged(); | 249 static void onDisplayChanged(); |
| 212 }; | 250 }; |
| 213 }; | 251 }; |
| OLD | NEW |