Chromium Code Reviews| 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; |
| 11 | 11 |
| 12 /** @typedef {{eventName: string, uid: number}} */ | 12 /** @typedef {{eventName: string, uid: number}} */ |
| 13 var WebUIListener; | 13 var WebUIListener; |
| 14 | 14 |
| 15 /** Platform, package, object property, and Event support. **/ | 15 /** Platform, package, object property, and Event support. **/ |
| 16 var cr = function() { | 16 var cr = cr || function() { |
|
dpapad
2016/03/02 19:14:55
Every time cr.js is evaluated is overwriting anyth
| |
| 17 'use strict'; | 17 'use strict'; |
| 18 | 18 |
| 19 /** | 19 /** |
| 20 * Builds an object structure for the provided namespace path, | 20 * Builds an object structure for the provided namespace path, |
| 21 * ensuring that names that already exist are not overwritten. For | 21 * ensuring that names that already exist are not overwritten. For |
| 22 * example: | 22 * example: |
| 23 * "a.b.c" -> a = {};a.b={};a.b.c={}; | 23 * "a.b.c" -> a = {};a.b={};a.b.c={}; |
| 24 * @param {string} name Name of the object that this file defines. | 24 * @param {string} name Name of the object that this file defines. |
| 25 * @param {*=} opt_object The object to expose at the end of the path. | 25 * @param {*=} opt_object The object to expose at the end of the path. |
| 26 * @param {Object=} opt_objectToExportTo The object to add the path to; | 26 * @param {Object=} opt_objectToExportTo The object to add the path to; |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 415 function removeWebUIListener(listener) { | 415 function removeWebUIListener(listener) { |
| 416 var listenerExists = webUIListenerMap[listener.eventName] && | 416 var listenerExists = webUIListenerMap[listener.eventName] && |
| 417 webUIListenerMap[listener.eventName][listener.uid]; | 417 webUIListenerMap[listener.eventName][listener.uid]; |
| 418 if (listenerExists) { | 418 if (listenerExists) { |
| 419 delete webUIListenerMap[listener.eventName][listener.uid]; | 419 delete webUIListenerMap[listener.eventName][listener.uid]; |
| 420 return true; | 420 return true; |
| 421 } | 421 } |
| 422 return false; | 422 return false; |
| 423 } | 423 } |
| 424 | 424 |
| 425 console.log('cr.js running'); | |
| 425 return { | 426 return { |
| 426 addSingletonGetter: addSingletonGetter, | 427 addSingletonGetter: addSingletonGetter, |
| 427 createUid: createUid, | 428 createUid: createUid, |
| 428 define: define, | 429 define: define, |
| 429 defineProperty: defineProperty, | 430 defineProperty: defineProperty, |
| 430 dispatchPropertyChange: dispatchPropertyChange, | 431 dispatchPropertyChange: dispatchPropertyChange, |
| 431 dispatchSimpleEvent: dispatchSimpleEvent, | 432 dispatchSimpleEvent: dispatchSimpleEvent, |
| 432 exportPath: exportPath, | 433 exportPath: exportPath, |
| 433 getUid: getUid, | 434 getUid: getUid, |
| 434 makePublic: makePublic, | 435 makePublic: makePublic, |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 464 get isLinux() { | 465 get isLinux() { |
| 465 return /Linux/.test(navigator.userAgent); | 466 return /Linux/.test(navigator.userAgent); |
| 466 }, | 467 }, |
| 467 | 468 |
| 468 /** Whether this is on Android. */ | 469 /** Whether this is on Android. */ |
| 469 get isAndroid() { | 470 get isAndroid() { |
| 470 return /Android/.test(navigator.userAgent); | 471 return /Android/.test(navigator.userAgent); |
| 471 } | 472 } |
| 472 }; | 473 }; |
| 473 }(); | 474 }(); |
| OLD | NEW |