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

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: 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: { 16 category: {
17 type: Number, 17 type: Number,
18 }, 18 },
19 }, 19 },
20 20
21 /** 21 /**
22 * Returns whether the category default is set to enabled or not.
23 * @param {number} category The category to check.
24 * @return {boolean} True if the category default is set to enabled.
25 * @protected
26 */
27 isCategoryAllowed: function(category) {
28 var pref = this.getPref(this.computeCategoryPrefName(category));
29
30 // FullScreen is Allow vs. Ask.
31 if (category == settings.ContentSettingsTypes.FULLSCREEN)
32 return pref.value != settings.PermissionValues.ASK;
33
34 return pref.value != settings.PermissionValues.BLOCK;
35 },
36
37 /**
38 * Re-sets the category permission for a given origin. 22 * Re-sets the category permission for a given origin.
39 * @param {string} origin The origin to change the permission for. 23 * @param {string} origin The origin to change the permission for.
40 * @param {number} category The category permission to change. 24 * @param {number} category The category permission to change.
41 * @protected 25 * @protected
42 */ 26 */
43 resetCategoryPermissionForOrigin: function(origin, category) { 27 resetCategoryPermissionForOrigin: function(origin, category) {
44 var pref = JSON.parse(JSON.stringify(this.getPref( 28 var pref = JSON.parse(JSON.stringify(this.getPref(
45 this.computeCategoryExceptionsPrefName(category)))); 29 this.computeCategoryExceptionsPrefName(category))));
46 delete pref.value[origin + ',' + origin]; 30 delete pref.value[origin + ',' + origin];
47 delete pref.value[origin + ',*']; 31 delete pref.value[origin + ',*'];
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 return settings.ContentSettingsTypes[type]; 292 return settings.ContentSettingsTypes[type];
309 } 293 }
310 } 294 }
311 assertNotReached(); 295 assertNotReached();
312 return 0; 296 return 0;
313 }, 297 },
314 }; 298 };
315 299
316 /** @polymerBehavior */ 300 /** @polymerBehavior */
317 var SiteSettingsBehavior = [PrefsBehavior, SiteSettingsBehaviorImpl]; 301 var SiteSettingsBehavior = [PrefsBehavior, SiteSettingsBehaviorImpl];
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698