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

Unified Diff: chrome/browser/safe_browsing/incident_reporting/last_download_finder.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: Fix comment, per asanka's review 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/incident_reporting/last_download_finder.cc
diff --git a/chrome/browser/safe_browsing/incident_reporting/last_download_finder.cc b/chrome/browser/safe_browsing/incident_reporting/last_download_finder.cc
index fad01ff1eabba476574c149855fe12563f8758f2..b007857181663caa7ec709844d9331593b52653c 100644
--- a/chrome/browser/safe_browsing/incident_reporting/last_download_finder.cc
+++ b/chrome/browser/safe_browsing/incident_reporting/last_download_finder.cc
@@ -25,6 +25,7 @@
#include "chrome/common/pref_names.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 "components/history/core/browser/download_constants.h"
#include "components/history/core/browser/history_service.h"
#include "components/prefs/pref_service.h"
@@ -91,15 +92,17 @@ bool IsBinaryDownloadForCurrentOS(
bool IsBinaryDownload(const history::DownloadRow& row) {
// TODO(grt): Peek into archives to see if they contain binaries;
// http://crbug.com/386915.
- return (download_protection_util::IsSupportedBinaryFile(row.target_path) &&
- !download_protection_util::IsArchiveFile(row.target_path) &&
+ FileTypePolicies* policies = FileTypePolicies::GetInstance();
+ return (policies->IsCheckedBinaryFile(row.target_path) &&
+ !policies->IsArchiveFile(row.target_path) &&
IsBinaryDownloadForCurrentOS(
download_protection_util::GetDownloadType(row.target_path)));
}
// Returns true if a download represented by a DownloadRow is not a binary file.
bool IsNonBinaryDownload(const history::DownloadRow& row) {
- return !download_protection_util::IsSupportedBinaryFile(row.target_path);
+ return !FileTypePolicies::GetInstance()->IsCheckedBinaryFile(
+ row.target_path);
}
// Returns true if a download represented by a DownloadDetails is binary file
@@ -213,8 +216,7 @@ void PopulateNonBinaryDetailsFromRow(
const history::DownloadRow& download,
ClientIncidentReport_NonBinaryDownloadDetails* details) {
details->set_file_type(
- base::FilePath(
- download_protection_util::GetFileExtension(download.target_path))
+ base::FilePath(FileTypePolicies::GetFileExtension(download.target_path))
.AsUTF8Unsafe());
details->set_length(download.received_bytes);
if (download.url_chain.back().has_host())
« no previous file with comments | « chrome/browser/safe_browsing/download_protection_service.cc ('k') | chrome/browser/safe_browsing/safe_browsing_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698