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.
5 cr.define('options', function() {
6 /** @const */ var DeletableItem = options.DeletableItem;
7 /** @const */ var DeletableItemList = options.DeletableItemList;
11 * @extends {DeletableItem}
13 function MediaGalleriesListItem(galleryInfo) {
14 var el = cr.doc.createElement('div');
15 el.galleryInfo_ = galleryInfo;
16 el.__proto__ = MediaGalleriesListItem.prototype;
21 MediaGalleriesListItem.prototype = {
22 __proto__: DeletableItem.prototype,
24 decorate: function() {
25 DeletableItem.prototype.decorate.call(this);
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;
34 var MediaGalleriesList = cr.ui.define('list');
36 MediaGalleriesList.prototype = {
37 __proto__: DeletableItemList.prototype,
40 decorate: function() {
41 DeletableItemList.prototype.decorate.call(this);
42 this.autoExpands_ = true;
46 createItem: function(galleryInfo) {
47 return new MediaGalleriesListItem(galleryInfo);
51 deleteItemAtIndex: function(index) {
52 chrome.send('forgetGallery', [this.dataModel.item(index).id]);
57 MediaGalleriesList: MediaGalleriesList