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

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

Issue 379563006: Merge 281089 "Include the latest binary download info in safe br..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/2062/src/
Patch Set: Created 6 years, 5 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/common/safe_browsing/download_protection_util.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/safe_browsing/download_protection_util.cc
===================================================================
--- chrome/common/safe_browsing/download_protection_util.cc (revision 281829)
+++ chrome/common/safe_browsing/download_protection_util.cc (working copy)
@@ -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 @@
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
« no previous file with comments | « chrome/common/safe_browsing/download_protection_util.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698