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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 remoting.ClientPlugin.HostDesktopImpl.prototype.onSizeUpdated = function( | 79 remoting.ClientPlugin.HostDesktopImpl.prototype.onSizeUpdated = function( |
80 message) { | 80 message) { |
81 this.width_ = base.getNumberAttr(message.data, 'width'); | 81 this.width_ = base.getNumberAttr(message.data, 'width'); |
82 this.height_ = base.getNumberAttr(message.data, 'height'); | 82 this.height_ = base.getNumberAttr(message.data, 'height'); |
83 this.xDpi_ = base.getNumberAttr(message.data, 'x_dpi', 96); | 83 this.xDpi_ = base.getNumberAttr(message.data, 'x_dpi', 96); |
84 this.yDpi_ = base.getNumberAttr(message.data, 'y_dpi', 96); | 84 this.yDpi_ = base.getNumberAttr(message.data, 'y_dpi', 96); |
85 this.raiseEvent(remoting.HostDesktop.Events.sizeChanged, | 85 this.raiseEvent(remoting.HostDesktop.Events.sizeChanged, |
86 this.getDimensions()); | 86 this.getDimensions()); |
87 }; | 87 }; |
88 | 88 |
89 /** | |
90 * This function is called by |this.plugin_| when the shape of the host | |
91 * desktop is changed. | |
92 * | |
93 * @param {remoting.ClientPluginMessage} message | |
94 * @return {Array<{left:number, top:number, width:number, height:number}>} | |
95 * rectangles of the desktop shape. | |
96 */ | |
97 remoting.ClientPlugin.HostDesktopImpl.prototype.onShapeUpdated = | |
98 function(message) { | |
99 var shapes = base.getArrayAttr(message.data, 'rects'); | |
100 var rects = shapes.map( | |
101 /** @param {Array<number>} shape */ | |
102 function(shape) { | |
103 if (!Array.isArray(shape) || shape.length != 4) { | |
104 throw 'Received invalid onDesktopShape message'; | |
105 } | |
106 var rect = {}; | |
107 rect.left = shape[0]; | |
108 rect.top = shape[1]; | |
109 rect.width = shape[2]; | |
110 rect.height = shape[3]; | |
111 return rect; | |
112 }); | |
113 | |
114 this.raiseEvent(remoting.HostDesktop.Events.shapeChanged, rects); | |
115 return rects; | |
116 }; | |
117 | |
118 }()); | 89 }()); |
OLD | NEW |