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

Unified Diff: chrome/browser/resources/settings/site_settings/site_settings_category.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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/settings/site_settings/site_settings_category.js
diff --git a/chrome/browser/resources/settings/site_settings/site_settings_category.js b/chrome/browser/resources/settings/site_settings/site_settings_category.js
index 7d1a33ff425f29d59118561c613c5fd1164204a3..1ea28b3b076a3b607ca6f3d5a9b8a4f669fbb3d6 100644
--- a/chrome/browser/resources/settings/site_settings/site_settings_category.js
+++ b/chrome/browser/resources/settings/site_settings/site_settings_category.js
@@ -43,7 +43,10 @@ Polymer({
* example, the Location category can be set to Block/Ask so false, in that
* case, represents Block and true represents Ask.
*/
- categoryEnabled: Boolean,
+ categoryEnabled: {
+ type: Boolean,
+ notify: true,
tommycli 2016/02/17 18:18:06 nit: Is notify = true only for testing? If so, can
Finnur 2016/02/18 20:38:17 Correct. Done.
+ },
/**
* The origin that was selected by the user in the dropdown list.
@@ -82,27 +85,30 @@ Polymer({
case settings.ContentSettingsTypes.JAVASCRIPT:
case settings.ContentSettingsTypes.POPUPS:
// "Allowed" vs "Blocked".
- this.setPrefValue(this.computeCategoryPrefName(this.category),
- this.categoryEnabled ?
- settings.PermissionValues.ALLOW :
- settings.PermissionValues.BLOCK);
+ this.$.prefsApi.setDefaultValueForContentType(
+ this.category,
+ this.categoryEnabled ?
+ settings.PermissionValues.ALLOW :
+ settings.PermissionValues.BLOCK);
break;
case settings.ContentSettingsTypes.NOTIFICATIONS:
case settings.ContentSettingsTypes.GEOLOCATION:
case settings.ContentSettingsTypes.CAMERA:
case settings.ContentSettingsTypes.MIC:
// "Ask" vs "Blocked".
- this.setPrefValue(this.computeCategoryPrefName(this.category),
- this.categoryEnabled ?
- settings.PermissionValues.ASK :
- settings.PermissionValues.BLOCK);
+ this.$.prefsApi.setDefaultValueForContentType(
+ this.category,
+ this.categoryEnabled ?
+ settings.PermissionValues.ASK :
+ settings.PermissionValues.BLOCK);
break;
case settings.ContentSettingsTypes.FULLSCREEN:
// "Allowed" vs. "Ask first".
- this.setPrefValue(this.computeCategoryPrefName(this.category),
- this.categoryEnabled ?
- settings.PermissionValues.ALLOW :
- settings.PermissionValues.ASK);
+ this.$.prefsApi.setDefaultValueForContentType(
+ this.category,
+ this.categoryEnabled ?
+ settings.PermissionValues.ALLOW :
+ settings.PermissionValues.ASK);
break;
default:
assertNotReached();
@@ -114,6 +120,10 @@ Polymer({
* @private
*/
onCategoryChanged_: function() {
- this.categoryEnabled = this.isCategoryAllowed(this.category);
+ var self = this;
+ this.$.prefsApi.getDefaultValueForContentType(this.category).
+ then(function(enabled) {
+ self.categoryEnabled = enabled;
tommycli 2016/02/17 18:18:06 nit: Does it work if you use function() { .. }.bin
Finnur 2016/02/18 20:38:17 Done.
+ });
},
});

Powered by Google App Engine
This is Rietveld 408576698