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

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

Issue 408493003: Show local storage usage on the Website Settings options page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 */ List = cr.ui.List; 6 /** @const */ List = cr.ui.List;
7 /** @const */ ListItem = cr.ui.ListItem; 7 /** @const */ ListItem = cr.ui.ListItem;
8 8
9 function OriginListItem(origin) { 9 function OriginListItem(origin) {
10 var el = cr.doc.createElement('div'); 10 var el = cr.doc.createElement('div');
11 el.origin_ = origin; 11
12 if (origin.origin) {
13 el.origin_ = origin.origin;
14 el.usage_ = origin.usage;
15 el.usage_string_ = origin.usage_string;
16 }
17 else
Bernhard Bauer 2014/07/21 11:29:29 If you have braces for the if clause, also use bra
Daniel Nishi 2014/07/21 17:53:36 Done.
18 el.origin_ = origin;
19
12 el.__proto__ = OriginListItem.prototype; 20 el.__proto__ = OriginListItem.prototype;
13 el.decorate(); 21 el.decorate();
14 return el; 22 return el;
15 } 23 }
16 24
17 OriginListItem.prototype = { 25 OriginListItem.prototype = {
18 __proto__: ListItem.prototype, 26 __proto__: ListItem.prototype,
19 27
20 /** @override */ 28 /** @override */
21 decorate: function() { 29 decorate: function() {
22 ListItem.prototype.decorate.call(this); 30 ListItem.prototype.decorate.call(this);
23 31
24 this.classList.add('deletable-item'); 32 this.className = 'deletable-item origin-list-item';
25
26 this.contentElement_ = this.ownerDocument.createElement('div'); 33 this.contentElement_ = this.ownerDocument.createElement('div');
27 this.appendChild(this.contentElement_); 34 this.appendChild(this.contentElement_);
28 35
29 var titleEl = this.ownerDocument.createElement('div'); 36 var titleEl = this.ownerDocument.createElement('div');
30 titleEl.className = 'title favicon-cell weaktrl'; 37 titleEl.className = 'title favicon-cell weaktrl';
31 titleEl.textContent = this.origin_; 38 titleEl.textContent = this.origin_;
32 titleEl.style.backgroundImage = getFaviconImageSet(this.origin_); 39 titleEl.style.backgroundImage = getFaviconImageSet(this.origin_);
33 this.contentElement_.appendChild(titleEl); 40 this.contentElement_.appendChild(titleEl);
41
42 if (this.usage_string_) {
43 var usageEl = this.ownerDocument.createElement('span');
44 usageEl.className = 'usage';
45 usageEl.textContent = this.usage_string_;
46 this.appendChild(usageEl);
47 }
34 } 48 }
35 }; 49 };
36 50
37 var OriginList = cr.ui.define('list'); 51 var OriginList = cr.ui.define('list');
38 52
39 OriginList.prototype = { 53 OriginList.prototype = {
40 __proto__: List.prototype, 54 __proto__: List.prototype,
41 55
42 /** @override */ 56 /** @override */
43 createItem: function(entry) { 57 createItem: function(entry) {
44 return new OriginListItem(entry); 58 return new OriginListItem(entry);
45 }, 59 },
46 }; 60 };
47 61
48 return { 62 return {
49 OriginListItem: OriginListItem, 63 OriginListItem: OriginListItem,
50 OriginList: OriginList, 64 OriginList: OriginList,
51 }; 65 };
52 }); 66 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698