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

Unified Diff: chrome/browser/resources/settings/site_settings/site_settings_category.js

Issue 2280233002: [HBD] Update MD Site Settings Plugins section to show 3rd mode checkbox. (Closed)
Patch Set: merge origin/master Created 4 years, 4 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 0b4cae16424e77ec7ece83304e94482813beca72..1ac0e50328a31c6a94dc4ca82b03b4c6e46fba64 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,14 @@ Polymer({
settings.PermissionValues.BLOCK);
break;
case settings.ContentSettingsTypes.PLUGINS:
- // "Detect important" vs "Let me choose".
- this.browserProxy.setDefaultValueForContentType(
- this.category,
- this.categoryEnabled ?
- settings.PermissionValues.IMPORTANT_CONTENT :
- settings.PermissionValues.BLOCK);
+ // This category is tri-state: "Allow", "Block", "Ask before running".
+ 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,9 +122,30 @@ 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 set to ALLOW.
+ if (this.category == settings.ContentSettingsTypes.PLUGINS &&
+ setting == settings.PermissionValues.ALLOW) {
+ this.flashAskFirst_ = false;
+ }
}.bind(this));
},
+ /** @private */
+ isFlashCategory_: function(category) {
+ return category == settings.ContentSettingsTypes.PLUGINS;
+ },
+
/**
* Returns whether this is the Plugins category.
* @param {string} category The current category.

Powered by Google App Engine
This is Rietveld 408576698