OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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 */ var DeletableItem = options.DeletableItem; | |
7 /** @const */ var DeletableItemList = options.DeletableItemList; | |
8 | |
9 /** | |
10 * @constructor | |
11 * @extends {DeletableItem} | |
12 */ | |
13 function MediaGalleriesListItem(galleryInfo) { | |
14 var el = cr.doc.createElement('div'); | |
15 el.galleryInfo_ = galleryInfo; | |
16 el.__proto__ = MediaGalleriesListItem.prototype; | |
17 el.decorate(); | |
18 return el; | |
19 } | |
20 | |
21 MediaGalleriesListItem.prototype = { | |
22 __proto__: DeletableItem.prototype, | |
23 | |
24 decorate: function() { | |
25 DeletableItem.prototype.decorate.call(this); | |
26 | |
27 var span = this.ownerDocument.createElement('span'); | |
28 span.textContent = this.galleryInfo_.displayName; | |
29 this.contentElement.appendChild(span); | |
30 this.contentElement.title = this.galleryInfo_.path; | |
31 }, | |
32 }; | |
33 | |
34 var MediaGalleriesList = cr.ui.define('list'); | |
35 | |
36 MediaGalleriesList.prototype = { | |
37 __proto__: DeletableItemList.prototype, | |
38 | |
39 /** @inheritDoc */ | |
40 decorate: function() { | |
41 DeletableItemList.prototype.decorate.call(this); | |
42 this.autoExpands_ = true; | |
43 }, | |
44 | |
45 /** @inheritDoc */ | |
46 createItem: function(galleryInfo) { | |
47 return new MediaGalleriesListItem(galleryInfo); | |
48 }, | |
49 | |
50 /** @inheritDoc */ | |
51 deleteItemAtIndex: function(index) { | |
52 chrome.send('forgetGallery', [this.dataModel.item(index).id]); | |
53 }, | |
54 }; | |
55 | |
56 return { | |
57 MediaGalleriesList: MediaGalleriesList | |
58 }; | |
59 }); | |
OLD | NEW |