summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-11 00:35:26 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-11 00:35:26 +0000
commited3d763b1fd7dddebd6cb8391027fe309ccaabd8 (patch)
tree6fd76c222cbec8c440f37f25f95fa176f7862ef3 /chrome/browser/resources
parent109fca34375e8e6233b9e597f20f9b55fcb404e2 (diff)
downloadchromium_src-ed3d763b1fd7dddebd6cb8391027fe309ccaabd8.zip
chromium_src-ed3d763b1fd7dddebd6cb8391027fe309ccaabd8.tar.gz
chromium_src-ed3d763b1fd7dddebd6cb8391027fe309ccaabd8.tar.bz2
Content settings: allow "session only" type for cookies exceptions
BUG=50629 TEST=manual Review URL: http://codereview.chromium.org/3145002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55642 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources')
-rw-r--r--chrome/browser/resources/options/content_settings_exceptions_area.js27
1 files changed, 20 insertions, 7 deletions
diff --git a/chrome/browser/resources/options/content_settings_exceptions_area.js b/chrome/browser/resources/options/content_settings_exceptions_area.js
index c037906..1642fb4 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);
},
/**