Commit b430338d authored by Luciano Pacheco's avatar Luciano Pacheco Committed by Commit Bot

CrOS Allow download preferences to be any folder inside MyFiles

Before this CL when MyFilesVolume flag is enabled users couldn't select
other folders inside MyFiles, only inside MyFiles/Downloads, this CL
fixes it.

The flag MyFilesVolume will be enabled by default in follow up CL.

this CL when MyFilesVolume flag is enabled

Test: browser_tests --gtest_filter=DownloadPrefsTest only passes with
Bug: 873539
Change-Id: I8dc172412a1fd7b7cc69bc82f75c39f29e2f984e
Reviewed-on: https://chromium-review.googlesource.com/c/1433635
Commit-Queue: Min Qin <qinmin@chromium.org>
Auto-Submit: Luciano Pacheco <lucmult@chromium.org>
Reviewed-by: default avatarMin Qin <qinmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#625733}
parent b7f3df5b
......@@ -451,12 +451,14 @@ base::FilePath DownloadPrefs::SanitizeDownloadTargetPath(
const base::FilePath& path) const {
#if defined(OS_CHROMEOS)
// If |path| isn't absolute, fall back to the default directory.
base::FilePath profile_download_dir = GetDefaultDownloadDirectoryForProfile();
base::FilePath profile_myfiles_path =
file_manager::util::GetMyFilesFolderForProfile(profile_);
if (!path.IsAbsolute() || path.ReferencesParent())
return profile_download_dir;
return profile_myfiles_path;
// Allow default download directory and subdirs.
if (profile_download_dir == path || profile_download_dir.IsParent(path))
// Allow myfiles directory and subdirs.
if (profile_myfiles_path == path || profile_myfiles_path.IsParent(path))
return path;
// Allow paths under the drive mount point.
......@@ -482,7 +484,7 @@ base::FilePath DownloadPrefs::SanitizeDownloadTargetPath(
return path;
// Fall back to the default download directory for all other paths.
return profile_download_dir;
return GetDefaultDownloadDirectoryForProfile();
#endif
return path;
}
......
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