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 9e28806a992de452440dadd66217d58200e935fa..2336aff1156c2cb900d43f60e13ede45958ff56c 100644 |
| --- a/chrome/browser/resources/settings/site_settings/site_settings_category.js |
| +++ b/chrome/browser/resources/settings/site_settings/site_settings_category.js |
| @@ -30,12 +30,19 @@ Polymer({ |
| }, |
| /** |
| - * Whether to show the '(recommended)' label prefix for permissions. |
| + * The description to be shown next to the slider. |
| */ |
| - showRecommendation: { |
| + sliderDescription_: String, |
| + |
| + /** |
| + * Used only for the Flash to persist the Ask First checkbox state. |
| + * Defaults to true, as the checkbox should be checked unless the user |
| + * has explicitly unchecked it or has the ALLOW setting on Flash. |
| + */ |
| + flashAskFirst_: { |
| type: Boolean, |
| value: true, |
| - }, |
| + } |
| }, |
| observers: [ |
| @@ -58,10 +65,10 @@ Polymer({ |
| }, |
| /** |
| - * A handler for flipping the toggle value. |
| + * A handler for changing the default permission value for a content type. |
| * @private |
| */ |
| - onToggleChange_: function(event) { |
| + onChangePermissionControl_: function(event) { |
| switch (this.category) { |
| case settings.ContentSettingsTypes.BACKGROUND_SYNC: |
| case settings.ContentSettingsTypes.COOKIES: |
| @@ -91,12 +98,13 @@ Polymer({ |
| settings.PermissionValues.BLOCK); |
| break; |
| case settings.ContentSettingsTypes.PLUGINS: |
| - // "Detect important" vs "Let me choose". |
|
Finnur
2016/08/29 11:26:27
Nit: These comments have been very helpful in the
tommycli
2016/08/29 18:31:46
Done. Thanks good suggestion.
|
| - this.browserProxy.setDefaultValueForContentType( |
| - this.category, |
| - this.categoryEnabled ? |
| - settings.PermissionValues.IMPORTANT_CONTENT : |
| - settings.PermissionValues.BLOCK); |
| + var value = settings.PermissionValues.BLOCK; |
| + if (this.categoryEnabled) { |
| + value = this.flashAskFirst_ ? |
| + settings.PermissionValues.IMPORTANT_CONTENT : |
| + settings.PermissionValues.ALLOW; |
| + } |
| + this.browserProxy.setDefaultValueForContentType(this.category, value); |
| break; |
| default: |
| assertNotReached('Invalid category: ' + this.category); |
| @@ -113,6 +121,27 @@ Polymer({ |
| this.category).then(function(setting) { |
| this.categoryEnabled = |
| this.computeIsSettingEnabled(this.category, setting); |
| + |
| + // Flash only shows ALLOW or BLOCK descriptions on the slider. |
| + var sliderSetting = setting; |
| + if (this.category == settings.ContentSettingsTypes.PLUGINS && |
| + setting == settings.PermissionValues.IMPORTANT_CONTENT) { |
| + sliderSetting = settings.PermissionValues.ALLOW; |
| + } |
| + this.sliderDescription_ = |
| + this.computeCategoryDesc(this.category, sliderSetting, true); |
| + |
| + // The checkbox should only be cleared when the Flash setting |
| + // is explicitly ALLOW. |
|
Finnur
2016/08/29 11:26:27
nit: s/explicitly/explicitly set to/
tommycli
2016/08/29 18:31:46
Done.
|
| + if (this.category == settings.ContentSettingsTypes.PLUGINS && |
| + setting == settings.PermissionValues.ALLOW) { |
| + this.flashAskFirst_ = false; |
| + } |
| }.bind(this)); |
| }, |
| + |
| + /** @private */ |
| + isFlashCategory_: function(category) { |
| + return category == settings.ContentSettingsTypes.PLUGINS; |
| + }, |
| }); |