Commit ee665037 authored by yoshiki@chromium.org's avatar yoshiki@chromium.org

Rename VolumeList -> NavigationList in Files.app

BUG=268812
TEST=Files.app runs without error. All tests pass.
R=mtomasz@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215855 0039d316-1c4b-4281-b951-d872f2087c98
parent 0633e9ba
...@@ -415,7 +415,7 @@ function onExecute(action, details) { ...@@ -415,7 +415,7 @@ function onExecute(action, details) {
defaultPath: details.entries[0].fullPath, defaultPath: details.entries[0].fullPath,
}; };
// For mounted devices just focus any Files.app window. The mounted // For mounted devices just focus any Files.app window. The mounted
// volume will appear on the volume list. // volume will appear on the navigation list.
var type = action == 'auto-open' ? LaunchType.FOCUS_ANY_OR_CREATE : var type = action == 'auto-open' ? LaunchType.FOCUS_ANY_OR_CREATE :
LaunchType.FOCUS_SAME_OR_CREATE; LaunchType.FOCUS_SAME_OR_CREATE;
launchFileManager(appState, launchFileManager(appState,
......
...@@ -448,7 +448,7 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52; ...@@ -448,7 +448,7 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52;
controller.attachDragSource(this.grid_); controller.attachDragSource(this.grid_);
controller.attachFileListDropTarget(this.grid_); controller.attachFileListDropTarget(this.grid_);
controller.attachTreeDropTarget(this.directoryTree_); controller.attachTreeDropTarget(this.directoryTree_);
controller.attachVolumesDropTarget(this.volumeList_, true); controller.attachNavigationListDropTarget(this.navigationList_, true);
controller.attachCopyPasteHandlers(); controller.attachCopyPasteHandlers();
controller.addEventListener('selection-copied', controller.addEventListener('selection-copied',
this.blinkSelection.bind(this)); this.blinkSelection.bind(this));
...@@ -474,7 +474,7 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52; ...@@ -474,7 +474,7 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52;
this.rootsContextMenu_ = this.rootsContextMenu_ =
this.dialogDom_.querySelector('#roots-context-menu'); this.dialogDom_.querySelector('#roots-context-menu');
cr.ui.Menu.decorate(this.rootsContextMenu_); cr.ui.Menu.decorate(this.rootsContextMenu_);
this.volumeList_.setContextMenu(this.rootsContextMenu_); this.navigationList_.setContextMenu(this.rootsContextMenu_);
this.directoryTreeContextMenu_ = this.directoryTreeContextMenu_ =
this.dialogDom_.querySelector('#directory-tree-context-menu'); this.dialogDom_.querySelector('#directory-tree-context-menu');
...@@ -565,14 +565,14 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52; ...@@ -565,14 +565,14 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52;
CommandUtil.registerCommand(this.dialogContainer_, 'change-default-app', CommandUtil.registerCommand(this.dialogContainer_, 'change-default-app',
Commands.changeDefaultAppCommand, this); Commands.changeDefaultAppCommand, this);
CommandUtil.registerCommand(this.volumeList_, 'unmount', CommandUtil.registerCommand(this.navigationList_, 'unmount',
Commands.unmountCommand, this.volumeList_, this); Commands.unmountCommand, this.navigationList_, this);
CommandUtil.registerCommand(this.volumeList_, 'import-photos', CommandUtil.registerCommand(this.navigationList_, 'import-photos',
Commands.importCommand, this.volumeList_); Commands.importCommand, this.navigationList_);
CommandUtil.registerCommand(this.dialogContainer_, 'format', CommandUtil.registerCommand(this.dialogContainer_, 'format',
Commands.formatCommand, this.volumeList_, this, Commands.formatCommand, this.navigationList_, this,
this.directoryModel_); this.directoryModel_);
CommandUtil.registerCommand(this.dialogContainer_, 'delete', CommandUtil.registerCommand(this.dialogContainer_, 'delete',
...@@ -624,7 +624,7 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52; ...@@ -624,7 +624,7 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52;
CommandUtil.registerCommand(this.dialogContainer_, CommandUtil.registerCommand(this.dialogContainer_,
'volume-switch-' + i, 'volume-switch-' + i,
Commands.volumeSwitchCommand, Commands.volumeSwitchCommand,
this.volumeList_, this.navigationList_,
i); i);
} }
...@@ -1181,10 +1181,10 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52; ...@@ -1181,10 +1181,10 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52;
this.updateMiddleBarVisibility_(true); this.updateMiddleBarVisibility_(true);
}.bind(this)); }.bind(this));
this.volumeList_ = this.dialogDom_.querySelector('#volume-list'); this.navigationList_ = this.dialogDom_.querySelector('#volume-list');
VolumeList.decorate(this.volumeList_, NavigationList.decorate(this.navigationList_,
this.directoryModel_, this.directoryModel_,
this.folderShortcutsModel_); this.folderShortcutsModel_);
}; };
/** /**
...@@ -1503,10 +1503,10 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52; ...@@ -1503,10 +1503,10 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52;
if (this.directoryTree_) if (this.directoryTree_)
this.directoryTree_.relayout(); this.directoryTree_.relayout();
// TODO(mtomasz, yoshiki): Initialize volume list earlier, before // TODO(mtomasz, yoshiki): Initialize navigation list earlier, before
// file system is available. // file system is available.
if (this.volumeList_) if (this.navigationList_)
this.volumeList_.redraw(); this.navigationList_.redraw();
// Hide the search box if there is not enough space. // Hide the search box if there is not enough space.
this.searchBoxWrapper_.classList.toggle( this.searchBoxWrapper_.classList.toggle(
......
...@@ -9,19 +9,19 @@ var CommandUtil = {}; ...@@ -9,19 +9,19 @@ var CommandUtil = {};
/** /**
* Extracts path on which command event was dispatched. * Extracts path on which command event was dispatched.
* *
* @param {DirectoryTree|DirectoryItem|VolumeList|HTMLLIElement|cr.ui.List} * @param {DirectoryTree|DirectoryItem|NavigationList|HTMLLIElement|cr.ui.List}
* element Directory to extract a path from. * element Directory to extract a path from.
* @return {?string} Path of the found node. * @return {?string} Path of the found node.
*/ */
CommandUtil.getCommandPath = function(element) { CommandUtil.getCommandPath = function(element) {
if (element instanceof VolumeList) { if (element instanceof NavigationList) {
// element is a VolumeList. // element is a NavigationList.
return element.selectedItem; return element.selectedItem;
} else if (element instanceof VolumeItem) { } else if (element instanceof NavigationListItem) {
// element is a subitem of VolumeList. // element is a subitem of NavigationList.
var volumeList = element.parentElement; var navigationList = element.parentElement;
var index = volumeList.getIndexOfListItem(element); var index = navigationList.getIndexOfListItem(element);
return (index != -1) ? volumeList.dataModel.item(index) : null; return (index != -1) ? navigationList.dataModel.item(index) : null;
} else if (element instanceof DirectoryTree) { } else if (element instanceof DirectoryTree) {
// element is a DirectoryTree. // element is a DirectoryTree.
var item = element.selectedItem; var item = element.selectedItem;
...@@ -44,11 +44,11 @@ CommandUtil.getCommandPath = function(element) { ...@@ -44,11 +44,11 @@ CommandUtil.getCommandPath = function(element) {
}; };
/** /**
* @param {VolumeList} volumeList Volume list to extract root node. * @param {NavigationList} navigationList navigation list to extract root node.
* @return {?RootType} Type of the found root. * @return {?RootType} Type of the found root.
*/ */
CommandUtil.getCommandRootType = function(volumeList) { CommandUtil.getCommandRootType = function(navigationList) {
var root = CommandUtil.getCommandPath(volumeList); var root = CommandUtil.getCommandPath(navigationList);
return root && PathUtil.isRootPath(root) && PathUtil.getRootType(root); return root && PathUtil.isRootPath(root) && PathUtil.getRootType(root);
}; };
...@@ -171,19 +171,19 @@ Commands.defaultCommand = { ...@@ -171,19 +171,19 @@ Commands.defaultCommand = {
Commands.unmountCommand = { Commands.unmountCommand = {
/** /**
* @param {Event} event Command event. * @param {Event} event Command event.
* @param {VolumeList} volumeList Target volume list. * @param {NavigationList} navigationList Target navigation list.
*/ */
execute: function(event, volumeList, fileManager) { execute: function(event, navigationList, fileManager) {
var root = CommandUtil.getCommandPath(volumeList); var root = CommandUtil.getCommandPath(navigationList);
if (root) if (root)
fileManager.unmountVolume(PathUtil.getRootPath(root)); fileManager.unmountVolume(PathUtil.getRootPath(root));
}, },
/** /**
* @param {Event} event Command event. * @param {Event} event Command event.
* @param {VolumeList} volumeList Target volume list. * @param {NavigationList} navigationList Target navigation list.
*/ */
canExecute: function(event, volumeList) { canExecute: function(event, navigationList) {
var rootType = CommandUtil.getCommandRootType(volumeList); var rootType = CommandUtil.getCommandRootType(navigationList);
event.canExecute = (rootType == RootType.ARCHIVE || event.canExecute = (rootType == RootType.ARCHIVE ||
rootType == RootType.REMOVABLE); rootType == RootType.REMOVABLE);
...@@ -200,11 +200,11 @@ Commands.unmountCommand = { ...@@ -200,11 +200,11 @@ Commands.unmountCommand = {
Commands.formatCommand = { Commands.formatCommand = {
/** /**
* @param {Event} event Command event. * @param {Event} event Command event.
* @param {VolumeList} volumeList Target volume list. * @param {NavigationList} navigationList Target navigation list.
* @param {FileManager} fileManager The file manager instance. * @param {FileManager} fileManager The file manager instance.
*/ */
execute: function(event, volumeList, fileManager) { execute: function(event, navigationList, fileManager) {
var root = CommandUtil.getCommandPath(volumeList); var root = CommandUtil.getCommandPath(navigationList);
if (root) { if (root) {
var url = util.makeFilesystemUrl(PathUtil.getRootPath(root)); var url = util.makeFilesystemUrl(PathUtil.getRootPath(root));
...@@ -215,12 +215,12 @@ Commands.formatCommand = { ...@@ -215,12 +215,12 @@ Commands.formatCommand = {
}, },
/** /**
* @param {Event} event Command event. * @param {Event} event Command event.
* @param {VolumeList} volumeList Target volume list. * @param {NavigationList} navigationList Target navigation list.
* @param {FileManager} fileManager The file manager instance. * @param {FileManager} fileManager The file manager instance.
* @param {DirectoryModel} directoryModel The directory model instance. * @param {DirectoryModel} directoryModel The directory model instance.
*/ */
canExecute: function(event, volumeList, fileManager, directoryModel) { canExecute: function(event, navigationList, fileManager, directoryModel) {
var root = CommandUtil.getCommandPath(volumeList); var root = CommandUtil.getCommandPath(navigationList);
var removable = root && var removable = root &&
PathUtil.getRootType(root) == RootType.REMOVABLE; PathUtil.getRootType(root) == RootType.REMOVABLE;
var isReadOnly = root && directoryModel.isPathReadOnly(root); var isReadOnly = root && directoryModel.isPathReadOnly(root);
...@@ -235,10 +235,10 @@ Commands.formatCommand = { ...@@ -235,10 +235,10 @@ Commands.formatCommand = {
Commands.importCommand = { Commands.importCommand = {
/** /**
* @param {Event} event Command event. * @param {Event} event Command event.
* @param {VolumeList} volumeList Target volume list. * @param {NavigationList} navigationList Target navigation list.
*/ */
execute: function(event, volumeList) { execute: function(event, navigationList) {
var root = CommandUtil.getCommandPath(volumeList); var root = CommandUtil.getCommandPath(navigationList);
if (!root) if (!root)
return; return;
...@@ -246,10 +246,10 @@ Commands.importCommand = { ...@@ -246,10 +246,10 @@ Commands.importCommand = {
}, },
/** /**
* @param {Event} event Command event. * @param {Event} event Command event.
* @param {VolumeList} volumeList Target volume list. * @param {NavigationList} navigationList Target navigation list.
*/ */
canExecute: function(event, volumeList) { canExecute: function(event, navigationList) {
var rootType = CommandUtil.getCommandRootType(volumeList); var rootType = CommandUtil.getCommandRootType(navigationList);
event.canExecute = (rootType != RootType.DRIVE); event.canExecute = (rootType != RootType.DRIVE);
} }
}; };
...@@ -420,11 +420,11 @@ Commands.searchCommand = { ...@@ -420,11 +420,11 @@ Commands.searchCommand = {
* Activates the n-th volume. * Activates the n-th volume.
*/ */
Commands.volumeSwitchCommand = { Commands.volumeSwitchCommand = {
execute: function(event, volumeList, index) { execute: function(event, navigationList, index) {
volumeList.selectByIndex(index - 1); navigationList.selectByIndex(index - 1);
}, },
canExecute: function(event, volumeList, index) { canExecute: function(event, navigationList, index) {
event.canExecute = index > 0 && index <= volumeList.dataModel.length; event.canExecute = index > 0 && index <= navigationList.dataModel.length;
} }
}; };
...@@ -579,7 +579,8 @@ Commands.createFolderShortcutCommand = { ...@@ -579,7 +579,8 @@ Commands.createFolderShortcutCommand = {
var target = event.target; var target = event.target;
// TODO(yoshiki): remove this after launching folder shortcuts feature. // TODO(yoshiki): remove this after launching folder shortcuts feature.
if (!fileManager.isFolderShortcutsEnabled() || if (!fileManager.isFolderShortcutsEnabled() ||
!target instanceof VolumeItem && !target instanceof DirectoryItem) { (!target instanceof NavigationListItem &&
!target instanceof DirectoryItem)) {
event.command.setHidden(true); event.command.setHidden(true);
return; return;
} }
...@@ -624,7 +625,8 @@ Commands.removeFolderShortcutCommand = { ...@@ -624,7 +625,8 @@ Commands.removeFolderShortcutCommand = {
var target = event.target; var target = event.target;
// TODO(yoshiki): remove this after launching folder shortcut feature. // TODO(yoshiki): remove this after launching folder shortcut feature.
if (!fileManager.isFolderShortcutsEnabled() || if (!fileManager.isFolderShortcutsEnabled() ||
!target instanceof VolumeItem && !target instanceof DirectoryItem) { (!target instanceof NavigationListItem &&
!target instanceof DirectoryItem)) {
event.command.setHidden(true); event.command.setHidden(true);
return; return;
} }
......
...@@ -99,9 +99,9 @@ FileTransferController.prototype = { ...@@ -99,9 +99,9 @@ FileTransferController.prototype = {
/** /**
* @this {FileTransferController} * @this {FileTransferController}
* @param {VolumeList} tree Its sub items will could be drop target. * @param {NavigationList} tree Its sub items will could be drop target.
*/ */
attachVolumesDropTarget: function(list) { attachNavigationListDropTarget: function(list) {
list.addEventListener('dragover', list.addEventListener('dragover',
this.onDragOver_.bind(this, true /* onlyIntoDirectories */, list)); this.onDragOver_.bind(this, true /* onlyIntoDirectories */, list));
list.addEventListener('dragenter', list.addEventListener('dragenter',
...@@ -409,7 +409,7 @@ FileTransferController.prototype = { ...@@ -409,7 +409,7 @@ FileTransferController.prototype = {
/** /**
* @this {FileTransferController} * @this {FileTransferController}
* @param {VolumeList} list Drop target list. * @param {NavigationList} list Drop target list.
* @param {Event} event A dragenter event of DOM. * @param {Event} event A dragenter event of DOM.
*/ */
onDragEnterVolumesList_: function(list, event) { onDragEnterVolumesList_: function(list, event) {
......
...@@ -247,6 +247,7 @@ FolderShortcutsDataModel.prototype = { ...@@ -247,6 +247,7 @@ FolderShortcutsDataModel.prototype = {
// 1) 'change' event is not necessary to fire since it is covered by // 1) 'change' event is not necessary to fire since it is covered by
// 'permuted' event. // 'permuted' event.
// 2) 'splice' and 'sorted' events are not implemented. These events are // 2) 'splice' and 'sorted' events are not implemented. These events are
// not used in VolumeListModel. We have to implement them when necessary. // not used in NavigationListModel. We have to implement them when
// necessary.
} }
}; };
...@@ -92,11 +92,11 @@ ...@@ -92,11 +92,11 @@
//<include src="file_type.js"/> //<include src="file_type.js"/>
//<include src="file_watcher.js"/> //<include src="file_watcher.js"/>
//<include src="folder_shortcuts_data_model.js"/> //<include src="folder_shortcuts_data_model.js"/>
//<include src="navigation_list.js"/>
//<include src="scrollbar.js"/> //<include src="scrollbar.js"/>
//<include src="share_client.js"/> //<include src="share_client.js"/>
//<include src="share_dialog.js"/> //<include src="share_dialog.js"/>
//<include src="tree.css.js"/> //<include src="tree.css.js"/>
//<include src="volume_list.js"/>
//<include src="volume_manager.js"/> //<include src="volume_manager.js"/>
//<include src="media/media_util.js"/> //<include src="media/media_util.js"/>
//<include src="metadata/metadata_cache.js"/> //<include src="metadata/metadata_cache.js"/>
......
...@@ -5,13 +5,13 @@ ...@@ -5,13 +5,13 @@
'use strict'; 'use strict';
/** /**
* A volume list model. This model combines the 2 lists. * A navigation list model. This model combines the 2 lists.
* @param {cr.ui.ArrayDataModel} volumesList The first list of the model. * @param {cr.ui.ArrayDataModel} volumesList The first list of the model.
* @param {cr.ui.ArrayDataModel} pinnedList The second list of the model. * @param {cr.ui.ArrayDataModel} pinnedList The second list of the model.
* @constructor * @constructor
* @extends {cr.EventTarget} * @extends {cr.EventTarget}
*/ */
function VolumeListModel(volumesList, pinnedList) { function NavigationListModel(volumesList, pinnedList) {
this.volumesList_ = volumesList; this.volumesList_ = volumesList;
this.pinnedList_ = pinnedList; this.pinnedList_ = pinnedList;
...@@ -62,9 +62,9 @@ function VolumeListModel(volumesList, pinnedList) { ...@@ -62,9 +62,9 @@ function VolumeListModel(volumesList, pinnedList) {
} }
/** /**
* VolumeList inherits cr.EventTarget. * NavigationList inherits cr.EventTarget.
*/ */
VolumeListModel.prototype = { NavigationListModel.prototype = {
__proto__: cr.EventTarget.prototype, __proto__: cr.EventTarget.prototype,
get length() { return this.length_(); } get length() { return this.length_(); }
}; };
...@@ -74,7 +74,7 @@ VolumeListModel.prototype = { ...@@ -74,7 +74,7 @@ VolumeListModel.prototype = {
* @param {number} index The index of the entry to get. * @param {number} index The index of the entry to get.
* @return {?string} The path at the given index. * @return {?string} The path at the given index.
*/ */
VolumeListModel.prototype.item = function(index) { NavigationListModel.prototype.item = function(index) {
var offset = this.volumesList_.length; var offset = this.volumesList_.length;
if (index < offset) { if (index < offset) {
var entry = this.volumesList_.item(index); var entry = this.volumesList_.item(index);
...@@ -85,10 +85,10 @@ VolumeListModel.prototype.item = function(index) { ...@@ -85,10 +85,10 @@ VolumeListModel.prototype.item = function(index) {
}; };
/** /**
* Type of the item on the volume list. * Type of the item on the navigation list.
* @enum {number} * @enum {number}
*/ */
VolumeListModel.ItemType = { NavigationListModel.ItemType = {
ROOT: 1, ROOT: 1,
PINNED: 2 PINNED: 2
}; };
...@@ -96,12 +96,12 @@ VolumeListModel.ItemType = { ...@@ -96,12 +96,12 @@ VolumeListModel.ItemType = {
/** /**
* Returns the type of the item at the given index. * Returns the type of the item at the given index.
* @param {number} index The index of the entry to get. * @param {number} index The index of the entry to get.
* @return {VolumeListModel.ItemType} The type of the item. * @return {NavigationListModel.ItemType} The type of the item.
*/ */
VolumeListModel.prototype.getItemType = function(index) { NavigationListModel.prototype.getItemType = function(index) {
var offset = this.volumesList_.length; var offset = this.volumesList_.length;
return index < offset ? return index < offset ?
VolumeListModel.ItemType.ROOT : VolumeListModel.ItemType.PINNED; NavigationListModel.ItemType.ROOT : NavigationListModel.ItemType.PINNED;
}; };
/** /**
...@@ -109,7 +109,7 @@ VolumeListModel.prototype.getItemType = function(index) { ...@@ -109,7 +109,7 @@ VolumeListModel.prototype.getItemType = function(index) {
* @return {number} The length of the model. * @return {number} The length of the model.
* @private * @private
*/ */
VolumeListModel.prototype.length_ = function() { NavigationListModel.prototype.length_ = function() {
return this.volumesList_.length + this.pinnedList_.length; return this.volumesList_.length + this.pinnedList_.length;
}; };
...@@ -120,7 +120,7 @@ VolumeListModel.prototype.length_ = function() { ...@@ -120,7 +120,7 @@ VolumeListModel.prototype.length_ = function() {
* the {@code opt_fromIndex}. * the {@code opt_fromIndex}.
* @return {number} The index of the first found element or -1 if not found. * @return {number} The index of the first found element or -1 if not found.
*/ */
VolumeListModel.prototype.indexOf = function(item, opt_fromIndex) { NavigationListModel.prototype.indexOf = function(item, opt_fromIndex) {
for (var i = opt_fromIndex || 0; i < this.length; i++) { for (var i = opt_fromIndex || 0; i < this.length; i++) {
if (item === this.item(i)) if (item === this.item(i))
return i; return i;
...@@ -129,20 +129,20 @@ VolumeListModel.prototype.indexOf = function(item, opt_fromIndex) { ...@@ -129,20 +129,20 @@ VolumeListModel.prototype.indexOf = function(item, opt_fromIndex) {
}; };
/** /**
* A volume item. * A navigation list item.
* @constructor * @constructor
* @extends {HTMLLIElement} * @extends {HTMLLIElement}
*/ */
var VolumeItem = cr.ui.define('li'); var NavigationListItem = cr.ui.define('li');
VolumeItem.prototype = { NavigationListItem.prototype = {
__proto__: HTMLLIElement.prototype, __proto__: HTMLLIElement.prototype,
}; };
/** /**
* Decorate the item. * Decorate the item.
*/ */
VolumeItem.prototype.decorate = function() { NavigationListItem.prototype.decorate = function() {
// decorate() may be called twice: from the constructor and from // decorate() may be called twice: from the constructor and from
// List.createItem(). This check prevents double-decorating. // List.createItem(). This check prevents double-decorating.
if (this.className) if (this.className)
...@@ -167,9 +167,9 @@ VolumeItem.prototype.decorate = function() { ...@@ -167,9 +167,9 @@ VolumeItem.prototype.decorate = function() {
* Associate a path with this item. * Associate a path with this item.
* @param {string} path Path of this item. * @param {string} path Path of this item.
*/ */
VolumeItem.prototype.setPath = function(path) { NavigationListItem.prototype.setPath = function(path) {
if (this.path_) if (this.path_)
console.warn('VolumeItem.setPath should be called only once.'); console.warn('NavigationListItem.setPath should be called only once.');
this.path_ = path; this.path_ = path;
...@@ -205,10 +205,10 @@ VolumeItem.prototype.setPath = function(path) { ...@@ -205,10 +205,10 @@ VolumeItem.prototype.setPath = function(path) {
* Associate a context menu with this item. * Associate a context menu with this item.
* @param {cr.ui.Menu} menu Menu this item. * @param {cr.ui.Menu} menu Menu this item.
*/ */
VolumeItem.prototype.maybeSetContextMenu = function(menu) { NavigationListItem.prototype.maybeSetContextMenu = function(menu) {
if (!this.path_) { if (!this.path_) {
console.error( console.error('NavigationListItem.maybeSetContextMenu must be called ' +
'VolumeItem.maybeSetContextMenu must be called after setPath().'); 'after setPath().');
return; return;
} }
...@@ -223,17 +223,17 @@ VolumeItem.prototype.maybeSetContextMenu = function(menu) { ...@@ -223,17 +223,17 @@ VolumeItem.prototype.maybeSetContextMenu = function(menu) {
}; };
/** /**
* A volume list. * A navigation list.
* @constructor * @constructor
* @extends {cr.ui.List} * @extends {cr.ui.List}
*/ */
function VolumeList() { function NavigationList() {
} }
/** /**
* VolumeList inherits cr.ui.List. * NavigationList inherits cr.ui.List.
*/ */
VolumeList.prototype.__proto__ = cr.ui.List.prototype; NavigationList.prototype.__proto__ = cr.ui.List.prototype;
/** /**
* @param {HTMLElement} el Element to be DirectoryItem. * @param {HTMLElement} el Element to be DirectoryItem.
...@@ -241,8 +241,8 @@ VolumeList.prototype.__proto__ = cr.ui.List.prototype; ...@@ -241,8 +241,8 @@ VolumeList.prototype.__proto__ = cr.ui.List.prototype;
* @param {cr.ui.ArrayDataModel} pinnedFolderModel Current model of the pinned * @param {cr.ui.ArrayDataModel} pinnedFolderModel Current model of the pinned
* folders. * folders.
*/ */
VolumeList.decorate = function(el, directoryModel, pinnedFolderModel) { NavigationList.decorate = function(el, directoryModel, pinnedFolderModel) {
el.__proto__ = VolumeList.prototype; el.__proto__ = NavigationList.prototype;
el.decorate(directoryModel, pinnedFolderModel); el.decorate(directoryModel, pinnedFolderModel);
}; };
...@@ -251,9 +251,10 @@ VolumeList.decorate = function(el, directoryModel, pinnedFolderModel) { ...@@ -251,9 +251,10 @@ VolumeList.decorate = function(el, directoryModel, pinnedFolderModel) {
* @param {cr.ui.ArrayDataModel} pinnedFolderModel Current model of the pinned * @param {cr.ui.ArrayDataModel} pinnedFolderModel Current model of the pinned
* folders. * folders.
*/ */
VolumeList.prototype.decorate = function(directoryModel, pinnedFolderModel) { NavigationList.prototype.decorate =
function(directoryModel, pinnedFolderModel) {
cr.ui.List.decorate(this); cr.ui.List.decorate(this);
this.__proto__ = VolumeList.prototype; this.__proto__ = NavigationList.prototype;
this.directoryModel_ = directoryModel; this.directoryModel_ = directoryModel;
this.volumeManager_ = VolumeManager.getInstance(); this.volumeManager_ = VolumeManager.getInstance();
...@@ -281,19 +282,19 @@ VolumeList.prototype.decorate = function(directoryModel, pinnedFolderModel) { ...@@ -281,19 +282,19 @@ VolumeList.prototype.decorate = function(directoryModel, pinnedFolderModel) {
this.pinnedItemList_ = pinnedFolderModel; this.pinnedItemList_ = pinnedFolderModel;
this.dataModel = this.dataModel =
new VolumeListModel(this.directoryModel_.getRootsList(), new NavigationListModel(this.directoryModel_.getRootsList(),
this.pinnedItemList_); this.pinnedItemList_);
}; };
/** /**
* Creates an element of a volume. This method is called from cr.ui.List * Creates an element of a navigation list. This method is called from
* internally. * cr.ui.List internally.
* @param {string} path Path of the directory to be rendered. * @param {string} path Path of the directory to be rendered.
* @return {VolumeItem} Rendered element. * @return {NavigationListItem} Rendered element.
* @private * @private
*/ */
VolumeList.prototype.renderRoot_ = function(path) { NavigationList.prototype.renderRoot_ = function(path) {
var item = new VolumeItem(); var item = new NavigationListItem();
item.setPath(path); item.setPath(path);
var handleClick = function() { var handleClick = function() {
...@@ -330,7 +331,7 @@ VolumeList.prototype.renderRoot_ = function(path) { ...@@ -330,7 +331,7 @@ VolumeList.prototype.renderRoot_ = function(path) {
* *
* @param {cr.ui.Menu} menu Context menu. * @param {cr.ui.Menu} menu Context menu.
*/ */
VolumeList.prototype.setContextMenu = function(menu) { NavigationList.prototype.setContextMenu = function(menu) {
this.contextMenu_ = menu; this.contextMenu_ = menu;
for (var i = 0; i < this.dataModel.length; i++) { for (var i = 0; i < this.dataModel.length; i++) {
...@@ -339,11 +340,11 @@ VolumeList.prototype.setContextMenu = function(menu) { ...@@ -339,11 +340,11 @@ VolumeList.prototype.setContextMenu = function(menu) {
}; };
/** /**
* Selects the n-th volume from the list. * Selects the n-th item from the list.
* @param {number} index Volume index. * @param {number} index Item index.
* @return {boolean} True for success, otherwise false. * @return {boolean} True for success, otherwise false.
*/ */
VolumeList.prototype.selectByIndex = function(index) { NavigationList.prototype.selectByIndex = function(index) {
if (index < 0 || index > this.dataModel.length - 1) if (index < 0 || index > this.dataModel.length - 1)
return false; return false;
...@@ -364,7 +365,7 @@ VolumeList.prototype.selectByIndex = function(index) { ...@@ -364,7 +365,7 @@ VolumeList.prototype.selectByIndex = function(index) {
* @param {Event} event The event. * @param {Event} event The event.
* @private * @private
*/ */
VolumeList.prototype.onBeforeSelectionChange_ = function(event) { NavigationList.prototype.onBeforeSelectionChange_ = function(event) {
if (event.changes.length == 1 && !event.changes[0].selected) if (event.changes.length == 1 && !event.changes[0].selected)
event.preventDefault(); event.preventDefault();
}; };
...@@ -374,8 +375,8 @@ VolumeList.prototype.onBeforeSelectionChange_ = function(event) { ...@@ -374,8 +375,8 @@ VolumeList.prototype.onBeforeSelectionChange_ = function(event) {
* @param {Event} event The event. * @param {Event} event The event.
* @private * @private
*/ */
VolumeList.prototype.onSelectionChange_ = function(event) { NavigationList.prototype.onSelectionChange_ = function(event) {
// This handler is invoked even when the volume list itself changes the // This handler is invoked even when the navigation list itself changes the
// selection. In such case, we shouldn't handle the event. // selection. In such case, we shouldn't handle the event.
if (this.dontHandleSelectionEvent_) if (this.dontHandleSelectionEvent_)
return; return;
...@@ -388,12 +389,12 @@ VolumeList.prototype.onSelectionChange_ = function(event) { ...@@ -388,12 +389,12 @@ VolumeList.prototype.onSelectionChange_ = function(event) {
* @param {Event} event The event. * @param {Event} event The event.
* @private * @private
*/ */
VolumeList.prototype.onCurrentDirectoryChanged_ = function(event) { NavigationList.prototype.onCurrentDirectoryChanged_ = function(event) {
var path = event.newDirEntry.fullPath || this.dataModel.getCurrentDirPath(); var path = event.newDirEntry.fullPath || this.dataModel.getCurrentDirPath();
var newRootPath = PathUtil.getRootPath(path); var newRootPath = PathUtil.getRootPath(path);
// Synchronizes the volume list selection with the current directory, after // Synchronizes the navigation list selection with the current directory,
// it is changed outside of the volume list. // after it is changed outside of the navigation list.
// (1) Select the nearest parent directory (including the pinned directories). // (1) Select the nearest parent directory (including the pinned directories).
var bestMatchIndex = -1; var bestMatchIndex = -1;
......
...@@ -410,7 +410,7 @@ test.util.async.selectVolume = function(contentWindow, iconName, callback) { ...@@ -410,7 +410,7 @@ test.util.async.selectVolume = function(contentWindow, iconName, callback) {
}, },
sendEvents: function() { sendEvents: function() {
// To change the selected volume, we have to send both events 'mousedown' // To change the selected volume, we have to send both events 'mousedown'
// and 'click' to the volume list. // and 'click' to the navigation list.
callback(test.util.sync.fakeMouseDown(contentWindow, query) && callback(test.util.sync.fakeMouseDown(contentWindow, query) &&
test.util.sync.fakeMouseClick(contentWindow, query)); test.util.sync.fakeMouseClick(contentWindow, query));
} }
......
...@@ -105,12 +105,12 @@ ...@@ -105,12 +105,12 @@
<script src="js/file_type.js"></script> <script src="js/file_type.js"></script>
<script src="js/file_watcher.js"></script> <script src="js/file_watcher.js"></script>
<script src="js/folder_shortcuts_data_model.js"></script> <script src="js/folder_shortcuts_data_model.js"></script>
<script src="js/navigation_list.js"></script>
<script src="js/scrollbar.js"></script> <script src="js/scrollbar.js"></script>
<script src="js/share_client.js"></script> <script src="js/share_client.js"></script>
<script src="js/share_dialog.js"></script> <script src="js/share_dialog.js"></script>
<script src="js/tree.css.js"></script> <script src="js/tree.css.js"></script>
<script src="js/volume_manager.js"></script> <script src="js/volume_manager.js"></script>
<script src="js/volume_list.js"></script>
<script src="js/media/media_util.js"></script> <script src="js/media/media_util.js"></script>
<script src="js/metadata/metadata_cache.js"></script> <script src="js/metadata/metadata_cache.js"></script>
<script src="js/default_action_dialog.js"></script> <script src="js/default_action_dialog.js"></script>
......
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