| 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 {{hasChildren: boolean, | 6 * @typedef {{hasChildren: boolean, |
| 7 * id: string, | 7 * id: string, |
| 8 * title: string, | 8 * title: string, |
| 9 * totalUsage: string, | 9 * totalUsage: string, |
| 10 * type: string}} | 10 * type: string}} |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 var id = siteEntry.data_.id; | 166 var id = siteEntry.data_.id; |
| 167 var description = ''; | 167 var description = ''; |
| 168 | 168 |
| 169 for (var j = 0; j < siteEntry.children_.length; ++j) { | 169 for (var j = 0; j < siteEntry.children_.length; ++j) { |
| 170 var descriptionNode = siteEntry.children_[j]; | 170 var descriptionNode = siteEntry.children_[j]; |
| 171 if (j > 0) | 171 if (j > 0) |
| 172 description += ', '; | 172 description += ', '; |
| 173 | 173 |
| 174 // Some types, like quota, have no description nodes. | 174 // Some types, like quota, have no description nodes. |
| 175 var dataType = ''; | 175 var dataType = ''; |
| 176 if (descriptionNode.data_.type != undefined) | 176 if (descriptionNode.data_.type != undefined) { |
| 177 dataType = descriptionNode.data_.type; | 177 dataType = descriptionNode.data_.type; |
| 178 else | 178 } else { |
| 179 dataType = descriptionNode.children_[0].data_.type; | 179 // A description node might not have children when it's deleted. |
| 180 if (descriptionNode.children_.length > 0) |
| 181 dataType = descriptionNode.children_[0].data_.type; |
| 182 } |
| 180 | 183 |
| 181 var count = | 184 var count = |
| 182 (dataType == 'cookie') ? descriptionNode.children_.length : 0; | 185 (dataType == 'cookie') ? descriptionNode.children_.length : 0; |
| 183 if (count > 1) { | 186 if (count > 1) { |
| 184 description += loadTimeData.getStringF('cookiePlural', count); | 187 description += loadTimeData.getStringF('cookiePlural', count); |
| 185 } else { | 188 } else { |
| 186 description += getCookieDataCategoryText( | 189 description += getCookieDataCategoryText( |
| 187 dataType, descriptionNode.data_.totalUsage); | 190 dataType, descriptionNode.data_.totalUsage); |
| 188 } | 191 } |
| 189 | 192 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 root.appendChild(content); | 243 root.appendChild(content); |
| 241 } | 244 } |
| 242 } | 245 } |
| 243 }, | 246 }, |
| 244 }; | 247 }; |
| 245 | 248 |
| 246 return { | 249 return { |
| 247 CookieTreeNode: CookieTreeNode, | 250 CookieTreeNode: CookieTreeNode, |
| 248 }; | 251 }; |
| 249 }); | 252 }); |
| OLD | NEW |