Chromium Code Reviews| 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 * The current selection object. | 6 * The current selection object. |
| 7 * @constructor | |
|
mtomasz
2013/02/14 04:38:56
As before.
yoshiki
2013/02/14 06:17:36
Done.
| |
| 7 * @param {FileManager} fileManager FileManager instance. | 8 * @param {FileManager} fileManager FileManager instance. |
| 8 * @param {Array.<number>} indexes Selected indexes. | 9 * @param {Array.<number>} indexes Selected indexes. |
| 9 */ | 10 */ |
| 10 function FileSelection(fileManager, indexes) { | 11 function FileSelection(fileManager, indexes) { |
| 11 this.fileManager_ = fileManager; | 12 this.fileManager_ = fileManager; |
| 12 this.indexes = indexes; | 13 this.indexes = indexes; |
| 13 this.entries = []; | 14 this.entries = []; |
| 14 this.urls = []; | 15 this.urls = []; |
| 15 this.totalCount = 0; | 16 this.totalCount = 0; |
| 16 this.fileCount = 0; | 17 this.fileCount = 0; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 /** | 125 /** |
| 125 * Cancels any async computation. | 126 * Cancels any async computation. |
| 126 * @private | 127 * @private |
| 127 */ | 128 */ |
| 128 FileSelection.prototype.cancelComputing_ = function() { | 129 FileSelection.prototype.cancelComputing_ = function() { |
| 129 this.cancelled_ = true; | 130 this.cancelled_ = true; |
| 130 }; | 131 }; |
| 131 | 132 |
| 132 /** | 133 /** |
| 133 * This object encapsulates everything related to current selection. | 134 * This object encapsulates everything related to current selection. |
| 135 * @constructor | |
| 134 * @param {FileManager} fileManager File manager instance. | 136 * @param {FileManager} fileManager File manager instance. |
| 135 */ | 137 */ |
| 136 function FileSelectionHandler(fileManager) { | 138 function FileSelectionHandler(fileManager) { |
| 137 this.fileManager_ = fileManager; | 139 this.fileManager_ = fileManager; |
| 138 // TODO(dgozman): create a shared object with most of UI elements. | 140 // TODO(dgozman): create a shared object with most of UI elements. |
| 139 this.okButton_ = fileManager.okButton_; | 141 this.okButton_ = fileManager.okButton_; |
| 140 this.filenameInput_ = fileManager.filenameInput_; | 142 this.filenameInput_ = fileManager.filenameInput_; |
| 141 | 143 |
| 142 this.previewPanel_ = fileManager.dialogDom_.querySelector('.preview-panel'); | 144 this.previewPanel_ = fileManager.dialogDom_.querySelector('.preview-panel'); |
| 143 this.previewThumbnails_ = this.previewPanel_. | 145 this.previewThumbnails_ = this.previewPanel_. |
| 144 querySelector('.preview-thumbnails'); | 146 querySelector('.preview-thumbnails'); |
| 145 this.previewSummary_ = this.previewPanel_.querySelector('.preview-summary'); | 147 this.previewSummary_ = this.previewPanel_.querySelector('.preview-summary'); |
| 146 this.previewText_ = this.previewSummary_.querySelector('.preview-text'); | 148 this.previewText_ = this.previewSummary_.querySelector('.preview-text'); |
| 147 this.calculatingSize_ = this.previewSummary_. | 149 this.calculatingSize_ = this.previewSummary_. |
| 148 querySelector('.calculating-size'); | 150 querySelector('.calculating-size'); |
| 149 this.calculatingSize_.textContent = str('CALCULATING_SIZE'); | 151 this.calculatingSize_.textContent = str('CALCULATING_SIZE'); |
| 150 | 152 |
| 151 this.searchBreadcrumbs_ = fileManager.searchBreadcrumbs_; | 153 this.searchBreadcrumbs_ = fileManager.searchBreadcrumbs_; |
| 152 this.taskItems_ = fileManager.taskItems_; | 154 this.taskItems_ = fileManager.taskItems_; |
| 153 | 155 |
| 154 this.animationTimeout_ = null; | 156 this.animationTimeout_ = null; |
| 155 } | 157 } |
| 156 | 158 |
| 157 /** | 159 /** |
| 158 * Maximum amount of thumbnails in the preview pane. | 160 * Maximum amount of thumbnails in the preview pane. |
|
mtomasz
2013/02/14 04:38:56
Shall we add @type to constants?
yoshiki
2013/02/14 06:17:36
Done.
| |
| 159 */ | 161 */ |
| 160 FileSelectionHandler.MAX_PREVIEW_THUMBNAIL_COUNT = 4; | 162 FileSelectionHandler.MAX_PREVIEW_THUMBNAIL_COUNT = 4; |
| 161 | 163 |
| 162 /** | 164 /** |
| 163 * Maximum width or height of an image what pops up when the mouse hovers | 165 * Maximum width or height of an image what pops up when the mouse hovers |
| 164 * thumbnail in the bottom panel (in pixels). | 166 * thumbnail in the bottom panel (in pixels). |
| 165 */ | 167 */ |
| 166 FileSelectionHandler.IMAGE_HOVER_PREVIEW_SIZE = 200; | 168 FileSelectionHandler.IMAGE_HOVER_PREVIEW_SIZE = 200; |
| 167 | 169 |
| 168 /** | 170 /** |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 664 style.left = (boxWidth - imageWidth) / 2 + 'px'; | 666 style.left = (boxWidth - imageWidth) / 2 + 'px'; |
| 665 style.top = (boxHeight - imageHeight) / 2 + 'px'; | 667 style.top = (boxHeight - imageHeight) / 2 + 'px'; |
| 666 style.position = 'relative'; | 668 style.position = 'relative'; |
| 667 | 669 |
| 668 util.applyTransform(largeImage, transform); | 670 util.applyTransform(largeImage, transform); |
| 669 | 671 |
| 670 largeImageBox.appendChild(largeImage); | 672 largeImageBox.appendChild(largeImage); |
| 671 largeImageBox.style.zIndex = 1000; | 673 largeImageBox.style.zIndex = 1000; |
| 672 return true; | 674 return true; |
| 673 }; | 675 }; |
| OLD | NEW |