Cleanup of remoting/host/file_transfer/directory_helpers
Bug: b/284943640 Change-Id: If0539d5bd6905f9e1fa9603ea113866d4e9cf2c5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4632678 Commit-Queue: Ashutosh Singhal <macinashutosh@google.com> Reviewed-by: Joe Downing <joedow@chromium.org> Cr-Commit-Position: refs/heads/main@{#1160791}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
2ffd94a7b4
commit
ccfb30b35c
@ -18,34 +18,24 @@ namespace remoting {
|
||||
|
||||
namespace {
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS)
|
||||
protocol::FileTransferResult<base::FilePath> GetDownloadDirectory() {
|
||||
base::FilePath download_path;
|
||||
if (!base::PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS_SAFE,
|
||||
&download_path)) {
|
||||
LOG(ERROR)
|
||||
<< "Failed to get DIR_DEFAULT_DOWNLOADS from base::PathService::Get";
|
||||
protocol::FileTransferResult<base::FilePath> GetDirectory(int path_key) {
|
||||
base::FilePath directory_path;
|
||||
if (!base::PathService::Get(path_key, &directory_path)) {
|
||||
LOG(ERROR) << "Failed to get path from base::PathService::Get";
|
||||
return protocol::MakeFileTransferError(
|
||||
FROM_HERE, protocol::FileTransfer_Error_Type_UNEXPECTED_ERROR);
|
||||
}
|
||||
|
||||
return download_path;
|
||||
return directory_path;
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace
|
||||
|
||||
protocol::FileTransferResult<base::FilePath> GetFileUploadDirectory() {
|
||||
#if BUILDFLAG(IS_CHROMEOS)
|
||||
return GetDownloadDirectory();
|
||||
return GetDirectory(chrome::DIR_DEFAULT_DOWNLOADS_SAFE);
|
||||
#else
|
||||
base::FilePath target_directory;
|
||||
if (!base::PathService::Get(base::DIR_USER_DESKTOP, &target_directory)) {
|
||||
LOG(ERROR) << "Failed to get DIR_USER_DESKTOP from base::PathService::Get";
|
||||
return protocol::MakeFileTransferError(
|
||||
FROM_HERE, protocol::FileTransfer_Error_Type_UNEXPECTED_ERROR);
|
||||
}
|
||||
return target_directory;
|
||||
return GetDirectory(base::DIR_USER_DESKTOP);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user