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
3 // found in the LICENSE file.
5 cr.define('device_emulator', function() {
8 var batterySettings = $('battery-settings');
9 var bluetoothSettings = $('bluetooth-settings');
11 function initialize() {
12 chrome.send('requestPowerInfo');
13 chrome.send('requestBluetoothInfo');
15 var toggles = document.getElementsByClassName('menu-item-toggle');
16 for (var i = 0; i < toggles.length; ++i) {
17 toggles[i].addEventListener('click', handleDrawerItemClick);
22 * Shows/hides a sidebar elements designated content.
23 * The content is identified by the |data-content-id| attribute of the
24 * sidebar element. This value is the ID of the HTML element to be toggled.
25 * @param {Event} e Contains information about the event which was fired.
27 function handleDrawerItemClick(e) {
28 var content = $(e.target.dataset.contentId);
29 content.hidden = !content.hidden;
32 // Return an object with all of the exports.
34 initialize: initialize,
35 batterySettings: batterySettings,
36 bluetoothSettings: bluetoothSettings,
40 document.addEventListener('DOMContentLoaded', device_emulator.initialize);