| OLD | NEW |
| 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 /** | 5 /** |
| 6 * Scrollable thumbnail ribbon at the bottom of the Gallery in the Slide mode. | 6 * Scrollable thumbnail ribbon at the bottom of the Gallery in the Slide mode. |
| 7 * | 7 * |
| 8 * @param {Document} document Document. | 8 * @param {Document} document Document. |
| 9 * @param {MetadataCache} metadataCache MetadataCache instance. | 9 * @param {MetadataCache} metadataCache MetadataCache instance. |
| 10 * @param {cr.ui.ArrayDataModel} dataModel Data model. | 10 * @param {cr.ui.ArrayDataModel} dataModel Data model. |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 // TODO: Implement LRU eviction. | 317 // TODO: Implement LRU eviction. |
| 318 // Never evict the thumbnails that are currently in the DOM because we rely | 318 // Never evict the thumbnails that are currently in the DOM because we rely |
| 319 // on this cache to find them by URL. | 319 // on this cache to find them by URL. |
| 320 this.renderCache_[url] = thumbnail; | 320 this.renderCache_[url] = thumbnail; |
| 321 return thumbnail; | 321 return thumbnail; |
| 322 }; | 322 }; |
| 323 | 323 |
| 324 /** | 324 /** |
| 325 * Set the thumbnail image. | 325 * Set the thumbnail image. |
| 326 * | 326 * |
| 327 * @param {Element} thumbnail Thumbnail element | 327 * @param {Element} thumbnail Thumbnail element. |
| 328 * @param {string} url Image url. | 328 * @param {string} url Image url. |
| 329 * @param {Object} metadata Metadata. | 329 * @param {Object} metadata Metadata. |
| 330 * @private | 330 * @private |
| 331 */ | 331 */ |
| 332 Ribbon.prototype.setThumbnailImage_ = function(thumbnail, url, metadata) { | 332 Ribbon.prototype.setThumbnailImage_ = function(thumbnail, url, metadata) { |
| 333 new ThumbnailLoader(url, ThumbnailLoader.LoaderType.IMAGE, metadata).load( | 333 new ThumbnailLoader(url, ThumbnailLoader.LoaderType.IMAGE, metadata).load( |
| 334 thumbnail.querySelector('.image-wrapper'), | 334 thumbnail.querySelector('.image-wrapper'), |
| 335 ThumbnailLoader.FillMode.FILL /* fill */, | 335 ThumbnailLoader.FillMode.FILL /* fill */, |
| 336 null /* success callback */, | 336 null /* success callback */, |
| 337 this.onThumbnailError_.bind(null, url)); | 337 this.onThumbnailError_.bind(null, url)); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 358 * @param {string} oldUrl Old url. | 358 * @param {string} oldUrl Old url. |
| 359 * @param {string} newUrl New url. | 359 * @param {string} newUrl New url. |
| 360 * @private | 360 * @private |
| 361 */ | 361 */ |
| 362 Ribbon.prototype.remapCache_ = function(oldUrl, newUrl) { | 362 Ribbon.prototype.remapCache_ = function(oldUrl, newUrl) { |
| 363 if (oldUrl != newUrl && (oldUrl in this.renderCache_)) { | 363 if (oldUrl != newUrl && (oldUrl in this.renderCache_)) { |
| 364 this.renderCache_[newUrl] = this.renderCache_[oldUrl]; | 364 this.renderCache_[newUrl] = this.renderCache_[oldUrl]; |
| 365 delete this.renderCache_[oldUrl]; | 365 delete this.renderCache_[oldUrl]; |
| 366 } | 366 } |
| 367 }; | 367 }; |
| OLD | NEW |