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

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

Issue 2965643004: MD Settings: Convert remaining classes to ES6 syntax. (Closed)
Patch Set: Fix Created 3 years, 6 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 | « chrome/browser/resources/settings/passwords_and_forms_page/passwords_section.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 809ee7f884f9fc8f2cfeef02626c886fcc86b320..2e27145a16711181c312233a912ebd3f9f410d6c 100644
--- a/chrome/browser/resources/settings/site_settings/cookie_tree_node.js
+++ b/chrome/browser/resources/settings/site_settings/cookie_tree_node.js
@@ -59,24 +59,21 @@ function getCookieDataCategoryText(dataType, totalUsage) {
cr.define('settings', function() {
'use strict';
- /**
- * @constructor
- */
- function CookieTreeNode(data) {
- /**
- * The data for this cookie node.
- * @type {CookieDetails}
- */
- this.data = data;
-
- /**
- * The child cookie nodes.
- * @private {!Array<!settings.CookieTreeNode>}
- */
- this.children_ = [];
- }
+ class CookieTreeNode {
+ constructor(data) {
+ /**
+ * The data for this cookie node.
+ * @type {CookieDetails}
+ */
+ this.data = data;
+
+ /**
+ * The child cookie nodes.
+ * @private {!Array<!settings.CookieTreeNode>}
+ */
+ this.children_ = [];
+ }
- CookieTreeNode.prototype = {
/**
* Converts a list of cookies and add them as CookieTreeNode children to
* the given parent node.
@@ -85,12 +82,12 @@ cr.define('settings', function() {
* @param {!Array<!CookieDetails>} newNodes The list containing the data to
* add.
*/
- addChildNodes: function(parentNode, newNodes) {
+ addChildNodes(parentNode, newNodes) {
var nodes = newNodes.map(function(x) {
return new settings.CookieTreeNode(x);
});
parentNode.children_ = nodes;
- },
+ }
/**
* Looks up a parent node and adds a list of CookieTreeNodes to them.
@@ -101,7 +98,7 @@ cr.define('settings', function() {
add.
* @return {boolean} True if the parent node was found.
*/
- populateChildNodes: function(parentId, startingNode, newNodes) {
+ populateChildNodes(parentId, startingNode, newNodes) {
for (var i = 0; i < startingNode.children_.length; ++i) {
if (startingNode.children_[i].data.id == parentId) {
this.addChildNodes(startingNode.children_[i], newNodes);
@@ -114,7 +111,7 @@ cr.define('settings', function() {
}
}
return false;
- },
+ }
/**
* Removes child nodes from a node with a given id.
@@ -123,16 +120,16 @@ cr.define('settings', function() {
* from.
* @param {number} count The number of children to delete.
*/
- removeByParentId: function(id, firstChild, count) {
+ removeByParentId(id, firstChild, count) {
var node = id == null ? this : this.fetchNodeById(id, true);
node.children_.splice(firstChild, count);
- },
+ }
/**
* Returns an array of cookies from the current node within the cookie tree.
* @return {!Array<!CookieDataItem>} The Cookie List.
*/
- getCookieList: function() {
+ getCookieList() {
var list = [];
for (var i = 0; i < this.children_.length; i++) {
var child = this.children_[i];
@@ -147,13 +144,13 @@ cr.define('settings', function() {
}
return list;
- },
+ }
/**
* Get a summary list of all sites and their stored data.
* @return {!Array<!CookieDataSummaryItem>} The summary list.
*/
- getSummaryList: function() {
+ getSummaryList() {
var list = [];
for (var i = 0; i < this.children_.length; ++i) {
var siteEntry = this.children_[i];
@@ -194,7 +191,7 @@ cr.define('settings', function() {
return a.site.localeCompare(b.site);
});
return list;
- },
+ }
/**
* Fetch a CookieTreeNode by ID.
@@ -202,7 +199,7 @@ cr.define('settings', function() {
* @param {boolean} recursive Whether to search the children also.
* @return {settings.CookieTreeNode} The node found, if any.
*/
- fetchNodeById: function(id, recursive) {
+ fetchNodeById(id, recursive) {
for (var i = 0; i < this.children_.length; ++i) {
if (this.children_[i] == null)
return null;
@@ -215,21 +212,21 @@ cr.define('settings', function() {
}
}
return null;
- },
+ }
/**
* Fetch a CookieTreeNode by site.
* @param {string} site The web site to look up.
* @return {?settings.CookieTreeNode} The node found, if any.
*/
- fetchNodeBySite: function(site) {
+ fetchNodeBySite(site) {
for (var i = 0; i < this.children_.length; ++i) {
if (this.children_[i].data.title == site)
return this.children_[i];
}
return null;
- },
- };
+ }
+ }
return {
CookieTreeNode: CookieTreeNode,
« no previous file with comments | « chrome/browser/resources/settings/passwords_and_forms_page/passwords_section.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698