OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * Plot a line graph of data versus time on a HTML canvas element. | 6 * Plot a line graph of data versus time on a HTML canvas element. |
7 * | 7 * |
8 * @param {HTMLCanvasElement} plotCanvas The canvas on which the line graph is | 8 * @param {HTMLCanvasElement} plotCanvas The canvas on which the line graph is |
9 * drawn. | 9 * drawn. |
10 * @param {HTMLCanvasElement} legendCanvas The canvas on which the legend for | 10 * @param {HTMLCanvasElement} legendCanvas The canvas on which the legend for |
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 function showHideCallback(sectionId, buttonId, requestFunction) { | 829 function showHideCallback(sectionId, buttonId, requestFunction) { |
830 return function() { | 830 return function() { |
831 if ($(sectionId).hidden) { | 831 if ($(sectionId).hidden) { |
832 $(sectionId).hidden = false; | 832 $(sectionId).hidden = false; |
833 $(buttonId).textContent = loadTimeData.getString('hideButton'); | 833 $(buttonId).textContent = loadTimeData.getString('hideButton'); |
834 requestFunction(); | 834 requestFunction(); |
835 } else { | 835 } else { |
836 $(sectionId).hidden = true; | 836 $(sectionId).hidden = true; |
837 $(buttonId).textContent = loadTimeData.getString('showButton'); | 837 $(buttonId).textContent = loadTimeData.getString('showButton'); |
838 } | 838 } |
839 } | 839 }; |
840 } | 840 } |
841 | 841 |
842 var powerUI = { | 842 var powerUI = { |
843 showBatteryChargeData: showBatteryChargeData, | 843 showBatteryChargeData: showBatteryChargeData, |
844 showCpuIdleData: showCpuIdleData, | 844 showCpuIdleData: showCpuIdleData, |
845 showCpuFreqData: showCpuFreqData | 845 showCpuFreqData: showCpuFreqData |
846 }; | 846 }; |
847 | 847 |
848 document.addEventListener('DOMContentLoaded', function() { | 848 document.addEventListener('DOMContentLoaded', function() { |
849 $('battery-charge-section').hidden = true; | 849 $('battery-charge-section').hidden = true; |
850 $('battery-charge-show-button').onclick = showHideCallback( | 850 $('battery-charge-show-button').onclick = showHideCallback( |
851 'battery-charge-section', | 851 'battery-charge-section', |
852 'battery-charge-show-button', | 852 'battery-charge-show-button', |
853 requestBatteryChargeData); | 853 requestBatteryChargeData); |
854 $('battery-charge-reload-button').onclick = requestBatteryChargeData; | 854 $('battery-charge-reload-button').onclick = requestBatteryChargeData; |
855 $('sample-count-input').onclick = requestBatteryChargeData; | 855 $('sample-count-input').onclick = requestBatteryChargeData; |
856 | 856 |
857 $('cpu-idle-section').hidden = true; | 857 $('cpu-idle-section').hidden = true; |
858 $('cpu-idle-show-button').onclick = showHideCallback( | 858 $('cpu-idle-show-button').onclick = showHideCallback( |
859 'cpu-idle-section', 'cpu-idle-show-button', requestCpuIdleData); | 859 'cpu-idle-section', 'cpu-idle-show-button', requestCpuIdleData); |
860 $('cpu-idle-reload-button').onclick = requestCpuIdleData; | 860 $('cpu-idle-reload-button').onclick = requestCpuIdleData; |
861 | 861 |
862 $('cpu-freq-section').hidden = true; | 862 $('cpu-freq-section').hidden = true; |
863 $('cpu-freq-show-button').onclick = showHideCallback( | 863 $('cpu-freq-show-button').onclick = showHideCallback( |
864 'cpu-freq-section', 'cpu-freq-show-button', requestCpuFreqData); | 864 'cpu-freq-section', 'cpu-freq-show-button', requestCpuFreqData); |
865 $('cpu-freq-reload-button').onclick = requestCpuFreqData; | 865 $('cpu-freq-reload-button').onclick = requestCpuFreqData; |
866 }); | 866 }); |
OLD | NEW |