| 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'); | 6 cr.exportPath('settings'); |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Mirrors DeviceType from ash/system/power/power_status.h. | 9 * Mirrors DeviceType from ash/system/power/power_status.h. |
| 10 * @enum {number} | 10 * @enum {number} |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 * @typedef {{ | 27 * @typedef {{ |
| 28 * charging: boolean, | 28 * charging: boolean, |
| 29 * calculating: boolean, | 29 * calculating: boolean, |
| 30 * percent: number, | 30 * percent: number, |
| 31 * statusText: string, | 31 * statusText: string, |
| 32 * }} | 32 * }} |
| 33 */ | 33 */ |
| 34 settings.BatteryStatus; | 34 settings.BatteryStatus; |
| 35 | 35 |
| 36 /** | 36 /** |
| 37 * Mirrors chromeos::settings::PowerHandler::IdleBehavior |
| 38 * @enum {number} |
| 39 */ |
| 40 settings.IdleBehavior = { |
| 41 DISPLAY_OFF_SLEEP: 0, |
| 42 DISPLAY_OFF_STAY_AWAKE: 1, |
| 43 DISPLAY_ON: 2, |
| 44 OTHER: 3, |
| 45 }; |
| 46 |
| 47 /** |
| 48 * Mirrors chromeos::PowerPolicyController::Action |
| 49 * @enum {number} |
| 50 */ |
| 51 settings.LidClosedBehavior = { |
| 52 SUSPEND: 0, |
| 53 STOP_SESSION: 1, |
| 54 SHUT_DOWN: 2, |
| 55 DO_NOTHING: 3, |
| 56 }; |
| 57 |
| 58 /** |
| 59 * @typedef {{ |
| 60 * idleBehavior: settings.IdleBehavior, |
| 61 * idleManaged: boolean, |
| 62 * lidClosedBehavior: settings.LidClosedBehavior, |
| 63 * lidClosedManaged: boolean, |
| 64 * }} |
| 65 */ |
| 66 settings.PowerManagementSettings; |
| 67 |
| 68 /** |
| 37 * @typedef {{name:string, value:string, preferred:boolean}} | 69 * @typedef {{name:string, value:string, preferred:boolean}} |
| 38 */ | 70 */ |
| 39 settings.NoteAppInfo; | 71 settings.NoteAppInfo; |
| 40 | 72 |
| 41 cr.define('settings', function() { | 73 cr.define('settings', function() { |
| 42 /** @interface */ | 74 /** @interface */ |
| 43 function DevicePageBrowserProxy() {} | 75 function DevicePageBrowserProxy() {} |
| 44 | 76 |
| 45 DevicePageBrowserProxy.prototype = { | 77 DevicePageBrowserProxy.prototype = { |
| 46 /** Initializes the mouse and touchpad handler. */ | 78 /** Initializes the mouse and touchpad handler. */ |
| (...skipping 18 matching lines...) Expand all Loading... |
| 65 /** Requests a power status update. */ | 97 /** Requests a power status update. */ |
| 66 updatePowerStatus: function() {}, | 98 updatePowerStatus: function() {}, |
| 67 | 99 |
| 68 /** | 100 /** |
| 69 * Sets the ID of the power source to use. | 101 * Sets the ID of the power source to use. |
| 70 * @param {string} powerSourceId ID of the power source. '' denotes the | 102 * @param {string} powerSourceId ID of the power source. '' denotes the |
| 71 * battery (no external power source). | 103 * battery (no external power source). |
| 72 */ | 104 */ |
| 73 setPowerSource: function(powerSourceId) {}, | 105 setPowerSource: function(powerSourceId) {}, |
| 74 | 106 |
| 107 /** Requests the current power management settings. */ |
| 108 requestPowerManagementSettings: function() {}, |
| 109 |
| 110 /** |
| 111 * Sets the idle power management behavior. |
| 112 * @param {settings.IdleBehavior} behavior Idle behavior. |
| 113 */ |
| 114 setIdleBehavior: function(behavior) {}, |
| 115 |
| 116 /** |
| 117 * Sets the lid-closed power management behavior. |
| 118 * @param {settings.LidClosedBehavior} behavior Lid-closed behavior. |
| 119 */ |
| 120 setLidClosedBehavior: function(behavior) {}, |
| 121 |
| 75 /** | 122 /** |
| 76 * |callback| is run when there is new note-taking app information | 123 * |callback| is run when there is new note-taking app information |
| 77 * available or after |requestNoteTakingApps| has been called. | 124 * available or after |requestNoteTakingApps| has been called. |
| 78 * @param {function(Array<settings.NoteAppInfo>, boolean):void} callback | 125 * @param {function(Array<settings.NoteAppInfo>, boolean):void} callback |
| 79 */ | 126 */ |
| 80 setNoteTakingAppsUpdatedCallback: function(callback) {}, | 127 setNoteTakingAppsUpdatedCallback: function(callback) {}, |
| 81 | 128 |
| 82 /** | 129 /** |
| 83 * Open up the play store with the given URL. | 130 * Open up the play store with the given URL. |
| 84 * @param {string} url | 131 * @param {string} url |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 updatePowerStatus: function() { | 186 updatePowerStatus: function() { |
| 140 chrome.send('updatePowerStatus'); | 187 chrome.send('updatePowerStatus'); |
| 141 }, | 188 }, |
| 142 | 189 |
| 143 /** @override */ | 190 /** @override */ |
| 144 setPowerSource: function(powerSourceId) { | 191 setPowerSource: function(powerSourceId) { |
| 145 chrome.send('setPowerSource', [powerSourceId]); | 192 chrome.send('setPowerSource', [powerSourceId]); |
| 146 }, | 193 }, |
| 147 | 194 |
| 148 /** @override */ | 195 /** @override */ |
| 196 requestPowerManagementSettings: function() { |
| 197 chrome.send('requestPowerManagementSettings'); |
| 198 }, |
| 199 |
| 200 /** @override */ |
| 201 setIdleBehavior: function(behavior) { |
| 202 chrome.send('setIdleBehavior', [behavior]); |
| 203 }, |
| 204 |
| 205 /** @override */ |
| 206 setLidClosedBehavior: function(behavior) { |
| 207 chrome.send('setLidClosedBehavior', [behavior]); |
| 208 }, |
| 209 |
| 210 /** @override */ |
| 149 setNoteTakingAppsUpdatedCallback: function(callback) { | 211 setNoteTakingAppsUpdatedCallback: function(callback) { |
| 150 cr.addWebUIListener('onNoteTakingAppsUpdated', callback); | 212 cr.addWebUIListener('onNoteTakingAppsUpdated', callback); |
| 151 }, | 213 }, |
| 152 | 214 |
| 153 /** @override */ | 215 /** @override */ |
| 154 showPlayStore: function(url) { | 216 showPlayStore: function(url) { |
| 155 chrome.send('showPlayStoreApps', [url]); | 217 chrome.send('showPlayStoreApps', [url]); |
| 156 }, | 218 }, |
| 157 | 219 |
| 158 /** @override */ | 220 /** @override */ |
| 159 requestNoteTakingApps: function() { | 221 requestNoteTakingApps: function() { |
| 160 chrome.send('requestNoteTakingApps'); | 222 chrome.send('requestNoteTakingApps'); |
| 161 }, | 223 }, |
| 162 | 224 |
| 163 /** @override */ | 225 /** @override */ |
| 164 setPreferredNoteTakingApp: function(appId) { | 226 setPreferredNoteTakingApp: function(appId) { |
| 165 chrome.send('setPreferredNoteTakingApp', [appId]); | 227 chrome.send('setPreferredNoteTakingApp', [appId]); |
| 166 }, | 228 }, |
| 167 }; | 229 }; |
| 168 | 230 |
| 169 return { | 231 return { |
| 170 DevicePageBrowserProxy: DevicePageBrowserProxy, | 232 DevicePageBrowserProxy: DevicePageBrowserProxy, |
| 171 DevicePageBrowserProxyImpl: DevicePageBrowserProxyImpl, | 233 DevicePageBrowserProxyImpl: DevicePageBrowserProxyImpl, |
| 172 }; | 234 }; |
| 173 }); | 235 }); |
| OLD | NEW |