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

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

Issue 2338283002: Site Settings Desktop: Implement Cookie Search. (Closed)
Patch Set: Address feedback Created 4 years, 3 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_data.js
diff --git a/chrome/browser/resources/settings/site_settings/site_data.js b/chrome/browser/resources/settings/site_settings/site_data.js
index 14fe40045d2a9e4745573489f7982c3f32064f5d..116ad3dfcd074c2dbd02a82cee564c8adef9f595 100644
--- a/chrome/browser/resources/settings/site_settings/site_data.js
+++ b/chrome/browser/resources/settings/site_settings/site_data.js
@@ -30,6 +30,14 @@ Polymer({
* Keeps track of how many outstanding requests for more data there are.
*/
requests_: Number,
+
+ /**
+ * The current filter applied to the cookie data list.
+ */
+ filterString_: {
+ type: String,
+ value: '',
+ }
},
ready: function() {
@@ -51,8 +59,26 @@ Polymer({
},
/**
+ * A filter function for the list.
+ * @param {!CookieDataSummaryItem} item The item to possibly filter out.
+ * @return {!boolean} Whether to show the item.
+ * @private
+ */
+ showItem_: function(item) {
+ if (this.filterString_.length == 0)
+ return true;
+ return item.site.indexOf(this.filterString_) > -1;
+ },
+
+ /** @private */
+ onSearchChanged_: function(e) {
+ this.filterString_ = e.detail;
+ this.$.list.render();
+ },
+
+ /**
* Returns whether remove all should be shown.
- * @param {Array<CookieDataSummaryItem>} sites The sites list to use to
+ * @param {!Array<!CookieDataSummaryItem>} sites The sites list to use to
* determine whether the button should be visible.
* @private
*/
@@ -61,6 +87,17 @@ Polymer({
},
/**
+ * Returns the string to use for the Remove label.
+ * @return {!string} filterString The current filter string.
+ * @private
+ */
+ computeRemoveLabel_: function(filterString) {
+ if (filterString.length == 0)
+ return loadTimeData.getString('siteSettingsCookieRemoveAll');
+ return loadTimeData.getString('siteSettingsCookieRemoveAllShown');
+ },
+
+ /**
* Called when the cookie list is ready to be shown.
* @param {!CookieList} list The cookie list to show.
* @private
@@ -118,13 +155,21 @@ Polymer({
},
/**
- * Deletes site data for all sites.
+ * Deletes site data for multiple sites.
* @private
*/
- onDeleteAllSites_: function() {
- this.browserProxy.removeAllCookies().then(function(list) {
- this.loadChildren_(list);
- }.bind(this));
+ onDeleteMultipleSites_: function() {
+ if (this.filterString_.length == 0) {
+ this.browserProxy.removeAllCookies().then(function(list) {
+ this.loadChildren_(list);
+ }.bind(this));
+ } else {
+ var items = this.$.list.items;
+ for (var i = 0; i < items.length; ++i) {
+ if (this.showItem_(items[i]))
+ this.browserProxy.removeCookie(items[i].id);
+ }
+ }
},
/**

Powered by Google App Engine
This is Rietveld 408576698