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

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

Issue 1882793002: Site Settings: Use only string values for permissions on the JS side. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback Created 4 years, 8 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_list.js
diff --git a/chrome/browser/resources/settings/site_settings/site_list.js b/chrome/browser/resources/settings/site_settings/site_list.js
index bd1927827a07239fbdb7cc7825cd4403740e73c0..2333c18cde8b9366e4f78053ed32ce3be8e0060f 100644
--- a/chrome/browser/resources/settings/site_settings/site_list.js
+++ b/chrome/browser/resources/settings/site_settings/site_list.js
@@ -50,11 +50,11 @@ Polymer({
/**
* The type of category this widget is displaying data for. Normally
- * either ALLOW or BLOCK, representing which sites are allowed or blocked
- * respectively.
+ * either 'allow' or 'block', representing which sites are allowed or
+ * blocked respectively.
*/
categorySubtype: {
- type: Number,
+ type: String,
value: settings.INVALID_CATEGORY_SUBTYPE,
},
@@ -160,7 +160,7 @@ Polymer({
this.browserProxy_.getExceptionList(this.category).then(
function(exceptionList) {
var allowExists = exceptionList.some(function(exception) {
- return exception.setting == settings.PermissionStringValues.ALLOW;
+ return exception.setting == settings.PermissionValues.ALLOW;
});
if (allowExists)
return;
@@ -250,13 +250,16 @@ Polymer({
appendSiteList_: function(sites, exceptionList) {
for (var i = 0; i < exceptionList.length; ++i) {
if (this.category != settings.ALL_SITES) {
+ if (exceptionList[i].setting == settings.PermissionValues.DEFAULT)
+ continue;
+
// Filter out 'Block' values if this list is handling 'Allow' items.
- if (exceptionList[i].setting == settings.PermissionStringValues.BLOCK &&
+ if (exceptionList[i].setting == settings.PermissionValues.BLOCK &&
this.categorySubtype != settings.PermissionValues.BLOCK) {
continue;
}
// Filter out 'Allow' values if this list is handling 'Block' items.
- if (exceptionList[i].setting == settings.PermissionStringValues.ALLOW &&
+ if (exceptionList[i].setting == settings.PermissionValues.ALLOW &&
this.categorySubtype != settings.PermissionValues.ALLOW) {
continue;
}
@@ -316,12 +319,18 @@ Polymer({
var lastEmbeddingOrigin = '';
for (var i = 0; i < sites.length; ++i) {
var origin = sites[i].origin;
- var embeddingOrigin = sites[i].embeddingOrigin;
-
var originForDisplay = origin.replace('[*.]', '');
+
+ var embeddingOrigin = sites[i].embeddingOrigin;
+ if (this.category == settings.ContentSettingsTypes.GEOLOCATION) {
+ if (embeddingOrigin == '')
+ embeddingOrigin = '*';
+ }
var embeddingOriginForDisplay = '';
- if (embeddingOrigin != '*' && origin != embeddingOrigin)
- embeddingOriginForDisplay = embeddingOrigin;
+ if (embeddingOrigin != '' && origin != embeddingOrigin) {
+ embeddingOriginForDisplay =
+ loadTimeData.getStringF('embeddedOnHost', embeddingOrigin);
+ }
// The All Sites category can contain duplicates (from other categories).
if (originForDisplay == lastOrigin &&
@@ -389,7 +398,7 @@ Polymer({
settings.PermissionValues.ALLOW :
settings.PermissionValues.BLOCK;
this.setCategoryPermissionForOrigin(
- origin, embeddingOrigin, value, this.category);
+ origin, embeddingOrigin, this.category, value);
}
},

Powered by Google App Engine
This is Rietveld 408576698