Speculative fix for Mac quarantine crash

BUG=13120
TEST=Quaraniting should continue to work on the Mac, and zone information should still be set on Windows.

Review URL: http://codereview.chromium.org/193075

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25904 0039d316-1c4b-4281-b951-d872f2087c98
parent eaad22ec
......@@ -136,6 +136,13 @@ bool DownloadFile::Open(const char* open_mode) {
return false;
}
#if defined(OS_WIN)
AnnotateWithSourceInformation();
#endif
return true;
}
void DownloadFile::AnnotateWithSourceInformation() {
#if defined(OS_WIN)
// Sets the Zone to tell Windows that this file comes from the internet.
// We ignore the return value because a failure is not fatal.
......@@ -144,7 +151,6 @@ bool DownloadFile::Open(const char* open_mode) {
quarantine_mac::AddQuarantineMetadataToFile(full_path_, source_url_,
referrer_url_);
#endif
return true;
}
// DownloadFileManager implementation ------------------------------------------
......@@ -565,6 +571,11 @@ void DownloadFileManager::OnFinalDownloadName(int id,
DownloadFile* download = it->second;
if (download->Rename(full_path)) {
#if defined(OS_MACOSX)
// Done here because we only want to do this once; see
// http://crbug.com/13120 for details.
download->AnnotateWithSourceInformation();
#endif
ui_loop_->PostTask(FROM_HERE,
NewRunnableMethod(manager,
&DownloadManager::DownloadRenamedToFinalName,
......
......@@ -99,6 +99,9 @@ class DownloadFile {
// Rename the download file. Returns 'true' if the rename was successful.
bool Rename(const FilePath& full_path);
// Informs the OS that this file came from the internet.
void AnnotateWithSourceInformation();
// Accessors.
int64 bytes_so_far() const { return bytes_so_far_; }
int id() const { return id_; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment