OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 /** | 5 /** |
6 * @fileoverview | 6 * @fileoverview |
7 * Provides an interface to manage the Host Desktop of a remoting session. | 7 * Provides an interface to manage the Host Desktop of a remoting session. |
8 */ | 8 */ |
9 | 9 |
10 var remoting = remoting || {}; | 10 var remoting = remoting || {}; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 * desktop is changed. | 99 * desktop is changed. |
100 * | 100 * |
101 * @param {remoting.ClientPluginMessage} message | 101 * @param {remoting.ClientPluginMessage} message |
102 * @return {Array<{left:number, top:number, width:number, height:number}>} | 102 * @return {Array<{left:number, top:number, width:number, height:number}>} |
103 * rectangles of the desktop shape. | 103 * rectangles of the desktop shape. |
104 */ | 104 */ |
105 remoting.ClientPlugin.HostDesktopImpl.prototype.onShapeUpdated = | 105 remoting.ClientPlugin.HostDesktopImpl.prototype.onShapeUpdated = |
106 function(message) { | 106 function(message) { |
107 var shapes = base.getArrayAttr(message.data, 'rects'); | 107 var shapes = base.getArrayAttr(message.data, 'rects'); |
108 var rects = shapes.map( | 108 var rects = shapes.map( |
109 /** @param {Array.<number>} shape */ | 109 /** @param {Array<number>} shape */ |
110 function(shape) { | 110 function(shape) { |
111 if (!Array.isArray(shape) || shape.length != 4) { | 111 if (!Array.isArray(shape) || shape.length != 4) { |
112 throw 'Received invalid onDesktopShape message'; | 112 throw 'Received invalid onDesktopShape message'; |
113 } | 113 } |
114 var rect = {}; | 114 var rect = {}; |
115 rect.left = shape[0]; | 115 rect.left = shape[0]; |
116 rect.top = shape[1]; | 116 rect.top = shape[1]; |
117 rect.width = shape[2]; | 117 rect.width = shape[2]; |
118 rect.height = shape[3]; | 118 rect.height = shape[3]; |
119 return rect; | 119 return rect; |
120 }); | 120 }); |
121 | 121 |
122 this.raiseEvent(remoting.HostDesktop.Events.shapeChanged, rects); | 122 this.raiseEvent(remoting.HostDesktop.Events.shapeChanged, rects); |
123 return rects; | 123 return rects; |
124 }; | 124 }; |
125 | 125 |
126 }()); | 126 }()); |
OLD | NEW |