| 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 /** |
| 11 * @typedef {{embeddingOrigin: string, | 11 * @typedef {{embeddingOrigin: string, |
| 12 * embeddingOriginForDisplay: string, |
| 13 * incognito: boolean, |
| 12 * origin: string, | 14 * origin: string, |
| 13 * originForDisplay: string, | 15 * originForDisplay: string, |
| 14 * setting: string, | 16 * setting: string, |
| 15 * source: string}} | 17 * source: string}} |
| 16 */ | 18 */ |
| 17 var SiteException; | 19 var SiteException; |
| 18 | 20 |
| 19 /** | 21 /** |
| 20 * @typedef {{location: string, | 22 * @typedef {{location: string, |
| 21 * notifications: string}} | 23 * notifications: string}} |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 */ | 92 */ |
| 91 getExceptionList: function(contentType) {}, | 93 getExceptionList: function(contentType) {}, |
| 92 | 94 |
| 93 /** | 95 /** |
| 94 * Resets the category permission for a given origin (expressed as primary | 96 * Resets the category permission for a given origin (expressed as primary |
| 95 * and secondary patterns). | 97 * and secondary patterns). |
| 96 * @param {string} primaryPattern The origin to change (primary pattern). | 98 * @param {string} primaryPattern The origin to change (primary pattern). |
| 97 * @param {string} secondaryPattern The embedding origin to change | 99 * @param {string} secondaryPattern The embedding origin to change |
| 98 * (secondary pattern). | 100 * (secondary pattern). |
| 99 * @param {string} contentType The name of the category to reset. | 101 * @param {string} contentType The name of the category to reset. |
| 102 * @param {boolean} incognito Whether this applies only to a current |
| 103 * incognito session exception. |
| 100 */ | 104 */ |
| 101 resetCategoryPermissionForOrigin: function( | 105 resetCategoryPermissionForOrigin: function( |
| 102 primaryPattern, secondaryPattern, contentType) {}, | 106 primaryPattern, secondaryPattern, contentType, incognito) {}, |
| 103 | 107 |
| 104 /** | 108 /** |
| 105 * Sets the category permission for a given origin (expressed as primary | 109 * Sets the category permission for a given origin (expressed as primary |
| 106 * and secondary patterns). | 110 * and secondary patterns). |
| 107 * @param {string} primaryPattern The origin to change (primary pattern). | 111 * @param {string} primaryPattern The origin to change (primary pattern). |
| 108 * @param {string} secondaryPattern The embedding origin to change | 112 * @param {string} secondaryPattern The embedding origin to change |
| 109 * (secondary pattern). | 113 * (secondary pattern). |
| 110 * @param {string} contentType The name of the category to change. | 114 * @param {string} contentType The name of the category to change. |
| 111 * @param {string} value The value to change the permission to. | 115 * @param {string} value The value to change the permission to. |
| 116 * @param {boolean} incognito Whether this rule applies only to the current |
| 117 * incognito session. |
| 112 */ | 118 */ |
| 113 setCategoryPermissionForOrigin: function( | 119 setCategoryPermissionForOrigin: function( |
| 114 primaryPattern, secondaryPattern, contentType, value) {}, | 120 primaryPattern, secondaryPattern, contentType, value, incognito) {}, |
| 115 | 121 |
| 116 /** | 122 /** |
| 117 * Checks whether a pattern is valid. | 123 * Checks whether a pattern is valid. |
| 118 * @param {string} pattern The pattern to check | 124 * @param {string} pattern The pattern to check |
| 119 * @return {!Promise<boolean>} True if the pattern is valid. | 125 * @return {!Promise<boolean>} True if the pattern is valid. |
| 120 */ | 126 */ |
| 121 isPatternValid: function(pattern) {}, | 127 isPatternValid: function(pattern) {}, |
| 122 | 128 |
| 123 /** | 129 /** |
| 124 * Gets the list of default capture devices for a given type of media. List | 130 * Gets the list of default capture devices for a given type of media. List |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 | 203 |
| 198 /** | 204 /** |
| 199 * Removes a particular USB device object permission by origin and embedding | 205 * Removes a particular USB device object permission by origin and embedding |
| 200 * origin. | 206 * origin. |
| 201 * @param {string} origin The origin to look up the permission for. | 207 * @param {string} origin The origin to look up the permission for. |
| 202 * @param {string} embeddingOrigin the embedding origin to look up. | 208 * @param {string} embeddingOrigin the embedding origin to look up. |
| 203 * @param {UsbDeviceDetails} usbDevice The USB device to revoke permission | 209 * @param {UsbDeviceDetails} usbDevice The USB device to revoke permission |
| 204 * for. | 210 * for. |
| 205 */ | 211 */ |
| 206 removeUsbDevice: function(origin, embeddingOrigin, usbDevice) {}, | 212 removeUsbDevice: function(origin, embeddingOrigin, usbDevice) {}, |
| 213 |
| 214 /** |
| 215 * Fetches the incognito status of the current profile (whether an icognito |
| 216 * profile exists). Returns the results via onIncognitoStatusChanged. |
| 217 */ |
| 218 updateIncognitoStatus: function() {}, |
| 207 }; | 219 }; |
| 208 | 220 |
| 209 /** | 221 /** |
| 210 * @constructor | 222 * @constructor |
| 211 * @implements {settings.SiteSettingsPrefsBrowserProxy} | 223 * @implements {settings.SiteSettingsPrefsBrowserProxy} |
| 212 */ | 224 */ |
| 213 function SiteSettingsPrefsBrowserProxyImpl() {} | 225 function SiteSettingsPrefsBrowserProxyImpl() {} |
| 214 | 226 |
| 215 // The singleton instance_ is replaced with a test version of this wrapper | 227 // The singleton instance_ is replaced with a test version of this wrapper |
| 216 // during testing. | 228 // during testing. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 227 return cr.sendWithPromise('getDefaultValueForContentType', contentType); | 239 return cr.sendWithPromise('getDefaultValueForContentType', contentType); |
| 228 }, | 240 }, |
| 229 | 241 |
| 230 /** @override */ | 242 /** @override */ |
| 231 getExceptionList: function(contentType) { | 243 getExceptionList: function(contentType) { |
| 232 return cr.sendWithPromise('getExceptionList', contentType); | 244 return cr.sendWithPromise('getExceptionList', contentType); |
| 233 }, | 245 }, |
| 234 | 246 |
| 235 /** @override */ | 247 /** @override */ |
| 236 resetCategoryPermissionForOrigin: function( | 248 resetCategoryPermissionForOrigin: function( |
| 237 primaryPattern, secondaryPattern, contentType) { | 249 primaryPattern, secondaryPattern, contentType, incognito) { |
| 238 chrome.send('resetCategoryPermissionForOrigin', | 250 chrome.send('resetCategoryPermissionForOrigin', |
| 239 [primaryPattern, secondaryPattern, contentType]); | 251 [primaryPattern, secondaryPattern, contentType, incognito]); |
| 240 }, | 252 }, |
| 241 | 253 |
| 242 /** @override */ | 254 /** @override */ |
| 243 setCategoryPermissionForOrigin: function( | 255 setCategoryPermissionForOrigin: function( |
| 244 primaryPattern, secondaryPattern, contentType, value) { | 256 primaryPattern, secondaryPattern, contentType, value, incognito) { |
| 245 chrome.send('setCategoryPermissionForOrigin', | 257 chrome.send('setCategoryPermissionForOrigin', |
| 246 [primaryPattern, secondaryPattern, contentType, value]); | 258 [primaryPattern, secondaryPattern, contentType, value, incognito]); |
| 247 }, | 259 }, |
| 248 | 260 |
| 249 /** @override */ | 261 /** @override */ |
| 250 isPatternValid: function(pattern) { | 262 isPatternValid: function(pattern) { |
| 251 return cr.sendWithPromise('isPatternValid', pattern); | 263 return cr.sendWithPromise('isPatternValid', pattern); |
| 252 }, | 264 }, |
| 253 | 265 |
| 254 /** @override */ | 266 /** @override */ |
| 255 getDefaultCaptureDevices: function(type) { | 267 getDefaultCaptureDevices: function(type) { |
| 256 chrome.send('getDefaultCaptureDevices', [type]); | 268 chrome.send('getDefaultCaptureDevices', [type]); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 274 /** @override */ | 286 /** @override */ |
| 275 removeCookie: function(path) { | 287 removeCookie: function(path) { |
| 276 chrome.send('removeCookie', [path]); | 288 chrome.send('removeCookie', [path]); |
| 277 }, | 289 }, |
| 278 | 290 |
| 279 /** @override */ | 291 /** @override */ |
| 280 removeAllCookies: function() { | 292 removeAllCookies: function() { |
| 281 return cr.sendWithPromise('removeAllCookies'); | 293 return cr.sendWithPromise('removeAllCookies'); |
| 282 }, | 294 }, |
| 283 | 295 |
| 284 | |
| 285 initializeProtocolHandlerList: function() { | 296 initializeProtocolHandlerList: function() { |
| 286 chrome.send('initializeProtocolHandlerList'); | 297 chrome.send('initializeProtocolHandlerList'); |
| 287 }, | 298 }, |
| 288 | 299 |
| 289 /** @override */ | 300 /** @override */ |
| 290 setProtocolHandlerDefault: function(enabled) { | 301 setProtocolHandlerDefault: function(enabled) { |
| 291 chrome.send('setHandlersEnabled', [enabled]); | 302 chrome.send('setHandlersEnabled', [enabled]); |
| 292 }, | 303 }, |
| 293 | 304 |
| 294 /** @override */ | 305 /** @override */ |
| 295 setProtocolDefault: function(protocol, url) { | 306 setProtocolDefault: function(protocol, url) { |
| 296 chrome.send('setDefault', [[protocol, url]]); | 307 chrome.send('setDefault', [[protocol, url]]); |
| 297 }, | 308 }, |
| 298 | 309 |
| 299 /** @override */ | 310 /** @override */ |
| 300 removeProtocolHandler: function(protocol, url) { | 311 removeProtocolHandler: function(protocol, url) { |
| 301 chrome.send('removeHandler', [[protocol, url]]); | 312 chrome.send('removeHandler', [[protocol, url]]); |
| 302 }, | 313 }, |
| 303 | 314 |
| 304 /** @override */ | 315 /** @override */ |
| 305 fetchUsbDevices: function() { | 316 fetchUsbDevices: function() { |
| 306 return cr.sendWithPromise('fetchUsbDevices'); | 317 return cr.sendWithPromise('fetchUsbDevices'); |
| 307 }, | 318 }, |
| 308 | 319 |
| 309 /** @override */ | 320 /** @override */ |
| 310 removeUsbDevice: function(origin, embeddingOrigin, usbDevice) { | 321 removeUsbDevice: function(origin, embeddingOrigin, usbDevice) { |
| 311 chrome.send('removeUsbDevice', [origin, embeddingOrigin, usbDevice]); | 322 chrome.send('removeUsbDevice', [origin, embeddingOrigin, usbDevice]); |
| 312 }, | 323 }, |
| 324 |
| 325 /** @override */ |
| 326 updateIncognitoStatus: function() { |
| 327 chrome.send('updateIncognitoStatus'); |
| 328 }, |
| 313 }; | 329 }; |
| 314 | 330 |
| 315 return { | 331 return { |
| 316 SiteSettingsPrefsBrowserProxy: SiteSettingsPrefsBrowserProxy, | 332 SiteSettingsPrefsBrowserProxy: SiteSettingsPrefsBrowserProxy, |
| 317 SiteSettingsPrefsBrowserProxyImpl: SiteSettingsPrefsBrowserProxyImpl, | 333 SiteSettingsPrefsBrowserProxyImpl: SiteSettingsPrefsBrowserProxyImpl, |
| 318 }; | 334 }; |
| 319 }); | 335 }); |
| OLD | NEW |