Disable "This type of file can harm your computer" nag in chrome

I don't want to see that Discard/Keep dialog when downloading a pdf file in browser. I just want it to automatically save to my default location. I'm using chrome on Ubuntu 13.04.

enter image description here


I have a solution which worked on Windows 10. The issue can be fixed by editing "download_file_types.pb" which is located in my computer at

%localappdata%\Google\Chrome\User Data\FileTypePolicies\21\download_file_types.pb

The file contains various file extensions. Just hexedit the file and remove the extension you want chrome to ignore. e.g. I wanted to download *.mat files, so I searched for 'mat' and replaced it with 'xxx'

This worked for me. Make backups as it is just a workaround.


I fear that the only way to disable this is to patch Chrome.

The file that contains the blacklist is /src/chrome/browser/download/download_extensions.cc.

One would just need to remove the line containing { "pdf", AllowOnUserGesture }, and recompile.


Or replace DownloadDangerLevel GetFileDangerLevel(const base::FilePath& path) with:

DownloadDangerLevel GetFileDangerLevel(const base::FilePath& path) {
  return NotDangerous;
}

which seems to have some irony to it.


UPDATE: I wrote a patch and have successfully tested it.

--- chromium-26.0.1410.43-old/chrome/browser/download/download_extensions.cc    2013-03-21 21:14:04.000000000 -0400
+++ chromium-26.0.1410.43-new/chrome/browser/download/download_extensions.cc    2013-06-04 11:51:40.000000000 -0400
@@ -213,6 +213,7 @@
 };

 DownloadDangerLevel GetFileDangerLevel(const base::FilePath& path) {
+  return NotDangerous;
   base::FilePath::StringType extension(path.Extension());
   if (extension.empty())
     return NotDangerous;

If on Gentoo, you can just place this in a file in /etc/portage/patches/www-client/chromium/ and emerge chromium.