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

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

Issue 2926473002: Mac Archive Type Sniffing (Closed)
Patch Set: addressing comments 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
« no previous file with comments | « chrome/browser/safe_browsing/DEPS ('k') | chrome/browser/safe_browsing/mac_archive_type_sniffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 43d631ddca872ef8e4e38446a9c0f3458e6d582d..a49b93e26b02735f3952ba8f8412b8c614d9fb4d 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
Jialiu Lin 2017/06/09 20:24:18 You also need to add unittest in download_protecti
mortonm 2017/06/09 22:47:25 Ok, I have added the test. Currently I only check
+ // 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)
+ StartExtractDmgFeatures();
+ else
+ StartExtractFileFeatures();
+ }
+
void OnDmgAnalysisFinished(const ArchiveAnalyzerResults& results) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK_EQ(ClientDownloadRequest::MAC_EXECUTABLE, type_);
« no previous file with comments | « chrome/browser/safe_browsing/DEPS ('k') | chrome/browser/safe_browsing/mac_archive_type_sniffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698