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

Side by Side Diff: chrome/browser/resources/settings/site_settings/site_settings_behavior.js

Issue 1698093007: Convert SiteSettingsCategory to use the HostContentSettingsMap instead of (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback Created 4 years, 10 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 Behavior common to Site Settings classes. 6 * @fileoverview Behavior common to Site Settings classes.
7 */ 7 */
8 8
9 /** @polymerBehavior */ 9 /** @polymerBehavior */
10 var SiteSettingsBehaviorImpl = { 10 var SiteSettingsBehaviorImpl = {
11 properties: { 11 properties: {
12 /** 12 /**
13 * The ID of the category this element is displaying data for. 13 * The ID of the category this element is displaying data for.
14 * See site_settings/constants.js for possible values. 14 * See site_settings/constants.js for possible values.
15 */ 15 */
16 category: Number, 16 category: Number,
17 }, 17 },
18 18
19 /** 19 /**
20 * Returns whether the category default is set to enabled or not.
21 * @param {number} category The category to check.
22 * @return {boolean} True if the category default is set to enabled.
23 * @protected
24 */
25 isCategoryAllowed: function(category) {
26 var pref = this.getPref(this.computeCategoryPrefName(category));
27
28 // FullScreen is Allow vs. Ask.
29 if (category == settings.ContentSettingsTypes.FULLSCREEN)
30 return pref.value != settings.PermissionValues.ASK;
31
32 return pref.value != settings.PermissionValues.BLOCK;
33 },
34
35 /**
36 * Re-sets the category permission for a given origin. 20 * Re-sets the category permission for a given origin.
37 * @param {string} origin The origin to change the permission for. 21 * @param {string} origin The origin to change the permission for.
38 * @param {number} category The category permission to change. 22 * @param {number} category The category permission to change.
39 * @protected 23 * @protected
40 */ 24 */
41 resetCategoryPermissionForOrigin: function(origin, category) { 25 resetCategoryPermissionForOrigin: function(origin, category) {
42 var pref = JSON.parse(JSON.stringify(this.getPref( 26 var pref = JSON.parse(JSON.stringify(this.getPref(
43 this.computeCategoryExceptionsPrefName(category)))); 27 this.computeCategoryExceptionsPrefName(category))));
44 delete pref.value[origin + ',' + origin]; 28 delete pref.value[origin + ',' + origin];
45 delete pref.value[origin + ',*']; 29 delete pref.value[origin + ',*'];
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 loadTimeData.getString('siteSettingsShowAll'); 273 loadTimeData.getString('siteSettingsShowAll');
290 default: 274 default:
291 assertNotReached(); 275 assertNotReached();
292 return ''; 276 return '';
293 } 277 }
294 }, 278 },
295 }; 279 };
296 280
297 /** @polymerBehavior */ 281 /** @polymerBehavior */
298 var SiteSettingsBehavior = [PrefsBehavior, SiteSettingsBehaviorImpl]; 282 var SiteSettingsBehavior = [PrefsBehavior, SiteSettingsBehaviorImpl];
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698