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 27 matching lines...) Expand all Loading... |
38 imageEl.classList.add('thumbnail'); | 38 imageEl.classList.add('thumbnail'); |
39 cr.defineProperty(imageEl, 'offline', cr.PropertyKind.BOOL_ATTR); | 39 cr.defineProperty(imageEl, 'offline', cr.PropertyKind.BOOL_ATTR); |
40 imageEl.offline = this.dataItem.availableOffline; | 40 imageEl.offline = this.dataItem.availableOffline; |
41 this.appendChild(imageEl); | 41 this.appendChild(imageEl); |
42 var self = this; | 42 var self = this; |
43 | 43 |
44 switch (this.dataItem.source) { | 44 switch (this.dataItem.source) { |
45 case Constants.WallpaperSourceEnum.AddNew: | 45 case Constants.WallpaperSourceEnum.AddNew: |
46 this.id = 'add-new'; | 46 this.id = 'add-new'; |
47 this.addEventListener('click', function(e) { | 47 this.addEventListener('click', function(e) { |
48 $('wallpaper-selection-container').hidden = false; | 48 var checkbox = $('surprise-me').querySelector('#checkbox'); |
| 49 if (!checkbox.classList.contains('checked')) |
| 50 $('wallpaper-selection-container').hidden = false; |
49 }); | 51 }); |
50 break; | 52 break; |
51 case Constants.WallpaperSourceEnum.Custom: | 53 case Constants.WallpaperSourceEnum.Custom: |
52 var errorHandler = function(e) { | 54 var errorHandler = function(e) { |
53 console.error('Can not access file system.'); | 55 console.error('Can not access file system.'); |
54 }; | 56 }; |
55 var wallpaperDirectories = WallpaperDirectories.getInstance(); | 57 var wallpaperDirectories = WallpaperDirectories.getInstance(); |
56 var getThumbnail = function(fileName) { | 58 var getThumbnail = function(fileName) { |
57 var setURL = function(fileEntry) { | 59 var setURL = function(fileEntry) { |
58 imageEl.src = fileEntry.toURL(); | 60 imageEl.src = fileEntry.toURL(); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 // The active thumbnail maybe deleted in the above redraw(). Sets it again | 281 // The active thumbnail maybe deleted in the above redraw(). Sets it again |
280 // to make sure checkmark shows correctly. | 282 // to make sure checkmark shows correctly. |
281 this.updateActiveThumb_(); | 283 this.updateActiveThumb_(); |
282 } | 284 } |
283 }; | 285 }; |
284 | 286 |
285 return { | 287 return { |
286 WallpaperThumbnailsGrid: WallpaperThumbnailsGrid | 288 WallpaperThumbnailsGrid: WallpaperThumbnailsGrid |
287 }; | 289 }; |
288 }); | 290 }); |
OLD | NEW |