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 /** | 5 /** |
| 6 * @fileoverview A helper object used from the "Site Settings" section to | 6 * @fileoverview A helper object used from the "Site Settings" section to |
| 7 * interact with the content settings prefs. | 7 * interact with the content settings prefs. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 * exceptions: ExceptionListPref}} | 33 * exceptions: ExceptionListPref}} |
| 34 */ | 34 */ |
| 35 var SiteSettingsPref; | 35 var SiteSettingsPref; |
| 36 | 36 |
| 37 /** | 37 /** |
| 38 * @typedef {{name: string, | 38 * @typedef {{name: string, |
| 39 * id: string}} | 39 * id: string}} |
| 40 */ | 40 */ |
| 41 var MediaPickerEntry; | 41 var MediaPickerEntry; |
| 42 | 42 |
| 43 /** | |
| 44 * @typedef {{name: string, | |
| 45 * product-id: Number, | |
| 46 * serial-number: string, | |
| 47 * vendor-id: Number}} | |
| 48 */ | |
| 49 var UsbDeviceDetails; | |
| 50 | |
| 51 /** | |
| 52 * @typedef {{embeddingOrigin: string, | |
| 53 * object: UsbDeviceDetails, | |
| 54 * objectName: string, | |
| 55 * origin: string, | |
| 56 * setting: string, | |
| 57 * source: string}} | |
| 58 */ | |
| 59 var UsbDeviceEntry; | |
| 60 | |
| 43 cr.define('settings', function() { | 61 cr.define('settings', function() { |
| 44 /** @interface */ | 62 /** @interface */ |
| 45 function SiteSettingsPrefsBrowserProxy() {} | 63 function SiteSettingsPrefsBrowserProxy() {} |
| 46 | 64 |
| 47 SiteSettingsPrefsBrowserProxy.prototype = { | 65 SiteSettingsPrefsBrowserProxy.prototype = { |
| 48 /** | 66 /** |
| 49 * Sets the default value for a site settings category. | 67 * Sets the default value for a site settings category. |
| 50 * @param {string} contentType The name of the category to change. | 68 * @param {string} contentType The name of the category to change. |
| 51 * @param {string} defaultValue The name of the value to set as default. | 69 * @param {string} defaultValue The name of the value to set as default. |
| 52 */ | 70 */ |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 * @param {string} url The url to use as the default. | 165 * @param {string} url The url to use as the default. |
| 148 */ | 166 */ |
| 149 setProtocolDefault: function(protocol, url) {}, | 167 setProtocolDefault: function(protocol, url) {}, |
| 150 | 168 |
| 151 /** | 169 /** |
| 152 * Deletes a certain protocol handler by url. | 170 * Deletes a certain protocol handler by url. |
| 153 * @param {string} protocol The protocol to delete the url from. | 171 * @param {string} protocol The protocol to delete the url from. |
| 154 * @param {string} url The url to delete. | 172 * @param {string} url The url to delete. |
| 155 */ | 173 */ |
| 156 removeProtocolHandler: function(protocol, url) {}, | 174 removeProtocolHandler: function(protocol, url) {}, |
| 175 | |
| 176 /** | |
| 177 * Fetches a list of all USB devices and the sites permitted to use them. | |
| 178 * @return {!Promise<Array<UsbDeviceEntry>>} The list of USB devices. | |
| 179 */ | |
| 180 fetchUsbDevices: function() {}, | |
| 181 | |
| 182 /** | |
| 183 * Removes a particular USB device object permission by origin and embedding | |
| 184 * origin. | |
| 185 * @param {string} origin The origin to look up the permission for. | |
| 186 * @param {string} embeddingOrigin the embedding origin to look up. | |
| 187 * @param {UsbDeviceDetails} object The USB device object to revoke | |
|
dschuyler
2016/08/11 23:28:07
nit: how about the name |usbDevice| instead of |ob
Finnur
2016/08/12 13:11:26
I like that idea.
| |
| 188 * permission for. | |
| 189 */ | |
| 190 removeUsbDevice: function(origin, embeddingOrigin, object) {}, | |
| 157 }; | 191 }; |
| 158 | 192 |
| 159 /** | 193 /** |
| 160 * @constructor | 194 * @constructor |
| 161 * @implements {settings.SiteSettingsPrefsBrowserProxy} | 195 * @implements {settings.SiteSettingsPrefsBrowserProxy} |
| 162 */ | 196 */ |
| 163 function SiteSettingsPrefsBrowserProxyImpl() {} | 197 function SiteSettingsPrefsBrowserProxyImpl() {} |
| 164 | 198 |
| 165 // The singleton instance_ is replaced with a test version of this wrapper | 199 // The singleton instance_ is replaced with a test version of this wrapper |
| 166 // during testing. | 200 // during testing. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 237 | 271 |
| 238 /** @override */ | 272 /** @override */ |
| 239 setProtocolDefault: function(protocol, url) { | 273 setProtocolDefault: function(protocol, url) { |
| 240 chrome.send('setDefault', [[protocol, url]]); | 274 chrome.send('setDefault', [[protocol, url]]); |
| 241 }, | 275 }, |
| 242 | 276 |
| 243 /** @override */ | 277 /** @override */ |
| 244 removeProtocolHandler: function(protocol, url) { | 278 removeProtocolHandler: function(protocol, url) { |
| 245 chrome.send('removeHandler', [[protocol, url]]); | 279 chrome.send('removeHandler', [[protocol, url]]); |
| 246 }, | 280 }, |
| 281 | |
| 282 /** @override */ | |
| 283 fetchUsbDevices: function() { | |
| 284 return cr.sendWithPromise('fetchUsbDevices'); | |
| 285 }, | |
| 286 | |
| 287 /** @override */ | |
| 288 removeUsbDevice: function(origin, embeddingOrigin, object) { | |
|
dschuyler
2016/08/11 23:28:07
Nit: is there another param name we can use other
Finnur
2016/08/12 13:11:26
Done.
| |
| 289 chrome.send('removeUsbDevice', [origin, embeddingOrigin, object]); | |
| 290 }, | |
| 247 }; | 291 }; |
| 248 | 292 |
| 249 return { | 293 return { |
| 250 SiteSettingsPrefsBrowserProxy: SiteSettingsPrefsBrowserProxy, | 294 SiteSettingsPrefsBrowserProxy: SiteSettingsPrefsBrowserProxy, |
| 251 SiteSettingsPrefsBrowserProxyImpl: SiteSettingsPrefsBrowserProxyImpl, | 295 SiteSettingsPrefsBrowserProxyImpl: SiteSettingsPrefsBrowserProxyImpl, |
| 252 }; | 296 }; |
| 253 }); | 297 }); |
| OLD | NEW |