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 00d4a53ef008f37c7b872afd47785be01edc4a3b..2b1b9c3301c9f888e3f08e85c858f707bf7277e2 100644 |
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc |
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc |
@@ -556,80 +556,6 @@ void FileManagerPrivatePinDriveFileFunction:: |
} |
} |
-FileManagerPrivateGetDriveFilesFunction:: |
- FileManagerPrivateGetDriveFilesFunction() { |
-} |
- |
-FileManagerPrivateGetDriveFilesFunction:: |
- ~FileManagerPrivateGetDriveFilesFunction() { |
-} |
- |
-bool FileManagerPrivateGetDriveFilesFunction::RunAsync() { |
- using extensions::api::file_manager_private::GetDriveFiles::Params; |
- const scoped_ptr<Params> params(Params::Create(*args_)); |
- EXTENSION_FUNCTION_VALIDATE(params); |
- |
- // Convert the list of strings to a list of GURLs. |
- for (size_t i = 0; i < params->file_urls.size(); ++i) { |
- const base::FilePath path = file_manager::util::GetLocalPathFromURL( |
- render_view_host(), GetProfile(), GURL(params->file_urls[i])); |
- DCHECK(drive::util::IsUnderDriveMountPoint(path)); |
- base::FilePath drive_path = drive::util::ExtractDrivePath(path); |
- remaining_drive_paths_.push(drive_path); |
- } |
- |
- GetFileOrSendResponse(); |
- return true; |
-} |
- |
-void FileManagerPrivateGetDriveFilesFunction::GetFileOrSendResponse() { |
- // Send the response if all files are obtained. |
- if (remaining_drive_paths_.empty()) { |
- results_ = extensions::api::file_manager_private:: |
- GetDriveFiles::Results::Create(local_paths_); |
- SendResponse(true); |
- return; |
- } |
- |
- // Get the file on the top of the queue. |
- base::FilePath drive_path = remaining_drive_paths_.front(); |
- |
- drive::FileSystemInterface* file_system = |
- drive::util::GetFileSystemByProfile(GetProfile()); |
- if (!file_system) { |
- // |file_system| is NULL if Drive is disabled or not mounted. |
- OnFileReady(drive::FILE_ERROR_FAILED, drive_path, |
- scoped_ptr<drive::ResourceEntry>()); |
- return; |
- } |
- |
- file_system->GetFile( |
- drive_path, |
- base::Bind(&FileManagerPrivateGetDriveFilesFunction::OnFileReady, this)); |
-} |
- |
- |
-void FileManagerPrivateGetDriveFilesFunction::OnFileReady( |
- drive::FileError error, |
- const base::FilePath& local_path, |
- scoped_ptr<drive::ResourceEntry> entry) { |
- base::FilePath drive_path = remaining_drive_paths_.front(); |
- |
- if (error == drive::FILE_ERROR_OK) { |
- local_paths_.push_back(local_path.AsUTF8Unsafe()); |
- DVLOG(1) << "Got " << drive_path.value() << " as " << local_path.value(); |
- } else { |
- local_paths_.push_back(""); |
- DVLOG(1) << "Failed to get " << drive_path.value() |
- << " with error code: " << error; |
- } |
- |
- remaining_drive_paths_.pop(); |
- |
- // Start getting the next file. |
- GetFileOrSendResponse(); |
-} |
- |
bool FileManagerPrivateCancelFileTransfersFunction::RunAsync() { |
using extensions::api::file_manager_private::CancelFileTransfers::Params; |
const scoped_ptr<Params> params(Params::Create(*args_)); |