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

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

Issue 1258783009: Add functionality to Bluetooth settings UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 var batterySettings = $('battery-settings'); 8 var batterySettings = $('battery-settings');
9 var bluetoothSettings = $('bluetooth-settings'); 9 var bluetoothSettings = $('bluetooth-settings');
10 10
11 function initialize() { 11 function initialize() {
12 chrome.send('requestPowerInfo'); 12 chrome.send('requestPowerInfo');
13 chrome.send('requestBluetoothInfo');
13 14
14 var toggles = document.getElementsByClassName('menu-item-toggle'); 15 var toggles = document.getElementsByClassName('menu-item-toggle');
15 for (var i = 0; i < toggles.length; ++i) { 16 for (var i = 0; i < toggles.length; ++i) {
16 toggles[i].addEventListener('click', handleDrawerItemClick); 17 toggles[i].addEventListener('click', handleDrawerItemClick);
17 } 18 }
18 } 19 }
19 20
20 /** 21 /**
21 * Shows/hides a sidebar elements designated content. 22 * Shows/hides a sidebar elements designated content.
22 * The content is identified by the |data-content-id| attribute of the 23 * The content is identified by the |data-content-id| attribute of the
23 * sidebar element. This value is the ID of the HTML element to be toggled. 24 * sidebar element. This value is the ID of the HTML element to be toggled.
24 * @param {Event} e Contains information about the event which was fired. 25 * @param {Event} e Contains information about the event which was fired.
25 */ 26 */
26 function handleDrawerItemClick(e) { 27 function handleDrawerItemClick(e) {
27 var content = $(e.target.dataset.contentId); 28 var content = $(e.target.dataset.contentId);
28 content.hidden = !content.hidden; 29 content.hidden = !content.hidden;
29 } 30 }
30 31
31 // Return an object with all of the exports. 32 // Return an object with all of the exports.
32 return { 33 return {
33 initialize: initialize, 34 initialize: initialize,
34 batterySettings: batterySettings, 35 batterySettings: batterySettings,
35 bluetoothSettings: bluetoothSettings, 36 bluetoothSettings: bluetoothSettings,
36 }; 37 };
37 }); 38 });
38 39
39 document.addEventListener('DOMContentLoaded', device_emulator.initialize); 40 document.addEventListener('DOMContentLoaded', device_emulator.initialize);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698