blob: 8d892bcdd005501e2d5351a2b36aed2d1350a335 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
cr.define('options', function() {
/** @const */ var DeletableItem = options.DeletableItem;
/** @const */ var DeletableItemList = options.DeletableItemList;
/**
* @constructor
* @extends {DeletableItem}
*/
function MediaGalleriesListItem(galleryInfo) {
var el = cr.doc.createElement('div');
el.galleryInfo_ = galleryInfo;
el.__proto__ = MediaGalleriesListItem.prototype;
el.decorate();
return el;
}
MediaGalleriesListItem.prototype = {
__proto__: DeletableItem.prototype,
decorate: function() {
DeletableItem.prototype.decorate.call(this);
var span = this.ownerDocument.createElement('span');
span.textContent = this.galleryInfo_.displayName;
this.contentElement.appendChild(span);
this.contentElement.title = this.galleryInfo_.path;
},
};
var MediaGalleriesList = cr.ui.define('list');
MediaGalleriesList.prototype = {
__proto__: DeletableItemList.prototype,
/** @override */
decorate: function() {
DeletableItemList.prototype.decorate.call(this);
this.autoExpands_ = true;
},
/** @override */
createItem: function(galleryInfo) {
return new MediaGalleriesListItem(galleryInfo);
},
/** @override */
deleteItemAtIndex: function(index) {
chrome.send('forgetGallery', [this.dataModel.item(index).id]);
},
};
return {
MediaGalleriesList: MediaGalleriesList
};
});
|