| 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 * Only used for tests. | 6 * Only used for tests. |
| 7 * @typedef {{ | 7 * @typedef {{ |
| 8 * auto_downloads: !Array<!RawSiteException>}, | 8 * auto_downloads: !Array<!RawSiteException>}, |
| 9 * background_sync: !Array<!RawSiteException>}, | 9 * background_sync: !Array<!RawSiteException>}, |
| 10 * camera: !Array<!RawSiteException>}, | 10 * camera: !Array<!RawSiteException>}, |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 'removeProtocolHandler', | 90 'removeProtocolHandler', |
| 91 'removeUsbDevice', | 91 'removeUsbDevice', |
| 92 'removeZoomLevel', | 92 'removeZoomLevel', |
| 93 'resetCategoryPermissionForOrigin', | 93 'resetCategoryPermissionForOrigin', |
| 94 'setCategoryPermissionForOrigin', | 94 'setCategoryPermissionForOrigin', |
| 95 'setDefaultValueForContentType', | 95 'setDefaultValueForContentType', |
| 96 'setProtocolDefault' | 96 'setProtocolDefault' |
| 97 ]); | 97 ]); |
| 98 | 98 |
| 99 /** @private {boolean} */ | 99 /** @private {boolean} */ |
| 100 this.hasIncognito = false; | 100 this.hasIncognito_ = false; |
| 101 | 101 |
| 102 /** @private {!SiteSettingsPref} */ | 102 /** @private {!SiteSettingsPref} */ |
| 103 this.prefs_ = prefsEmpty; | 103 this.prefs_ = prefsEmpty; |
| 104 | 104 |
| 105 /** @private {!Array<ZoomLevelEntry>} */ | 105 /** @private {!Array<ZoomLevelEntry>} */ |
| 106 this.zoomList_ = []; | 106 this.zoomList_ = []; |
| 107 | 107 |
| 108 /** @private {!Array<!UsbDeviceEntry>} */ | 108 /** @private {!Array<!UsbDeviceEntry>} */ |
| 109 this.usbDevices_ = []; | 109 this.usbDevices_ = []; |
| 110 | 110 |
| 111 /** @private {!Array<!ProtocolEntry>} */ | 111 /** @private {!Array<!ProtocolEntry>} */ |
| 112 this.protocolHandlers_ = []; | 112 this.protocolHandlers_ = []; |
| 113 | 113 |
| 114 /** @private {?CookieList} */ | 114 /** @private {?CookieList} */ |
| 115 this.cookieDetails_ = null; | 115 this.cookieDetails_ = null; |
| 116 | 116 |
| 117 /** @private {boolean} */ | 117 /** @private {boolean} */ |
| 118 this.isPatternValid_ = true; | 118 this.isPatternValid_ = true; |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 TestSiteSettingsPrefsBrowserProxy.prototype = { | 121 TestSiteSettingsPrefsBrowserProxy.prototype = { |
| 122 __proto__: settings.TestBrowserProxy.prototype, | 122 __proto__: settings.TestBrowserProxy.prototype, |
| 123 | 123 |
| 124 /** | 124 /** |
| 125 * Pretends an incognito session started or ended. | 125 * Pretends an incognito session started or ended. |
| 126 * @param {boolean} hasIncognito True for session started. | 126 * @param {boolean} hasIncognito True for session started. |
| 127 */ | 127 */ |
| 128 setIncognito: function(hasIncognito) { | 128 setIncognito: function(hasIncognito) { |
| 129 this.hasIncognito = hasIncognito; | 129 this.hasIncognito_ = hasIncognito; |
| 130 cr.webUIListenerCallback('onIncognitoStatusChanged', hasIncognito); | 130 cr.webUIListenerCallback('onIncognitoStatusChanged', hasIncognito); |
| 131 }, | 131 }, |
| 132 | 132 |
| 133 /** | 133 /** |
| 134 * Sets the prefs to use when testing. | 134 * Sets the prefs to use when testing. |
| 135 * @param {!SiteSettingsPref} prefs The prefs to set. | 135 * @param {!SiteSettingsPref} prefs The prefs to set. |
| 136 */ | 136 */ |
| 137 setPrefs: function(prefs) { | 137 setPrefs: function(prefs) { |
| 138 this.prefs_ = prefs; | 138 this.prefs_ = prefs; |
| 139 | 139 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 else if (contentType == settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS) | 272 else if (contentType == settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS) |
| 273 pref = this.prefs_.exceptions.unsandboxed_plugins; | 273 pref = this.prefs_.exceptions.unsandboxed_plugins; |
| 274 else if (contentType == settings.ContentSettingsTypes.SUBRESOURCE_FILTER) { | 274 else if (contentType == settings.ContentSettingsTypes.SUBRESOURCE_FILTER) { |
| 275 pref = this.prefs_.exceptions.subresource_filter; | 275 pref = this.prefs_.exceptions.subresource_filter; |
| 276 } | 276 } |
| 277 else | 277 else |
| 278 console.log('getExceptionList received unknown category: ' + contentType); | 278 console.log('getExceptionList received unknown category: ' + contentType); |
| 279 | 279 |
| 280 assert(pref != undefined, 'Pref is missing for ' + contentType); | 280 assert(pref != undefined, 'Pref is missing for ' + contentType); |
| 281 | 281 |
| 282 if (this.hasIncognito) { | 282 if (this.hasIncognito_) { |
| 283 var incognitoElements = []; | 283 var incognitoElements = []; |
| 284 for (var i = 0; i < pref.length; ++i) | 284 for (var i = 0; i < pref.length; ++i) |
| 285 incognitoElements.push(Object.assign({incognito: true}, pref[i])); | 285 incognitoElements.push(Object.assign({incognito: true}, pref[i])); |
| 286 pref = pref.concat(incognitoElements); | 286 pref = pref.concat(incognitoElements); |
| 287 } | 287 } |
| 288 | 288 |
| 289 return Promise.resolve(pref); | 289 return Promise.resolve(pref); |
| 290 }, | 290 }, |
| 291 | 291 |
| 292 /** @override */ | 292 /** @override */ |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 /** @override */ | 366 /** @override */ |
| 367 setProtocolDefault: function() { | 367 setProtocolDefault: function() { |
| 368 this.methodCalled('setProtocolDefault', arguments); | 368 this.methodCalled('setProtocolDefault', arguments); |
| 369 }, | 369 }, |
| 370 | 370 |
| 371 /** @override */ | 371 /** @override */ |
| 372 removeProtocolHandler: function() { | 372 removeProtocolHandler: function() { |
| 373 this.methodCalled('removeProtocolHandler', arguments); | 373 this.methodCalled('removeProtocolHandler', arguments); |
| 374 } | 374 } |
| 375 }; | 375 }; |
| OLD | NEW |