| Index: trunk/src/chrome/browser/resources/file_manager/js/file_manager.js
|
| ===================================================================
|
| --- trunk/src/chrome/browser/resources/file_manager/js/file_manager.js (revision 221612)
|
| +++ trunk/src/chrome/browser/resources/file_manager/js/file_manager.js (working copy)
|
| @@ -82,15 +82,6 @@
|
| };
|
|
|
| /**
|
| - * @param {string} type Dialog type.
|
| - * @return {boolean} Whther the type is open dialog.
|
| - */
|
| -DialogType.isOpenDialog = function(type) {
|
| - return type == DialogType.SELECT_OPEN_FILE ||
|
| - type == DialogType.SELECT_OPEN_MULTI_FILE;
|
| -};
|
| -
|
| -/**
|
| * Bottom magrin of the list and tree for transparent preview panel.
|
| * @const
|
| */
|
| @@ -842,17 +833,6 @@
|
| 'pathclick', this.onBreadcrumbClick_.bind(this));
|
| this.searchBreadcrumbs_.setHideLast(false);
|
|
|
| - this.previewPanel_ = new PreviewPanel(
|
| - dom.querySelector('.preview-panel'),
|
| - DialogType.isOpenDialog(this.dialogType) ?
|
| - PreviewPanel.VisibilityType.ALWAYS_VISIBLE :
|
| - PreviewPanel.VisibilityType.AUTO,
|
| - this.getCurrentDirectory());
|
| - this.previewPanel_.addEventListener(
|
| - PreviewPanel.Event.VISIBILITY_CHANGE,
|
| - this.onPreviewPanelVisibilityChange_.bind(this));
|
| - this.previewPanel_.initialize();
|
| -
|
| // Check the option to hide the selecting checkboxes.
|
| this.table_.showCheckboxes = this.showCheckboxes_;
|
|
|
| @@ -1077,6 +1057,10 @@
|
| this.folderShortcutsModel_ = new FolderShortcutsDataModel();
|
|
|
| this.selectionHandler_ = new FileSelectionHandler(this);
|
| + this.selectionHandler_.addEventListener('show-preview-panel',
|
| + this.onPreviewPanelVisibilityChanged_.bind(this, true));
|
| + this.selectionHandler_.addEventListener('hide-preview-panel',
|
| + this.onPreviewPanelVisibilityChanged_.bind(this, false));
|
|
|
| var dataModel = this.directoryModel_.getFileList();
|
|
|
| @@ -1515,9 +1499,8 @@
|
| * Resize details and thumb views to fit the new window size.
|
| * @private
|
| */
|
| - FileManager.prototype.onPreviewPanelVisibilityChange_ = function() {
|
| - var panelHeight = this.previewPanel_.visible ?
|
| - this.previewPanel_.height : 0;
|
| + FileManager.prototype.onPreviewPanelVisibilityChanged_ = function(visible) {
|
| + var panelHeight = visible ? this.getPreviewPanelHeight_() : 0;
|
| this.grid_.setBottomMarginForPanel(panelHeight);
|
| this.table_.setBottomMarginForPanel(panelHeight);
|
| this.directoryTree_.setBottomMarginForPanel(panelHeight);
|
| @@ -1528,11 +1511,7 @@
|
| * @private
|
| */
|
| FileManager.prototype.onDragStart_ = function() {
|
| - // On open file dialog, the preview panel is always shown.
|
| - if (DialogType.isOpenDialog(this.dialogType))
|
| - return;
|
| - this.previewPanel_.visibilityType =
|
| - PreviewPanel.VisibilityType.ALWAYS_HIDDEN;
|
| + this.selectionHandler_.setPreviewPanelMustBeHidden(true);
|
| };
|
|
|
| /**
|
| @@ -1540,13 +1519,24 @@
|
| * @private
|
| */
|
| FileManager.prototype.onDragEnd_ = function() {
|
| - // On open file dialog, the preview panel is always shown.
|
| - if (DialogType.isOpenDialog(this.dialogType))
|
| - return;
|
| - this.previewPanel_.visibilityType = PreviewPanel.VisibilityType.AUTO;
|
| + this.selectionHandler_.setPreviewPanelMustBeHidden(false);
|
| };
|
|
|
| /**
|
| + * Gets height of the preview panel, using cached value if available. This
|
| + * returns the value even when the preview panel is hidden.
|
| + *
|
| + * @return {number} Height of the preview panel. If failure, returns 0.
|
| + */
|
| + FileManager.prototype.getPreviewPanelHeight_ = function() {
|
| + if (!this.cachedPreviewPanelHeight_) {
|
| + var previewPanel = this.dialogDom_.querySelector('.preview-panel');
|
| + this.cachedPreviewPanelHeight_ = previewPanel.clientHeight;
|
| + }
|
| + return this.cachedPreviewPanelHeight_;
|
| + };
|
| +
|
| + /**
|
| * Restores current directory and may be a selected item after page load (or
|
| * reload) or popping a state (after click on back/forward). If location.hash
|
| * is present it means that the user has navigated somewhere and that place
|
| @@ -2472,7 +2462,6 @@
|
| this.updateUnformattedDriveStatus_();
|
| this.updateTitle_();
|
| this.updateGearMenu_();
|
| - this.previewPanel_.currentPath_ = this.getCurrentDirectory();
|
| };
|
|
|
| /**
|
|
|