diff options
-rw-r--r-- | chrome/browser/download/download_exe.cc | 168 | ||||
-rw-r--r-- | chrome/browser/download/download_manager.cc | 14 | ||||
-rw-r--r-- | chrome/browser/download/download_manager.h | 2 | ||||
-rw-r--r-- | chrome/browser/download/download_util.h | 2 |
4 files changed, 99 insertions, 87 deletions
diff --git a/chrome/browser/download/download_exe.cc b/chrome/browser/download/download_exe.cc index e54b485..dfd21ff 100644 --- a/chrome/browser/download/download_exe.cc +++ b/chrome/browser/download/download_exe.cc @@ -52,92 +52,92 @@ namespace download_util { * * ***** END LICENSE BLOCK ***** */ -static const wchar_t* const g_executables[] = { - L"ad", - L"ade", - L"adp", - L"app", - L"application", - L"asp", - L"asx", - L"bas", - L"bat", - L"chm", - L"cmd", - L"com", - L"cpl", - L"crt", - L"dll", - L"exe", - L"fxp", - L"hlp", - L"hta", - L"htm", - L"html", - L"inf", - L"ins", - L"isp", - L"jar", - L"js", - L"jse", - L"lnk", - L"mad", - L"maf", - L"mag", - L"mam", - L"maq", - L"mar", - L"mas", - L"mat", - L"mau", - L"mav", - L"maw", - L"mda", - L"mdb", - L"mde", - L"mdt", - L"mdw", - L"mdz", - L"msc", - L"msh", - L"mshxml", - L"msi", - L"msp", - L"mst", - L"ops", - L"pcd", - L"pif", - L"plg", - L"prf", - L"prg", - L"pst", - L"reg", - L"scf", - L"scr", - L"sct", - L"shb", - L"shs", - L"shtm", - L"shtml", - L"url", - L"vb", - L"vbe", - L"vbs", - L"vsd", - L"vsmacros", - L"vss", - L"vst", - L"vsw", - L"ws", - L"wsc", - L"wsf", - L"wsh", - L"xht", - L"xhtm", - L"xhtml" +static const char* const g_executables[] = { + "ad", + "ade", + "adp", + "app", + "application", + "asp", + "asx", + "bas", + "bat", + "chm", + "cmd", + "com", + "cpl", + "crt", + "dll", + "exe", + "fxp", + "hlp", + "hta", + "htm", + "html", + "inf", + "ins", + "isp", + "jar", + "js", + "jse", + "lnk", + "mad", + "maf", + "mag", + "mam", + "maq", + "mar", + "mas", + "mat", + "mau", + "mav", + "maw", + "mda", + "mdb", + "mde", + "mdt", + "mdw", + "mdz", + "msc", + "msh", + "mshxml", + "msi", + "msp", + "mst", + "ops", + "pcd", + "pif", + "plg", + "prf", + "prg", + "pst", + "reg", + "scf", + "scr", + "sct", + "shb", + "shs", + "shtm", + "shtml", + "url", + "vb", + "vbe", + "vbs", + "vsd", + "vsmacros", + "vss", + "vst", + "vsw", + "ws", + "wsc", + "wsf", + "wsh", + "xht", + "xhtm", + "xhtml" }; -void InitializeExeTypes(std::set<std::wstring>* exe_extensions) { +void InitializeExeTypes(std::set<std::string>* exe_extensions) { DCHECK(exe_extensions); for (size_t i = 0; i < arraysize(g_executables); ++i) exe_extensions->insert(g_executables[i]); diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc index a88e8a2..7db3d54 100644 --- a/chrome/browser/download/download_manager.cc +++ b/chrome/browser/download/download_manager.cc @@ -1240,7 +1240,19 @@ bool DownloadManager::IsExecutableMimeType(const std::string& mime_type) { } bool DownloadManager::IsExecutable(const FilePath::StringType& extension) { - return exe_types_.find(extension) != exe_types_.end(); +#if defined(OS_WIN) + if (!IsStringASCII(extension)) + return false; + std::string ascii_extension = WideToASCII(extension); + StringToLowerASCII(&ascii_extension); + + return exe_types_.find(ascii_extension) != exe_types_.end(); +#elif defined(OS_POSIX) + // TODO(port): we misght not want to call this function on other platforms. + // Figure it out. + NOTIMPLEMENTED(); + return false; +#endif } void DownloadManager::ResetAutoOpenFiles() { diff --git a/chrome/browser/download/download_manager.h b/chrome/browser/download/download_manager.h index 75ab75b..9a94e52 100644 --- a/chrome/browser/download/download_manager.h +++ b/chrome/browser/download/download_manager.h @@ -561,7 +561,7 @@ class DownloadManager : public base::RefCountedThreadSafe<DownloadManager>, std::set<FilePath::StringType> auto_open_; // Set of file extensions that are executables and shouldn't be auto opened. - std::set<FilePath::StringType> exe_types_; + std::set<std::string> exe_types_; // Keep track of downloads that are completed before the user selects the // destination, so that observers are appropriately notified of completion diff --git a/chrome/browser/download/download_util.h b/chrome/browser/download/download_util.h index 0d7d7477..7f1c236 100644 --- a/chrome/browser/download/download_util.h +++ b/chrome/browser/download/download_util.h @@ -189,7 +189,7 @@ void DragDownload(const DownloadItem* download, SkBitmap* icon); // Executable file support ----------------------------------------------------- // Copy all executable file extensions. -void InitializeExeTypes(std::set<std::wstring>* exe_extensions); +void InitializeExeTypes(std::set<std::string>* exe_extensions); } // namespace download_util |