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

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

Issue 330653006: Include the latest binary download info in safe browsing incident reports. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: better histogram text Created 6 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/common/safe_browsing/download_protection_util.cc
diff --git a/chrome/common/safe_browsing/download_protection_util.cc b/chrome/common/safe_browsing/download_protection_util.cc
index 88d5cab1b16f3f812b424857080093de30405cc4..ee09cd1e1fe28982e58a8a4778923b48729df34e 100644
--- a/chrome/common/safe_browsing/download_protection_util.cc
+++ b/chrome/common/safe_browsing/download_protection_util.cc
@@ -2,7 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/common/safe_browsing/download_protection_util.h"
+
#include "base/files/file_path.h"
+#include "base/logging.h"
namespace safe_browsing {
namespace download_protection_util {
@@ -34,5 +37,19 @@ bool IsBinaryFile(const base::FilePath& file) {
IsArchiveFile(file));
}
+ClientDownloadRequest::DownloadType GetDownloadType(
+ const base::FilePath& file) {
+ DCHECK(IsBinaryFile(file));
+ if (file.MatchesExtension(FILE_PATH_LITERAL(".apk")))
+ return ClientDownloadRequest::ANDROID_APK;
+ else if (file.MatchesExtension(FILE_PATH_LITERAL(".crx")))
+ return ClientDownloadRequest::CHROME_EXTENSION;
+ // For zip files, we use the ZIPPED_EXECUTABLE type since we will only send
+ // the pingback if we find an executable inside the zip archive.
+ else if (file.MatchesExtension(FILE_PATH_LITERAL(".zip")))
+ return ClientDownloadRequest::ZIPPED_EXECUTABLE;
+ return ClientDownloadRequest::WIN_EXECUTABLE;
+}
+
} // namespace download_protection_util
} // namespace safe_browsing

Powered by Google App Engine
This is Rietveld 408576698