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

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

Issue 2846723002: [MD settings] separate all-sites from site-list (Closed)
Patch Set: review changes Created 3 years, 7 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 2ff2e966c092ad81322818a9d90e567ceabffabc..e95115fe7d38cee04a54fec5227ea0b27c8c41c4 100644
--- a/chrome/browser/resources/settings/site_settings/site_list.js
+++ b/chrome/browser/resources/settings/site_settings/site_list.js
@@ -56,14 +56,6 @@ Polymer({
},
/**
- * Whether this list is for the All Sites category.
- */
- allSites: {
- type: Boolean,
- value: false,
- },
-
- /**
* The type of category this widget is displaying data for. Normally
* either 'allow' or 'block', representing which sites are allowed or
* blocked respectively.
@@ -131,7 +123,7 @@ Polymer({
* @private
*/
siteWithinCategoryChanged_: function(category, site) {
- if (category == this.category || this.allSites)
+ if (category == this.category)
this.configureWidget_();
},
@@ -192,7 +184,7 @@ Polymer({
shouldHideResetButton_: function(exception, readOnlyList) {
return exception.enforcement ==
chrome.settingsPrivate.Enforcement.ENFORCED ||
- this.allSites || !(readOnlyList || !!exception.embeddingOrigin);
+ !(readOnlyList || !!exception.embeddingOrigin);
},
/**
@@ -204,7 +196,7 @@ Polymer({
shouldHideActionMenu_: function(exception, readOnlyList) {
return exception.enforcement ==
chrome.settingsPrivate.Enforcement.ENFORCED ||
- this.allSites || readOnlyList || !!exception.embeddingOrigin;
+ readOnlyList || !!exception.embeddingOrigin;
},
/**
@@ -233,18 +225,11 @@ Polymer({
* @private
*/
populateList_: function() {
- if (this.allSites) {
- this.getAllSitesList_().then(function(lists) {
- this.processExceptions_(lists);
- this.closeActionMenu_();
- }.bind(this));
- } else {
- this.browserProxy_.getExceptionList(this.category).then(
- function(exceptionList) {
+ this.browserProxy_.getExceptionList(this.category)
+ .then(function(exceptionList) {
this.processExceptions_([exceptionList]);
this.closeActionMenu_();
- }.bind(this));
- }
+ }.bind(this));
},
/**
@@ -258,9 +243,8 @@ Polymer({
for (var i = 0; i < data.length; ++i) {
var exceptionList = data[i];
for (var k = 0; k < exceptionList.length; ++k) {
- if (!this.allSites &&
- (exceptionList[k].setting == settings.PermissionValues.DEFAULT ||
- exceptionList[k].setting != this.categorySubtype)) {
+ if (exceptionList[k].setting == settings.PermissionValues.DEFAULT ||
+ exceptionList[k].setting != this.categorySubtype) {
continue;
}
@@ -271,65 +255,13 @@ Polymer({
},
/**
- * Retrieves a list of all known sites (any category/setting).
- * @return {!Promise}
- * @private
- */
- getAllSitesList_: function() {
- var promiseList = [];
- for (var type in settings.ContentSettingsTypes) {
- if (settings.ContentSettingsTypes[type] ==
- settings.ContentSettingsTypes.PROTOCOL_HANDLERS ||
- settings.ContentSettingsTypes[type] ==
- settings.ContentSettingsTypes.USB_DEVICES ||
- settings.ContentSettingsTypes[type] ==
- settings.ContentSettingsTypes.ZOOM_LEVELS) {
- // Some categories store their data in a custom way.
- continue;
- }
-
- promiseList.push(
- this.browserProxy_.getExceptionList(
- settings.ContentSettingsTypes[type]));
- }
-
- return Promise.all(promiseList);
- },
-
- /**
* Converts a list of exceptions received from the C++ handler to
- * full SiteException objects. If this site-list is used as an all sites
- * view, the list is sorted by site name, then protocol and port and de-duped
- * (by origin).
+ * full SiteException objects.
* @param {!Array<RawSiteException>} sites A list of sites to convert.
- * @return {!Array<SiteException>} A list of full SiteExceptions. Sorted and
- * deduped if allSites is set.
+ * @return {!Array<SiteException>} A list of full SiteExceptions.
* @private
*/
toSiteArray_: function(sites) {
- var self = this;
- if (this.allSites) {
- sites.sort(function(a, b) {
- var url1 = self.toUrl(a.origin);
- var url2 = self.toUrl(b.origin);
- var comparison = url1.host.localeCompare(url2.host);
- if (comparison == 0) {
- comparison = url1.protocol.localeCompare(url2.protocol);
- if (comparison == 0) {
- comparison = url1.port.localeCompare(url2.port);
- if (comparison == 0) {
- // Compare hosts for the embedding origins.
- var host1 = self.toUrl(a.embeddingOrigin);
- var host2 = self.toUrl(b.embeddingOrigin);
- host1 = (host1 == null) ? '' : host1.host;
- host2 = (host2 == null) ? '' : host2.host;
- return host1.localeCompare(host2);
- }
- }
- }
- return comparison;
- });
- }
var results = /** @type {!Array<SiteException>} */([]);
var lastOrigin = '';
var lastEmbeddingOrigin = '';
@@ -337,12 +269,6 @@ Polymer({
/** @type {!SiteException} */
var siteException = this.expandSiteException(sites[i]);
- // The All Sites category can contain duplicates (from other categories).
- if (this.allSites && siteException.origin == lastOrigin &&
- siteException.embeddingOrigin == lastEmbeddingOrigin) {
- continue;
- }
-
results.push(siteException);
lastOrigin = siteException.origin;
lastEmbeddingOrigin = siteException.embeddingOrigin;
« no previous file with comments | « chrome/browser/resources/settings/site_settings/site_list.html ('k') | chrome/test/data/webui/settings/all_sites_tests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698