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

Side by Side Diff: chrome/common/safe_browsing/download_protection_util.cc

Issue 2010333004: Make file type MPKG generate a download ping (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also fix a SBClientDownload histogram type Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/common/safe_browsing/download_protection_util.h" 5 #include "chrome/common/safe_browsing/download_protection_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 16 matching lines...) Expand all
27 // files unless they contain either executables or archives. The resulting 27 // files unless they contain either executables or archives. The resulting
28 // DownloadType is either ZIPPED_EXECUTABLE or ZIPPED_ARCHIVE respectively. 28 // DownloadType is either ZIPPED_EXECUTABLE or ZIPPED_ARCHIVE respectively.
29 // This function will return ZIPPED_EXECUTABLE for ZIP files as a 29 // This function will return ZIPPED_EXECUTABLE for ZIP files as a
30 // placeholder. The correct DownloadType will be determined based on the 30 // placeholder. The correct DownloadType will be determined based on the
31 // result of analyzing the ZIP file. 31 // result of analyzing the ZIP file.
32 return ClientDownloadRequest::ZIPPED_EXECUTABLE; 32 return ClientDownloadRequest::ZIPPED_EXECUTABLE;
33 else if (file.MatchesExtension(FILE_PATH_LITERAL(".dmg")) || 33 else if (file.MatchesExtension(FILE_PATH_LITERAL(".dmg")) ||
34 file.MatchesExtension(FILE_PATH_LITERAL(".img")) || 34 file.MatchesExtension(FILE_PATH_LITERAL(".img")) ||
35 file.MatchesExtension(FILE_PATH_LITERAL(".iso")) || 35 file.MatchesExtension(FILE_PATH_LITERAL(".iso")) ||
36 file.MatchesExtension(FILE_PATH_LITERAL(".pkg")) || 36 file.MatchesExtension(FILE_PATH_LITERAL(".pkg")) ||
37 file.MatchesExtension(FILE_PATH_LITERAL(".mpkg")) ||
37 file.MatchesExtension(FILE_PATH_LITERAL(".smi")) || 38 file.MatchesExtension(FILE_PATH_LITERAL(".smi")) ||
38 file.MatchesExtension(FILE_PATH_LITERAL(".osx")) || 39 file.MatchesExtension(FILE_PATH_LITERAL(".osx")) ||
39 file.MatchesExtension(FILE_PATH_LITERAL(".app")) || 40 file.MatchesExtension(FILE_PATH_LITERAL(".app")) ||
40 file.MatchesExtension(FILE_PATH_LITERAL(".cdr")) || 41 file.MatchesExtension(FILE_PATH_LITERAL(".cdr")) ||
41 file.MatchesExtension(FILE_PATH_LITERAL(".dmgpart")) || 42 file.MatchesExtension(FILE_PATH_LITERAL(".dmgpart")) ||
42 file.MatchesExtension(FILE_PATH_LITERAL(".dvdr")) || 43 file.MatchesExtension(FILE_PATH_LITERAL(".dvdr")) ||
43 file.MatchesExtension(FILE_PATH_LITERAL(".dart")) || 44 file.MatchesExtension(FILE_PATH_LITERAL(".dart")) ||
44 file.MatchesExtension(FILE_PATH_LITERAL(".dc42")) || 45 file.MatchesExtension(FILE_PATH_LITERAL(".dc42")) ||
45 file.MatchesExtension(FILE_PATH_LITERAL(".diskcopy42")) || 46 file.MatchesExtension(FILE_PATH_LITERAL(".diskcopy42")) ||
46 file.MatchesExtension(FILE_PATH_LITERAL(".imgpart")) || 47 file.MatchesExtension(FILE_PATH_LITERAL(".imgpart")) ||
47 file.MatchesExtension(FILE_PATH_LITERAL(".ndif")) || 48 file.MatchesExtension(FILE_PATH_LITERAL(".ndif")) ||
48 file.MatchesExtension(FILE_PATH_LITERAL(".udif")) || 49 file.MatchesExtension(FILE_PATH_LITERAL(".udif")) ||
49 file.MatchesExtension(FILE_PATH_LITERAL(".toast")) || 50 file.MatchesExtension(FILE_PATH_LITERAL(".toast")) ||
50 file.MatchesExtension(FILE_PATH_LITERAL(".sparsebundle")) || 51 file.MatchesExtension(FILE_PATH_LITERAL(".sparsebundle")) ||
51 file.MatchesExtension(FILE_PATH_LITERAL(".sparseimage"))) 52 file.MatchesExtension(FILE_PATH_LITERAL(".sparseimage")))
52 return ClientDownloadRequest::MAC_EXECUTABLE; 53 return ClientDownloadRequest::MAC_EXECUTABLE;
53 else if (FileTypePolicies::GetInstance()->IsArchiveFile(file)) 54 else if (FileTypePolicies::GetInstance()->IsArchiveFile(file))
54 return ClientDownloadRequest::ARCHIVE; 55 return ClientDownloadRequest::ARCHIVE;
55 return ClientDownloadRequest::WIN_EXECUTABLE; 56 return ClientDownloadRequest::WIN_EXECUTABLE;
56 } 57 }
57 58
58 } // namespace download_protection_util 59 } // namespace download_protection_util
59 } // namespace safe_browsing 60 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/resources/safe_browsing/download_file_types.asciipb ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698