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
3 // found in the LICENSE file.
5 cr.define('options', function() {
6 /** @const */ List = cr.ui.List;
7 /** @const */ ListItem = cr.ui.ListItem;
10 * Creates a new list item for the origin's data.
11 * @param {!Object} origin Data used to create the origin list item.
13 function OriginListItem(origin) {
14 var el = cr.doc.createElement('div');
15 el.origin_ = origin.origin;
16 el.usage_ = origin.usage;
17 el.usageString_ = origin.usageString;
18 el.__proto__ = OriginListItem.prototype;
23 OriginListItem.prototype = {
24 __proto__: ListItem.prototype,
27 decorate: function() {
28 ListItem.prototype.decorate.call(this);
30 this.className = 'deletable-item origin-list-item';
31 this.contentElement_ = this.ownerDocument.createElement('div');
32 this.appendChild(this.contentElement_);
34 var titleEl = this.ownerDocument.createElement('div');
35 titleEl.className = 'title favicon-cell weaktrl';
36 titleEl.textContent = this.origin_;
37 titleEl.style.backgroundImage = getFaviconImageSet(this.origin_);
38 this.contentElement_.appendChild(titleEl);
40 if (this.usageString_) {
41 var usageEl = this.ownerDocument.createElement('span');
42 usageEl.className = 'local-storage-usage';
43 usageEl.textContent = this.usageString_;
44 this.appendChild(usageEl);
49 var OriginList = cr.ui.define('list');
51 OriginList.prototype = {
52 __proto__: List.prototype,
55 createItem: function(entry) {
56 return new OriginListItem(entry);
61 OriginListItem: OriginListItem,
62 OriginList: OriginList,