Commit e408b270 authored by Luciano Pacheco's avatar Luciano Pacheco Committed by Commit Bot

Add closure markup to use FilesAppEntry

This is a continuation of crrev.com/c/1086680 and crrev.com/c/1116400.

isFakeEntry changed the logic to not use operator "in" since Closure
compiler was failing for FilesAppEntry types:
"ERROR - Cannot use the IN operator with structs".

Bug: 846587
Cq-Include-Trybots: luci.chromium.try:closure_compilation
Change-Id: I34914893d01bba43fdbcfc9e4b197031e50c662a
Reviewed-on: https://chromium-review.googlesource.com/1116517
Commit-Queue: Luciano Pacheco <lucmult@chromium.org>
Reviewed-by: default avatarSasha Morrissey <sashab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572503}
parent 3ddda8ad
......@@ -6,7 +6,7 @@
* Interface on which |CommandHandler| depends.
* @interface
*/
function CommandHandlerDeps(){};
function CommandHandlerDeps() {}
/**
* @type {ActionsController}
......@@ -94,7 +94,7 @@ CommandHandlerDeps.prototype.ui;
CommandHandlerDeps.prototype.volumeManager;
/**
* @return {DirectoryEntry|FakeEntry}
* @return {DirectoryEntry|FakeEntry|FilesAppEntry}
*/
CommandHandlerDeps.prototype.getCurrentDirectoryEntry = function() {};
......
......@@ -47,7 +47,8 @@ VolumeInfoList.prototype.findIndex = function(volumeId) {};
/**
* Searches the information of the volume that contains the passed entry.
* @param {!Entry|!FakeEntry} entry Entry on the volume to be found.
* @param {!Entry|!FakeEntry|!FilesAppEntry} entry Entry on the volume to be
* found.
* @return {VolumeInfo} The volume's information, or null if not found.
*/
VolumeInfoList.prototype.findByEntry = function(entry) {};
......
......@@ -7,7 +7,7 @@
* @interface
* @extends {VolumeManagerCommon.VolumeInfoProvider}
*/
function VolumeManager() {};
function VolumeManager() {}
/**
* The list of VolumeInfo instances for each mounted volume.
......@@ -59,8 +59,8 @@ VolumeManager.prototype.getCurrentProfileVolumeInfo = function(volumeType) {};
/**
* Obtains location information from an entry.
*
* @param {!Entry|!FakeEntry} entry File or directory entry. It can be a fake
* entry.
* @param {!Entry|!FakeEntry|!FilesAppEntry} entry File or directory entry. It
* can be a fake entry.
* @return {EntryLocation} Location information.
*/
VolumeManager.prototype.getLocationInfo = function(entry) {};
......
......@@ -59,7 +59,8 @@ MockVolumeManager.prototype.createVolumeInfo =
/**
* Returns the corresponding VolumeInfo.
*
* @param {!Entry|!FakeEntry} entry FileEntry pointing anywhere on a volume.
* @param {!Entry|!FakeEntry|!FilesAppEntry} entry FileEntry pointing anywhere
* on a volume.
* @return {VolumeInfo} Corresponding VolumeInfo.
*/
MockVolumeManager.prototype.getVolumeInfo = function(entry) {
......@@ -70,7 +71,7 @@ MockVolumeManager.prototype.getVolumeInfo = function(entry) {
* Obtains location information from an entry.
* Current implementation can handle only fake entries.
*
* @param {!Entry|!FakeEntry} entry A fake entry.
* @param {!Entry|!FakeEntry|!FilesAppEntry} entry A fake entry.
* @return {EntryLocation} Location information.
*/
MockVolumeManager.prototype.getLocationInfo = function(entry) {
......
......@@ -292,7 +292,7 @@ VolumeManagerImpl.prototype.getCurrentProfileVolumeInfo = function(volumeType) {
VolumeManagerImpl.prototype.getLocationInfo = function(entry) {
var volumeInfo = this.volumeInfoList.findByEntry(entry);
if (util.isFakeEntry(entry)) {
if (util.isFakeEntry(entry) || entry.type_name == 'EntryList') {
return new EntryLocationImpl(
volumeInfo, entry.rootType,
true /* the entry points a root directory. */,
......
......@@ -183,7 +183,7 @@ importer.isEligibleEntry = function(volumeInfoProvider, entry) {
* Returns true if the entry represents a media directory for the purposes
* of Cloud Import.
*
* @param {Entry|FakeEntry} entry
* @param {Entry|FakeEntry|FilesAppEntry} entry
* @param {VolumeManagerCommon.VolumeInfoProvider} volumeInfoProvider
* @return {boolean}
*/
......
......@@ -649,16 +649,16 @@ Object.freeze(util.EntryChangedKind);
/**
* Obtains whether an entry is fake or not.
* @param {(!Entry|!FakeEntry)} entry Entry or a fake entry.
* @param {(!Entry|!FakeEntry|!FilesAppEntry)} entry Entry or a fake entry.
* @return {boolean} True if the given entry is fake.
*/
util.isFakeEntry = function(entry) {
return !('getParent' in entry);
return (entry.getParent === undefined);
};
/**
* Obtains whether an entry is the root directory of a Team Drive.
* @param {(!Entry|!FakeEntry)|null} entry Entry or a fake entry.
* @param {(!Entry|!FakeEntry|!FilesAppEntry)|null} entry Entry or a fake entry.
* @return {boolean} True if the given entry is root of a Team Drive.
*/
util.isTeamDriveRoot = function(entry) {
......@@ -684,7 +684,7 @@ util.isTeamDrivesGrandRoot = function(entry) {
/**
* Obtains whether an entry is descendant of the Team Drives directory.
* @param {(!Entry|!FakeEntry)} entry Entry or a fake entry.
* @param {(!Entry|!FakeEntry|!FilesAppEntry)} entry Entry or a fake entry.
* @return {boolean} True if the given entry is under Team Drives.
*/
util.isTeamDriveEntry = function(entry) {
......@@ -712,7 +712,7 @@ util.getTeamDriveName = function(entry) {
/**
* Returns true if the given entry is the root folder of recent files.
* @param {(!Entry|!FakeEntry)} entry Entry or a fake entry.
* @param {(!Entry|!FakeEntry|!FilesAppEntry)} entry Entry or a fake entry.
* @returns {boolean}
*/
util.isRecentRoot = function(entry) {
......@@ -772,8 +772,10 @@ util.UserDOMError.prototype = {
/**
* Compares two entries.
* @param {Entry|FakeEntry} entry1 The entry to be compared. Can be a fake.
* @param {Entry|FakeEntry} entry2 The entry to be compared. Can be a fake.
* @param {Entry|FakeEntry|FilesAppEntry} entry1 The entry to be compared. Can
* be a fake.
* @param {Entry|FakeEntry|FilesAppEntry} entry2 The entry to be compared. Can
* be a fake.
* @return {boolean} True if the both entry represents a same file or
* directory. Returns true if both entries are null.
*/
......@@ -871,7 +873,8 @@ util.comparePath = function(entry1, entry2) {
* Checks if {@code entry} is an immediate child of {@code directory}.
*
* @param {Entry} entry The presumptive child.
* @param {DirectoryEntry|FakeEntry} directory The presumptive parent.
* @param {DirectoryEntry|FakeEntry|FilesAppEntry} directory The presumptive
* parent.
* @return {!Promise<boolean>} Resolves with true if {@code directory} is
* parent of {@code entry}.
*/
......
......@@ -306,8 +306,8 @@ VolumeManagerCommon.VolumeInfoProvider = function() {};
/**
* Obtains a volume info containing the passed entry.
* @param {!Entry|!FakeEntry} entry Entry on the volume to be returned.
* Can be fake.
* @param {!Entry|!FakeEntry|!FilesAppEntry} entry Entry on the volume to be
* returned. Can be fake.
* @return {?VolumeInfo} The VolumeInfo instance or null if not found.
*/
VolumeManagerCommon.VolumeInfoProvider.prototype.getVolumeInfo;
......
......@@ -36,7 +36,7 @@ ContentScanner.prototype.cancel = function() {
/**
* Scanner of the entries in a directory.
* @param {DirectoryEntry} entry The directory to be read.
* @param {DirectoryEntry|FilesAppDirEntry} entry The directory to be read.
* @constructor
* @extends {ContentScanner}
*/
......@@ -592,8 +592,8 @@ FileListContext.createPrefetchPropertyNames_ = function() {
* @param {FileListContext} context The file list context.
* @param {boolean} isSearch True for search directory contents, otherwise
* false.
* @param {DirectoryEntry|FakeEntry} directoryEntry The entry of the current
* directory.
* @param {DirectoryEntry|FakeEntry|FilesAppDirEntry} directoryEntry The entry
* of the current directory.
* @param {function():ContentScanner} scannerFactory The factory to create
* ContentScanner instance.
* @constructor
......@@ -731,7 +731,8 @@ DirectoryContents.prototype.isSearch = function() {
};
/**
* @return {DirectoryEntry|FakeEntry} A DirectoryEntry for current directory.
* @return {DirectoryEntry|FakeEntry|FilesAppDirEntry} A DirectoryEntry for
* current directory.
* In case of search -- the top directory from which search is run.
*/
DirectoryContents.prototype.getDirectoryEntry = function() {
......@@ -989,7 +990,8 @@ DirectoryContents.prototype.prefetchMetadata =
* Creates a DirectoryContents instance to show entries in a directory.
*
* @param {FileListContext} context File list context.
* @param {DirectoryEntry} directoryEntry The current directory entry.
* @param {DirectoryEntry|FilesAppDirEntry} directoryEntry The current directory
* entry.
* @return {DirectoryContents} Created DirectoryContents instance.
*/
DirectoryContents.createForDirectory = function(context, directoryEntry) {
......
......@@ -327,7 +327,7 @@ DirectoryModel.prototype.getFileFilter = function() {
};
/**
* @return {DirectoryEntry|FakeEntry} Current directory.
* @return {DirectoryEntry|FakeEntry|FilesAppDirEntry} Current directory.
*/
DirectoryModel.prototype.getCurrentDirEntry = function() {
return this.currentDirContents_.getDirectoryEntry();
......@@ -1205,7 +1205,7 @@ DirectoryModel.prototype.onVolumeInfoListUpdated_ = function(event) {
* Creates directory contents for the entry and query.
*
* @param {FileListContext} context File list context.
* @param {!DirectoryEntry|!FakeEntry} entry Current directory.
* @param {!DirectoryEntry|!FakeEntry|!FilesAppEntry} entry Current directory.
* @param {string=} opt_query Search query string.
* @return {DirectoryContents} Directory contents.
* @private
......
......@@ -1474,7 +1474,8 @@ FileManager.prototype = /** @struct */ {
/**
* Return DirectoryEntry of the current directory or null.
* @return {DirectoryEntry|FakeEntry} DirectoryEntry of the current directory.
* @return {DirectoryEntry|FakeEntry|FilesAppDirEntry} DirectoryEntry of the
* current directory.
* Returns null if the directory model is not ready or the current
* directory is not set.
*/
......
......@@ -69,7 +69,7 @@ CommandUtil.getCommandEntries = function(element) {
*
* @param {EventTarget} element Element which is the command event's target.
* @param {DirectoryModel} directoryModel
* @return {DirectoryEntry|FakeEntry} The extracted parent entry.
* @return {DirectoryEntry|FakeEntry|FilesAppEntry} The extracted parent entry.
*/
CommandUtil.getParentEntry = function(element, directoryModel) {
if (element instanceof DirectoryTree) {
......
......@@ -1469,7 +1469,8 @@ FileTransferController.prototype.onBeforePaste_ = function(event) {
/**
* @param {!ClipboardData} clipboardData Clipboard data object.
* @param {DirectoryEntry|FakeEntry} destinationEntry Destination entry.
* @param {DirectoryEntry|FakeEntry|FilesAppEntry} destinationEntry Destination
* entry.
* @return {boolean} Returns true if items stored in {@code clipboardData} can
* be pasted to {@code destinationEntry}. Otherwise, returns false.
* @private
......@@ -1508,7 +1509,7 @@ FileTransferController.prototype.canPasteOrDrop_ =
/**
* Execute paste command.
*
* @param {DirectoryEntry|FakeEntry} destinationEntry
* @param {DirectoryEntry|FakeEntry|FilesAppEntry} destinationEntry
* @return {boolean} Returns true, the paste is success. Otherwise, returns
* false.
*/
......@@ -1616,7 +1617,8 @@ FileTransferController.prototype.onFileSelectionChangedThrottled_ = function() {
* @param {!Event} event Drag event.
* @param {Object<string>} dragAndDropData drag & drop data from
* getDragAndDropGlobalData_().
* @param {DirectoryEntry|FakeEntry} destinationEntry Destination entry.
* @param {DirectoryEntry|FakeEntry|FilesAppEntry} destinationEntry Destination
* entry.
* @return {DropEffectAndLabel} Returns the appropriate drop query type
* ('none', 'move' or copy') to the current modifiers status and the
* destination, as well as label message to describe why the operation is
......
......@@ -1071,7 +1071,7 @@ importer.ControllerEnvironment.prototype.getSelection;
/**
* Returns the directory entry for the current directory.
* @return {DirectoryEntry|FakeEntry}
* @return {DirectoryEntry|FakeEntry|FilesAppEntry}
*/
importer.ControllerEnvironment.prototype.getCurrentDirectory;
......
......@@ -300,7 +300,7 @@ VolumeManagerWrapper.prototype.getDefaultDisplayRoot =
/**
* Obtains location information from an entry.
*
* @param {(!Entry|!FakeEntry)} entry File or directory entry.
* @param {(!Entry|!FakeEntry|!FilesAppEntry)} entry File or directory entry.
* @return {EntryLocation} Location information.
*/
VolumeManagerWrapper.prototype.getLocationInfo = function(entry) {
......
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