Chromium Code Reviews| 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.
|
| + }); |
| }, |
| }); |