Chromium Code Reviews| 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, | |
| 7 * id: string, | |
| 8 * title: string, | |
| 9 * totalUsage: string, | |
| 10 * type: string}} | |
| 11 */ | |
| 12 var CookieDetails; | |
| 13 | |
| 14 /** | |
| 15 * @typedef {{content: string, | |
| 16 * label: string}} | |
| 17 */ | |
| 18 var CookieDataForDisplay; | |
|
dschuyler
2016/10/26 00:18:38
Moved (not removed).
| |
| 19 | |
| 20 /** | |
| 21 * @typedef {{title: string, | 6 * @typedef {{title: string, |
| 22 * id: string, | 7 * id: string, |
| 23 * data: CookieDetails}} | 8 * data: CookieDetails}} |
| 24 */ | 9 */ |
| 25 var CookieDataItem; | 10 var CookieDataItem; |
| 26 | 11 |
| 27 /** | 12 /** |
| 28 * @typedef {{site: string, | 13 * @typedef {{site: string, |
| 29 * id: string, | 14 * id: string, |
| 30 * localData: string}} | 15 * localData: string}} |
| 31 */ | 16 */ |
| 32 var CookieDataSummaryItem; | 17 var CookieDataSummaryItem; |
| 33 | 18 |
| 34 /** | 19 /** |
| 35 * @typedef {{id: string, | 20 * @typedef {{id: string, |
| 36 * start: number, | 21 * start: number, |
| 37 * children: !Array<CookieDetails>}} | 22 * children: !Array<CookieDetails>}} |
| 38 */ | 23 */ |
| 39 var CookieList; | 24 var CookieList; |
| 40 | 25 |
| 41 /** | 26 /** |
| 42 * @typedef {{id: string, | 27 * @typedef {{id: string, |
| 43 * start: !number, | 28 * start: number, |
| 44 * count: !number}} | 29 * count: number}} |
| 45 */ | 30 */ |
| 46 var CookieRemovePacket; | 31 var CookieRemovePacket; |
| 47 | 32 |
| 48 var categoryLabels = { | 33 var categoryLabels = { |
| 49 'app_cache': loadTimeData.getString('cookieAppCache'), | 34 'app_cache': loadTimeData.getString('cookieAppCache'), |
| 50 'cache_storage': loadTimeData.getString('cookieCacheStorage'), | 35 'cache_storage': loadTimeData.getString('cookieCacheStorage'), |
| 51 'channel_id': loadTimeData.getString('cookieChannelId'), | 36 'channel_id': loadTimeData.getString('cookieChannelId'), |
| 52 'cookie': loadTimeData.getString('cookieSingular'), | 37 'cookie': loadTimeData.getString('cookieSingular'), |
| 53 'database': loadTimeData.getString('cookieDatabaseStorage'), | 38 'database': loadTimeData.getString('cookieDatabaseStorage'), |
| 54 'file_system': loadTimeData.getString('cookieFileSystem'), | 39 'file_system': loadTimeData.getString('cookieFileSystem'), |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 if (this.children_[i].data_.id == id) | 207 if (this.children_[i].data_.id == id) |
| 223 return this.children_[i]; | 208 return this.children_[i]; |
| 224 if (recursive) { | 209 if (recursive) { |
| 225 var node = this.children_[i].fetchNodeById(id, true); | 210 var node = this.children_[i].fetchNodeById(id, true); |
| 226 if (node != null) | 211 if (node != null) |
| 227 return node; | 212 return node; |
| 228 } | 213 } |
| 229 } | 214 } |
| 230 return null; | 215 return null; |
| 231 }, | 216 }, |
| 232 | |
| 233 /** | |
| 234 * Get cookie data for a given HTML node. | |
| 235 * @return {!Array<CookieDataForDisplay>} | |
| 236 */ | |
| 237 getCookieData: function(item) { | |
| 238 /** @type {!Array<CookieDataForDisplay>} */ | |
| 239 var out = []; | |
| 240 var fields = cookieInfo[item.data_.type]; | |
| 241 for (var field of fields) { | |
| 242 // Iterate through the keys found in |cookieInfo| for the given |type| | |
| 243 // and see if those keys are present in the data. If so, display them | |
| 244 // (in the order determined by |cookieInfo|). | |
| 245 var key = field[0]; | |
| 246 if (item.data_[key].length > 0) { | |
| 247 var entry = /** @type {CookieDataForDisplay} */({ | |
| 248 label: loadTimeData.getString(field[1]), | |
| 249 content: item.data_[key], | |
| 250 }); | |
| 251 out.push(entry); | |
| 252 } | |
| 253 } | |
| 254 return out; | |
| 255 }, | |
|
dschuyler
2016/10/26 00:18:38
Moved to cookie_info.js
| |
| 256 }; | 217 }; |
| 257 | 218 |
| 258 return { | 219 return { |
| 259 CookieTreeNode: CookieTreeNode, | 220 CookieTreeNode: CookieTreeNode, |
| 260 }; | 221 }; |
| 261 }); | 222 }); |
| OLD | NEW |