Commit 2db8c37f authored by Sam McNally's avatar Sam McNally Committed by Commit Bot

Remove chrome.fileManagerPrivate.cancelAllFileTransfers().

It isn't supported by DriveFS and doesn't make much sense even with the
current Drive sync implementation.

Bug: 844292
Cq-Include-Trybots: luci.chromium.try:closure_compilation
Change-Id: I0237ea4bb903604672f5e2a7e07ffe3260db7a9a
Reviewed-on: https://chromium-review.googlesource.com/1182906Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Commit-Queue: Sam McNally <sammc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584665}
parent 387f8320
......@@ -1062,25 +1062,6 @@ bool FileManagerPrivateInternalCancelFileTransfersFunction::RunAsync() {
return true;
}
bool FileManagerPrivateCancelAllFileTransfersFunction::RunAsync() {
drive::DriveIntegrationService* const integration_service =
drive::DriveIntegrationServiceFactory::FindForProfile(GetProfile());
if (!integration_service || !integration_service->IsMounted())
return false;
drive::JobListInterface* const job_list = integration_service->job_list();
DCHECK(job_list);
const std::vector<drive::JobInfo> jobs = job_list->GetJobInfoList();
for (size_t i = 0; i < jobs.size(); ++i) {
if (drive::IsActiveFileTransferJobInfo(jobs[i]))
job_list->CancelJob(jobs[i].job_id);
}
SendResponse(true);
return true;
}
bool FileManagerPrivateSearchDriveFunction::RunAsync() {
using extensions::api::file_manager_private::SearchDrive::Params;
const std::unique_ptr<Params> params(Params::Create(*args_));
......
......@@ -121,20 +121,6 @@ class FileManagerPrivateInternalCancelFileTransfersFunction
bool RunAsync() override;
};
// Implements the chrome.fileManagerPrivate.cancelAllFileTransfers method.
class FileManagerPrivateCancelAllFileTransfersFunction
: public LoggedAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.cancelAllFileTransfers",
FILEMANAGERPRIVATE_CANCELALLFILETRANSFERS)
protected:
~FileManagerPrivateCancelAllFileTransfersFunction() override = default;
// ChromeAsyncExtensionFunction overrides.
bool RunAsync() override;
};
class FileManagerPrivateSearchDriveFunction
: public LoggedAsyncExtensionFunction {
public:
......
......@@ -910,10 +910,6 @@ interface Functions {
static void cancelFileTransfers([instanceof=Entry] object[] entries,
SimpleCallback callback);
// Cancels all ongoing file transfers.
// |callback| Completion callback of the cancel.
static void cancelAllFileTransfers(SimpleCallback callback);
// Starts to copy an entry. If the source is a directory, the copy is done
// recursively.
// |entry| Entry of the source entry to be copied.
......
......@@ -659,12 +659,6 @@ chrome.fileManagerPrivate.getVolumeMetadataList = function(callback) {};
*/
chrome.fileManagerPrivate.cancelFileTransfers = function(entries, callback) {};
/**
* Cancels all ongoing file transfers.
* @param {function()} callback
*/
chrome.fileManagerPrivate.cancelAllFileTransfers = function(callback) {};
/**
* Starts to copy an entry. If the source is a directory, the copy is done
* recursively. |entry| Entry of the source entry to be copied. |parent| Entry
......
......@@ -175,7 +175,6 @@ DriveSyncHandler.prototype.updateItem_ = function(status) {
} else {
this.item_.message = strf('SYNC_FILE_NAME', entry.name);
}
this.item_.cancelCallback = this.requestCancel_.bind(this);
this.item_.progressValue = status.processed || 0;
this.item_.progressMax = status.total || 0;
this.progressCenter_.updateItem(this.item_);
......@@ -205,14 +204,6 @@ DriveSyncHandler.prototype.removeItem_ = function(status) {
}.bind(this));
};
/**
* Requests to cancel for the given files' drive sync.
* @private
*/
DriveSyncHandler.prototype.requestCancel_ = function() {
chrome.fileManagerPrivate.cancelAllFileTransfers(util.checkAPIError);
};
/**
* Handles drive's sync errors.
* @param {chrome.fileManagerPrivate.DriveSyncErrorEvent} event Drive sync
......
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