| Index: chrome/browser/safe_browsing/unverified_download_policy.cc
|
| diff --git a/chrome/browser/safe_browsing/unverified_download_policy.cc b/chrome/browser/safe_browsing/unverified_download_policy.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..846ad0b69639a7452d3b941e0a626a141d0efdb3
|
| --- /dev/null
|
| +++ b/chrome/browser/safe_browsing/unverified_download_policy.cc
|
| @@ -0,0 +1,31 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved. Use of this source
|
| +// code is governed by a BSD-style license that can be found in the LICENSE
|
| +// file.
|
| +
|
| +#include "chrome/browser/safe_browsing/unverified_download_policy.h"
|
| +
|
| +#include "base/files/file_path.h"
|
| +#include "base/metrics/histogram_macros.h"
|
| +#include "chrome/browser/safe_browsing/unverified_download_field_trial.h"
|
| +#include "chrome/common/safe_browsing/download_protection_util.h"
|
| +
|
| +namespace safe_browsing {
|
| +
|
| +bool IsUnverifiedDownloadAllowed(const base::FilePath& file) {
|
| + // Currently, the policy is determined entirely by a field trial.
|
| + bool is_allowed = IsUnverifiedDownloadAllowedByFieldTrial(file);
|
| + int uma_file_type =
|
| + download_protection_util::GetSBClientDownloadExtensionValueForUMA(file);
|
| + if (is_allowed) {
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + "SafeBrowsing.UnverifiedDownloads.Allowed", uma_file_type,
|
| + download_protection_util::kSBClientDownloadExtensionsMax);
|
| + } else {
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + "SafeBrowsing.UnverifiedDownloads.Blocked", uma_file_type,
|
| + download_protection_util::kSBClientDownloadExtensionsMax);
|
| + }
|
| + return is_allowed;
|
| +}
|
| +
|
| +} // namespace safe_browsing
|
|
|