Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Side by Side Diff: chrome/test/data/webui/settings/test_site_settings_prefs_browser_proxy.js

Issue 2936003003: MD Settings: Set all content setting values in Site Details Javascript. (Closed)
Patch Set: Review comments, tests & cleanup. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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(
318 contentType, origin, embeddingOrigin) {
319 this.methodCalled(
320 'getCategoryPermissionForOrigin',
321 [contentType, origin, embeddingOrigin]);
322
323 // Convert |contentType| to its corresponding pref name, if different.
324 if (contentType == settings.ContentSettingsTypes.GEOLOCATION) {
325 contentType = 'geolocation';
326 } else if (contentType == settings.ContentSettingsTypes.CAMERA) {
327 contentType = 'camera';
328 } else if (contentType == settings.ContentSettingsTypes.MIC) {
329 contentType = 'mic';
330 } else if (contentType == settings.ContentSettingsTypes.BACKGROUND_SYNC) {
331 contentType = 'background_sync';
332 } else if (
333 contentType == settings.ContentSettingsTypes.AUTOMATIC_DOWNLOADS) {
334 contentType = 'auto_downloads';
335 } else if (
336 contentType == settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS) {
337 contentType = 'unsandboxed_plugins';
338 }
339
340 var setting = undefined;
341 this.prefs_.exceptions[contentType].some(function(originPrefs) {
342 if (originPrefs.origin == origin) {
343 setting = originPrefs.setting;
344 return true;
345 }
346 });
347 assert(
348 settings !== undefined,
349 'There was no exception set for origin: ' + origin +
350 ' and contentType: ' + contentType);
351
352 return Promise.resolve({
353 embeddingOrigin: embeddingOrigin,
354 embeddingDisplayName: '',
355 incognito: false,
356 origin: origin,
357 displayName: '',
358 setting: setting,
359 source: undefined
360 });
361 },
362
363 /** @override */
316 setCategoryPermissionForOrigin: function( 364 setCategoryPermissionForOrigin: function(
317 primaryPattern, secondaryPattern, contentType, value, incognito) { 365 primaryPattern, secondaryPattern, contentType, value, incognito) {
318 this.methodCalled('setCategoryPermissionForOrigin', 366 this.methodCalled('setCategoryPermissionForOrigin',
319 [primaryPattern, secondaryPattern, contentType, value, incognito]); 367 [primaryPattern, secondaryPattern, contentType, value, incognito]);
320 return Promise.resolve(); 368 return Promise.resolve();
321 }, 369 },
322 370
323 /** @override */ 371 /** @override */
324 fetchZoomLevels: function() { 372 fetchZoomLevels: function() {
325 cr.webUIListenerCallback('onZoomLevelsChanged', this.zoomList_); 373 cr.webUIListenerCallback('onZoomLevelsChanged', this.zoomList_);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 /** @override */ 421 /** @override */
374 removeProtocolHandler: function() { 422 removeProtocolHandler: function() {
375 this.methodCalled('removeProtocolHandler', arguments); 423 this.methodCalled('removeProtocolHandler', arguments);
376 }, 424 },
377 425
378 /** @override */ 426 /** @override */
379 updateIncognitoStatus: function() { 427 updateIncognitoStatus: function() {
380 this.methodCalled('updateIncognitoStatus', arguments); 428 this.methodCalled('updateIncognitoStatus', arguments);
381 } 429 }
382 }; 430 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698