| 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 * idleControlled: boolean, |
| 62 * lidClosedBehavior: settings.LidClosedBehavior, |
| 63 * lidClosedControlled: boolean, |
| 64 * hasLid: boolean, |
| 65 * }} |
| 66 */ |
| 67 settings.PowerManagementSettings; |
| 68 |
| 69 /** |
| 37 * @typedef {{name:string, | 70 * @typedef {{name:string, |
| 38 * value:string, | 71 * value:string, |
| 39 * preferred:boolean, | 72 * preferred:boolean, |
| 40 * supportsLockScreen: boolean}} | 73 * supportsLockScreen: boolean}} |
| 41 */ | 74 */ |
| 42 settings.NoteAppInfo; | 75 settings.NoteAppInfo; |
| 43 | 76 |
| 44 cr.define('settings', function() { | 77 cr.define('settings', function() { |
| 45 /** @interface */ | 78 /** @interface */ |
| 46 function DevicePageBrowserProxy() {} | 79 function DevicePageBrowserProxy() {} |
| (...skipping 21 matching lines...) Expand all Loading... |
| 68 /** Requests a power status update. */ | 101 /** Requests a power status update. */ |
| 69 updatePowerStatus: function() {}, | 102 updatePowerStatus: function() {}, |
| 70 | 103 |
| 71 /** | 104 /** |
| 72 * Sets the ID of the power source to use. | 105 * Sets the ID of the power source to use. |
| 73 * @param {string} powerSourceId ID of the power source. '' denotes the | 106 * @param {string} powerSourceId ID of the power source. '' denotes the |
| 74 * battery (no external power source). | 107 * battery (no external power source). |
| 75 */ | 108 */ |
| 76 setPowerSource: function(powerSourceId) {}, | 109 setPowerSource: function(powerSourceId) {}, |
| 77 | 110 |
| 111 /** Requests the current power management settings. */ |
| 112 requestPowerManagementSettings: function() {}, |
| 113 |
| 114 /** |
| 115 * Sets the idle power management behavior. |
| 116 * @param {settings.IdleBehavior} behavior Idle behavior. |
| 117 */ |
| 118 setIdleBehavior: function(behavior) {}, |
| 119 |
| 120 /** |
| 121 * Sets the lid-closed power management behavior. |
| 122 * @param {settings.LidClosedBehavior} behavior Lid-closed behavior. |
| 123 */ |
| 124 setLidClosedBehavior: function(behavior) {}, |
| 125 |
| 78 /** | 126 /** |
| 79 * |callback| is run when there is new note-taking app information | 127 * |callback| is run when there is new note-taking app information |
| 80 * available or after |requestNoteTakingApps| has been called. | 128 * available or after |requestNoteTakingApps| has been called. |
| 81 * @param {function(Array<settings.NoteAppInfo>, boolean):void} callback | 129 * @param {function(Array<settings.NoteAppInfo>, boolean):void} callback |
| 82 */ | 130 */ |
| 83 setNoteTakingAppsUpdatedCallback: function(callback) {}, | 131 setNoteTakingAppsUpdatedCallback: function(callback) {}, |
| 84 | 132 |
| 85 /** | 133 /** |
| 86 * Open up the play store with the given URL. | 134 * Open up the play store with the given URL. |
| 87 * @param {string} url | 135 * @param {string} url |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 updatePowerStatus: function() { | 190 updatePowerStatus: function() { |
| 143 chrome.send('updatePowerStatus'); | 191 chrome.send('updatePowerStatus'); |
| 144 }, | 192 }, |
| 145 | 193 |
| 146 /** @override */ | 194 /** @override */ |
| 147 setPowerSource: function(powerSourceId) { | 195 setPowerSource: function(powerSourceId) { |
| 148 chrome.send('setPowerSource', [powerSourceId]); | 196 chrome.send('setPowerSource', [powerSourceId]); |
| 149 }, | 197 }, |
| 150 | 198 |
| 151 /** @override */ | 199 /** @override */ |
| 200 requestPowerManagementSettings: function() { |
| 201 chrome.send('requestPowerManagementSettings'); |
| 202 }, |
| 203 |
| 204 /** @override */ |
| 205 setIdleBehavior: function(behavior) { |
| 206 chrome.send('setIdleBehavior', [behavior]); |
| 207 }, |
| 208 |
| 209 /** @override */ |
| 210 setLidClosedBehavior: function(behavior) { |
| 211 chrome.send('setLidClosedBehavior', [behavior]); |
| 212 }, |
| 213 |
| 214 /** @override */ |
| 152 setNoteTakingAppsUpdatedCallback: function(callback) { | 215 setNoteTakingAppsUpdatedCallback: function(callback) { |
| 153 cr.addWebUIListener('onNoteTakingAppsUpdated', callback); | 216 cr.addWebUIListener('onNoteTakingAppsUpdated', callback); |
| 154 }, | 217 }, |
| 155 | 218 |
| 156 /** @override */ | 219 /** @override */ |
| 157 showPlayStore: function(url) { | 220 showPlayStore: function(url) { |
| 158 chrome.send('showPlayStoreApps', [url]); | 221 chrome.send('showPlayStoreApps', [url]); |
| 159 }, | 222 }, |
| 160 | 223 |
| 161 /** @override */ | 224 /** @override */ |
| 162 requestNoteTakingApps: function() { | 225 requestNoteTakingApps: function() { |
| 163 chrome.send('requestNoteTakingApps'); | 226 chrome.send('requestNoteTakingApps'); |
| 164 }, | 227 }, |
| 165 | 228 |
| 166 /** @override */ | 229 /** @override */ |
| 167 setPreferredNoteTakingApp: function(appId) { | 230 setPreferredNoteTakingApp: function(appId) { |
| 168 chrome.send('setPreferredNoteTakingApp', [appId]); | 231 chrome.send('setPreferredNoteTakingApp', [appId]); |
| 169 }, | 232 }, |
| 170 }; | 233 }; |
| 171 | 234 |
| 172 return { | 235 return { |
| 173 DevicePageBrowserProxy: DevicePageBrowserProxy, | 236 DevicePageBrowserProxy: DevicePageBrowserProxy, |
| 174 DevicePageBrowserProxyImpl: DevicePageBrowserProxyImpl, | 237 DevicePageBrowserProxyImpl: DevicePageBrowserProxyImpl, |
| 175 }; | 238 }; |
| 176 }); | 239 }); |
| OLD | NEW |