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

Unified Diff: chrome/common/safe_browsing/zip_analyzer.cc

Issue 1979153002: Use FileTypePolicies for is_archive and is_supported classifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@split_by_platform
Patch Set: rebase Created 4 years, 7 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/common/safe_browsing/zip_analyzer.cc
diff --git a/chrome/common/safe_browsing/zip_analyzer.cc b/chrome/common/safe_browsing/zip_analyzer.cc
index 9a4b9e8a847abf3cacb4608034ef6f655f136a75..db47a2da5156384215a8ce24f2d9b8f57e4aa7c1 100644
--- a/chrome/common/safe_browsing/zip_analyzer.cc
+++ b/chrome/common/safe_browsing/zip_analyzer.cc
@@ -16,6 +16,7 @@
#include "chrome/common/safe_browsing/binary_feature_extractor.h"
#include "chrome/common/safe_browsing/csd.pb.h"
#include "chrome/common/safe_browsing/download_protection_util.h"
+#include "chrome/common/safe_browsing/file_type_policies.h"
#include "chrome/common/safe_browsing/zip_analyzer_results.h"
#include "crypto/secure_hash.h"
#include "crypto/sha2.h"
@@ -96,6 +97,10 @@ void AnalyzeContainedFile(
void AnalyzeZipFile(base::File zip_file,
base::File temp_file,
Results* results) {
+ // Read the the file type policies from disk, since we won't have access
+ // to those read by SafeBrowsingService if we're running in a utility process.
+ safe_browsing::FileTypePoliciesManager file_type_policies_manager;
+
std::set<base::FilePath> archived_archive_filenames;
scoped_refptr<BinaryFeatureExtractor> binary_feature_extractor(
new BinaryFeatureExtractor());
@@ -116,11 +121,11 @@ void AnalyzeZipFile(base::File zip_file,
continue;
}
const base::FilePath& file = reader.current_entry_info()->file_path();
- if (download_protection_util::IsArchiveFile(file)) {
+ if (FileTypePolicies::GlobalInstance()->IsArchiveFile(file)) {
DVLOG(2) << "Downloaded a zipped archive: " << file.value();
results->has_archive = true;
archived_archive_filenames.insert(file.BaseName());
- } else if (download_protection_util::IsSupportedBinaryFile(file)) {
+ } else if (FileTypePolicies::GlobalInstance()->IsCheckedBinaryFile(file)) {
DVLOG(2) << "Downloaded a zipped executable: " << file.value();
results->has_executable = true;
AnalyzeContainedFile(binary_feature_extractor, file, &reader, &temp_file,

Powered by Google App Engine
This is Rietveld 408576698