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

Unified Diff: chrome/browser/safe_browsing/unverified_download_policy.cc

Issue 1409003002: [SafeBrowsing] Block dangerous unchecked downloads based on a Finch trial. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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/browser/safe_browsing/unverified_download_policy.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..17e74ffaad5b96f1a8c57c493b1eb3f9083a908c
--- /dev/null
+++ b/chrome/browser/safe_browsing/unverified_download_policy.cc
@@ -0,0 +1,29 @@
+// 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/sparse_histogram.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_SPARSE_SLOWLY("SafeBrowsing.UnverifiedDownloads.Allowed",
+ uma_file_type);
+ } else {
+ UMA_HISTOGRAM_SPARSE_SLOWLY("SafeBrowsing.UnverifiedDownloads.Blocked",
+ uma_file_type);
+ }
+ return is_allowed;
+}
+
+} // namespace safe_browsing
« no previous file with comments | « chrome/browser/safe_browsing/unverified_download_policy.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698