Skip to content

Commit

Permalink
Files app: Add missing @type
Browse files Browse the repository at this point in the history
TS compiler doesn't recognize the JSDoc type withtout the tag @type.

This is a preparation to replcae Closure Compiler with TS for type
checking the JS files.

This CL was generated using the following sed commands:
$ grep -R '@public {' ui/file_manager/file_manager/ -l  | \
   xargs sed -i 's/@public {/@public @type {/g'
$ grep -R '@const {' ui/file_manager/file_manager/ -l   | \
   xargs sed -i 's/@const {/@const @type {/g'
$ grep -R '@Private {' ui/file_manager/file_manager/ -l | \
   xargs sed -i 's/@Private {/@Private @type {/g'
$ grep -R '@Protected {' ui/file_manager/file_manager/ -l | \
   xargs sed -i 's/@Protected {/@Protected @type {/g'

Bug: b:304851448
Change-Id: Ib6623c71ebbba8e240471020fbed8de34114dcd0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4937198
Reviewed-by: Wenbo Jie <wenbojie@chromium.org>
Reviewed-by: Ben Reich <benreich@chromium.org>
Commit-Queue: Luciano Pacheco <lucmult@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1210009}
  • Loading branch information
Luciano Pacheco authored and Chromium LUCI CQ committed Oct 16, 2023
1 parent 47ddcb4 commit 6c62357
Show file tree
Hide file tree
Showing 110 changed files with 734 additions and 723 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class FileManagerBase {

/**
* Event handler for progress center.
* @private {FileOperationHandler}
* @private @type {FileOperationHandler}
*/
this.fileOperationHandler_ = null;

Expand Down Expand Up @@ -348,7 +348,10 @@ export class FileManagerBase {
}
}

