OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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('wallpapers', function() { | 5 cr.define('wallpapers', function() { |
6 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; | 6 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; |
7 /** @const */ var Grid = cr.ui.Grid; | 7 /** @const */ var Grid = cr.ui.Grid; |
8 /** @const */ var GridItem = cr.ui.GridItem; | 8 /** @const */ var GridItem = cr.ui.GridItem; |
9 /** @const */ var GridSelectionController = cr.ui.GridSelectionController; | 9 /** @const */ var GridSelectionController = cr.ui.GridSelectionController; |
10 /** @const */ var ListSingleSelectionModel = cr.ui.ListSingleSelectionModel; | 10 /** @const */ var ListSingleSelectionModel = cr.ui.ListSingleSelectionModel; |
(...skipping 15 matching lines...) Expand all Loading... | |
26 } | 26 } |
27 | 27 |
28 WallpaperThumbnailsGridItem.prototype = { | 28 WallpaperThumbnailsGridItem.prototype = { |
29 __proto__: GridItem.prototype, | 29 __proto__: GridItem.prototype, |
30 | 30 |
31 /** @override */ | 31 /** @override */ |
32 decorate: function() { | 32 decorate: function() { |
33 GridItem.prototype.decorate.call(this); | 33 GridItem.prototype.decorate.call(this); |
34 // Removes garbage created by GridItem. | 34 // Removes garbage created by GridItem. |
35 this.innerText = ''; | 35 this.innerText = ''; |
36 cr.defineProperty(this, 'active', cr.PropertyKind.BOOL_ATTR); | |
bshe
2013/01/25 04:35:05
Also removed checkMark here for every item. And dy
| |
37 this.active = false; | |
38 var imageEl = cr.doc.createElement('img'); | 36 var imageEl = cr.doc.createElement('img'); |
39 imageEl.classList.add('thumbnail'); | 37 imageEl.classList.add('thumbnail'); |
40 cr.defineProperty(imageEl, 'offline', cr.PropertyKind.BOOL_ATTR); | 38 cr.defineProperty(imageEl, 'offline', cr.PropertyKind.BOOL_ATTR); |
41 imageEl.offline = this.dataItem.availableOffline; | 39 imageEl.offline = this.dataItem.availableOffline; |
42 this.appendChild(imageEl); | 40 this.appendChild(imageEl); |
43 var checkMark = cr.doc.createElement('div'); | 41 |
44 checkMark.classList.add('check'); | |
45 this.appendChild(checkMark); | |
46 var self = this; | 42 var self = this; |
47 chrome.wallpaperPrivate.getThumbnail(this.dataItem.baseURL, | 43 chrome.wallpaperPrivate.getThumbnail(this.dataItem.baseURL, |
48 function(data) { | 44 function(data) { |
49 if (data) { | 45 if (data) { |
50 var blob = new Blob([new Int8Array(data)], {'type' : 'image\/png'}); | 46 var blob = new Blob([new Int8Array(data)], {'type' : 'image\/png'}); |
51 imageEl.src = window.URL.createObjectURL(blob); | 47 imageEl.src = window.URL.createObjectURL(blob); |
52 imageEl.addEventListener('load', function(e) { | 48 imageEl.addEventListener('load', function(e) { |
53 window.URL.revokeObjectURL(this.src); | 49 window.URL.revokeObjectURL(this.src); |
54 }); | 50 }); |
55 } else { | 51 } else { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
184 this.columns = 0; | 180 this.columns = 0; |
185 this.redraw(); | 181 this.redraw(); |
186 this.focus(); | 182 this.focus(); |
187 } | 183 } |
188 }; | 184 }; |
189 | 185 |
190 return { | 186 return { |
191 WallpaperThumbnailsGrid: WallpaperThumbnailsGrid | 187 WallpaperThumbnailsGrid: WallpaperThumbnailsGrid |
192 }; | 188 }; |
193 }); | 189 }); |
OLD | NEW |