Chromium Code Reviews| 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/common/system/chromeos/power/power_status.h. | 9 * Mirrors DeviceType from ash/common/system/chromeos/power/power_status.h. |
| 10 * @enum {number} | 10 * @enum {number} |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 /** | 26 /** |
| 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 /** | |
| 37 * @typedef {{name:string, value:string, preferred:boolean}} | |
| 38 */ | |
| 39 var NoteAppInfo; | |
|
stevenjb
2017/02/03 22:56:50
Prefer putting this into the settings namespace an
jdufault
2017/02/07 00:00:27
Done.
| |
| 40 | |
| 36 cr.define('settings', function() { | 41 cr.define('settings', function() { |
| 37 /** @interface */ | 42 /** @interface */ |
| 38 function DevicePageBrowserProxy() {} | 43 function DevicePageBrowserProxy() {} |
| 39 | 44 |
| 40 DevicePageBrowserProxy.prototype = { | 45 DevicePageBrowserProxy.prototype = { |
| 41 /** Initializes the mouse and touchpad handler. */ | 46 /** Initializes the mouse and touchpad handler. */ |
| 42 initializePointers: function() {}, | 47 initializePointers: function() {}, |
| 43 | 48 |
| 44 /** | 49 /** |
| 45 * Override to interact with the on-tap/on-keydown event on the Learn More | 50 * Override to interact with the on-tap/on-keydown event on the Learn More |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 56 | 61 |
| 57 /** Requests a power status update. */ | 62 /** Requests a power status update. */ |
| 58 updatePowerStatus: function() {}, | 63 updatePowerStatus: function() {}, |
| 59 | 64 |
| 60 /** | 65 /** |
| 61 * Sets the ID of the power source to use. | 66 * Sets the ID of the power source to use. |
| 62 * @param {string} powerSourceId ID of the power source. '' denotes the | 67 * @param {string} powerSourceId ID of the power source. '' denotes the |
| 63 * battery (no external power source). | 68 * battery (no external power source). |
| 64 */ | 69 */ |
| 65 setPowerSource: function(powerSourceId) {}, | 70 setPowerSource: function(powerSourceId) {}, |
| 71 | |
| 72 /** | |
| 73 * |callback| is run when there is new note-taking app information | |
| 74 * available or after |requestNoteTakingApps| has been called. | |
| 75 * @param {function(Array<NoteAppInfo>, boolean):void} callback | |
| 76 */ | |
| 77 setNoteTakingAppsUpdatedCallback: function(callback) {}, | |
| 78 | |
| 79 /** | |
| 80 * Request current note-taking app info. Invokes any callback registered in | |
| 81 * |onNoteTakingAppsUpdated|. | |
| 82 */ | |
| 83 requestNoteTakingApps: function() {}, | |
| 84 | |
| 85 /** | |
| 86 * Changes the preferred note taking app. | |
| 87 * @param {string} appId The app id. This should be a value retrieved from a | |
| 88 * |onNoteTakingAppsUpdated| callback. | |
| 89 */ | |
| 90 setPreferredNoteTakingApp: function(appId) {}, | |
| 66 }; | 91 }; |
| 67 | 92 |
| 68 /** | 93 /** |
| 69 * @constructor | 94 * @constructor |
| 70 * @implements {settings.DevicePageBrowserProxy} | 95 * @implements {settings.DevicePageBrowserProxy} |
| 71 */ | 96 */ |
| 72 function DevicePageBrowserProxyImpl() {} | 97 function DevicePageBrowserProxyImpl() {} |
| 73 cr.addSingletonGetter(DevicePageBrowserProxyImpl); | 98 cr.addSingletonGetter(DevicePageBrowserProxyImpl); |
| 74 | 99 |
| 75 DevicePageBrowserProxyImpl.prototype = { | 100 DevicePageBrowserProxyImpl.prototype = { |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 98 | 123 |
| 99 /** @override */ | 124 /** @override */ |
| 100 updatePowerStatus: function() { | 125 updatePowerStatus: function() { |
| 101 chrome.send('updatePowerStatus'); | 126 chrome.send('updatePowerStatus'); |
| 102 }, | 127 }, |
| 103 | 128 |
| 104 /** @override */ | 129 /** @override */ |
| 105 setPowerSource: function(powerSourceId) { | 130 setPowerSource: function(powerSourceId) { |
| 106 chrome.send('setPowerSource', [powerSourceId]); | 131 chrome.send('setPowerSource', [powerSourceId]); |
| 107 }, | 132 }, |
| 133 | |
| 134 /** @override */ | |
| 135 setNoteTakingAppsUpdatedCallback: function(callback) { | |
| 136 cr.addWebUIListener('onNoteTakingAppsUpdated', callback); | |
| 137 }, | |
| 138 | |
| 139 /** @override */ | |
| 140 requestNoteTakingApps: function() { | |
| 141 chrome.send('requestNoteTakingApps'); | |
| 142 }, | |
| 143 | |
| 144 /** @override */ | |
| 145 setPreferredNoteTakingApp: function(appId) { | |
| 146 chrome.send('setPreferredNoteTakingApp', [appId]); | |
| 147 }, | |
| 108 }; | 148 }; |
| 109 | 149 |
| 110 return { | 150 return { |
| 111 DevicePageBrowserProxy: DevicePageBrowserProxy, | 151 DevicePageBrowserProxy: DevicePageBrowserProxy, |
| 112 DevicePageBrowserProxyImpl: DevicePageBrowserProxyImpl, | 152 DevicePageBrowserProxyImpl: DevicePageBrowserProxyImpl, |
| 113 }; | 153 }; |
| 114 }); | 154 }); |
| OLD | NEW |