Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2942)

Unified Diff: chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc

Issue 22181002: Remove fileBrowserPrivate.transferFile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc
index c963b42f9c7a274f19502b3ebe236fec3f96c062..f86ccffb99073db3e05a4f1baecb90148326e7d6 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc
@@ -382,72 +382,6 @@ bool CancelFileTransfersFunction::RunImpl() {
return true;
}
-TransferFileFunction::TransferFileFunction() {
-}
-
-TransferFileFunction::~TransferFileFunction() {
-}
-
-bool TransferFileFunction::RunImpl() {
- std::string source_file_url;
- std::string destination_file_url;
- if (!args_->GetString(0, &source_file_url) ||
- !args_->GetString(1, &destination_file_url)) {
- return false;
- }
-
- drive::DriveIntegrationService* integration_service =
- drive::DriveIntegrationServiceFactory::GetForProfile(profile_);
- // |integration_service| is NULL if Drive is disabled.
- if (!integration_service)
- return false;
-
- base::FilePath source_file = util::GetLocalPathFromURL(
- render_view_host(), profile(), GURL(source_file_url));
- base::FilePath destination_file = util::GetLocalPathFromURL(
- render_view_host(), profile(), GURL(destination_file_url));
- if (source_file.empty() || destination_file.empty())
- return false;
-
- bool source_file_under_drive =
- drive::util::IsUnderDriveMountPoint(source_file);
- bool destination_file_under_drive =
- drive::util::IsUnderDriveMountPoint(destination_file);
-
- if (source_file_under_drive && !destination_file_under_drive) {
- // Transfer a file from drive to local file system.
- source_file = drive::util::ExtractDrivePath(source_file);
- integration_service->file_system()->TransferFileFromRemoteToLocal(
- source_file,
- destination_file,
- base::Bind(&TransferFileFunction::OnTransferCompleted, this));
- } else if (!source_file_under_drive && destination_file_under_drive) {
- // Transfer a file from local to Drive file system
- destination_file = drive::util::ExtractDrivePath(destination_file);
- integration_service->file_system()->TransferFileFromLocalToRemote(
- source_file,
- destination_file,
- base::Bind(&TransferFileFunction::OnTransferCompleted, this));
- } else {
- // Local-to-local or Drive-to-Drive file transfers should be done via
- // FileEntry.copyTo in the File API and are thus not supported here.
- NOTREACHED();
- SendResponse(false);
- }
- return true;
-}
-
-void TransferFileFunction::OnTransferCompleted(drive::FileError error) {
- if (error == drive::FILE_ERROR_OK) {
- SendResponse(true);
- } else {
- error_ = base::StringPrintf("%d", static_cast<int>(
- fileapi::PlatformFileErrorToWebFileError(
- drive::FileErrorToPlatformError(error))));
- SendResponse(false);
- }
-}
-
SearchDriveFunction::SearchDriveFunction() {
}

Powered by Google App Engine
This is Rietveld 408576698