Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(763)

Unified Diff: chrome/browser/download/download_manager.cc

Issue 159345: Implement mimetype sniffing for extensions. (Closed)
Patch Set: rebase Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/download/download_manager.h ('k') | chrome/browser/download/save_package.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_manager.cc
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc
index 01ea2d0aa89efd31af3af02b702a1e9a7b54a887..1a3fb53cd6df5b51df56469b42ff113abfa68507 100644
--- a/chrome/browser/download/download_manager.cc
+++ b/chrome/browser/download/download_manager.cc
@@ -117,6 +117,8 @@ DownloadItem::DownloadItem(const DownloadCreateInfo& info)
: id_(-1),
full_path_(info.path),
url_(info.url),
+ referrer_url_(info.referrer_url),
+ mime_type_(info.mime_type),
total_bytes_(info.total_bytes),
received_bytes_(info.received_bytes),
start_tick_(base::TimeTicks()),
@@ -142,6 +144,7 @@ DownloadItem::DownloadItem(int32 download_id,
int path_uniquifier,
const GURL& url,
const GURL& referrer_url,
+ const std::string& mime_type,
const FilePath& original_name,
const base::Time start_time,
int64 download_size,
@@ -153,6 +156,7 @@ DownloadItem::DownloadItem(int32 download_id,
path_uniquifier_(path_uniquifier),
url_(url),
referrer_url_(referrer_url),
+ mime_type_(mime_type),
total_bytes_(download_size),
received_bytes_(0),
start_tick_(base::TimeTicks::Now()),
@@ -677,6 +681,7 @@ void DownloadManager::ContinueStartDownload(DownloadCreateInfo* info,
info->path_uniquifier,
info->url,
info->referrer_url,
+ info->mime_type,
info->original_name,
info->start_time,
info->total_bytes,
@@ -841,7 +846,7 @@ void DownloadManager::ContinueDownloadFinished(DownloadItem* download) {
extension = extension.substr(1);
// Handle chrome extensions explicitly and skip the shell execute.
- if (Extension::IsExtension(download->full_path())) {
+ if (download->mime_type() == Extension::kMimeType) {
OpenChromeExtension(download->full_path(), download->url(),
download->referrer_url());
download->set_auto_opened(true);
@@ -1211,7 +1216,7 @@ void DownloadManager::OpenDownload(const DownloadItem* download,
gfx::NativeView parent_window) {
// Open Chrome extensions with ExtensionsService. For everything else do shell
// execute.
- if (Extension::IsExtension(download->full_path())) {
+ if (download->mime_type() == Extension::kMimeType) {
OpenChromeExtension(download->full_path(), download->url(),
download->referrer_url());
} else {
« no previous file with comments | « chrome/browser/download/download_manager.h ('k') | chrome/browser/download/save_package.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698