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

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

Issue 1047793002: Web MIDI API: disallow to add custom exceptions on content settings UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: relocation Created 5 years, 9 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 | « no previous file | 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 12004a53efdaf3658adecae84492dbefeb1a3c32..97b6f43d071dc6f7a6de7a5bc90091ebf9998380 100644
--- a/chrome/browser/resources/options/content_settings_exceptions_area.js
+++ b/chrome/browser/resources/options/content_settings_exceptions_area.js
@@ -10,6 +10,21 @@ cr.define('options.contentSettings', function() {
/** @const */ var ArrayDataModel = cr.ui.ArrayDataModel;
/**
+ * Returns whether exceptions list for the type is editable.
+ *
+ * @param {string} contentType The type of the list.
+ */
+ function IsEditableType(contentType) {
+ // Exceptions of the following lists are not editable for now.
+ return !(contentType == 'notifications' ||
+ contentType == 'location' ||
+ contentType == 'fullscreen' ||
+ contentType == 'media-stream' ||
+ contentType == 'midi-sysex' ||
+ contentType == 'zoomlevels');
+ }
+
+ /**
* Creates a new exceptions list item.
*
* @param {string} contentType The type of the list.
@@ -124,7 +139,6 @@ cr.define('options.contentSettings', function() {
if (this.contentType == 'zoomlevels') {
this.deletable = true;
- this.editable = false;
var zoomLabel = cr.doc.createElement('span');
zoomLabel.textContent = this.dataItem.zoom;
@@ -151,14 +165,7 @@ cr.define('options.contentSettings', function() {
this.select = select;
this.updateEditables();
-
- // Editing notifications, geolocation and media-stream is disabled for
- // now.
- if (this.contentType == 'notifications' ||
- this.contentType == 'location' ||
- this.contentType == 'media-stream') {
- this.editable = false;
- }
+ this.editable = this.editable && IsEditableType(this.contentType);
// If the source of the content setting exception is not a user
// preference, that source controls the exception and the user cannot edit
@@ -540,11 +547,7 @@ cr.define('options.contentSettings', function() {
*/
isEditable: function() {
// Exceptions of the following lists are not editable for now.
- return !(this.contentType == 'notifications' ||
- this.contentType == 'location' ||
- this.contentType == 'fullscreen' ||
- this.contentType == 'media-stream' ||
- this.contentType == 'zoomlevels');
+ return IsEditableType(this.contentType);
},
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698