| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @typedef {{title: string, | 6 * @typedef {{title: string, |
| 7 * id: string, | 7 * id: string, |
| 8 * data: CookieDetails}} | 8 * data: CookieDetails}} |
| 9 */ | 9 */ |
| 10 var CookieDataItem; | 10 var CookieDataItem; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 * The data for this cookie node. | 67 * The data for this cookie node. |
| 68 * @type {CookieDetails} | 68 * @type {CookieDetails} |
| 69 */ | 69 */ |
| 70 this.data = data; | 70 this.data = data; |
| 71 | 71 |
| 72 /** | 72 /** |
| 73 * The child cookie nodes. | 73 * The child cookie nodes. |
| 74 * @private {!Array<!settings.CookieTreeNode>} | 74 * @private {!Array<!settings.CookieTreeNode>} |
| 75 */ | 75 */ |
| 76 this.children_ = []; | 76 this.children_ = []; |
| 77 }; | 77 } |
| 78 | 78 |
| 79 CookieTreeNode.prototype = { | 79 CookieTreeNode.prototype = { |
| 80 /** | 80 /** |
| 81 * Converts a list of cookies and add them as CookieTreeNode children to | 81 * Converts a list of cookies and add them as CookieTreeNode children to |
| 82 * the given parent node. | 82 * the given parent node. |
| 83 * @param {!settings.CookieTreeNode} parentNode The parent node to add | 83 * @param {!settings.CookieTreeNode} parentNode The parent node to add |
| 84 * children to. | 84 * children to. |
| 85 * @param {!Array<!CookieDetails>} newNodes The list containing the data to | 85 * @param {!Array<!CookieDetails>} newNodes The list containing the data to |
| 86 * add. | 86 * add. |
| 87 */ | 87 */ |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 179 |
| 180 var count = | 180 var count = |
| 181 (dataType == 'cookie') ? descriptionNode.children_.length : 0; | 181 (dataType == 'cookie') ? descriptionNode.children_.length : 0; |
| 182 if (count > 1) { | 182 if (count > 1) { |
| 183 description += loadTimeData.getStringF('cookiePlural', count); | 183 description += loadTimeData.getStringF('cookiePlural', count); |
| 184 } else { | 184 } else { |
| 185 description += getCookieDataCategoryText( | 185 description += getCookieDataCategoryText( |
| 186 dataType, descriptionNode.data.totalUsage); | 186 dataType, descriptionNode.data.totalUsage); |
| 187 } | 187 } |
| 188 } | 188 } |
| 189 list.push({ site: title, id: id, localData: description }); | 189 list.push({site: title, id: id, localData: description}); |
| 190 } | 190 } |
| 191 list.sort(function(a, b) { | 191 list.sort(function(a, b) { |
| 192 return a.site.localeCompare(b.site); | 192 return a.site.localeCompare(b.site); |
| 193 }); | 193 }); |
| 194 return list; | 194 return list; |
| 195 }, | 195 }, |
| 196 | 196 |
| 197 /** | 197 /** |
| 198 * Fetch a CookieTreeNode by ID. | 198 * Fetch a CookieTreeNode by ID. |
| 199 * @param {string} id The ID to look up. | 199 * @param {string} id The ID to look up. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 226 return this.children_[i]; | 226 return this.children_[i]; |
| 227 } | 227 } |
| 228 return null; | 228 return null; |
| 229 }, | 229 }, |
| 230 }; | 230 }; |
| 231 | 231 |
| 232 return { | 232 return { |
| 233 CookieTreeNode: CookieTreeNode, | 233 CookieTreeNode: CookieTreeNode, |
| 234 }; | 234 }; |
| 235 }); | 235 }); |
| OLD | NEW |