| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * Class handling setting of the local app window shape to account for windows | 7 * Class handling setting of the local app window shape to account for windows |
| 8 * on the remote desktop, as well as any client-side UI. | 8 * on the remote desktop, as well as any client-side UI. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 'use strict'; | 11 'use strict'; |
| 12 | 12 |
| 13 /** @suppress {duplicate} */ | 13 /** @suppress {duplicate} */ |
| 14 var remoting = remoting || {}; | 14 var remoting = remoting || {}; |
| 15 | 15 |
| 16 /** @constructor */ | 16 /** @constructor */ |
| 17 remoting.WindowShape = function() { | 17 remoting.WindowShape = function() { |
| 18 /** | 18 /** |
| 19 * @type {Array.<{left: number, top: number, width: number, height: number}>} | 19 * @type {Array<{left: number, top: number, width: number, height: number}>} |
| 20 * @private | 20 * @private |
| 21 */ | 21 */ |
| 22 this.desktopRects_ = []; | 22 this.desktopRects_ = []; |
| 23 | 23 |
| 24 /** | 24 /** |
| 25 * @type {Array.<remoting.WindowShape.ClientUI>} | 25 * @type {Array<remoting.WindowShape.ClientUI>} |
| 26 * @private | 26 * @private |
| 27 */ | 27 */ |
| 28 this.clientUICallbacks_ = []; | 28 this.clientUICallbacks_ = []; |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @return {boolean} True if setShape is available. | 32 * @return {boolean} True if setShape is available. |
| 33 */ | 33 */ |
| 34 remoting.WindowShape.isSupported = function() { | 34 remoting.WindowShape.isSupported = function() { |
| 35 return base.isAppsV2() && | 35 return base.isAppsV2() && |
| 36 typeof(chrome.app.window.current().setShape) != 'undefined'; | 36 typeof(chrome.app.window.current().setShape) != 'undefined'; |
| 37 } | 37 } |
| 38 | 38 |
| 39 /** | 39 /** |
| 40 * Add a client-side UI measurement callback. | 40 * Add a client-side UI measurement callback. |
| 41 * | 41 * |
| 42 * @param {remoting.WindowShape.ClientUI} callback | 42 * @param {remoting.WindowShape.ClientUI} callback |
| 43 */ | 43 */ |
| 44 remoting.WindowShape.prototype.addCallback = function(callback) { | 44 remoting.WindowShape.prototype.addCallback = function(callback) { |
| 45 this.clientUICallbacks_.push(callback); | 45 this.clientUICallbacks_.push(callback); |
| 46 this.updateClientWindowShape(); | 46 this.updateClientWindowShape(); |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 /** | 49 /** |
| 50 * Set the region associated with the remote desktop windows. | 50 * Set the region associated with the remote desktop windows. |
| 51 * | 51 * |
| 52 * @param {Array.<{left: number, top: number, width: number, height: number}>} | 52 * @param {Array<{left: number, top: number, width: number, height: number}>} |
| 53 * rects | 53 * rects |
| 54 */ | 54 */ |
| 55 remoting.WindowShape.prototype.setDesktopRects = function(rects) { | 55 remoting.WindowShape.prototype.setDesktopRects = function(rects) { |
| 56 this.desktopRects_ = rects; | 56 this.desktopRects_ = rects; |
| 57 this.updateClientWindowShape(); | 57 this.updateClientWindowShape(); |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 /** | 60 /** |
| 61 * Update the client window shape. | 61 * Update the client window shape. |
| 62 */ | 62 */ |
| (...skipping 23 matching lines...) Expand all Loading... |
| 86 | 86 |
| 87 /** | 87 /** |
| 88 * @interface | 88 * @interface |
| 89 */ | 89 */ |
| 90 remoting.WindowShape.ClientUI = function () { | 90 remoting.WindowShape.ClientUI = function () { |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 /** | 93 /** |
| 94 * Add the context menu's bounding rectangle to the specified region. | 94 * Add the context menu's bounding rectangle to the specified region. |
| 95 * | 95 * |
| 96 * @param {Array.<{left: number, top: number, width: number, height: number}>} | 96 * @param {Array<{left: number, top: number, width: number, height: number}>} |
| 97 * rects | 97 * rects |
| 98 */ | 98 */ |
| 99 remoting.WindowShape.ClientUI.prototype.addToRegion = function(rects) {}; | 99 remoting.WindowShape.ClientUI.prototype.addToRegion = function(rects) {}; |
| 100 | 100 |
| 101 | 101 |
| 102 /** @type {remoting.WindowShape} */ | 102 /** @type {remoting.WindowShape} */ |
| 103 remoting.windowShape = new remoting.WindowShape(); | 103 remoting.windowShape = new remoting.WindowShape(); |
| OLD | NEW |