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

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

Issue 2450423002: [MD settings] cookie and site data from dialog to subpage (Closed)
Patch Set: merge Created 4 years, 2 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/cookie_tree_node.js
diff --git a/chrome/browser/resources/settings/site_settings/cookie_tree_node.js b/chrome/browser/resources/settings/site_settings/cookie_tree_node.js
index 34c91c8e42736ce50a4c1819015a0c77f06b0a3a..d73fb57605663fa9dd090ae226ce48dee5f0ce61 100644
--- a/chrome/browser/resources/settings/site_settings/cookie_tree_node.js
+++ b/chrome/browser/resources/settings/site_settings/cookie_tree_node.js
@@ -134,7 +134,6 @@ cr.define('settings', function() {
*/
getCookieList: function() {
var list = [];
-
for (var group of this.children_) {
for (var cookie of group.children_) {
list.push({title: cookie.data.title,
@@ -142,7 +141,6 @@ cr.define('settings', function() {
data: cookie.data});
}
}
-
return list;
},
@@ -157,7 +155,6 @@ cr.define('settings', function() {
var title = siteEntry.data.title;
var id = siteEntry.data.id;
var description = '';
-
if (siteEntry.children_.length == 0)
continue;
@@ -175,7 +172,6 @@ cr.define('settings', function() {
if (descriptionNode.children_.length > 0)
dataType = descriptionNode.children_[0].data.type;
}
-
var count =
(dataType == 'cookie') ? descriptionNode.children_.length : 0;
if (count > 1) {
@@ -184,7 +180,6 @@ cr.define('settings', function() {
description += getCookieDataCategoryText(
dataType, descriptionNode.data.totalUsage);
}
-
Dan Beam 2016/11/01 06:33:27 why did you make all these changes? ^
dschuyler 2016/11/01 18:55:34 Personal readability and over application of the c
Dan Beam 2016/11/01 19:10:15 yeah, last removal is fine
}
list.push({ site: title, id: id, localData: description });
}
@@ -214,6 +209,27 @@ cr.define('settings', function() {
}
return null;
},
+
+ /**
+ * Fetch a CookieTreeNode by site.
+ * @param {string} site The web site to look up.
+ * @param {boolean} recursive Whether to search the children also.
+ * @return {settings.CookieTreeNode} The node found, if any.
Dan Beam 2016/11/01 06:33:27 ?settings.CookieTreeNode
dschuyler 2016/11/01 18:55:34 Done.
+ */
+ fetchNodeBySite: function(site, recursive) {
+ for (var i = 0; i < this.children_.length; ++i) {
+ if (this.children_[i] == null)
Dan Beam 2016/11/01 06:33:27 when does this happen?
dschuyler 2016/11/01 18:55:34 This was based on a similar existing function. Thi
+ return null;
+ if (this.children_[i].data.title == site)
+ return this.children_[i];
+ if (recursive) {
+ var node = this.children_[i].fetchNodeBySite(site, true);
+ if (node != null)
+ return node;
+ }
+ }
+ return null;
+ },
};
return {

Powered by Google App Engine
This is Rietveld 408576698