 Chromium Code Reviews
 Chromium Code Reviews Issue 2072633002:
  Add Get/SetDisplayLayout to chrome.system.display extension API  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 2072633002:
  Add Get/SetDisplayLayout to chrome.system.display extension API  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| 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(); | 
| 156 | 176 | 
| 157 interface Functions { | 177 interface Functions { | 
| 158 // Get the information of all attached display devices. | 178 // Get the information of all attached display devices. | 
| 159 static void getInfo(DisplayInfoCallback callback); | 179 static void getInfo(DisplayInfoCallback callback); | 
| 160 | 180 | 
| 181 // Get the layout info for all displays. | |
| 182 // NOTE: This is only available to Chrome OS Kiosk apps and Web UI. | |
| 183 static void getDisplayLayout(DisplayLayoutCallback callback); | |
| 184 | |
| 161 // Updates the properties for the display specified by |id|, according to | 185 // Updates the properties for the display specified by |id|, according to | 
| 162 // the information provided in |info|. On failure, $(ref:runtime.lastError) | 186 // the information provided in |info|. On failure, $(ref:runtime.lastError) | 
| 163 // will be set. | 187 // will be set. | 
| 164 // NOTE: This is only available to Chrome OS Kiosk apps and Web UI. | 188 // NOTE: This is only available to Chrome OS Kiosk apps and Web UI. | 
| 165 // |id|: The display's unique identifier. | 189 // |id|: The display's unique identifier. | 
| 166 // |info|: The information about display properties that should be changed. | 190 // |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 | 191 // A property will be changed only if a new value for it is specified in | 
| 168 // |info|. | 192 // |info|. | 
| 169 // |callback|: Empty function called when the function finishes. To find out | 193 // |callback|: Empty function called when the function finishes. To find out | 
| 170 // whether the function succeeded, $(ref:runtime.lastError) should be | 194 // whether the function succeeded, $(ref:runtime.lastError) should be | 
| 171 // queried. | 195 // queried. | 
| 172 static void setDisplayProperties( | 196 static void setDisplayProperties( | 
| 173 DOMString id, | 197 DOMString id, | 
| 174 DisplayProperties info, | 198 DisplayProperties info, | 
| 175 optional SetDisplayUnitInfoCallback callback); | 199 optional SetDisplayUnitInfoCallback callback); | 
| 176 | 200 | 
| 201 // Set the layout for all displays. Any display not included will use the | |
| 202 // default layout. If a layout would overlap or be otherwise invalid it | |
| 203 // will be adjusted to a valid layout. After layout is resolved, an | |
| 204 // onDisplayChanged event will be triggered. | |
| 205 static void setDisplayLayout(DisplayLayout[] layouts); | |
| 
asargent_no_longer_on_chrome
2016/06/16 19:08:30
optional: you might consider adding a callback whi
 
stevenjb
2016/06/17 01:34:59
I don't want to add too much complexity to the API
 | |
| 206 | |
| 177 // Enables/disables the unified desktop feature. Note that this simply | 207 // Enables/disables the unified desktop feature. Note that this simply | 
| 178 // enables the feature, but will not change the actual desktop mode. | 208 // 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) | 209 // (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. | 210 // NOTE: This is only available to Chrome OS Kiosk apps and Web UI. | 
| 181 // |enabled|: True if unified desktop should be enabled. | 211 // |enabled|: True if unified desktop should be enabled. | 
| 182 static void enableUnifiedDesktop(boolean enabled); | 212 static void enableUnifiedDesktop(boolean enabled); | 
| 183 | 213 | 
| 184 // Starts overscan calibration for a display. This will show an overlay | 214 // Starts overscan calibration for a display. This will show an overlay | 
| 185 // on the screen indicating the current overscan insets. If overscan | 215 // on the screen indicating the current overscan insets. If overscan | 
| 186 // calibration for display |id| is in progress this will reset calibration. | 216 // calibration for display |id| is in progress this will reset calibration. | 
| (...skipping 17 matching lines...) Expand all Loading... | |
| 204 // and hiding the overlay. | 234 // and hiding the overlay. | 
| 205 // |id|: The display's unique identifier. | 235 // |id|: The display's unique identifier. | 
| 206 static void overscanCalibrationComplete(DOMString id); | 236 static void overscanCalibrationComplete(DOMString id); | 
| 207 }; | 237 }; | 
| 208 | 238 | 
| 209 interface Events { | 239 interface Events { | 
| 210 // Fired when anything changes to the display configuration. | 240 // Fired when anything changes to the display configuration. | 
| 211 static void onDisplayChanged(); | 241 static void onDisplayChanged(); | 
| 212 }; | 242 }; | 
| 213 }; | 243 }; | 
| OLD | NEW |