OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 cr.define('options', function() { | 5 cr.define('options', function() { |
6 const DeletableItemList = options.DeletableItemList; | 6 const DeletableItemList = options.DeletableItemList; |
7 const DeletableItem = options.DeletableItem; | 7 const DeletableItem = options.DeletableItem; |
8 const ArrayDataModel = cr.ui.ArrayDataModel; | 8 const ArrayDataModel = cr.ui.ArrayDataModel; |
9 const ListSingleSelectionModel = cr.ui.ListSingleSelectionModel; | 9 const ListSingleSelectionModel = cr.ui.ListSingleSelectionModel; |
10 | 10 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 | 94 |
95 CookieListItem.prototype = { | 95 CookieListItem.prototype = { |
96 __proto__: DeletableItem.prototype, | 96 __proto__: DeletableItem.prototype, |
97 | 97 |
98 /** @inheritDoc */ | 98 /** @inheritDoc */ |
99 decorate: function() { | 99 decorate: function() { |
100 this.siteChild = this.ownerDocument.createElement('div'); | 100 this.siteChild = this.ownerDocument.createElement('div'); |
101 this.siteChild.className = 'cookie-site'; | 101 this.siteChild.className = 'cookie-site'; |
102 this.dataChild = this.ownerDocument.createElement('div'); | 102 this.dataChild = this.ownerDocument.createElement('div'); |
103 this.dataChild.className = 'cookie-data'; | 103 this.dataChild.className = 'cookie-data'; |
104 this.sizeChild = this.ownerDocument.createElement('div'); | |
105 this.sizeChild.className = 'cookie-size'; | |
104 this.itemsChild = this.ownerDocument.createElement('div'); | 106 this.itemsChild = this.ownerDocument.createElement('div'); |
105 this.itemsChild.className = 'cookie-items'; | 107 this.itemsChild.className = 'cookie-items'; |
106 this.infoChild = this.ownerDocument.createElement('div'); | 108 this.infoChild = this.ownerDocument.createElement('div'); |
107 this.infoChild.className = 'cookie-details'; | 109 this.infoChild.className = 'cookie-details'; |
108 this.infoChild.hidden = true; | 110 this.infoChild.hidden = true; |
109 var remove = this.ownerDocument.createElement('button'); | 111 var remove = this.ownerDocument.createElement('button'); |
110 remove.textContent = localStrings.getString('remove_cookie'); | 112 remove.textContent = localStrings.getString('remove_cookie'); |
111 remove.onclick = this.removeCookie_.bind(this); | 113 remove.onclick = this.removeCookie_.bind(this); |
112 this.infoChild.appendChild(remove); | 114 this.infoChild.appendChild(remove); |
113 var content = this.contentElement; | 115 var content = this.contentElement; |
114 content.appendChild(this.siteChild); | 116 content.appendChild(this.siteChild); |
115 content.appendChild(this.dataChild); | 117 content.appendChild(this.dataChild); |
118 content.appendChild(this.sizeChild); | |
116 content.appendChild(this.itemsChild); | 119 content.appendChild(this.itemsChild); |
117 this.itemsChild.appendChild(this.infoChild); | 120 this.itemsChild.appendChild(this.infoChild); |
118 if (this.origin && this.origin.data) { | 121 if (this.origin && this.origin.data) { |
119 this.siteChild.textContent = this.origin.data.title; | 122 this.siteChild.textContent = this.origin.data.title; |
120 this.siteChild.setAttribute('title', this.origin.data.title); | 123 this.siteChild.setAttribute('title', this.origin.data.title); |
121 } | 124 } |
122 this.itemList_ = []; | 125 this.itemList_ = []; |
123 }, | 126 }, |
124 | 127 |
125 /** @type {boolean} */ | 128 /** @type {boolean} */ |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
225 list.push(localStrings.getString('cookie_app_cache')); | 228 list.push(localStrings.getString('cookie_app_cache')); |
226 if (info.fileSystem) | 229 if (info.fileSystem) |
227 list.push(localStrings.getString('cookie_file_system')); | 230 list.push(localStrings.getString('cookie_file_system')); |
228 var text = ''; | 231 var text = ''; |
229 for (var i = 0; i < list.length; ++i) | 232 for (var i = 0; i < list.length; ++i) |
230 if (text.length > 0) | 233 if (text.length > 0) |
231 text += ', ' + list[i]; | 234 text += ', ' + list[i]; |
232 else | 235 else |
233 text = list[i]; | 236 text = list[i]; |
234 this.dataChild.textContent = text; | 237 this.dataChild.textContent = text; |
238 if (info.quota && info.quota.totalUsage) { | |
239 this.sizeChild.textContent = info.quota.totalUsage; | |
Mike Mammarella
2011/07/26 21:46:31
It looks odd to only have the size column filled i
tzik
2011/07/27 03:51:47
Done.
| |
240 } | |
241 | |
235 if (this.expanded) | 242 if (this.expanded) |
236 this.updateItems_(); | 243 this.updateItems_(); |
237 }, | 244 }, |
238 | 245 |
239 /** | 246 /** |
240 * Updates the items section to reflect changes, animating to the new state. | 247 * Updates the items section to reflect changes, animating to the new state. |
241 * Removes existing contents and calls @{code CookieTreeNode.createItems}. | 248 * Removes existing contents and calls @{code CookieTreeNode.createItems}. |
242 * @private | 249 * @private |
243 */ | 250 */ |
244 updateItems_: function() { | 251 updateItems_: function() { |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
417 else if (this.data.type == 'database') | 424 else if (this.data.type == 'database') |
418 info.database = true; | 425 info.database = true; |
419 else if (this.data.type == 'local_storage') | 426 else if (this.data.type == 'local_storage') |
420 info.localStorage = true; | 427 info.localStorage = true; |
421 else if (this.data.type == 'app_cache') | 428 else if (this.data.type == 'app_cache') |
422 info.appCache = true; | 429 info.appCache = true; |
423 else if (this.data.type == 'indexed_db') | 430 else if (this.data.type == 'indexed_db') |
424 info.indexedDb = true; | 431 info.indexedDb = true; |
425 else if (this.data.type == 'file_system') | 432 else if (this.data.type == 'file_system') |
426 info.fileSystem = true; | 433 info.fileSystem = true; |
434 else if (this.data.type == 'quota') | |
435 info.quota = { | |
Mike Mammarella
2011/07/26 21:46:31
For a multiline statement like this, you'd need to
tzik
2011/07/27 03:51:47
Done.
| |
436 totalUsage: this.data.totalUsage, | |
437 temporaryUsage: this.data.temporaryUsage, | |
438 persistentUsage: this.data.persistentUsage, | |
439 persistentQuota: this.data.persistentQuota, | |
440 }; | |
427 } | 441 } |
428 }, | 442 }, |
429 | 443 |
430 /** | 444 /** |
431 * Create the cookie "bubbles" for this node, recursing into children | 445 * Create the cookie "bubbles" for this node, recursing into children |
432 * if there are any. Append the cookie bubbles to @{code item}. | 446 * if there are any. Append the cookie bubbles to @{code item}. |
433 * @param {CookieListItem} item The cookie list item to create items in. | 447 * @param {CookieListItem} item The cookie list item to create items in. |
434 */ | 448 */ |
435 createItems: function(item) { | 449 createItems: function(item) { |
436 if (this.children.length > 0) { | 450 if (this.children.length > 0) { |
(...skipping 12 matching lines...) Expand all Loading... | |
449 case 'app_cache': | 463 case 'app_cache': |
450 text = localStrings.getString('cookie_app_cache'); | 464 text = localStrings.getString('cookie_app_cache'); |
451 break; | 465 break; |
452 case 'indexed_db': | 466 case 'indexed_db': |
453 text = localStrings.getString('cookie_indexed_db'); | 467 text = localStrings.getString('cookie_indexed_db'); |
454 break; | 468 break; |
455 case 'file_system': | 469 case 'file_system': |
456 text = localStrings.getString('cookie_file_system'); | 470 text = localStrings.getString('cookie_file_system'); |
457 break; | 471 break; |
458 } | 472 } |
473 if (!text) | |
Mike Mammarella
2011/07/26 21:46:31
What is this for?
tzik
2011/07/27 03:51:47
I want not to allocate bubble for quota since quot
| |
474 return; | |
459 var div = item.ownerDocument.createElement('div'); | 475 var div = item.ownerDocument.createElement('div'); |
460 div.className = 'cookie-item'; | 476 div.className = 'cookie-item'; |
461 // Help out screen readers and such: this is a clickable thing. | 477 // Help out screen readers and such: this is a clickable thing. |
462 div.setAttribute('role', 'button'); | 478 div.setAttribute('role', 'button'); |
463 div.textContent = text; | 479 div.textContent = text; |
464 var index = item.appendItem(this, div); | 480 var index = item.appendItem(this, div); |
465 div.onclick = function() { | 481 div.onclick = function() { |
466 if (item.selectedIndex == index) | 482 if (item.selectedIndex == index) |
467 item.selectedIndex = -1; | 483 item.selectedIndex = -1; |
468 else | 484 else |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
821 parent.clear(); | 837 parent.clear(); |
822 this.addByParent_(parent, 0, children); | 838 this.addByParent_(parent, 0, children); |
823 parent.endBatchUpdates(); | 839 parent.endBatchUpdates(); |
824 }, | 840 }, |
825 }; | 841 }; |
826 | 842 |
827 return { | 843 return { |
828 CookiesList: CookiesList | 844 CookiesList: CookiesList |
829 }; | 845 }; |
830 }); | 846 }); |
OLD | NEW |