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

Unified Diff: chrome/browser/safe_browsing/download_protection_service.cc

Issue 2926473002: Mac Archive Type Sniffing (Closed)
Patch Set: adding signature check file read and removing mods to UDIFParser Created 3 years, 6 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
Index: chrome/browser/safe_browsing/download_protection_service.cc
diff --git a/chrome/browser/safe_browsing/download_protection_service.cc b/chrome/browser/safe_browsing/download_protection_service.cc
index aad28a885aeaddde13df3128d920789a185c623b..eb084c78da6efdb3e4b7afe06ac483548b503809 100644
--- a/chrome/browser/safe_browsing/download_protection_service.cc
+++ b/chrome/browser/safe_browsing/download_protection_service.cc
@@ -74,6 +74,7 @@
#include "net/url_request/url_request_status.h"
#if defined(OS_MACOSX)
+#include "chrome/browser/safe_browsing/mac_archive_type_sniffer.h"
#include "chrome/browser/safe_browsing/sandboxed_dmg_analyzer_mac.h"
#endif
@@ -471,7 +472,19 @@ class DownloadProtectionService::CheckClientDownloadRequest
StartExtractDmgFeatures();
#endif
} else {
+#if defined(OS_MACOSX)
+ // Checks for existence of "koly" signature even if file doesn't have
+ // archive-type extension, then calls ExtractFileOrDmgFeatures() with
+ // result.
+ BrowserThread::PostTaskAndReplyWithResult(
+ BrowserThread::FILE, FROM_HERE,
+ base::Bind(MacArchiveTypeSniffer::IsAppleDiskImage,
+ item_->GetTargetFilePath()),
+ base::Bind(&CheckClientDownloadRequest::ExtractFileOrDmgFeatures,
+ this));
+#else
StartExtractFileFeatures();
+#endif
}
}
@@ -779,6 +792,16 @@ class DownloadProtectionService::CheckClientDownloadRequest
dmg_analysis_start_time_ = base::TimeTicks::Now();
}
+ // Extracts DMG features if file has 'koly' signature, otherwise extracts
+ // regular file features.
+ void ExtractFileOrDmgFeatures(bool download_file_has_koly_signature) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ if (download_file_has_koly_signature)
Jialiu Lin 2017/06/13 20:55:38 We would like to track some UMA stats here. e.g. w
mortonm 2017/06/13 22:09:44 Done.
+ StartExtractDmgFeatures();
+ else
+ StartExtractFileFeatures();
+ }
+
void OnDmgAnalysisFinished(const ArchiveAnalyzerResults& results) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK_EQ(ClientDownloadRequest::MAC_EXECUTABLE, type_);

Powered by Google App Engine
This is Rietveld 408576698