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

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

Issue 2316633002: Site Settings Desktop: Implement tri-state 'Delete local data on exit'. (Closed)
Patch Set: Address feedback Created 4 years, 3 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 1ac0e50328a31c6a94dc4ca82b03b4c6e46fba64..b2553e3d24a603ef9af7ef601e4e3379a26f1a78 100644
--- a/chrome/browser/resources/settings/site_settings/site_settings_category.js
+++ b/chrome/browser/resources/settings/site_settings/site_settings_category.js
@@ -42,7 +42,17 @@ Polymer({
flashAskFirst_: {
type: Boolean,
value: true,
- }
+ },
+
+ /**
+ * Used only for Cookies to keep track of the Session Only state.
+ * Defaults to true, as the checkbox should be checked unless the user
+ * has explicitly unchecked it or has the ALLOW setting on Cookies.
+ */
+ cookiesSessionOnly_: {
+ type: Boolean,
+ value: true,
+ },
},
observers: [
@@ -71,7 +81,6 @@ Polymer({
onChangePermissionControl_: function(event) {
switch (this.category) {
case settings.ContentSettingsTypes.BACKGROUND_SYNC:
- case settings.ContentSettingsTypes.COOKIES:
case settings.ContentSettingsTypes.IMAGES:
case settings.ContentSettingsTypes.JAVASCRIPT:
case settings.ContentSettingsTypes.KEYGEN:
@@ -97,6 +106,17 @@ Polymer({
settings.PermissionValues.ASK :
settings.PermissionValues.BLOCK);
break;
+ case settings.ContentSettingsTypes.COOKIES:
+ // This category is tri-state: "Allow", "Block", "Keep data until
+ // browser quits".
+ var value = settings.PermissionValues.BLOCK;
+ if (this.categoryEnabled) {
+ value = this.cookiesSessionOnly_ ?
+ settings.PermissionValues.SESSION_ONLY :
+ settings.PermissionValues.ALLOW;
+ }
+ this.browserProxy.setDefaultValueForContentType(this.category, value);
+ break;
case settings.ContentSettingsTypes.PLUGINS:
// This category is tri-state: "Allow", "Block", "Ask before running".
var value = settings.PermissionValues.BLOCK;
@@ -128,15 +148,27 @@ Polymer({
if (this.category == settings.ContentSettingsTypes.PLUGINS &&
setting == settings.PermissionValues.IMPORTANT_CONTENT) {
sliderSetting = settings.PermissionValues.ALLOW;
+ } else if (
+ this.category == settings.ContentSettingsTypes.COOKIES &&
+ setting == settings.PermissionValues.SESSION_ONLY) {
+ 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;
+ if (this.category == settings.ContentSettingsTypes.PLUGINS) {
+ // The checkbox should only be cleared when the Flash setting
+ // is explicitly set to ALLOW.
+ if (setting == settings.PermissionValues.ALLOW)
+ this.flashAskFirst_ = false;
+ if (setting == settings.PermissionValues.IMPORTANT_CONTENT)
+ this.flashAskFirst_ = true;
+ } else if (
+ this.category == settings.ContentSettingsTypes.COOKIES) {
+ if (setting == settings.PermissionValues.ALLOW)
+ this.cookiesSessionOnly_ = false;
+ else if (setting == settings.PermissionValues.SESSION_ONLY)
+ this.cookiesSessionOnly_ = true;
}
}.bind(this));
},
@@ -146,6 +178,11 @@ Polymer({
return category == settings.ContentSettingsTypes.PLUGINS;
},
+ /** @private */
+ isCookiesCategory_: function(category) {
+ return category == settings.ContentSettingsTypes.COOKIES;
+ },
+
/**
* Returns whether this is the Plugins category.
* @param {string} category The current category.

Powered by Google App Engine
This is Rietveld 408576698