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

Side by Side Diff: chrome/browser/resources/file_manager/foreground/js/photo/ribbon.js

Issue 135973012: [Galley] Fix an exception in clicking a thumbnail (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 'use strict'; 5 'use strict';
6 6
7 /** 7 /**
8 * Scrollable thumbnail ribbon at the bottom of the Gallery in the Slide mode. 8 * Scrollable thumbnail ribbon at the bottom of the Gallery in the Slide mode.
9 * 9 *
10 * @param {Document} document Document. 10 * @param {Document} document Document.
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 var img = cached.querySelector('img'); 298 var img = cached.querySelector('img');
299 if (img) 299 if (img)
300 img.classList.add('cached'); 300 img.classList.add('cached');
301 return cached; 301 return cached;
302 } 302 }
303 303
304 var thumbnail = this.ownerDocument.createElement('div'); 304 var thumbnail = this.ownerDocument.createElement('div');
305 thumbnail.className = 'ribbon-image'; 305 thumbnail.className = 'ribbon-image';
306 thumbnail.addEventListener('click', function() { 306 thumbnail.addEventListener('click', function() {
307 var index = this.dataModel_.indexOf(item); 307 var index = this.dataModel_.indexOf(item);
308 this.selectionModel_.beginChange();
hirono 2014/02/13 04:57:07 I'm not sure why the pair of methods fix the excep
308 this.selectionModel_.unselectAll(); 309 this.selectionModel_.unselectAll();
309 this.selectionModel_.setIndexSelected(index, true); 310 this.selectionModel_.setIndexSelected(index, true);
311 this.selectionModel_.endChange();
310 }.bind(this)); 312 }.bind(this));
311 313
312 util.createChild(thumbnail, 'image-wrapper'); 314 util.createChild(thumbnail, 'image-wrapper');
313 315
314 this.metadataCache_.get(item.getEntry(), Gallery.METADATA_TYPE, 316 this.metadataCache_.get(item.getEntry(), Gallery.METADATA_TYPE,
315 this.setThumbnailImage_.bind(this, thumbnail, item.getEntry())); 317 this.setThumbnailImage_.bind(this, thumbnail, item.getEntry()));
316 318
317 // TODO: Implement LRU eviction. 319 // TODO: Implement LRU eviction.
318 // Never evict the thumbnails that are currently in the DOM because we rely 320 // Never evict the thumbnails that are currently in the DOM because we rely
319 // on this cache to find them by URL. 321 // on this cache to find them by URL.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 * @param {string} oldUrl Old url. 359 * @param {string} oldUrl Old url.
358 * @param {string} newUrl New url. 360 * @param {string} newUrl New url.
359 * @private 361 * @private
360 */ 362 */
361 Ribbon.prototype.remapCache_ = function(oldUrl, newUrl) { 363 Ribbon.prototype.remapCache_ = function(oldUrl, newUrl) {
362 if (oldUrl != newUrl && (oldUrl in this.renderCache_)) { 364 if (oldUrl != newUrl && (oldUrl in this.renderCache_)) {
363 this.renderCache_[newUrl] = this.renderCache_[oldUrl]; 365 this.renderCache_[newUrl] = this.renderCache_[oldUrl];
364 delete this.renderCache_[oldUrl]; 366 delete this.renderCache_[oldUrl];
365 } 367 }
366 }; 368 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698