| 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 * A module that contains basic utility components and methods for the | 7 * A module that contains basic utility components and methods for the |
| 8 * chromoting project | 8 * chromoting project |
| 9 * | 9 * |
| 10 */ | 10 */ |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 * @type {Array.<base.Disposable>} | 71 * @type {Array.<base.Disposable>} |
| 72 * @private | 72 * @private |
| 73 */ | 73 */ |
| 74 this.disposables_ = Array.prototype.slice.call(arguments, 0); | 74 this.disposables_ = Array.prototype.slice.call(arguments, 0); |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 base.Disposables.prototype.dispose = function() { | 77 base.Disposables.prototype.dispose = function() { |
| 78 for (var i = 0; i < this.disposables_.length; i++) { | 78 for (var i = 0; i < this.disposables_.length; i++) { |
| 79 this.disposables_[i].dispose(); | 79 this.disposables_[i].dispose(); |
| 80 } | 80 } |
| 81 this.disposables_ = null; |
| 81 }; | 82 }; |
| 82 | 83 |
| 83 /** | 84 /** |
| 84 * A utility function to invoke |obj|.dispose without a null check on |obj|. | 85 * A utility function to invoke |obj|.dispose without a null check on |obj|. |
| 85 * @param {base.Disposable} obj | 86 * @param {base.Disposable} obj |
| 86 */ | 87 */ |
| 87 base.dispose = function(obj) { | 88 base.dispose = function(obj) { |
| 88 if (obj) { | 89 if (obj) { |
| 89 base.debug.assert(typeof obj.dispose == 'function'); | 90 base.debug.assert(typeof obj.dispose == 'function'); |
| 90 obj.dispose(); | 91 obj.dispose(); |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 */ | 603 */ |
| 603 base.resizeWindowToContent = function() { | 604 base.resizeWindowToContent = function() { |
| 604 var appWindow = chrome.app.window.current(); | 605 var appWindow = chrome.app.window.current(); |
| 605 var outerBounds = appWindow.outerBounds; | 606 var outerBounds = appWindow.outerBounds; |
| 606 var borderY = outerBounds.height - appWindow.innerBounds.height; | 607 var borderY = outerBounds.height - appWindow.innerBounds.height; |
| 607 appWindow.resizeTo(outerBounds.width, document.body.clientHeight + borderY); | 608 appWindow.resizeTo(outerBounds.width, document.body.clientHeight + borderY); |
| 608 // Sometimes, resizing the window causes its position to be reset to (0, 0), | 609 // Sometimes, resizing the window causes its position to be reset to (0, 0), |
| 609 // so restore it explicitly. | 610 // so restore it explicitly. |
| 610 appWindow.moveTo(outerBounds.left, outerBounds.top); | 611 appWindow.moveTo(outerBounds.left, outerBounds.top); |
| 611 }; | 612 }; |
| OLD | NEW |