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 16 matching lines...) Expand all Loading... |
27 * Copy properties from |source| to |destination|. | 27 * Copy properties from |source| to |destination|. |
28 * @param {Object} source Source of the copy. | 28 * @param {Object} source Source of the copy. |
29 * @param {Object} destination Destination of the copy. | 29 * @param {Object} destination Destination of the copy. |
30 * @return {Object} |destination|. | 30 * @return {Object} |destination|. |
31 * @private | 31 * @private |
32 */ | 32 */ |
33 function copyAttributes_(source, destination) { | 33 function copyAttributes_(source, destination) { |
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) { |
45 if (window.i18nTemplate && window.templateData) | 45 if (window.i18nTemplate && window.loadTimeData) |
46 i18nTemplate.process(element, templateData); | 46 i18nTemplate.process(element, loadTimeData); |
47 }; | 47 } |
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 |