diff options
-rw-r--r-- | chrome/browser/download/download_manager.cc | 20 | ||||
-rw-r--r-- | net/base/mime_util.cc | 3 |
2 files changed, 5 insertions, 18 deletions
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc index 92a9885..6b0191c 100644 --- a/chrome/browser/download/download_manager.cc +++ b/chrome/browser/download/download_manager.cc @@ -109,20 +109,6 @@ static bool DownloadPathIsDangerous(const FilePath& download_path) { return (download_path == desktop_dir); } -// Helper to determine if a download is a Chrome extension. We should be able to -// just use the mime type, but even our own servers are not setup to serve the -// right headers yet, so we have a short-term file extension heuristic, too. -static bool IsChromeExtension(const FilePath& path, - const std::string& mime_type) { - // If the server says it is an extension, it is definitely an extension. - if (mime_type == Extension::kMimeType) - return true; - - // Otherwise, it is an extension if it has the right, err, extension. - return path.Extension().size() > 1 && - path.Extension().substr(1) == chrome::kExtensionFileExtension; -} - // DownloadItem implementation ------------------------------------------------- // Constructor for reading from the history service. @@ -585,7 +571,7 @@ void DownloadManager::StartDownload(DownloadCreateInfo* info) { // b) They are an extension that is not from the gallery if (IsDangerous(info->suggested_path.BaseName())) info->is_dangerous = true; - else if (IsChromeExtension(info->suggested_path, info->mime_type) && + else if (info->mime_type == Extension::kMimeType && !ExtensionsService::IsDownloadFromGallery(info->url, info->referrer_url)) { info->is_dangerous = true; @@ -865,7 +851,7 @@ void DownloadManager::ContinueDownloadFinished(DownloadItem* download) { extension = extension.substr(1); // Handle chrome extensions explicitly and skip the shell execute. - if (IsChromeExtension(download->full_path(), download->mime_type())) { + if (download->mime_type() == Extension::kMimeType) { OpenChromeExtension(download->full_path(), download->url(), download->referrer_url()); download->set_auto_opened(true); @@ -1250,7 +1236,7 @@ void DownloadManager::OpenDownload(const DownloadItem* download, gfx::NativeView parent_window) { // Open Chrome extensions with ExtensionsService. For everything else do shell // execute. - if (IsChromeExtension(download->full_path(), download->mime_type())) { + if (download->mime_type() == Extension::kMimeType) { OpenChromeExtension(download->full_path(), download->url(), download->referrer_url()); } else { diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc index 7951177..22e8eea 100644 --- a/net/base/mime_util.cc +++ b/net/base/mime_util.cc @@ -77,7 +77,8 @@ static const MimeInfo primary_mappings[] = { { "audio/mp3", "mp3" }, { "video/ogg", "ogv,ogm" }, { "audio/ogg", "ogg,oga" }, - { "application/xhtml+xml", "xhtml,xht" } + { "application/xhtml+xml", "xhtml,xht" }, + { "application/x-chrome-extension", "crx" } }; static const MimeInfo secondary_mappings[] = { |