summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-27 21:11:34 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-27 21:11:34 +0000
commit8ef0637fffc0ad76943be9a6e3bd72b9e5fab07b (patch)
tree8ac751eacc58518b541b9312b4f9a48528781bd8 /chrome/browser
parent440a4cc75da5e520fd25c5ef0c0b22823b6ca1b4 (diff)
downloadchromium_src-8ef0637fffc0ad76943be9a6e3bd72b9e5fab07b.zip
chromium_src-8ef0637fffc0ad76943be9a6e3bd72b9e5fab07b.tar.gz
chromium_src-8ef0637fffc0ad76943be9a6e3bd72b9e5fab07b.tar.bz2
Add quarantine metadata to downloads on the Mac. Patch by Stuart Morgan
<stuart.morgan@gmail.com>. BUG=10853 Code review URL: http://codereview.chromium.org/99005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14657 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/download/download_file.cc7
-rw-r--r--chrome/browser/download/download_file.h6
-rw-r--r--chrome/browser/history/download_types.h1
-rw-r--r--chrome/browser/renderer_host/download_resource_handler.cc1
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_;