Index: ui/file_manager/file_manager/background/js/import_history.js |
diff --git a/ui/file_manager/file_manager/background/js/import_history.js b/ui/file_manager/file_manager/background/js/import_history.js |
index 9a474ba63e5e28f84dce344e5f31f3d51677917d..aba2c16f454cc3be96b0e405c3f1d4a5d2e19c09 100644 |
--- a/ui/file_manager/file_manager/background/js/import_history.js |
+++ b/ui/file_manager/file_manager/background/js/import_history.js |
@@ -5,94 +5,13 @@ |
// Namespace |
var importer = importer || {}; |
-/** |
- * A persistent data store for Cloud Import history information. |
- * |
- * @interface |
- */ |
-importer.ImportHistory = function() {}; |
- |
-/** |
- * @return {!Promise<!importer.ImportHistory>} Resolves when history |
- * has been fully loaded. |
- */ |
-importer.ImportHistory.prototype.whenReady; |
- |
-/** |
- * @param {!FileEntry} entry |
- * @param {!importer.Destination} destination |
- * @return {!Promise<boolean>} Resolves with true if the FileEntry |
- * was previously copied to the device. |
- */ |
-importer.ImportHistory.prototype.wasCopied; |
- |
-/** |
- * @param {!FileEntry} entry |
- * @param {!importer.Destination} destination |
- * @return {!Promise<boolean>} Resolves with true if the FileEntry |
- * was previously imported to the specified destination. |
- */ |
-importer.ImportHistory.prototype.wasImported; |
- |
-/** |
- * @param {!FileEntry} entry |
- * @param {!importer.Destination} destination |
- * @param {string} destinationUrl |
- */ |
-importer.ImportHistory.prototype.markCopied; |
- |
-/** |
- * List urls of all files that are marked as copied, but not marked as synced. |
- * @param {!importer.Destination} destination |
- * @return {!Promise<!Array<string>>} |
- */ |
-importer.ImportHistory.prototype.listUnimportedUrls; |
- |
-/** |
- * @param {!FileEntry} entry |
- * @param {!importer.Destination} destination |
- * @return {!Promise<?>} Resolves when the operation is completed. |
- */ |
-importer.ImportHistory.prototype.markImported; |
- |
-/** |
- * @param {string} destinationUrl |
- * @return {!Promise<?>} Resolves when the operation is completed. |
- */ |
-importer.ImportHistory.prototype.markImportedByUrl; |
- |
-/** |
- * Adds an observer, which will be notified when cloud import history changes. |
- * |
- * @param {!importer.ImportHistory.Observer} observer |
- */ |
-importer.ImportHistory.prototype.addObserver; |
- |
-/** |
- * Remove a previously registered observer. |
- * |
- * @param {!importer.ImportHistory.Observer} observer |
- */ |
-importer.ImportHistory.prototype.removeObserver; |
- |
/** @enum {string} */ |
-importer.ImportHistory.State = { |
+importer.ImportHistoryState = { |
'COPIED': 'copied', |
'IMPORTED': 'imported' |
}; |
/** |
- * @typedef {{ |
- * state: !importer.ImportHistory.State, |
- * entry: !FileEntry |
- * }} |
- */ |
-importer.ImportHistory.ChangedEvent; |
- |
-/** @typedef {function(!importer.ImportHistory.ChangedEvent)} */ |
-importer.ImportHistory.Observer; |
- |
-/** |
* An dummy {@code ImportHistory} implementation. This class can conveniently |
* be used when cloud import is disabled. |
* @param {boolean} answer The value to answer all {@code wasImported} |
@@ -383,10 +302,9 @@ importer.PersistentImportHistory.prototype.wasImported = |
}; |
/** @override */ |
-importer.PersistentImportHistory.prototype.markCopied = |
- function(entry, destination, destinationUrl) { |
- return this.whenReady_ |
- .then(this.createKey_.bind(this, entry)) |
+importer.PersistentImportHistory.prototype.markCopied = function( |
+ entry, destination, destinationUrl) { |
+ return this.whenReady_.then(this.createKey_.bind(this, entry)) |
.then( |
/** |
* @param {string} key |
@@ -402,10 +320,7 @@ importer.PersistentImportHistory.prototype.markCopied = |
importer.deflateAppUrl(destinationUrl)]); |
}.bind(this)) |
.then(this.notifyObservers_.bind( |
- this, |
- importer.ImportHistory.State.COPIED, |
- entry, |
- destination, |
+ this, importer.ImportHistoryState.COPIED, entry, destination, |
destinationUrl)) |
.catch(importer.getLogger().catcher('import-history-mark-copied')); |
}; |
@@ -435,10 +350,9 @@ importer.PersistentImportHistory.prototype.listUnimportedUrls = |
}; |
/** @override */ |
-importer.PersistentImportHistory.prototype.markImported = |
- function(entry, destination) { |
- return this.whenReady_ |
- .then(this.createKey_.bind(this, entry)) |
+importer.PersistentImportHistory.prototype.markImported = function( |
+ entry, destination) { |
+ return this.whenReady_.then(this.createKey_.bind(this, entry)) |
.then( |
/** |
* @param {string} key |
@@ -452,10 +366,7 @@ importer.PersistentImportHistory.prototype.markImported = |
destination]); |
}.bind(this)) |
.then(this.notifyObservers_.bind( |
- this, |
- importer.ImportHistory.State.IMPORTED, |
- entry, |
- destination)) |
+ this, importer.ImportHistoryState.IMPORTED, entry, destination)) |
.catch(importer.getLogger().catcher('import-history-mark-imported')); |
}; |
@@ -492,9 +403,8 @@ importer.PersistentImportHistory.prototype.markImportedByUrl = |
function(entry) { |
if (entry.isFile) { |
this.notifyObservers_( |
- importer.ImportHistory.State.IMPORTED, |
- /** @type {!FileEntry} */ (entry), |
- destination); |
+ importer.ImportHistoryState.IMPORTED, |
+ /** @type {!FileEntry} */ (entry), destination); |
} |
}.bind(this), |
function() { |
@@ -532,7 +442,7 @@ importer.PersistentImportHistory.prototype.removeObserver = |
}; |
/** |
- * @param {!importer.ImportHistory.State} state |
+ * @param {!importer.ImportHistoryState} state |
* @param {!FileEntry} entry |
* @param {!importer.Destination} destination |
* @param {string=} opt_destinationUrl |
@@ -577,34 +487,6 @@ importer.PersistentImportHistory.prototype.getDestinations_ = function(key) { |
}; |
/** |
- * Provider of lazy loaded importer.ImportHistory. This is the main |
- * access point for a fully prepared {@code importer.ImportHistory} object. |
- * |
- * @interface |
- */ |
-importer.HistoryLoader = function() {}; |
- |
-/** |
- * Instantiates an {@code importer.ImportHistory} object and manages any |
- * necessary ongoing maintenance of the object with respect to |
- * its external dependencies. |
- * |
- * @see importer.SynchronizedHistoryLoader for an example. |
- * |
- * @return {!Promise<!importer.ImportHistory>} Resolves when history instance |
- * is ready. |
- */ |
-importer.HistoryLoader.prototype.getHistory; |
- |
-/** |
- * Adds a listener to be notified when history is fully loaded for the first |
- * time. If history is already loaded...will be called immediately. |
- * |
- * @param {function(!importer.ImportHistory)} listener |
- */ |
-importer.HistoryLoader.prototype.addHistoryLoadedListener; |
- |
-/** |
* Class responsible for lazy loading of {@code importer.ImportHistory}, |
* and reloading when the underlying data is updated (via sync). |
* |
@@ -978,9 +860,8 @@ importer.DriveSyncWatcher.prototype.onFileTransfersUpdated_ = |
* @param {!importer.ImportHistory.ChangedEvent} event |
* @private |
*/ |
-importer.DriveSyncWatcher.prototype.onHistoryChanged_ = |
- function(event) { |
- if (event.state === importer.ImportHistory.State.COPIED) { |
+importer.DriveSyncWatcher.prototype.onHistoryChanged_ = function(event) { |
+ if (event.state === importer.ImportHistoryState.COPIED) { |
// Check sync status incase the file synced *before* it was able |
// to mark be marked as copied. |
this.checkSyncStatus_( |