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

Unified Diff: chrome/browser/resources/options/content_settings_exceptions_area.js

Issue 3145002: Content settings: allow "session only" type for cookies exceptions (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 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
« no previous file with comments | « chrome/browser/dom_ui/content_settings_handler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/options/content_settings_exceptions_area.js
diff --git a/chrome/browser/resources/options/content_settings_exceptions_area.js b/chrome/browser/resources/options/content_settings_exceptions_area.js
index c0379062c49ece5b964905dabe159a5675e7268e..1642fb4ed4c14a2150ca2077cfde2b1503e53703 100644
--- a/chrome/browser/resources/options/content_settings_exceptions_area.js
+++ b/chrome/browser/resources/options/content_settings_exceptions_area.js
@@ -9,12 +9,14 @@ cr.define('options.contentSettings', function() {
/**
* Creates a new exceptions list item.
+ * @param {string} contentType The type of the list.
* @param {Array} exception A pair of the form [filter, setting].
* @constructor
* @extends {cr.ui.ListItem}
*/
- function ExceptionsListItem(exception) {
+ function ExceptionsListItem(contentType, exception) {
var el = cr.doc.createElement('li');
+ el.contentType = contentType;
el.dataItem = exception;
el.__proto__ = ExceptionsListItem.prototype;
el.decorate();
@@ -50,10 +52,18 @@ cr.define('options.contentSettings', function() {
var select = cr.doc.createElement('select');
var optionAllow = cr.doc.createElement('option');
optionAllow.textContent = templateData.allowException;
+ select.appendChild(optionAllow);
var optionBlock = cr.doc.createElement('option');
optionBlock.textContent = templateData.blockException;
- select.appendChild(optionAllow);
select.appendChild(optionBlock);
+
+ if (this.contentType == 'cookies') {
+ var optionSession = cr.doc.createElement('option');
+ optionSession.textContent = templateData.sessionException;
+ select.appendChild(optionSession);
+ this.optionSession = optionSession;
+ }
+
this.appendChild(select);
select.className = 'exceptionSetting hidden';
@@ -82,10 +92,8 @@ cr.define('options.contentSettings', function() {
// Handle events on the editable nodes.
input.oninput = function(event) {
listItem.inputValidityKnown = false;
- if (listItem.parentNode) {
- chrome.send('checkExceptionPatternValidity',
- [listItem.parentNode.contentType, input.value]);
- }
+ chrome.send('checkExceptionPatternValidity',
+ [listItem.contentType, input.value]);
};
var eventsToStop =
@@ -203,6 +211,8 @@ cr.define('options.contentSettings', function() {
this.optionAllow.selected = true;
else if (this.setting == 'block')
this.optionBlock.selected = true;
+ else if (this.setting == 'session')
+ this.optionSession.selected = true;
},
/**
@@ -226,6 +236,7 @@ cr.define('options.contentSettings', function() {
var select = this.select;
var optionAllow = this.optionAllow;
var optionBlock = this.optionBlock;
+ var optionSession = this.optionSession;
// Check that we have a valid pattern and if not we do not change the
// editing mode.
@@ -254,6 +265,8 @@ cr.define('options.contentSettings', function() {
this.setting = 'allow';
else if (optionBlock.selected)
this.setting = 'block';
+ else if (optionSession.selected)
+ this.setting = 'session';
settingLabel.textContent = this.settingForDisplay();
this.removeAttribute('editing');
@@ -292,7 +305,7 @@ cr.define('options.contentSettings', function() {
* @param {Object} entry The element from the data model for this row.
*/
createItem: function(entry) {
- return new ExceptionsListItem(entry);
+ return new ExceptionsListItem(this.contentType, entry);
},
/**
« no previous file with comments | « chrome/browser/dom_ui/content_settings_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698