Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Commit

Permalink
removing DownloadPathIsDangerous as mentioned in #508
Browse files Browse the repository at this point in the history
  • Loading branch information
jumde committed Mar 8, 2018
1 parent 5817092 commit 543101f
Showing 1 changed file with 4 additions and 23 deletions.
27 changes: 4 additions & 23 deletions atom/browser/api/atom_api_dialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,6 @@ struct Converter<file_dialog::DialogSettings> {

namespace {

// Consider downloads 'dangerous' if they go to the home directory on Linux and
// to the desktop on any platform.
bool DownloadPathIsDangerous(const base::FilePath& download_path) {
#if defined(OS_LINUX)
base::FilePath home_dir = base::GetHomeDir();
if (download_path == home_dir) {
return true;
}
#endif
base::FilePath desktop_dir;
if (!PathService::Get(base::DIR_USER_DESKTOP, &desktop_dir)) {
NOTREACHED();
return false;
}
return (download_path == desktop_dir);
}

void ShowMessageBox(int type,
const std::vector<std::string>& buttons,
int default_id,
Expand Down Expand Up @@ -173,12 +156,10 @@ void ShowDialog(const file_dialog::DialogSettings& settings,
NOTREACHED();
}
}
if (DownloadPathIsDangerous(default_path)) {
// This is only useful on platforms that support
// DIR_DEFAULT_DOWNLOADS_SAFE.
if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS_SAFE, &default_path)) {
NOTREACHED();
}
// This is only useful on platforms that support
// DIR_DEFAULT_DOWNLOADS_SAFE.
if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS_SAFE, &default_path)) {
NOTREACHED();
}
file_type_info.include_all_files = settings.include_all_files;
file_type_info.extension_description_overrides =
Expand Down

0 comments on commit 543101f

Please sign in to comment.