| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. Use of this source |
| 2 // code is governed by a BSD-style license that can be found in the LICENSE |
| 3 // file. |
| 4 |
| 5 #include "chrome/browser/safe_browsing/unverified_download_policy.h" |
| 6 |
| 7 #include "base/files/file_path.h" |
| 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "chrome/browser/safe_browsing/unverified_download_field_trial.h" |
| 10 #include "chrome/common/safe_browsing/download_protection_util.h" |
| 11 |
| 12 namespace safe_browsing { |
| 13 |
| 14 bool IsUnverifiedDownloadAllowed(const base::FilePath& file) { |
| 15 // Currently, the policy is determined entirely by a field trial. |
| 16 bool is_allowed = IsUnverifiedDownloadAllowedByFieldTrial(file); |
| 17 int uma_file_type = |
| 18 download_protection_util::GetSBClientDownloadExtensionValueForUMA(file); |
| 19 if (is_allowed) { |
| 20 UMA_HISTOGRAM_ENUMERATION( |
| 21 "SafeBrowsing.UnverifiedDownloads.Allowed", uma_file_type, |
| 22 download_protection_util::kSBClientDownloadExtensionsMax); |
| 23 } else { |
| 24 UMA_HISTOGRAM_ENUMERATION( |
| 25 "SafeBrowsing.UnverifiedDownloads.Blocked", uma_file_type, |
| 26 download_protection_util::kSBClientDownloadExtensionsMax); |
| 27 } |
| 28 return is_allowed; |
| 29 } |
| 30 |
| 31 } // namespace safe_browsing |
| OLD | NEW |