Chromium Code Reviews| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 /** | 58 /** |
| 59 * @interface | 59 * @interface |
| 60 */ | 60 */ |
| 61 base.Disposable = function() {}; | 61 base.Disposable = function() {}; |
| 62 base.Disposable.prototype.dispose = function() {}; | 62 base.Disposable.prototype.dispose = function() {}; |
| 63 | 63 |
| 64 /** | 64 /** |
| 65 * @constructor | 65 * @constructor |
| 66 * @param {...base.Disposable} var_args | 66 * @param {...base.Disposable} var_args |
| 67 * @implements {base.Disposable} | 67 * @implements {base.Disposable} |
| 68 * @suppress {reportUnknownTypes} | |
|
Jamie
2015/06/24 23:50:18
Can you add something to the CL description explai
James Hawkins
2015/06/25 00:00:44
You're not losing type checking. You're suppressi
Jamie
2015/06/25 00:10:49
So am I right in thinking that the old compiler (o
| |
| 68 */ | 69 */ |
| 69 base.Disposables = function(var_args) { | 70 base.Disposables = function(var_args) { |
| 70 /** | 71 /** |
| 71 * @type {Array<base.Disposable>} | 72 * @type {Array<base.Disposable>} |
| 72 * @private | 73 * @private |
| 73 */ | 74 */ |
| 74 this.disposables_ = Array.prototype.slice.call(arguments, 0); | 75 this.disposables_ = Array.prototype.slice.call(arguments, 0); |
| 75 }; | 76 }; |
| 76 | 77 |
| 77 /** | 78 /** |
| 78 * @param {...base.Disposable} var_args | 79 * @param {...base.Disposable} var_args |
| 80 * @suppress {reportUnknownTypes} | |
| 79 */ | 81 */ |
| 80 base.Disposables.prototype.add = function(var_args) { | 82 base.Disposables.prototype.add = function(var_args) { |
| 81 var disposables = Array.prototype.slice.call(arguments, 0); | 83 var disposables = Array.prototype.slice.call(arguments, 0); |
| 82 for (var i = 0; i < disposables.length; i++) { | 84 for (var i = 0; i < disposables.length; i++) { |
| 83 var current = /** @type {base.Disposable} */ (disposables[i]); | 85 var current = /** @type {base.Disposable} */ (disposables[i]); |
| 84 if (this.disposables_.indexOf(current) === -1) { | 86 if (this.disposables_.indexOf(current) === -1) { |
| 85 this.disposables_.push(current); | 87 this.disposables_.push(current); |
| 86 } | 88 } |
| 87 } | 89 } |
| 88 }; | 90 }; |
| 89 | 91 |
| 90 /** | 92 /** |
| 91 * @param {...base.Disposable} var_args Dispose |var_args| and remove | 93 * @param {...base.Disposable} var_args Dispose |var_args| and remove |
| 92 * them from the current object. | 94 * them from the current object. |
| 95 * @suppress {reportUnknownTypes} | |
| 93 */ | 96 */ |
| 94 base.Disposables.prototype.remove = function(var_args) { | 97 base.Disposables.prototype.remove = function(var_args) { |
| 95 var disposables = Array.prototype.slice.call(arguments, 0); | 98 var disposables = Array.prototype.slice.call(arguments, 0); |
| 96 for (var i = 0; i < disposables.length; i++) { | 99 for (var i = 0; i < disposables.length; i++) { |
| 97 var disposable = /** @type {base.Disposable} */ (disposables[i]); | 100 var disposable = /** @type {base.Disposable} */ (disposables[i]); |
| 98 var index = this.disposables_.indexOf(disposable); | 101 var index = this.disposables_.indexOf(disposable); |
| 99 if(index !== -1) { | 102 if(index !== -1) { |
| 100 this.disposables_.splice(index, 1); | 103 this.disposables_.splice(index, 1); |
| 101 disposable.dispose(); | 104 disposable.dispose(); |
| 102 } | 105 } |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 812 var height = Math.ceil(document.documentElement.scrollHeight + borderY); | 815 var height = Math.ceil(document.documentElement.scrollHeight + borderY); |
| 813 appWindow.outerBounds.width = width; | 816 appWindow.outerBounds.width = width; |
| 814 appWindow.outerBounds.height = height; | 817 appWindow.outerBounds.height = height; |
| 815 if (opt_centerWindow) { | 818 if (opt_centerWindow) { |
| 816 var screenWidth = screen.availWidth; | 819 var screenWidth = screen.availWidth; |
| 817 var screenHeight = screen.availHeight; | 820 var screenHeight = screen.availHeight; |
| 818 appWindow.outerBounds.left = Math.round((screenWidth - width) / 2); | 821 appWindow.outerBounds.left = Math.round((screenWidth - width) / 2); |
| 819 appWindow.outerBounds.top = Math.round((screenHeight - height) / 2); | 822 appWindow.outerBounds.top = Math.round((screenHeight - height) / 2); |
| 820 } | 823 } |
| 821 }; | 824 }; |
| OLD | NEW |