| 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 28 matching lines...) Expand all Loading... |
| 39 background_sync: '', | 39 background_sync: '', |
| 40 camera: '', | 40 camera: '', |
| 41 cookies: '', | 41 cookies: '', |
| 42 geolocation: '', | 42 geolocation: '', |
| 43 javascript: '', | 43 javascript: '', |
| 44 mic: '', | 44 mic: '', |
| 45 midiDevices: '', | 45 midiDevices: '', |
| 46 notifications: '', | 46 notifications: '', |
| 47 plugins: '', | 47 plugins: '', |
| 48 popups: '', | 48 popups: '', |
| 49 subresource_filter: '', |
| 49 unsandboxed_plugins: '', | 50 unsandboxed_plugins: '', |
| 50 }, | 51 }, |
| 51 exceptions: { | 52 exceptions: { |
| 52 auto_downloads: [], | 53 auto_downloads: [], |
| 53 background_sync: [], | 54 background_sync: [], |
| 54 camera: [], | 55 camera: [], |
| 55 cookies: [], | 56 cookies: [], |
| 56 geolocation: [], | 57 geolocation: [], |
| 57 javascript: [], | 58 javascript: [], |
| 58 mic: [], | 59 mic: [], |
| 59 midiDevices: [], | 60 midiDevices: [], |
| 60 notifications: [], | 61 notifications: [], |
| 61 plugins: [], | 62 plugins: [], |
| 62 popups: [], | 63 popups: [], |
| 64 subresource_filter: [], |
| 63 unsandboxed_plugins: [], | 65 unsandboxed_plugins: [], |
| 64 }, | 66 }, |
| 65 }; | 67 }; |
| 66 | 68 |
| 67 /** | 69 /** |
| 68 * A test version of SiteSettingsPrefsBrowserProxy. Provides helper methods | 70 * A test version of SiteSettingsPrefsBrowserProxy. Provides helper methods |
| 69 * for allowing tests to know when a method was called, as well as | 71 * for allowing tests to know when a method was called, as well as |
| 70 * specifying mock responses. | 72 * specifying mock responses. |
| 71 * | 73 * |
| 72 * @constructor | 74 * @constructor |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 pref = this.prefs_.defaults.notifications; | 218 pref = this.prefs_.defaults.notifications; |
| 217 } else if (contentType == settings.ContentSettingsTypes.PDF_DOCUMENTS) { | 219 } else if (contentType == settings.ContentSettingsTypes.PDF_DOCUMENTS) { |
| 218 pref = this.prefs_.defaults.pdf_documents; | 220 pref = this.prefs_.defaults.pdf_documents; |
| 219 } else if (contentType == settings.ContentSettingsTypes.POPUPS) { | 221 } else if (contentType == settings.ContentSettingsTypes.POPUPS) { |
| 220 pref = this.prefs_.defaults.popups; | 222 pref = this.prefs_.defaults.popups; |
| 221 } else if (contentType == settings.ContentSettingsTypes.PLUGINS) { | 223 } else if (contentType == settings.ContentSettingsTypes.PLUGINS) { |
| 222 pref = this.prefs_.defaults.plugins; | 224 pref = this.prefs_.defaults.plugins; |
| 223 } else if ( | 225 } else if ( |
| 224 contentType == settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS) { | 226 contentType == settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS) { |
| 225 pref = this.prefs_.defaults.unsandboxed_plugins; | 227 pref = this.prefs_.defaults.unsandboxed_plugins; |
| 228 } |
| 229 else if (contentType == settings.ContentSettingsTypes.SUBRESOURCE_FILTER) { |
| 230 pref = this.prefs_.defaults.subresource_filter; |
| 226 } else { | 231 } else { |
| 227 console.log('getDefault received unknown category: ' + contentType); | 232 console.log('getDefault received unknown category: ' + contentType); |
| 228 } | 233 } |
| 229 | 234 |
| 230 assert(pref != undefined, 'Pref is missing for ' + contentType); | 235 assert(pref != undefined, 'Pref is missing for ' + contentType); |
| 231 return Promise.resolve(pref); | 236 return Promise.resolve(pref); |
| 232 }, | 237 }, |
| 233 | 238 |
| 234 /** @override */ | 239 /** @override */ |
| 235 getExceptionList: function(contentType) { | 240 getExceptionList: function(contentType) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 259 else if (contentType == settings.ContentSettingsTypes.PDF_DOCUMENTS) | 264 else if (contentType == settings.ContentSettingsTypes.PDF_DOCUMENTS) |
| 260 pref = this.prefs_.exceptions.pdf_documents; | 265 pref = this.prefs_.exceptions.pdf_documents; |
| 261 else if (contentType == settings.ContentSettingsTypes.PLUGINS) | 266 else if (contentType == settings.ContentSettingsTypes.PLUGINS) |
| 262 pref = this.prefs_.exceptions.plugins; | 267 pref = this.prefs_.exceptions.plugins; |
| 263 else if (contentType == settings.ContentSettingsTypes.PROTECTED_CONTENT) | 268 else if (contentType == settings.ContentSettingsTypes.PROTECTED_CONTENT) |
| 264 pref = this.prefs_.exceptions.protectedContent; | 269 pref = this.prefs_.exceptions.protectedContent; |
| 265 else if (contentType == settings.ContentSettingsTypes.POPUPS) | 270 else if (contentType == settings.ContentSettingsTypes.POPUPS) |
| 266 pref = this.prefs_.exceptions.popups; | 271 pref = this.prefs_.exceptions.popups; |
| 267 else if (contentType == settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS) | 272 else if (contentType == settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS) |
| 268 pref = this.prefs_.exceptions.unsandboxed_plugins; | 273 pref = this.prefs_.exceptions.unsandboxed_plugins; |
| 274 else if (contentType == settings.ContentSettingsTypes.SUBRESOURCE_FILTER) { |
| 275 pref = this.prefs_.exceptions.subresource_filter; |
| 276 } |
| 269 else | 277 else |
| 270 console.log('getExceptionList received unknown category: ' + contentType); | 278 console.log('getExceptionList received unknown category: ' + contentType); |
| 271 | 279 |
| 272 assert(pref != undefined, 'Pref is missing for ' + contentType); | 280 assert(pref != undefined, 'Pref is missing for ' + contentType); |
| 273 | 281 |
| 274 if (this.hasIncognito) { | 282 if (this.hasIncognito) { |
| 275 var incognitoElements = []; | 283 var incognitoElements = []; |
| 276 for (var i = 0; i < pref.length; ++i) | 284 for (var i = 0; i < pref.length; ++i) |
| 277 incognitoElements.push(Object.assign({incognito: true}, pref[i])); | 285 incognitoElements.push(Object.assign({incognito: true}, pref[i])); |
| 278 pref = pref.concat(incognitoElements); | 286 pref = pref.concat(incognitoElements); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 /** @override */ | 366 /** @override */ |
| 359 setProtocolDefault: function() { | 367 setProtocolDefault: function() { |
| 360 this.methodCalled('setProtocolDefault', arguments); | 368 this.methodCalled('setProtocolDefault', arguments); |
| 361 }, | 369 }, |
| 362 | 370 |
| 363 /** @override */ | 371 /** @override */ |
| 364 removeProtocolHandler: function() { | 372 removeProtocolHandler: function() { |
| 365 this.methodCalled('removeProtocolHandler', arguments); | 373 this.methodCalled('removeProtocolHandler', arguments); |
| 366 } | 374 } |
| 367 }; | 375 }; |
| OLD | NEW |