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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 }, | 240 }, |
241 set selectedItem(selectedItem) { | 241 set selectedItem(selectedItem) { |
242 var index = this.dataModel.indexOf(selectedItem); | 242 var index = this.dataModel.indexOf(selectedItem); |
243 this.inProgramSelection_ = true; | 243 this.inProgramSelection_ = true; |
244 this.selectionModel.leadIndex = index; | 244 this.selectionModel.leadIndex = index; |
245 this.selectionModel.selectedIndex = index; | 245 this.selectionModel.selectedIndex = index; |
246 this.inProgramSelection_ = false; | 246 this.inProgramSelection_ = false; |
247 }, | 247 }, |
248 | 248 |
249 /** | 249 /** |
| 250 * The previous selected item. |
| 251 * @type {!Object} Wallpaper information in the data model. |
| 252 */ |
| 253 previousSelectedItem_: undefined, |
| 254 get previousSelectedItem() { |
| 255 return this.previousSelectedItem_; |
| 256 }, |
| 257 set previousSelectedItem(selectedItem) { |
| 258 this.previousSelectedItem_ = selectedItem; |
| 259 }, |
| 260 |
| 261 /** |
250 * Forces re-display, size re-calculation and focuses grid. | 262 * Forces re-display, size re-calculation and focuses grid. |
251 */ | 263 */ |
252 updateAndFocus: function() { | 264 updateAndFocus: function() { |
253 // Recalculate the measured item size. | 265 // Recalculate the measured item size. |
254 this.measured_ = null; | 266 this.measured_ = null; |
255 this.columns = 0; | 267 this.columns = 0; |
256 this.redraw(); | 268 this.redraw(); |
257 this.focus(); | 269 this.focus(); |
258 }, | 270 }, |
259 | 271 |
(...skipping 27 matching lines...) Expand all Loading... |
287 // to make sure checkmark shows correctly. | 299 // to make sure checkmark shows correctly. |
288 this.updateActiveThumb_(); | 300 this.updateActiveThumb_(); |
289 } | 301 } |
290 }; | 302 }; |
291 | 303 |
292 return { | 304 return { |
293 WallpaperSourceEnum: WallpaperSourceEnum, | 305 WallpaperSourceEnum: WallpaperSourceEnum, |
294 WallpaperThumbnailsGrid: WallpaperThumbnailsGrid | 306 WallpaperThumbnailsGrid: WallpaperThumbnailsGrid |
295 }; | 307 }; |
296 }); | 308 }); |
OLD | NEW |