| 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 }; | 79 }; |
| 80 | 80 |
| 81 /** | 81 /** |
| 82 * This function is called by |this.plugin_| when the size of the host | 82 * This function is called by |this.plugin_| when the size of the host |
| 83 * desktop is changed. | 83 * desktop is changed. |
| 84 * | 84 * |
| 85 * @param {remoting.ClientPluginMessage} message | 85 * @param {remoting.ClientPluginMessage} message |
| 86 */ | 86 */ |
| 87 remoting.ClientPlugin.HostDesktopImpl.prototype.onSizeUpdated = function( | 87 remoting.ClientPlugin.HostDesktopImpl.prototype.onSizeUpdated = function( |
| 88 message) { | 88 message) { |
| 89 this.width_ = getNumberAttr(message.data, 'width'); | 89 this.width_ = base.getNumberAttr(message.data, 'width'); |
| 90 this.height_ = getNumberAttr(message.data, 'height'); | 90 this.height_ = base.getNumberAttr(message.data, 'height'); |
| 91 this.xDpi_ = getNumberAttr(message.data, 'x_dpi', 96); | 91 this.xDpi_ = base.getNumberAttr(message.data, 'x_dpi', 96); |
| 92 this.yDpi_ = getNumberAttr(message.data, 'y_dpi', 96); | 92 this.yDpi_ = base.getNumberAttr(message.data, 'y_dpi', 96); |
| 93 this.raiseEvent(remoting.HostDesktop.Events.sizeChanged, | 93 this.raiseEvent(remoting.HostDesktop.Events.sizeChanged, |
| 94 this.getDimensions()); | 94 this.getDimensions()); |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 /** | 97 /** |
| 98 * This function is called by |this.plugin_| when the shape of the host | 98 * This function is called by |this.plugin_| when the shape of the host |
| 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 = 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 |