/** @private {number} Total number of retries for the resolve entries below.*/
/**
* @private @type {number} Total number of retries for the resolve entries
* below.
*/
const MAX_RETRIES = 6;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ import {fileOperationUtil} from './file_operation_util.js';
export class FileOperationManagerImpl {
constructor() {
/**
* @private {VolumeManager}
* @private @type {VolumeManager}
*/
this.volumeManager_ = null;

/**
* @private {number}
* @private @type {number}
*/
this.taskIdCounter_ = 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,24 +125,25 @@ class Speedometer {
*/
constructor(maxSamples = 20) {
/**
* @private @const {number} Max number of samples to keep.
* @private @const @type {number} Max number of samples to keep.
*/
this.maxSamples_ = maxSamples;

/**
* @private {!Array<!{time: number, bytes: number}>} Recent samples.
* @private @type {!Array<!{time: number, bytes: number}>} Recent samples.
* |time| is in milliseconds.
*/
this.samples_ = [];

/**
* @private {?{time: number, bytes: number}} First sample.
* @private @type {?{time: number, bytes: number}} First sample.
* |time| is in milliseconds.
*/
this.first_ = null;

/**
* @private {number} Total number of bytes to be processed by the task.
* @private @type {number} Total number of bytes to be processed by the
* task.
*/
this.totalBytes_ = 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class MockProgressCenter {
constructor() {
/**
* Items stored in the progress center.
* @const {!Object<ProgressCenterItem>}
* @const @type {!Object<ProgressCenterItem>}
*/
this.items = {};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const fakeDriveVolumeId =
*/
export class MockVolumeManager {
constructor() {
/** @const {!VolumeInfoList} */
/** @const @type {!VolumeInfoList} */
this.volumeInfoList = new VolumeInfoListImpl();

/** @type {!chrome.fileManagerPrivate.DriveConnectionState} */
Expand Down Expand Up @@ -299,7 +299,7 @@ export class MockVolumeManager {
}
}

/** @private {?VolumeManager} */
/** @private @type {?VolumeManager} */
MockVolumeManager.instance_ = null;

MockVolumeManager.prototype.getVolumeInfo =
Expand Down
14 changes: 7 additions & 7 deletions ui/file_manager/file_manager/background/js/progress_center.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ export class ProgressCenterImpl {
constructor() {
/**
* Current items managed by the progress center.
* @private @const {!Array<!ProgressCenterItem>}
* @private @const @type {!Array<!ProgressCenterItem>}
*/
this.items_ = [];

/**
* Map of progress ID and notification ID.
* @private @const {!ProgressCenterImpl.Notifications_}
* @private @const @type {!ProgressCenterImpl.Notifications_}
*/
this.notifications_ = new ProgressCenterImpl.Notifications_(
this.requestCancel.bind(this),
this.onNotificationDismissed_.bind(this));

/**
* List of panel UI managed by the progress center.
* @private @const {!Array<ProgressCenterPanelInterface>}
* @private @const @type {!Array<ProgressCenterPanelInterface>}
*/
this.panels_ = [];

Expand Down Expand Up @@ -368,25 +368,25 @@ ProgressCenterImpl.Notifications_ = class {
/**
* ID set of notifications that is progressing now.
* @private
* @const {Object<ProgressCenterImpl.Notifications_.NotificationState_>}
* @const @type {Object<ProgressCenterImpl.Notifications_.NotificationState_>}
*/
this.ids_ = {};

/**
* Async queue.
* @private @const {AsyncQueue}
* @private @const @type {AsyncQueue}
*/
this.queue_ = new AsyncQueue();

/**
* Callback to notify the progress center of cancel operation.
* @private @const {function(string)}
* @private @const @type {function(string)}
*/
this.cancelCallback_ = cancelCallback;

/**
* Callback to notify the progress center that a notification is dismissed.
* @private {function(string)}
* @private @type {function(string)}
*/
this.dismissCallback_ = dismissCallback;

Expand Down
28 changes: 14 additions & 14 deletions ui/file_manager/file_manager/background/js/test_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,15 +373,15 @@ test.util.async.renderWindowTextDirectionRTL = (contentWindow, callback) => {
* Maps the path to the replaced attribute to the PrepareFake instance that
* replaced it, to be able to restore the original value.
*
* @private {Object<string, test.util.PrepareFake>}
* @private @type {Object<string, test.util.PrepareFake>}
*/
test.util.backgroundReplacedObjects_ = {};

/**
* Map the appId to a map of all fakes applied in the foreground window e.g.:
* {'files#0': {'chrome.bla.api': FAKE}
*
* @private {Object<string, Object<string, test.util.PrepareFake>>}
* @private @type {Object<string, Object<string, test.util.PrepareFake>>}
*/
test.util.foregroundReplacedObjects_ = {};

Expand Down Expand Up @@ -410,7 +410,7 @@ test.util.staticFakeFactory = (attrName, staticValue) => {
* Registry of available fakes, it maps the an string ID to a factory function
* which returns the actual fake used to replace an implementation.
*
* @private {Object<string, function(string, *)>}
* @private @type {Object<string, function(string, *)>}
*/
test.util.fakes_ = {
'static_fake': test.util.staticFakeFactory,
Expand Down Expand Up @@ -441,69 +441,69 @@ test.util.PrepareFake = class {
constructor(attrName, fakeId, context, ...args) {
/**
* The instance of the fake to be used, ready to be used.
* @private {*}
* @private @type {*}
*/
this.fake_ = null;

/**
* The attribute name to be traversed in the |context_|.
* @private {string}
* @private @type {string}
*/
this.attrName_ = attrName;

/**
* The fake id the key to retrieve from test.util.fakes_.
* @private {string}
* @private @type {string}
*/
this.fakeId_ = fakeId;

/**
* The context where |attrName_| will be traversed from, e.g. Window.
* @private {*}
* @private @type {*}
*/
this.context_ = context;

/**
* After traversing |context_| the object that holds the attribute to be
* replaced by the fake.
* @private {*}
* @private @type {*}
*/
this.parentObject_ = null;

/**
* After traversing |context_| the attribute name in |parentObject_| that
* will be replaced by the fake.
* @private {string}
* @private @type {string}
*/
this.leafAttrName_ = '';

/**
* Additional data provided from integration tests to the fake constructor.
* @private {!Array}
* @private @type {!Array}
*/
this.args_ = args;

/**
* Original object that was replaced by the fake.
* @private {*}
* @private @type {*}
*/
this.original_ = null;

/**
* If this fake object has been constructed and everything initialized.
* @private {boolean}
* @private @type {boolean}
*/
this.prepared_ = false;

/**
* Counter to record the number of times the static fake is called.
* @private {number}
* @private @type {number}
*/
this.callCounter_ = 0;

/**
* List to record the arguments provided to the static fake calls.
* @private {!Array}
* @private @type {!Array}
*/
this.calledArgs_ = [];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ export class VolumeManagerImpl extends EventTarget {

/**
* Holds the resolver for the `waitForInitialization_` promise.
* @private {null|function():void}
* @private @type {null|function():void}
*/
this.finishInitialization_ = null;

/**
* Promise used to wait for the initialize() method to finish.
* @private {!Promise<void>}
* @private @type {!Promise<void>}
*/
this.waitForInitialization_ =
new Promise(resolve => this.finishInitialization_ = resolve);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,25 @@ const volumeManagerUtil = {};
* Time in milliseconds that we wait a response for general volume operations
* such as mount, unmount, and requestFileSystem. If no response on
* mount/unmount received the request supposed failed.
* @const {number}
* @const @type {number}
*/
volumeManagerUtil.TIMEOUT = 15 * 60 * 1000;

/**
* Time in milliseconds that we wait a response for
* chrome.fileManagerPrivate.resolveIsolatedEntries.
* @const {number}
* @const @type {number}
*/
volumeManagerUtil.TIMEOUT_FOR_RESOLVE_ISOLATED_ENTRIES = 1 * 60 * 1000;

/**
* @const {string}
* @const @type {string}
*/
volumeManagerUtil.TIMEOUT_STR_REQUEST_FILE_SYSTEM =
'timeout(requestFileSystem)';

/**
* @const {string}
* @const @type {string}
*/
volumeManagerUtil.TIMEOUT_STR_RESOLVE_ISOLATED_ENTRIES =
'timeout(resolveIsolatedEntries)';
Expand Down

0 comments on commit 6c62357

Please sign in to comment.