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