| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 * The global object. | 6 * The global object. |
| 7 * @type {!Object} | 7 * @type {!Object} |
| 8 * @const | 8 * @const |
| 9 */ | 9 */ |
| 10 var global = this; | 10 var global = this; |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 * Forwards public APIs to private implementations. | 303 * Forwards public APIs to private implementations. |
| 304 * @param {Function} ctor Constructor that have private implementations in its | 304 * @param {Function} ctor Constructor that have private implementations in its |
| 305 * prototype. | 305 * prototype. |
| 306 * @param {Array<string>} methods List of public method names that have their | 306 * @param {Array<string>} methods List of public method names that have their |
| 307 * underscored counterparts in constructor's prototype. | 307 * underscored counterparts in constructor's prototype. |
| 308 * @param {string=} opt_target Selector for target node. | 308 * @param {string=} opt_target Selector for target node. |
| 309 */ | 309 */ |
| 310 function makePublic(ctor, methods, opt_target) { | 310 function makePublic(ctor, methods, opt_target) { |
| 311 methods.forEach(function(method) { | 311 methods.forEach(function(method) { |
| 312 ctor[method] = function() { | 312 ctor[method] = function() { |
| 313 // Disable document.getElementById restriction since cr.js should not |
| 314 // depend on util.js. |
| 315 /* eslint-disable no-restricted-properties */ |
| 313 var target = opt_target ? document.getElementById(opt_target) : | 316 var target = opt_target ? document.getElementById(opt_target) : |
| 314 ctor.getInstance(); | 317 ctor.getInstance(); |
| 318 /* eslint-enable no-restricted-properties */ |
| 315 return target[method + '_'].apply(target, arguments); | 319 return target[method + '_'].apply(target, arguments); |
| 316 }; | 320 }; |
| 317 }); | 321 }); |
| 318 } | 322 } |
| 319 | 323 |
| 320 /** | 324 /** |
| 321 * The mapping used by the sendWithPromise mechanism to tie the Promise | 325 * The mapping used by the sendWithPromise mechanism to tie the Promise |
| 322 * returned to callers with the corresponding WebUI response. The mapping is | 326 * returned to callers with the corresponding WebUI response. The mapping is |
| 323 * from ID to the PromiseResolver helper; the ID is generated by | 327 * from ID to the PromiseResolver helper; the ID is generated by |
| 324 * sendWithPromise and is unique across all invocations of said method. | 328 * sendWithPromise and is unique across all invocations of said method. |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 get isAndroid() { | 480 get isAndroid() { |
| 477 return /Android/.test(navigator.userAgent); | 481 return /Android/.test(navigator.userAgent); |
| 478 }, | 482 }, |
| 479 | 483 |
| 480 /** Whether this is on iOS. */ | 484 /** Whether this is on iOS. */ |
| 481 get isIOS() { | 485 get isIOS() { |
| 482 return /iPad|iPhone|iPod/.test(navigator.platform); | 486 return /iPad|iPhone|iPod/.test(navigator.platform); |
| 483 } | 487 } |
| 484 }; | 488 }; |
| 485 }(); | 489 }(); |
| OLD | NEW |