Commit 05863f50 authored by hirono@chromium.org's avatar hirono@chromium.org

Files.app: Hide fake entries for the save dialog.

Fake entries are readonly and it is not useful for the save dialog.

BUG=396179
TEST=manually

Review URL: https://codereview.chromium.org/410843002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284874 0039d316-1c4b-4281-b951-d872f2087c98
parent 88787147
...@@ -412,12 +412,13 @@ function DirectoryTree() {} ...@@ -412,12 +412,13 @@ function DirectoryTree() {}
* @param {DirectoryModel} directoryModel Current DirectoryModel. * @param {DirectoryModel} directoryModel Current DirectoryModel.
* @param {VolumeManagerWrapper} volumeManager VolumeManager of the system. * @param {VolumeManagerWrapper} volumeManager VolumeManager of the system.
* @param {MetadataCache} metadataCache Shared MetadataCache instance. * @param {MetadataCache} metadataCache Shared MetadataCache instance.
* @param {boolean} fakeEntriesVisible True if it should show the fakeEntries.
*/ */
DirectoryTree.decorate = function( DirectoryTree.decorate = function(
el, directoryModel, volumeManager, metadataCache) { el, directoryModel, volumeManager, metadataCache, fakeEntriesVisible) {
el.__proto__ = DirectoryTree.prototype; el.__proto__ = DirectoryTree.prototype;
(/** @type {DirectoryTree} */ el).decorate( (/** @type {DirectoryTree} */ el).decorate(
directoryModel, volumeManager, metadataCache); directoryModel, volumeManager, metadataCache, fakeEntriesVisible);
}; };
DirectoryTree.prototype = { DirectoryTree.prototype = {
...@@ -494,9 +495,10 @@ DirectoryTree.prototype.searchAndSelectByEntry = function(entry) { ...@@ -494,9 +495,10 @@ DirectoryTree.prototype.searchAndSelectByEntry = function(entry) {
* @param {DirectoryModel} directoryModel Current DirectoryModel. * @param {DirectoryModel} directoryModel Current DirectoryModel.
* @param {VolumeManagerWrapper} volumeManager VolumeManager of the system. * @param {VolumeManagerWrapper} volumeManager VolumeManager of the system.
* @param {MetadataCache} metadataCache Shared MetadataCache instance. * @param {MetadataCache} metadataCache Shared MetadataCache instance.
* @param {boolean} fakeEntriesVisible True if it should show the fakeEntries.
*/ */
DirectoryTree.prototype.decorate = function( DirectoryTree.prototype.decorate = function(
directoryModel, volumeManager, metadataCache) { directoryModel, volumeManager, metadataCache, fakeEntriesVisible) {
cr.ui.Tree.prototype.decorate.call(this); cr.ui.Tree.prototype.decorate.call(this);
this.sequence_ = 0; this.sequence_ = 0;
...@@ -526,6 +528,13 @@ DirectoryTree.prototype.decorate = function( ...@@ -526,6 +528,13 @@ DirectoryTree.prototype.decorate = function(
this.scrollBar_ = MainPanelScrollBar(); this.scrollBar_ = MainPanelScrollBar();
this.scrollBar_.initialize(this.parentNode, this); this.scrollBar_.initialize(this.parentNode, this);
/**
* Flag to show fake entries in the tree.
* @type {boolean}
* @private
*/
this.fakeEntriesVisible_ = fakeEntriesVisible;
}; };
/** /**
...@@ -573,8 +582,10 @@ DirectoryTree.prototype.updateSubDirectories = function( ...@@ -573,8 +582,10 @@ DirectoryTree.prototype.updateSubDirectories = function(
}; };
// Add fakes (if any). // Add fakes (if any).
for (var key in this.currentVolumeInfo_.fakeEntries) { if (this.fakeEntriesVisible_) {
this.entries_.push(this.currentVolumeInfo_.fakeEntries[key]); for (var key in this.currentVolumeInfo_.fakeEntries) {
this.entries_.push(this.currentVolumeInfo_.fakeEntries[key]);
}
} }
// If the display root is not available yet, then redraw anyway with what // If the display root is not available yet, then redraw anyway with what
......
...@@ -104,6 +104,7 @@ FileManager.prototype = { ...@@ -104,6 +104,7 @@ FileManager.prototype = {
* FULL_PAGE which is specific to this code. * FULL_PAGE which is specific to this code.
* *
* @enum {string} * @enum {string}
* @const
*/ */
var DialogType = { var DialogType = {
SELECT_FOLDER: 'folder', SELECT_FOLDER: 'folder',
...@@ -155,6 +156,8 @@ DialogType.isFolderDialog = function(type) { ...@@ -155,6 +156,8 @@ DialogType.isFolderDialog = function(type) {
type == DialogType.SELECT_UPLOAD_FOLDER; type == DialogType.SELECT_UPLOAD_FOLDER;
}; };
Object.freeze(DialogType);
/** /**
* Bottom margin of the list and tree for transparent preview panel. * Bottom margin of the list and tree for transparent preview panel.
* @const * @const
...@@ -1078,11 +1081,14 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52; ...@@ -1078,11 +1081,14 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52;
* @private * @private
*/ */
FileManager.prototype.initNavigationList_ = function() { FileManager.prototype.initNavigationList_ = function() {
var fakeEntriesVisible =
this.dialogType != DialogType.SELECT_SAVEAS_FILE;
this.directoryTree_ = this.dialogDom_.querySelector('#directory-tree'); this.directoryTree_ = this.dialogDom_.querySelector('#directory-tree');
DirectoryTree.decorate(this.directoryTree_, DirectoryTree.decorate(this.directoryTree_,
this.directoryModel_, this.directoryModel_,
this.volumeManager_, this.volumeManager_,
this.metadataCache_); this.metadataCache_,
fakeEntriesVisible);
this.navigationList_ = this.dialogDom_.querySelector('#navigation-list'); this.navigationList_ = this.dialogDom_.querySelector('#navigation-list');
NavigationList.decorate(this.navigationList_, NavigationList.decorate(this.navigationList_,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment