diff options
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/download/download_file.cc | 7 | ||||
-rw-r--r-- | chrome/browser/download/download_file.h | 6 | ||||
-rw-r--r-- | chrome/browser/history/download_types.h | 1 | ||||
-rw-r--r-- | chrome/browser/renderer_host/download_resource_handler.cc | 1 |
4 files changed, 14 insertions, 1 deletions
diff --git a/chrome/browser/download/download_file.cc b/chrome/browser/download/download_file.cc index bd10ad7..89b468c 100644 --- a/chrome/browser/download/download_file.cc +++ b/chrome/browser/download/download_file.cc @@ -26,6 +26,8 @@ #if defined(OS_WIN) #include "chrome/common/win_util.h" #include "chrome/common/win_safe_util.h" +#elif defined(OS_MACOSX) +#include "chrome/common/quarantine_mac.h" #endif // Throttle updates to the UI thread so that a fast moving download doesn't @@ -54,6 +56,8 @@ class DownloadFileUpdateTask : public Task { DownloadFile::DownloadFile(const DownloadCreateInfo* info) : file_(NULL), + source_url_(info->url), + referrer_url_(info->referrer_url), id_(info->download_id), render_process_id_(info->render_process_id), render_view_id_(info->render_view_id), @@ -136,7 +140,8 @@ bool DownloadFile::Open(const char* open_mode) { // We ignore the return value because a failure is not fatal. win_util::SetInternetZoneIdentifier(full_path_); #elif defined(OS_MACOSX) - // TODO(port): Set quarrantine information, http://crbug.com/10853 + quarantine_mac::AddQuarantineMetadataToFile(full_path_, source_url_, + referrer_url_); #endif return true; } diff --git a/chrome/browser/download/download_file.h b/chrome/browser/download/download_file.h index 82f7597..0b3bc31 100644 --- a/chrome/browser/download/download_file.h +++ b/chrome/browser/download/download_file.h @@ -121,6 +121,12 @@ class DownloadFile { // OS file handle for writing FILE* file_; + // Source URL for the file being downloaded. + GURL source_url_; + + // The URL where the download was initiated. + GURL referrer_url_; + // The unique identifier for this download, assigned at creation by // the DownloadFileManager for its internal record keeping. int id_; diff --git a/chrome/browser/history/download_types.h b/chrome/browser/history/download_types.h index 73a0ba7..477a249 100644 --- a/chrome/browser/history/download_types.h +++ b/chrome/browser/history/download_types.h @@ -48,6 +48,7 @@ struct DownloadCreateInfo { // DownloadItem fields FilePath path; GURL url; + GURL referrer_url; FilePath suggested_path; // A number that should be added to the suggested path to make it unique. // 0 means no number should be appended. Not actually stored in the db. diff --git a/chrome/browser/renderer_host/download_resource_handler.cc b/chrome/browser/renderer_host/download_resource_handler.cc index bef9a2e..9824d97 100644 --- a/chrome/browser/renderer_host/download_resource_handler.cc +++ b/chrome/browser/renderer_host/download_resource_handler.cc @@ -51,6 +51,7 @@ bool DownloadResourceHandler::OnResponseStarted(int request_id, // |download_manager_| consumes (deletes): DownloadCreateInfo* info = new DownloadCreateInfo; info->url = url_; + info->referrer_url = GURL(request_->referrer()); info->start_time = base::Time::Now(); info->received_bytes = 0; info->total_bytes = content_length_; |