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

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

Issue 193075: Speculative fix for Mac quarantine crash (Closed)
Patch Set: Created 11 years, 3 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_file.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_file.cc
diff --git a/chrome/browser/download/download_file.cc b/chrome/browser/download/download_file.cc
index 246e5b8d26b1d4c48e4f5cac90b7af2de9126d63..b6ff4574f6e4be0cf60c32d8e706e7f54bd319a0 100644
--- a/chrome/browser/download/download_file.cc
+++ b/chrome/browser/download/download_file.cc
@@ -137,6 +137,13 @@ bool DownloadFile::Open(const char* open_mode) {
}
#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.
win_util::SetInternetZoneIdentifier(full_path_);
@@ -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,
« no previous file with comments | « chrome/browser/download/download_file.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698