| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 }; | 337 }; |
| 338 | 338 |
| 339 /** | 339 /** |
| 340 * Content change handler. | 340 * Content change handler. |
| 341 * | 341 * |
| 342 * @param {Event} event Event. | 342 * @param {Event} event Event. |
| 343 * @private | 343 * @private |
| 344 */ | 344 */ |
| 345 Ribbon.prototype.onContentChange_ = function(event) { | 345 Ribbon.prototype.onContentChange_ = function(event) { |
| 346 var url = event.item.getEntry().toURL(); | 346 var url = event.item.getEntry().toURL(); |
| 347 if (event.oldEntry.toURL() !== url) { | 347 if (event.oldEntry.toURL() !== url) |
| 348 this.remapCache_(event.oldEntry.toURL(), url); | 348 this.remapCache_(event.oldEntry.toURL(), url); |
| 349 } else { | |
| 350 delete this.renderCache_[url]; | |
| 351 var index = this.dataModel_.indexOf(event.item); | |
| 352 this.renderThumbnail_(index); | |
| 353 } | |
| 354 | 349 |
| 355 var thumbnail = this.renderCache_[url]; | 350 var thumbnail = this.renderCache_[url]; |
| 356 if (thumbnail && event.metadata) | 351 if (thumbnail && event.metadata) |
| 357 this.setThumbnailImage_(thumbnail, event.item.getEntry(), event.metadata); | 352 this.setThumbnailImage_(thumbnail, event.item.getEntry(), event.metadata); |
| 358 }; | 353 }; |
| 359 | 354 |
| 360 /** | 355 /** |
| 361 * Update the thumbnail element cache. | 356 * Update the thumbnail element cache. |
| 362 * | 357 * |
| 363 * @param {string} oldUrl Old url. | 358 * @param {string} oldUrl Old url. |
| 364 * @param {string} newUrl New url. | 359 * @param {string} newUrl New url. |
| 365 * @private | 360 * @private |
| 366 */ | 361 */ |
| 367 Ribbon.prototype.remapCache_ = function(oldUrl, newUrl) { | 362 Ribbon.prototype.remapCache_ = function(oldUrl, newUrl) { |
| 368 if (oldUrl != newUrl && (oldUrl in this.renderCache_)) { | 363 if (oldUrl != newUrl && (oldUrl in this.renderCache_)) { |
| 369 this.renderCache_[newUrl] = this.renderCache_[oldUrl]; | 364 this.renderCache_[newUrl] = this.renderCache_[oldUrl]; |
| 370 delete this.renderCache_[oldUrl]; | 365 delete this.renderCache_[oldUrl]; |
| 371 } | 366 } |
| 372 }; | 367 }; |
| OLD | NEW |