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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 | 56 |
| 57 /** Requests a power status update. */ | 57 /** Requests a power status update. */ |
| 58 updatePowerStatus: function() {}, | 58 updatePowerStatus: function() {}, |
| 59 | 59 |
| 60 /** | 60 /** |
| 61 * Sets the ID of the power source to use. | 61 * Sets the ID of the power source to use. |
| 62 * @param {string} powerSourceId ID of the power source. '' denotes the | 62 * @param {string} powerSourceId ID of the power source. '' denotes the |
| 63 * battery (no external power source). | 63 * battery (no external power source). |
| 64 */ | 64 */ |
| 65 setPowerSource: function(powerSourceId) {}, | 65 setPowerSource: function(powerSourceId) {}, |
| 66 | |
| 67 /** | |
| 68 * |callback| is run when there is new note-taking app information | |
| 69 * available or after |requestNoteTakingApps| has been called. | |
| 70 * @param {function(Array<{name:string, value:string, preferred:boolean}>, | |
| 71 * boolean):void} callback Callback to run. | |
| 72 */ | |
| 73 onNoteTakingAppsUpdated: function(callback) {}, | |
| 74 | |
| 75 /** | |
| 76 * Request current note-taking app info. Invokes any callback registered in | |
| 77 * |onNoteTakingAppsUpdated|. | |
| 78 */ | |
| 79 requestNoteTakingApps: function() {}, | |
| 80 | |
| 81 /** | |
| 82 * Changes the preferred note taking app. | |
| 83 * @param {string} appId The app id. This should be a value retrieved from a | |
| 84 * |onNoteTakingAppsUpdated| callback. | |
| 85 */ | |
| 86 setPreferredNoteTakingApp: function(appId) {}, | |
| 66 }; | 87 }; |
| 67 | 88 |
| 68 /** | 89 /** |
| 69 * @constructor | 90 * @constructor |
| 70 * @implements {settings.DevicePageBrowserProxy} | 91 * @implements {settings.DevicePageBrowserProxy} |
| 71 */ | 92 */ |
| 72 function DevicePageBrowserProxyImpl() {} | 93 function DevicePageBrowserProxyImpl() {} |
| 73 cr.addSingletonGetter(DevicePageBrowserProxyImpl); | 94 cr.addSingletonGetter(DevicePageBrowserProxyImpl); |
| 74 | 95 |
| 75 DevicePageBrowserProxyImpl.prototype = { | 96 DevicePageBrowserProxyImpl.prototype = { |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 98 | 119 |
| 99 /** @override */ | 120 /** @override */ |
| 100 updatePowerStatus: function() { | 121 updatePowerStatus: function() { |
| 101 chrome.send('updatePowerStatus'); | 122 chrome.send('updatePowerStatus'); |
| 102 }, | 123 }, |
| 103 | 124 |
| 104 /** @override */ | 125 /** @override */ |
| 105 setPowerSource: function(powerSourceId) { | 126 setPowerSource: function(powerSourceId) { |
| 106 chrome.send('setPowerSource', [powerSourceId]); | 127 chrome.send('setPowerSource', [powerSourceId]); |
| 107 }, | 128 }, |
| 129 | |
| 130 /** @override */ | |
| 131 onNoteTakingAppsUpdated: function(callback) { | |
| 132 cr.addWebUIListener('onNoteTakingAppsUpdated', callback); | |
| 133 }, | |
|
stevenjb
2017/01/25 01:40:08
Hmm. I haven't seen this done as a proxy before. I
jdufault
2017/02/03 21:32:08
Done.
| |
| 134 | |
| 135 /** @override */ | |
| 136 requestNoteTakingApps: function() { | |
| 137 chrome.send('requestNoteTakingApps'); | |
| 138 }, | |
| 139 | |
| 140 /** @override */ | |
| 141 setPreferredNoteTakingApp: function(appId) { | |
| 142 chrome.send('setPreferredNoteTakingApp', [appId]); | |
| 143 }, | |
| 108 }; | 144 }; |
| 109 | 145 |
| 110 return { | 146 return { |
| 111 DevicePageBrowserProxy: DevicePageBrowserProxy, | 147 DevicePageBrowserProxy: DevicePageBrowserProxy, |
| 112 DevicePageBrowserProxyImpl: DevicePageBrowserProxyImpl, | 148 DevicePageBrowserProxyImpl: DevicePageBrowserProxyImpl, |
| 113 }; | 149 }; |
| 114 }); | 150 }); |
| OLD | NEW |