OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // require cr.js | 5 // require cr.js |
6 // require cr/event_target.js | 6 // require cr/event_target.js |
7 // require cr/ui.js | 7 // require cr/ui.js |
8 // require cr/ui/tabs.js | 8 // require cr/ui/tabs.js |
9 // require cr/ui/tree.js | 9 // require cr/ui/tree.js |
10 // require cr/util.js | 10 // require cr/util.js |
(...skipping 23 matching lines...) Expand all Loading... | |
34 for (var i in source) | 34 for (var i in source) |
35 destination[i] = source[i]; | 35 destination[i] = source[i]; |
36 return destination; | 36 return destination; |
37 }; | 37 }; |
38 | 38 |
39 /** | 39 /** |
40 * Apply localization to |element| with i18n_template.js if available. | 40 * Apply localization to |element| with i18n_template.js if available. |
41 * @param {Element} element Element to be localized. | 41 * @param {Element} element Element to be localized. |
42 * @private | 42 * @private |
43 */ | 43 */ |
44 function localize_(element) { | 44 function localize_(element) { |
Dan Beam
2014/09/23 00:13:28
nit: _ only goes at the end of private members, af
Evan Stade
2014/09/23 00:54:28
I don't really want to fix all the cases in this f
| |
45 if (window.i18nTemplate && window.templateData) | 45 if (i18nTemplate && loadTimeData) |
Dan Beam
2014/09/23 00:13:29
why did you remove the window.?
Evan Stade
2014/09/23 00:54:28
was it serving a purpose? It's not used before loa
Dan Beam
2014/09/23 01:03:03
avoids ReferenceErrors
Evan Stade
2014/09/23 01:07:31
I didn't run into any of those. Are you saying all
Evan Stade
2014/09/23 01:30:00
Done.
Dan Beam
2014/09/23 01:36:29
just when checking for the existence of a global (
| |
46 i18nTemplate.process(element, templateData); | 46 i18nTemplate.process(element, loadTimeData); |
47 }; | 47 }; |
Dan Beam
2014/09/23 00:13:29
nit: }; -> }
Evan Stade
2014/09/23 00:54:28
Done.
| |
48 | 48 |
49 /** | 49 /** |
50 * Returns 'N/A' (Not Available) text if |value| is undefined. | 50 * Returns 'N/A' (Not Available) text if |value| is undefined. |
51 * @param {Object} value Object to print. | 51 * @param {Object} value Object to print. |
52 * @return {string} 'N/A' or ''. | 52 * @return {string} 'N/A' or ''. |
53 * @private | 53 * @private |
54 */ | 54 */ |
55 function checkIfAvailable_(value) { | 55 function checkIfAvailable_(value) { |
56 return value === undefined ? 'N/A' : ''; | 56 return value === undefined ? 'N/A' : ''; |
57 } | 57 } |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
511 separator + | 511 separator + |
512 JSON.stringify(dumpTreeToObj(), null, 2) + '\n' + | 512 JSON.stringify(dumpTreeToObj(), null, 2) + '\n' + |
513 separator + | 513 separator + |
514 'Misc Statistics\n' + | 514 'Misc Statistics\n' + |
515 separator + | 515 separator + |
516 JSON.stringify(dumpStatisticsToObj(), null, 2); | 516 JSON.stringify(dumpStatisticsToObj(), null, 2); |
517 } | 517 } |
518 | 518 |
519 function onLoad() { | 519 function onLoad() { |
520 cr.ui.decorate('tabbox', cr.ui.TabBox); | 520 cr.ui.decorate('tabbox', cr.ui.TabBox); |
521 localize_(document); | |
522 | 521 |
523 cr.quota.onAvailableSpaceUpdated.addEventListener('update', | 522 cr.quota.onAvailableSpaceUpdated.addEventListener('update', |
524 handleAvailableSpace); | 523 handleAvailableSpace); |
525 cr.quota.onGlobalInfoUpdated.addEventListener('update', handleGlobalInfo); | 524 cr.quota.onGlobalInfoUpdated.addEventListener('update', handleGlobalInfo); |
526 cr.quota.onPerHostInfoUpdated.addEventListener('update', handlePerHostInfo); | 525 cr.quota.onPerHostInfoUpdated.addEventListener('update', handlePerHostInfo); |
527 cr.quota.onPerOriginInfoUpdated.addEventListener('update', | 526 cr.quota.onPerOriginInfoUpdated.addEventListener('update', |
528 handlePerOriginInfo); | 527 handlePerOriginInfo); |
529 cr.quota.onStatisticsUpdated.addEventListener('update', handleStatistics); | 528 cr.quota.onStatisticsUpdated.addEventListener('update', handleStatistics); |
530 cr.quota.requestInfo(); | 529 cr.quota.requestInfo(); |
531 | 530 |
532 $('refresh-button').addEventListener('click', cr.quota.requestInfo, false); | 531 $('refresh-button').addEventListener('click', cr.quota.requestInfo, false); |
533 $('dump-button').addEventListener('click', dump, false); | 532 $('dump-button').addEventListener('click', dump, false); |
534 } | 533 } |
535 | 534 |
536 cr.doc.addEventListener('DOMContentLoaded', onLoad, false); | 535 cr.doc.addEventListener('DOMContentLoaded', onLoad, false); |
537 })(); | 536 })(); |
OLD | NEW |