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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 220 | 220 |
| 221 /** | 221 /** |
| 222 * @param {!Object} object | 222 * @param {!Object} object |
| 223 * @return {boolean} True if the object is empty (equal to {}); false otherwise. | 223 * @return {boolean} True if the object is empty (equal to {}); false otherwise. |
| 224 */ | 224 */ |
| 225 base.isEmptyObject = function(object) { | 225 base.isEmptyObject = function(object) { |
| 226 return Object.keys(object).length === 0; | 226 return Object.keys(object).length === 0; |
| 227 }; | 227 }; |
| 228 | 228 |
| 229 /** | 229 /** |
| 230 * @param {!Map<K,V>} map | |
| 231 * @return {!Set<K>} A set of the keys in |map|. | |
| 232 * @template K | |
| 233 * @template V | |
| 234 */ | |
| 235 base.keySet = function(map) { | |
|
kelvinp
2015/07/20 18:00:51
Why can't we call map.keys() directly? Is this tr
John Williams
2015/07/20 21:43:10
I need a Set (so I can test for membership), but M
| |
| 236 return new Set(/** @type {!Iterable} */ (/** @type {*} */ (map.keys()))); | |
| 237 }; | |
| 238 | |
| 239 /** | |
| 230 * @type {boolean|undefined} | 240 * @type {boolean|undefined} |
| 231 * @private | 241 * @private |
| 232 */ | 242 */ |
| 233 base.isAppsV2_ = undefined; | 243 base.isAppsV2_ = undefined; |
| 234 | 244 |
| 235 /** | 245 /** |
| 236 * @return {boolean} True if this is a v2 app; false if it is a legacy app. | 246 * @return {boolean} True if this is a v2 app; false if it is a legacy app. |
| 237 */ | 247 */ |
| 238 base.isAppsV2 = function() { | 248 base.isAppsV2 = function() { |
| 239 if (base.isAppsV2_ === undefined) { | 249 if (base.isAppsV2_ === undefined) { |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 827 var height = Math.ceil(document.documentElement.scrollHeight + borderY); | 837 var height = Math.ceil(document.documentElement.scrollHeight + borderY); |
| 828 appWindow.outerBounds.width = width; | 838 appWindow.outerBounds.width = width; |
| 829 appWindow.outerBounds.height = height; | 839 appWindow.outerBounds.height = height; |
| 830 if (opt_centerWindow) { | 840 if (opt_centerWindow) { |
| 831 var screenWidth = screen.availWidth; | 841 var screenWidth = screen.availWidth; |
| 832 var screenHeight = screen.availHeight; | 842 var screenHeight = screen.availHeight; |
| 833 appWindow.outerBounds.left = Math.round((screenWidth - width) / 2); | 843 appWindow.outerBounds.left = Math.round((screenWidth - width) / 2); |
| 834 appWindow.outerBounds.top = Math.round((screenHeight - height) / 2); | 844 appWindow.outerBounds.top = Math.round((screenHeight - height) / 2); |
| 835 } | 845 } |
| 836 }; | 846 }; |
| OLD | NEW |