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

Unified Diff: chrome/browser/safe_browsing/download_protection_service.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/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 766bbd15bbe60927426745d02a68780576aa2fde..ab7384797b77659f5924d6af837d0d62cb0c21bd 100644
--- a/chrome/browser/safe_browsing/download_protection_service.cc
+++ b/chrome/browser/safe_browsing/download_protection_service.cc
@@ -43,6 +43,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 "chrome/common/url_constants.h"
#include "components/google/core/browser/google_util.h"
@@ -84,14 +85,13 @@ namespace {
void RecordFileExtensionType(const base::FilePath& file) {
UMA_HISTOGRAM_SPARSE_SLOWLY(
"SBClientDownload.DownloadExtensions",
- download_protection_util::GetSBClientDownloadExtensionValueForUMA(file));
+ FileTypePolicies::GlobalInstance()->UmaValueForFile(file));
}
-void RecordArchivedArchiveFileExtensionType(const base::FilePath& file_name) {
+void RecordArchivedArchiveFileExtensionType(const base::FilePath& file) {
UMA_HISTOGRAM_SPARSE_SLOWLY(
"SBClientDownload.ArchivedArchiveExtensions",
- download_protection_util::GetSBClientDownloadExtensionValueForUMA(
- file_name));
+ FileTypePolicies::GlobalInstance()->UmaValueForFile(file));
}
// Enumerate for histogramming purposes.
@@ -516,7 +516,7 @@ class DownloadProtectionService::CheckClientDownloadRequest
*reason = REASON_INVALID_URL;
return false;
}
- if (!download_protection_util::IsSupportedBinaryFile(target_path)) {
+ if (!FileTypePolicies::GlobalInstance()->IsCheckedBinaryFile(target_path)) {
*reason = REASON_NOT_BINARY_FILE;
return false;
}
@@ -699,9 +699,8 @@ class DownloadProtectionService::CheckClientDownloadRequest
<< ", has_executable=" << results.has_executable
<< ", success=" << results.success;
- int uma_file_type =
- download_protection_util::GetSBClientDownloadExtensionValueForUMA(
- item_->GetTargetFilePath());
+ int64_t uma_file_type = FileTypePolicies::GlobalInstance()->UmaValueForFile(
+ item_->GetTargetFilePath());
if (results.success) {
UMA_HISTOGRAM_SPARSE_SLOWLY("SBClientDownload.DmgFileSuccessByType",

Powered by Google App Engine
This is Rietveld 408576698