OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 cr.define('options', function() { |
| 6 /** @const */ List = cr.ui.List; |
| 7 /** @const */ ListItem = cr.ui.ListItem; |
| 8 |
| 9 function OriginListItem(origin) { |
| 10 var el = cr.doc.createElement('div'); |
| 11 el.origin_ = origin; |
| 12 el.__proto__ = OriginListItem.prototype; |
| 13 el.decorate(); |
| 14 return el; |
| 15 } |
| 16 |
| 17 OriginListItem.prototype = { |
| 18 __proto__: ListItem.prototype, |
| 19 |
| 20 /** @override */ |
| 21 decorate: function() { |
| 22 ListItem.prototype.decorate.call(this); |
| 23 |
| 24 this.classList.add('deletable-item'); |
| 25 |
| 26 this.contentElement_ = this.ownerDocument.createElement('div'); |
| 27 this.appendChild(this.contentElement_); |
| 28 |
| 29 var titleEl = this.ownerDocument.createElement('div'); |
| 30 titleEl.className = 'title favicon-cell weaktrl'; |
| 31 titleEl.textContent = this.origin_; |
| 32 titleEl.style.backgroundImage = getFaviconImageSet(this.origin_); |
| 33 this.contentElement_.appendChild(titleEl); |
| 34 } |
| 35 }; |
| 36 |
| 37 var OriginList = cr.ui.define('list'); |
| 38 |
| 39 OriginList.prototype = { |
| 40 __proto__: List.prototype, |
| 41 |
| 42 /** @override */ |
| 43 createItem: function(entry) { |
| 44 return new OriginListItem(entry); |
| 45 }, |
| 46 }; |
| 47 |
| 48 return { |
| 49 OriginListItem: OriginListItem, |
| 50 OriginList: OriginList, |
| 51 }; |
| 52 }); |
OLD | NEW |