OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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>systemInfo.display</code> API to query display metadata. |
5 namespace systemInfo.display { | 6 namespace systemInfo.display { |
6 | 7 |
7 dictionary Bounds { | 8 dictionary Bounds { |
8 // The x-coordinate of the upper-left corner. | 9 // The x-coordinate of the upper-left corner. |
9 long left; | 10 long left; |
10 | 11 |
11 // The y-coordinate of the upper-left corner. | 12 // The y-coordinate of the upper-left corner. |
12 long top; | 13 long top; |
13 | 14 |
14 // The width of the display in pixels. | 15 // The width of the display in pixels. |
(...skipping 13 matching lines...) Expand all Loading... |
28 // The x-axis distance from the right bound. | 29 // The x-axis distance from the right bound. |
29 long right; | 30 long right; |
30 | 31 |
31 // The y-axis distance from the bottom bound. | 32 // The y-axis distance from the bottom bound. |
32 long bottom; | 33 long bottom; |
33 }; | 34 }; |
34 | 35 |
35 dictionary DisplayUnitInfo { | 36 dictionary DisplayUnitInfo { |
36 // The unique identifier of the display. | 37 // The unique identifier of the display. |
37 DOMString id; | 38 DOMString id; |
38 | 39 |
39 // The user-friendly name (e.g. "HP LCD monitor"). | 40 // The user-friendly name (e.g. "HP LCD monitor"). |
40 DOMString name; | 41 DOMString name; |
41 | 42 |
42 // Identifier of the display that is being mirrored on the display unit. | 43 // Identifier of the display that is being mirrored on the display unit. |
43 // If mirroring is not in progress, set to an empty string. | 44 // If mirroring is not in progress, set to an empty string. |
44 // Currently exposed only on ChromeOS. Will be empty string on other | 45 // Currently exposed only on ChromeOS. Will be empty string on other |
45 // platforms. | 46 // platforms. |
46 DOMString mirroringSourceId; | 47 DOMString mirroringSourceId; |
47 | 48 |
48 // True if this is the primary display. | 49 // True if this is the primary display. |
49 boolean isPrimary; | 50 boolean isPrimary; |
50 | 51 |
51 // True if this is an internal display. | 52 // True if this is an internal display. |
52 boolean isInternal; | 53 boolean isInternal; |
53 | 54 |
54 // True if this display is enabled. | 55 // True if this display is enabled. |
55 boolean isEnabled; | 56 boolean isEnabled; |
56 | 57 |
57 // The number of pixels per inch along the x-axis. | 58 // The number of pixels per inch along the x-axis. |
(...skipping 22 matching lines...) Expand all Loading... |
80 }; | 81 }; |
81 | 82 |
82 dictionary DisplayProperties { | 83 dictionary DisplayProperties { |
83 // If set and not empty, starts mirroring between this and the display with | 84 // If set and not empty, starts mirroring between this and the display with |
84 // the provided id (the system will determine which of the displays is | 85 // the provided id (the system will determine which of the displays is |
85 // actually mirrored). | 86 // actually mirrored). |
86 // If set and not empty, stops mirroring between this and the display with | 87 // If set and not empty, stops mirroring between this and the display with |
87 // the specified id (if mirroring is in progress). | 88 // the specified id (if mirroring is in progress). |
88 // If set, no other parameter may be set. | 89 // If set, no other parameter may be set. |
89 DOMString? mirroringSourceId; | 90 DOMString? mirroringSourceId; |
90 | 91 |
91 // If set to true, makes the display primary. No-op if set to false. | 92 // If set to true, makes the display primary. No-op if set to false. |
92 boolean? isPrimary; | 93 boolean? isPrimary; |
93 | 94 |
94 // If set, sets the display's overscan insets to the provided values. Note | 95 // If set, sets the display's overscan insets to the provided values. Note |
95 // that overscan values may not be negative or larger than a half of the | 96 // that overscan values may not be negative or larger than a half of the |
96 // screen's size. Overscan cannot be changed on the internal monitor. | 97 // screen's size. Overscan cannot be changed on the internal monitor. |
97 // It's applied after <code>isPrimary</code> parameter. | 98 // It's applied after <code>isPrimary</code> parameter. |
98 Insets? overscan; | 99 Insets? overscan; |
99 | 100 |
100 // If set, updates the display's rotation. | 101 // If set, updates the display's rotation. |
101 // Legal values are [0, 90, 180, 270]. The rotation is set clockwise, | 102 // Legal values are [0, 90, 180, 270]. The rotation is set clockwise, |
102 // relative to the display's vertical position. | 103 // relative to the display's vertical position. |
103 // It's applied after <code>overscan</code> paramter. | 104 // It's applied after <code>overscan</code> paramter. |
104 long? rotation; | 105 long? rotation; |
105 | 106 |
106 // If set, updates the display's logical bounds origin along x-axis. Applied | 107 // If set, updates the display's logical bounds origin along x-axis. Applied |
107 // together with <code>boundsOriginY</code>, if <code>boundsOriginY</code> | 108 // together with <code>boundsOriginY</code>, if <code>boundsOriginY</code> |
108 // is set. Note that, when updating the display origin, some constraints | 109 // is set. Note that, when updating the display origin, some constraints |
109 // will be applied, so the final bounds origin may be different than the one | 110 // will be applied, so the final bounds origin may be different than the one |
110 // set. The final bounds can be retrieved using $ref:getDisplayInfo. | 111 // set. The final bounds can be retrieved using $ref:getDisplayInfo. |
111 // The bounds origin is applied after <code>rotation</code>. | 112 // The bounds origin is applied after <code>rotation</code>. |
112 // The bounds origin cannot be changed on the primary display. Note that is | 113 // The bounds origin cannot be changed on the primary display. Note that is |
113 // also invalid to set bounds origin values if <code>isPrimary</code> is | 114 // also invalid to set bounds origin values if <code>isPrimary</code> is |
114 // also set (as <code>isPrimary</code> parameter is applied first). | 115 // also set (as <code>isPrimary</code> parameter is applied first). |
115 long? boundsOriginX; | 116 long? boundsOriginX; |
116 | 117 |
117 // If set, updates the display's logical bounds origin along y-axis. | 118 // If set, updates the display's logical bounds origin along y-axis. |
118 // See documentation for <code>boundsOriginX</code> parameter. | 119 // See documentation for <code>boundsOriginX</code> parameter. |
119 long? boundsOriginY; | 120 long? boundsOriginY; |
120 }; | 121 }; |
121 | 122 |
122 callback DisplayInfoCallback = void (DisplayUnitInfo[] displayInfo); | 123 callback DisplayInfoCallback = void (DisplayUnitInfo[] displayInfo); |
123 callback SetDisplayUnitInfoCallback = void(); | 124 callback SetDisplayUnitInfoCallback = void(); |
124 | 125 |
125 interface Functions { | 126 interface Functions { |
126 // Get the information of all attached display devices. | 127 // Get the information of all attached display devices. |
127 static void getDisplayInfo(DisplayInfoCallback callback); | 128 static void getDisplayInfo(DisplayInfoCallback callback); |
128 | 129 |
129 // Updates the properties for the display specified by |id|, according to | 130 // Updates the properties for the display specified by |id|, according to |
130 // the information provided in |info|. On failure, $ref:runtime.lastError | 131 // the information provided in |info|. On failure, $ref:runtime.lastError |
131 // will be set. | 132 // will be set. |
132 // |id|: The display's unique identifier. | 133 // |id|: The display's unique identifier. |
133 // |info|: The information about display properties that should be changed. | 134 // |info|: The information about display properties that should be changed. |
134 // A property will be changed only if a new value for it is specified in | 135 // A property will be changed only if a new value for it is specified in |
135 // |info|. | 136 // |info|. |
136 // |callback|: Empty function called when the function finishes. To find out | 137 // |callback|: Empty function called when the function finishes. To find out |
137 // whether the function succeeded, $ref:runtime.lastError should be | 138 // whether the function succeeded, $ref:runtime.lastError should be |
138 // queried. | 139 // queried. |
139 static void setDisplayProperties( | 140 static void setDisplayProperties( |
140 DOMString id, | 141 DOMString id, |
141 DisplayProperties info, | 142 DisplayProperties info, |
142 optional SetDisplayUnitInfoCallback callback); | 143 optional SetDisplayUnitInfoCallback callback); |
143 }; | 144 }; |
144 | 145 |
145 interface Events { | 146 interface Events { |
146 // Fired when anything changes to the display configuration. | 147 // Fired when anything changes to the display configuration. |
147 static void onDisplayChanged(); | 148 static void onDisplayChanged(); |
148 }; | 149 }; |
149 }; | 150 }; |
OLD | NEW |