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

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

Issue 1929693003: Populate download_file_types proto and filter it for each platform (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@file_type_polices2
Patch Set: reorder ascipb per asanka's comments 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 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 EXTENSION_CDR, 275 EXTENSION_CDR,
276 EXTENSION_DMGPART, 276 EXTENSION_DMGPART,
277 EXTENSION_DVDR, 277 EXTENSION_DVDR,
278 EXTENSION_DART, 278 EXTENSION_DART,
279 EXTENSION_DC42, 279 EXTENSION_DC42,
280 EXTENSION_DISKCOPY42, 280 EXTENSION_DISKCOPY42,
281 EXTENSION_IMGPART, 281 EXTENSION_IMGPART,
282 EXTENSION_NDIF, 282 EXTENSION_NDIF,
283 EXTENSION_UDIF, 283 EXTENSION_UDIF,
284 EXTENSION_TOAST, 284 EXTENSION_TOAST,
285
285 // New values go above this one. 286 // New values go above this one.
286 EXTENSION_MAX 287 EXTENSION_MAX
287 }; 288 };
288 289
290 static_assert(EXTENSION_TOAST + 1 == EXTENSION_MAX,
291 "You must add new types to download_file_types.asciipb as "
292 "well.");
293
289 struct SafeBrowsingFiletype { 294 struct SafeBrowsingFiletype {
290 const base::FilePath::CharType* const extension; 295 const base::FilePath::CharType* const extension;
291 int uma_value; 296 int uma_value;
292 bool is_supported_binary; 297 bool is_supported_binary;
293 bool is_archive; 298 bool is_archive;
294 }; 299 };
295 300
296 const SafeBrowsingFiletype kSafeBrowsingFileTypes[] = { 301 const SafeBrowsingFiletype kSafeBrowsingFileTypes[] = {
297 // KEEP THIS LIST SORTED! 302 // KEEP THIS LIST SORTED!
298 {FILE_PATH_LITERAL(".001"), EXTENSION_001, true, true}, 303 {FILE_PATH_LITERAL(".001"), EXTENSION_001, true, true},
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 return ClientDownloadRequest::ARCHIVE; 647 return ClientDownloadRequest::ARCHIVE;
643 return ClientDownloadRequest::WIN_EXECUTABLE; 648 return ClientDownloadRequest::WIN_EXECUTABLE;
644 } 649 }
645 650
646 int GetSBClientDownloadExtensionValueForUMA(const base::FilePath& file) { 651 int GetSBClientDownloadExtensionValueForUMA(const base::FilePath& file) {
647 return GetFileType(file).uma_value; 652 return GetFileType(file).uma_value;
648 } 653 }
649 654
650 } // namespace download_protection_util 655 } // namespace download_protection_util
651 } // namespace safe_browsing 656 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/common/safe_browsing/download_file_types.proto ('k') | chrome/common/safe_browsing/file_type_policies.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698