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

Side by Side Diff: chrome/browser/resources/settings/device_page/device_page_browser_proxy.js

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

Powered by Google App Engine
This is Rietveld 408576698