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

Side by Side Diff: chrome/browser/resources/options/cookies_list.js

Issue 7387007: Adding usage and quota entry to chrome://settings/cookies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed leak suppressions. Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 CookieListItem.prototype = { 113 CookieListItem.prototype = {
114 __proto__: DeletableItem.prototype, 114 __proto__: DeletableItem.prototype,
115 115
116 /** @inheritDoc */ 116 /** @inheritDoc */
117 decorate: function() { 117 decorate: function() {
118 this.siteChild = this.ownerDocument.createElement('div'); 118 this.siteChild = this.ownerDocument.createElement('div');
119 this.siteChild.className = 'cookie-site'; 119 this.siteChild.className = 'cookie-site';
120 this.dataChild = this.ownerDocument.createElement('div'); 120 this.dataChild = this.ownerDocument.createElement('div');
121 this.dataChild.className = 'cookie-data'; 121 this.dataChild.className = 'cookie-data';
122 this.sizeChild = this.ownerDocument.createElement('div');
123 this.sizeChild.className = 'cookie-size';
122 this.itemsChild = this.ownerDocument.createElement('div'); 124 this.itemsChild = this.ownerDocument.createElement('div');
123 this.itemsChild.className = 'cookie-items'; 125 this.itemsChild.className = 'cookie-items';
124 this.infoChild = this.ownerDocument.createElement('div'); 126 this.infoChild = this.ownerDocument.createElement('div');
125 this.infoChild.className = 'cookie-details'; 127 this.infoChild.className = 'cookie-details';
126 this.infoChild.hidden = true; 128 this.infoChild.hidden = true;
127 var remove = this.ownerDocument.createElement('button'); 129 var remove = this.ownerDocument.createElement('button');
128 remove.textContent = localStrings.getString('remove_cookie'); 130 remove.textContent = localStrings.getString('remove_cookie');
129 remove.onclick = this.removeCookie_.bind(this); 131 remove.onclick = this.removeCookie_.bind(this);
130 this.infoChild.appendChild(remove); 132 this.infoChild.appendChild(remove);
131 var content = this.contentElement; 133 var content = this.contentElement;
132 content.appendChild(this.siteChild); 134 content.appendChild(this.siteChild);
133 content.appendChild(this.dataChild); 135 content.appendChild(this.dataChild);
136 content.appendChild(this.sizeChild);
134 content.appendChild(this.itemsChild); 137 content.appendChild(this.itemsChild);
135 this.itemsChild.appendChild(this.infoChild); 138 this.itemsChild.appendChild(this.infoChild);
136 if (this.origin && this.origin.data) { 139 if (this.origin && this.origin.data) {
137 this.siteChild.textContent = this.origin.data.title; 140 this.siteChild.textContent = this.origin.data.title;
138 this.siteChild.setAttribute('title', this.origin.data.title); 141 this.siteChild.setAttribute('title', this.origin.data.title);
139 } 142 }
140 this.itemList_ = []; 143 this.itemList_ = [];
141 }, 144 },
142 145
143 /** @type {boolean} */ 146 /** @type {boolean} */
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 list.push(localStrings.getString('cookie_app_cache')); 246 list.push(localStrings.getString('cookie_app_cache'));
244 if (info.fileSystem) 247 if (info.fileSystem)
245 list.push(localStrings.getString('cookie_file_system')); 248 list.push(localStrings.getString('cookie_file_system'));
246 var text = ''; 249 var text = '';
247 for (var i = 0; i < list.length; ++i) 250 for (var i = 0; i < list.length; ++i)
248 if (text.length > 0) 251 if (text.length > 0)
249 text += ', ' + list[i]; 252 text += ', ' + list[i];
250 else 253 else
251 text = list[i]; 254 text = list[i];
252 this.dataChild.textContent = text; 255 this.dataChild.textContent = text;
256 if (info.quota && info.quota.totalUsage) {
257 this.sizeChild.textContent = info.quota.totalUsage;
258 }
259
253 if (this.expanded) 260 if (this.expanded)
254 this.updateItems_(); 261 this.updateItems_();
255 }, 262 },
256 263
257 /** 264 /**
258 * Updates the items section to reflect changes, animating to the new state. 265 * Updates the items section to reflect changes, animating to the new state.
259 * Removes existing contents and calls @{code CookieTreeNode.createItems}. 266 * Removes existing contents and calls @{code CookieTreeNode.createItems}.
260 * @private 267 * @private
261 */ 268 */
262 updateItems_: function() { 269 updateItems_: function() {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 /** 430 /**
424 * Summarize the information in this node and update @{code info}. 431 * Summarize the information in this node and update @{code info}.
425 * This will recurse into child nodes to summarize all descendants. 432 * This will recurse into child nodes to summarize all descendants.
426 * @param {Object} info The info object from @{code updateOrigin}. 433 * @param {Object} info The info object from @{code updateOrigin}.
427 */ 434 */
428 collectSummaryInfo: function(info) { 435 collectSummaryInfo: function(info) {
429 if (this.children.length > 0) { 436 if (this.children.length > 0) {
430 for (var i = 0; i < this.children.length; ++i) 437 for (var i = 0; i < this.children.length; ++i)
431 this.children[i].collectSummaryInfo(info); 438 this.children[i].collectSummaryInfo(info);
432 } else if (this.data && !this.data.hasChildren) { 439 } else if (this.data && !this.data.hasChildren) {
433 if (this.data.type == 'cookie') 440 if (this.data.type == 'cookie') {
434 info.cookies++; 441 info.cookies++;
435 else if (this.data.type == 'database') 442 } else if (this.data.type == 'database') {
436 info.database = true; 443 info.database = true;
437 else if (this.data.type == 'local_storage') 444 } else if (this.data.type == 'local_storage') {
438 info.localStorage = true; 445 info.localStorage = true;
439 else if (this.data.type == 'app_cache') 446 } else if (this.data.type == 'app_cache') {
440 info.appCache = true; 447 info.appCache = true;
441 else if (this.data.type == 'indexed_db') 448 } else if (this.data.type == 'indexed_db') {
442 info.indexedDb = true; 449 info.indexedDb = true;
443 else if (this.data.type == 'file_system') 450 } else if (this.data.type == 'file_system') {
444 info.fileSystem = true; 451 info.fileSystem = true;
452 } else if (this.data.type == 'quota') {
453 info.quota = this.data;
454 }
445 } 455 }
446 }, 456 },
447 457
448 /** 458 /**
449 * Create the cookie "bubbles" for this node, recursing into children 459 * Create the cookie "bubbles" for this node, recursing into children
450 * if there are any. Append the cookie bubbles to @{code item}. 460 * if there are any. Append the cookie bubbles to @{code item}.
451 * @param {CookieListItem} item The cookie list item to create items in. 461 * @param {CookieListItem} item The cookie list item to create items in.
452 */ 462 */
453 createItems: function(item) { 463 createItems: function(item) {
454 if (this.children.length > 0) { 464 if (this.children.length > 0) {
(...skipping 12 matching lines...) Expand all
467 case 'app_cache': 477 case 'app_cache':
468 text = localStrings.getString('cookie_app_cache'); 478 text = localStrings.getString('cookie_app_cache');
469 break; 479 break;
470 case 'indexed_db': 480 case 'indexed_db':
471 text = localStrings.getString('cookie_indexed_db'); 481 text = localStrings.getString('cookie_indexed_db');
472 break; 482 break;
473 case 'file_system': 483 case 'file_system':
474 text = localStrings.getString('cookie_file_system'); 484 text = localStrings.getString('cookie_file_system');
475 break; 485 break;
476 } 486 }
487 if (!text)
488 return;
477 var div = item.ownerDocument.createElement('div'); 489 var div = item.ownerDocument.createElement('div');
478 div.className = 'cookie-item'; 490 div.className = 'cookie-item';
479 // Help out screen readers and such: this is a clickable thing. 491 // Help out screen readers and such: this is a clickable thing.
480 div.setAttribute('role', 'button'); 492 div.setAttribute('role', 'button');
481 div.textContent = text; 493 div.textContent = text;
482 var index = item.appendItem(this, div); 494 var index = item.appendItem(this, div);
483 div.onclick = function() { 495 div.onclick = function() {
484 if (item.selectedIndex == index) 496 if (item.selectedIndex == index)
485 item.selectedIndex = -1; 497 item.selectedIndex = -1;
486 else 498 else
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 parent.clear(); 846 parent.clear();
835 this.addByParent_(parent, 0, children); 847 this.addByParent_(parent, 0, children);
836 parent.endBatchUpdates(); 848 parent.endBatchUpdates();
837 }, 849 },
838 }; 850 };
839 851
840 return { 852 return {
841 CookiesList: CookiesList 853 CookiesList: CookiesList
842 }; 854 };
843 }); 855 });
OLDNEW
« no previous file with comments | « chrome/browser/mock_browsing_data_quota_helper.cc ('k') | chrome/browser/resources/options/cookies_view.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698