| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 'getExceptionList', | 87 'getExceptionList', |
| 88 'isPatternValid', | 88 'isPatternValid', |
| 89 'observeProtocolHandlers', | 89 'observeProtocolHandlers', |
| 90 'observeProtocolHandlersEnabledState', | 90 'observeProtocolHandlersEnabledState', |
| 91 'reloadCookies', | 91 'reloadCookies', |
| 92 'removeCookie', | 92 'removeCookie', |
| 93 'removeProtocolHandler', | 93 'removeProtocolHandler', |
| 94 'removeUsbDevice', | 94 'removeUsbDevice', |
| 95 'removeZoomLevel', | 95 'removeZoomLevel', |
| 96 'resetCategoryPermissionForOrigin', | 96 'resetCategoryPermissionForOrigin', |
| 97 'getCategoryPermissionForOrigin', |
| 97 'setCategoryPermissionForOrigin', | 98 'setCategoryPermissionForOrigin', |
| 98 'setDefaultValueForContentType', | 99 'setDefaultValueForContentType', |
| 99 'setProtocolDefault', | 100 'setProtocolDefault', |
| 100 'updateIncognitoStatus', | 101 'updateIncognitoStatus', |
| 101 ]); | 102 ]); |
| 102 | 103 |
| 103 /** @private {boolean} */ | 104 /** @private {boolean} */ |
| 104 this.hasIncognito_ = false; | 105 this.hasIncognito_ = false; |
| 105 | 106 |
| 106 /** @private {!SiteSettingsPref} */ | 107 /** @private {!SiteSettingsPref} */ |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 | 307 |
| 307 /** @override */ | 308 /** @override */ |
| 308 resetCategoryPermissionForOrigin: function( | 309 resetCategoryPermissionForOrigin: function( |
| 309 primaryPattern, secondaryPattern, contentType, incognito) { | 310 primaryPattern, secondaryPattern, contentType, incognito) { |
| 310 this.methodCalled('resetCategoryPermissionForOrigin', | 311 this.methodCalled('resetCategoryPermissionForOrigin', |
| 311 [primaryPattern, secondaryPattern, contentType, incognito]); | 312 [primaryPattern, secondaryPattern, contentType, incognito]); |
| 312 return Promise.resolve(); | 313 return Promise.resolve(); |
| 313 }, | 314 }, |
| 314 | 315 |
| 315 /** @override */ | 316 /** @override */ |
| 317 getCategoryPermissionForOrigin: function(contentType, origin) { |
| 318 this.methodCalled('getCategoryPermissionForOrigin', [contentType, origin]); |
| 319 |
| 320 // Convert |contentType| to its corresponding pref name, if different. |
| 321 if (contentType == settings.ContentSettingsTypes.GEOLOCATION) { |
| 322 contentType = 'geolocation'; |
| 323 } else if (contentType == settings.ContentSettingsTypes.CAMERA) { |
| 324 contentType = 'camera'; |
| 325 } else if (contentType == settings.ContentSettingsTypes.MIC) { |
| 326 contentType = 'mic'; |
| 327 } else if (contentType == settings.ContentSettingsTypes.BACKGROUND_SYNC) { |
| 328 contentType = 'background_sync'; |
| 329 } else if ( |
| 330 contentType == settings.ContentSettingsTypes.AUTOMATIC_DOWNLOADS) { |
| 331 contentType = 'auto_downloads'; |
| 332 } else if ( |
| 333 contentType == settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS) { |
| 334 contentType = 'unsandboxed_plugins'; |
| 335 } |
| 336 |
| 337 var setting = undefined; |
| 338 this.prefs_.exceptions[contentType].some(function(originPrefs) { |
| 339 if (originPrefs.origin == origin) { |
| 340 setting = originPrefs.setting; |
| 341 return true; |
| 342 } |
| 343 }); |
| 344 assert( |
| 345 settings !== undefined, |
| 346 'There was no exception set for origin: ' + origin + |
| 347 ' and contentType: ' + contentType); |
| 348 |
| 349 return Promise.resolve({ |
| 350 embeddingOrigin: '', |
| 351 embeddingDisplayName: '', |
| 352 incognito: false, |
| 353 origin: origin, |
| 354 displayName: '', |
| 355 setting: setting, |
| 356 source: undefined |
| 357 }); |
| 358 }, |
| 359 |
| 360 /** @override */ |
| 316 setCategoryPermissionForOrigin: function( | 361 setCategoryPermissionForOrigin: function( |
| 317 primaryPattern, secondaryPattern, contentType, value, incognito) { | 362 primaryPattern, secondaryPattern, contentType, value, incognito) { |
| 318 this.methodCalled('setCategoryPermissionForOrigin', | 363 this.methodCalled('setCategoryPermissionForOrigin', |
| 319 [primaryPattern, secondaryPattern, contentType, value, incognito]); | 364 [primaryPattern, secondaryPattern, contentType, value, incognito]); |
| 320 return Promise.resolve(); | 365 return Promise.resolve(); |
| 321 }, | 366 }, |
| 322 | 367 |
| 323 /** @override */ | 368 /** @override */ |
| 324 fetchZoomLevels: function() { | 369 fetchZoomLevels: function() { |
| 325 cr.webUIListenerCallback('onZoomLevelsChanged', this.zoomList_); | 370 cr.webUIListenerCallback('onZoomLevelsChanged', this.zoomList_); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 /** @override */ | 418 /** @override */ |
| 374 removeProtocolHandler: function() { | 419 removeProtocolHandler: function() { |
| 375 this.methodCalled('removeProtocolHandler', arguments); | 420 this.methodCalled('removeProtocolHandler', arguments); |
| 376 }, | 421 }, |
| 377 | 422 |
| 378 /** @override */ | 423 /** @override */ |
| 379 updateIncognitoStatus: function() { | 424 updateIncognitoStatus: function() { |
| 380 this.methodCalled('updateIncognitoStatus', arguments); | 425 this.methodCalled('updateIncognitoStatus', arguments); |
| 381 } | 426 } |
| 382 }; | 427 }; |
| OLD | NEW |