Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1162)

Side by Side Diff: ui/webui/resources/js/cr.js

Issue 2921783003: WebUI: Fix/suppress some existing violations of no-restricted-globals. (Closed)
Patch Set: Fix svg Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 var target = opt_target ? document.getElementById(opt_target) : 313 var target = opt_target ?
314 ctor.getInstance(); 314 // Disable document.getElementById restriction since cr.js should
315 // not depend on util.js.
316 // eslint-disable-next-line no-restricted-properties
317 document.getElementById(opt_target) :
318 ctor.getInstance();
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
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 }();
OLDNEW
« no previous file with comments | « chrome/browser/resources/print_preview/settings/other_options_settings.js ('k') | ui/webui/resources/js/util.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698