| 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * PreviewPanel UI class. | 8 * PreviewPanel UI class. |
| 9 * @param {HTMLElement} element DOM Element of preview panel. | 9 * @param {HTMLElement} element DOM Element of preview panel. |
| 10 * @param {PreviewPanel.VisibilityType} visibilityType Initial value of the | 10 * @param {PreviewPanel.VisibilityType} visibilityType Initial value of the |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 */ | 51 */ |
| 52 this.breadcrumbs = new BreadcrumbsController( | 52 this.breadcrumbs = new BreadcrumbsController( |
| 53 element.querySelector('#search-breadcrumbs'), | 53 element.querySelector('#search-breadcrumbs'), |
| 54 metadataCache, | 54 metadataCache, |
| 55 volumeManager); | 55 volumeManager); |
| 56 | 56 |
| 57 /** | 57 /** |
| 58 * @type {PreviewPanel.Thumbnails} | 58 * @type {PreviewPanel.Thumbnails} |
| 59 */ | 59 */ |
| 60 this.thumbnails = new PreviewPanel.Thumbnails( | 60 this.thumbnails = new PreviewPanel.Thumbnails( |
| 61 element.querySelector('.preview-thumbnails'), metadataCache); | 61 element.querySelector('.preview-thumbnails'), |
| 62 metadataCache, |
| 63 volumeManager); |
| 62 | 64 |
| 63 /** | 65 /** |
| 64 * @type {HTMLElement} | 66 * @type {HTMLElement} |
| 65 * @private | 67 * @private |
| 66 */ | 68 */ |
| 67 this.summaryElement_ = element.querySelector('.preview-summary'); | 69 this.summaryElement_ = element.querySelector('.preview-summary'); |
| 68 | 70 |
| 69 /** | 71 /** |
| 70 * @type {PreviewPanel.CalculatingSizeLabel} | 72 * @type {PreviewPanel.CalculatingSizeLabel} |
| 71 * @private | 73 * @private |
| (...skipping 16 matching lines...) Expand all Loading... |
| 88 | 90 |
| 89 /** | 91 /** |
| 90 * Sequence value that is incremented by every selection update and is used to | 92 * Sequence value that is incremented by every selection update and is used to |
| 91 * check if the callback is up to date or not. | 93 * check if the callback is up to date or not. |
| 92 * @type {number} | 94 * @type {number} |
| 93 * @private | 95 * @private |
| 94 */ | 96 */ |
| 95 this.sequence_ = 0; | 97 this.sequence_ = 0; |
| 96 | 98 |
| 97 /** | 99 /** |
| 98 * @type {VolumeManager} | 100 * @type {VolumeManagerWrapper} |
| 99 * @private | 101 * @private |
| 100 */ | 102 */ |
| 101 this.volumeManager_ = volumeManager; | 103 this.volumeManager_ = volumeManager; |
| 102 | 104 |
| 103 cr.EventTarget.call(this); | 105 cr.EventTarget.call(this); |
| 104 }; | 106 }; |
| 105 | 107 |
| 106 /** | 108 /** |
| 107 * Name of PreviewPanels's event. | 109 * Name of PreviewPanels's event. |
| 108 * @enum {string} | 110 * @enum {string} |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 } | 370 } |
| 369 this.element_.textContent = text; | 371 this.element_.textContent = text; |
| 370 this.count_++; | 372 this.count_++; |
| 371 }; | 373 }; |
| 372 | 374 |
| 373 /** | 375 /** |
| 374 * Thumbnails on the preview panel. | 376 * Thumbnails on the preview panel. |
| 375 * | 377 * |
| 376 * @param {HTMLElement} element DOM Element of thumbnail container. | 378 * @param {HTMLElement} element DOM Element of thumbnail container. |
| 377 * @param {MetadataCache} metadataCache MetadataCache. | 379 * @param {MetadataCache} metadataCache MetadataCache. |
| 380 * @param {VolumeManagerWrapper} volumeManager Volume manager instance. |
| 378 * @constructor | 381 * @constructor |
| 379 */ | 382 */ |
| 380 PreviewPanel.Thumbnails = function(element, metadataCache) { | 383 PreviewPanel.Thumbnails = function(element, metadataCache, volumeManager) { |
| 381 this.element_ = element; | 384 this.element_ = element; |
| 382 this.metadataCache_ = metadataCache; | 385 this.metadataCache_ = metadataCache; |
| 386 this.volumeManager_ = volumeManager; |
| 383 this.sequence_ = 0; | 387 this.sequence_ = 0; |
| 384 Object.seal(this); | 388 Object.seal(this); |
| 385 }; | 389 }; |
| 386 | 390 |
| 387 /** | 391 /** |
| 388 * Maximum number of thumbnails. | 392 * Maximum number of thumbnails. |
| 389 * @const {number} | 393 * @const {number} |
| 390 */ | 394 */ |
| 391 PreviewPanel.Thumbnails.MAX_THUMBNAIL_COUNT = 4; | 395 PreviewPanel.Thumbnails.MAX_THUMBNAIL_COUNT = 4; |
| 392 | 396 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 for (var i = 0; i < length; i++) { | 434 for (var i = 0; i < length; i++) { |
| 431 // Create a box. | 435 // Create a box. |
| 432 var box = this.element_.ownerDocument.createElement('div'); | 436 var box = this.element_.ownerDocument.createElement('div'); |
| 433 box.style.zIndex = PreviewPanel.Thumbnails.MAX_THUMBNAIL_COUNT + 1 - i; | 437 box.style.zIndex = PreviewPanel.Thumbnails.MAX_THUMBNAIL_COUNT + 1 - i; |
| 434 | 438 |
| 435 // Load the image. | 439 // Load the image. |
| 436 if (entries[i]) { | 440 if (entries[i]) { |
| 437 FileGrid.decorateThumbnailBox(box, | 441 FileGrid.decorateThumbnailBox(box, |
| 438 entries[i], | 442 entries[i], |
| 439 this.metadataCache_, | 443 this.metadataCache_, |
| 444 this.volumeManager_, |
| 440 ThumbnailLoader.FillMode.FILL, | 445 ThumbnailLoader.FillMode.FILL, |
| 441 FileGrid.ThumbnailQuality.LOW, | 446 FileGrid.ThumbnailQuality.LOW, |
| 442 i == 0 && length == 1 && | 447 i == 0 && length == 1 && |
| 443 this.setZoomedImage_.bind(this)); | 448 this.setZoomedImage_.bind(this)); |
| 444 } | 449 } |
| 445 | 450 |
| 446 // Register the click handler. | 451 // Register the click handler. |
| 447 if (clickHandler) | 452 if (clickHandler) |
| 448 box.addEventListener('click', clickHandler); | 453 box.addEventListener('click', clickHandler); |
| 449 | 454 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 var zoomedBox = this.element_.ownerDocument.createElement('div'); | 514 var zoomedBox = this.element_.ownerDocument.createElement('div'); |
| 510 zoomedBox.className = 'popup'; | 515 zoomedBox.className = 'popup'; |
| 511 zoomedBox.style.width = boxWidth + 'px'; | 516 zoomedBox.style.width = boxWidth + 'px'; |
| 512 zoomedBox.style.height = boxHeight + 'px'; | 517 zoomedBox.style.height = boxHeight + 'px'; |
| 513 zoomedBox.appendChild(zoomedImage); | 518 zoomedBox.appendChild(zoomedImage); |
| 514 | 519 |
| 515 this.element_.appendChild(zoomedBox); | 520 this.element_.appendChild(zoomedBox); |
| 516 this.element_.classList.add('has-zoom'); | 521 this.element_.classList.add('has-zoom'); |
| 517 return; | 522 return; |
| 518 }; | 523 }; |
| OLD | NEW |