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

Side by Side Diff: chrome/browser/resources/chromeos/emulator/device_emulator.js

Issue 1206733002: ChromeOs Power Emulation Impl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: New Impl, Work with UI Created 5 years, 5 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 cr.define('device_emulator', function() { 5 cr.define('device_emulator', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Updates the UI with the battery status. 9 * Updates the UI with the battery status.
10 * @param {number} percent Battery percentage (out of 100). 10 * @param {number} percent Battery percentage (out of 100).
11 */ 11 */
12 function setBatteryInfo(percent) { 12 function setBatteryInfo(percent) {
13 var slider = $('battery-percent-slider'); 13 var slider = $('battery-percent-slider');
14 var text = $('battery-percent-text'); 14 var text = $('battery-percent-text');
15 15
16 slider.valueAsNumber = percent; 16 slider.valueAsNumber = percent;
17 text.valueAsNumber = percent; 17 text.valueAsNumber = percent;
18 } 18 }
19 19
20 /** 20 /**
21 * Event listener fired when the battery percent slider is moved and the mouse 21 * Event listener fired when the battery percent slider is moved and the mouse
22 * is released. Updates the Chrome OS UI. 22 * is released. Updates the Chrome OS UI.
23 * @param {Event} event Contains information about the event which was fired. 23 * @param {Event} event Contains information about the event which was fired.
24 */ 24 */
25 function onBatterySliderChange(event) { 25 function onBatterySliderChange(event) {
26 var slider = event.target; 26 var slider = event.target;
27 chrome.send('updateBatteryInfo', [slider.valueAsNumer]); 27 chrome.send('updateBatteryInfo', [slider.valueAsNumber]);
mozartalouis 2015/06/30 02:16:08 typo preventing slider from working properly
28 } 28 }
29 29
30 /** 30 /**
31 * Event listener fired when the battery percent slider is moved. Updates 31 * Event listener fired when the battery percent slider is moved. Updates
32 * the battery slider's associated text input. 32 * the battery slider's associated text input.
33 * @param {Event} event Contains information about the event which was fired. 33 * @param {Event} event Contains information about the event which was fired.
34 */ 34 */
35 function onBatterySliderInput(event) { 35 function onBatterySliderInput(event) {
36 var slider = event.target; 36 var slider = event.target;
37 var text = $('battery-percent-text'); 37 var text = $('battery-percent-text');
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 } 113 }
114 114
115 // Return an object with all of the exports. 115 // Return an object with all of the exports.
116 return { 116 return {
117 initialize: initialize, 117 initialize: initialize,
118 setBatteryInfo: setBatteryInfo, 118 setBatteryInfo: setBatteryInfo,
119 }; 119 };
120 }); 120 });
121 121
122 document.addEventListener('DOMContentLoaded', device_emulator.initialize); 122 document.addEventListener('DOMContentLoaded', device_emulator.initialize);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698