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

Unified Diff: components/safe_browsing_db/safe_browsing_prefs.cc

Issue 2418813002: [Reland] Refactoring of SBER preference usage (Closed)
Patch Set: Sync Created 4 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 | « components/safe_browsing_db/safe_browsing_prefs.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/safe_browsing_db/safe_browsing_prefs.cc
diff --git a/components/safe_browsing_db/safe_browsing_prefs.cc b/components/safe_browsing_db/safe_browsing_prefs.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6f7e247ec2f5ec84a21d75592c0cab907af9a0ee
--- /dev/null
+++ b/components/safe_browsing_db/safe_browsing_prefs.cc
@@ -0,0 +1,32 @@
+// Copyright (c) 2016 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 "base/metrics/histogram_macros.h"
+#include "components/prefs/pref_service.h"
+#include "components/safe_browsing_db/safe_browsing_prefs.h"
+
+namespace prefs {
+
+// Boolean that tell us whether Safe Browsing extended reporting is enabled.
+const char kSafeBrowsingExtendedReportingEnabled[] =
+ "safebrowsing.extended_reporting_enabled";
+
+} // namespace prefs
+
+namespace safe_browsing {
+
+const char* GetExtendedReportingPrefName() {
+ return prefs::kSafeBrowsingExtendedReportingEnabled;
+}
+
+bool IsExtendedReportingEnabled(const PrefService& prefs) {
+ return prefs.GetBoolean(GetExtendedReportingPrefName());
+}
+
+void RecordExtendedReportingMetrics(const PrefService& prefs) {
+ UMA_HISTOGRAM_BOOLEAN("SafeBrowsing.Pref.Extended",
+ IsExtendedReportingEnabled(prefs));
+}
+
+} // namespace safe_browsing
« no previous file with comments | « components/safe_browsing_db/safe_browsing_prefs.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698