Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_images_grid.js

Issue 14244011: Fix custom wallpaper going back from wallpaper 2 to wallpaper 1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 * Inserts newElement at the position specified by index.
251 * @param {number} index The index of the newElement to insert.
252 * @type {!Object} Wallpaper information inserted into the data model.
flackr 2013/04/15 15:02:02 @param {!Object} newElement Although I'd prefer th
bshe 2013/04/15 15:22:10 Done.
253 */
254 insertElement: function(index, newElement) {
255 // splice may dispatch a change event because the position of selected
256 // element changing. But the actual selected element didn't change after
257 // splice. Sets inProgramSelection to true to disable the event handler of
258 // change event. Otherwise, wallpaper may reset to previous one as
flackr 2013/04/15 15:02:02 Can we not we prevent handling a change event whic
bshe 2013/04/15 15:22:10 Sorry, just to confirm. Do you mean we check if th
flackr 2013/04/15 20:00:54 Yes. On 2013/04/15 15:22:10, bshe wrote:
bshe 2013/04/15 23:38:22 Done.
259 // described in http://crbug.com/229036.
260 this.inProgramSelection_ = true;
261 this.dataModel.splice(index, 0, newElement);
262 this.inProgramSelection_ = false;
263 },
264
265 /**
250 * Forces re-display, size re-calculation and focuses grid. 266 * Forces re-display, size re-calculation and focuses grid.
251 */ 267 */
252 updateAndFocus: function() { 268 updateAndFocus: function() {
253 // Recalculate the measured item size. 269 // Recalculate the measured item size.
254 this.measured_ = null; 270 this.measured_ = null;
255 this.columns = 0; 271 this.columns = 0;
256 this.redraw(); 272 this.redraw();
257 this.focus(); 273 this.focus();
258 }, 274 },
259 275
(...skipping 27 matching lines...) Expand all
287 // to make sure checkmark shows correctly. 303 // to make sure checkmark shows correctly.
288 this.updateActiveThumb_(); 304 this.updateActiveThumb_();
289 } 305 }
290 }; 306 };
291 307
292 return { 308 return {
293 WallpaperSourceEnum: WallpaperSourceEnum, 309 WallpaperSourceEnum: WallpaperSourceEnum,
294 WallpaperThumbnailsGrid: WallpaperThumbnailsGrid 310 WallpaperThumbnailsGrid: WallpaperThumbnailsGrid
295 }; 311 };
296 }); 312 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698