| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 /** @fileoverview A helper object used for testing the Device page. */ | 5 /** @fileoverview A helper object used for testing the Device page. */ |
| 6 cr.exportPath('settings'); |
| 7 |
| 8 /** |
| 9 * Mirrors DeviceType from ash/common/system/chromeos/power/power_status.h. |
| 10 * @enum {number} |
| 11 */ |
| 12 settings.PowerDeviceType = { |
| 13 DEDICATED_CHARGER: 0, |
| 14 DUAL_ROLE_USB: 1, |
| 15 }; |
| 16 |
| 17 /** |
| 18 * @typedef {{ |
| 19 * id: string, |
| 20 * type: settings.PowerDeviceType, |
| 21 * description: string |
| 22 * }} |
| 23 */ |
| 24 settings.PowerSource; |
| 25 |
| 26 /** |
| 27 * @typedef {{ |
| 28 * charging: boolean, |
| 29 * calculating: boolean, |
| 30 * percent: number, |
| 31 * statusText: string, |
| 32 * }} |
| 33 */ |
| 34 settings.BatteryStatus; |
| 35 |
| 6 cr.define('settings', function() { | 36 cr.define('settings', function() { |
| 7 /** @interface */ | 37 /** @interface */ |
| 8 function DevicePageBrowserProxy() {} | 38 function DevicePageBrowserProxy() {} |
| 9 | 39 |
| 10 DevicePageBrowserProxy.prototype = { | 40 DevicePageBrowserProxy.prototype = { |
| 11 /** Initializes the mouse and touchpad handler. */ | 41 /** Initializes the mouse and touchpad handler. */ |
| 12 initializePointers: function() {}, | 42 initializePointers: function() {}, |
| 13 | 43 |
| 14 /** | 44 /** |
| 15 * Override to interact with the on-tap/on-keydown event on the Learn More | 45 * Override to interact with the on-tap/on-keydown event on the Learn More |
| 16 * link. | 46 * link. |
| 17 * @param {!Event} e | 47 * @param {!Event} e |
| 18 */ | 48 */ |
| 19 handleLinkEvent: function(e) {}, | 49 handleLinkEvent: function(e) {}, |
| 20 | 50 |
| 21 /** Initializes the keyboard WebUI handler. */ | 51 /** Initializes the keyboard WebUI handler. */ |
| 22 initializeKeyboard: function() {}, | 52 initializeKeyboard: function() {}, |
| 23 | 53 |
| 24 /** Shows the Ash keyboard shortcuts overlay. */ | 54 /** Shows the Ash keyboard shortcuts overlay. */ |
| 25 showKeyboardShortcutsOverlay: function() {}, | 55 showKeyboardShortcutsOverlay: function() {}, |
| 56 |
| 57 /** Requests a power status update. */ |
| 58 updatePowerStatus: function() {}, |
| 59 |
| 60 /** |
| 61 * Sets the ID of the power source to use. |
| 62 * @param {string} powerSourceId ID of the power source. '' denotes the |
| 63 * battery (no external power source). |
| 64 */ |
| 65 setPowerSource: function(powerSourceId) {}, |
| 26 }; | 66 }; |
| 27 | 67 |
| 28 /** | 68 /** |
| 29 * @constructor | 69 * @constructor |
| 30 * @implements {settings.DevicePageBrowserProxy} | 70 * @implements {settings.DevicePageBrowserProxy} |
| 31 */ | 71 */ |
| 32 function DevicePageBrowserProxyImpl() {} | 72 function DevicePageBrowserProxyImpl() {} |
| 33 cr.addSingletonGetter(DevicePageBrowserProxyImpl); | 73 cr.addSingletonGetter(DevicePageBrowserProxyImpl); |
| 34 | 74 |
| 35 DevicePageBrowserProxyImpl.prototype = { | 75 DevicePageBrowserProxyImpl.prototype = { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 48 | 88 |
| 49 /** @override */ | 89 /** @override */ |
| 50 initializeKeyboard: function() { | 90 initializeKeyboard: function() { |
| 51 chrome.send('initializeKeyboardSettings'); | 91 chrome.send('initializeKeyboardSettings'); |
| 52 }, | 92 }, |
| 53 | 93 |
| 54 /** @override */ | 94 /** @override */ |
| 55 showKeyboardShortcutsOverlay: function() { | 95 showKeyboardShortcutsOverlay: function() { |
| 56 chrome.send('showKeyboardShortcutsOverlay'); | 96 chrome.send('showKeyboardShortcutsOverlay'); |
| 57 }, | 97 }, |
| 98 |
| 99 /** @override */ |
| 100 updatePowerStatus: function() { |
| 101 chrome.send('updatePowerStatus'); |
| 102 }, |
| 103 |
| 104 /** @override */ |
| 105 setPowerSource: function(powerSourceId) { |
| 106 chrome.send('setPowerSource', [powerSourceId]); |
| 107 }, |
| 58 }; | 108 }; |
| 59 | 109 |
| 60 return { | 110 return { |
| 61 DevicePageBrowserProxy: DevicePageBrowserProxy, | 111 DevicePageBrowserProxy: DevicePageBrowserProxy, |
| 62 DevicePageBrowserProxyImpl: DevicePageBrowserProxyImpl, | 112 DevicePageBrowserProxyImpl: DevicePageBrowserProxyImpl, |
| 63 }; | 113 }; |
| 64 }); | 114 }); |
| OLD | NEW |