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

Unified Diff: chrome/browser/content_settings/web_site_settings_uma_util.cc

Issue 952463002: Add UMA to track permission changes from the content settings menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
Index: chrome/browser/content_settings/web_site_settings_uma_util.cc
diff --git a/chrome/browser/content_settings/web_site_settings_uma_util.cc b/chrome/browser/content_settings/web_site_settings_uma_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4aa979d2dd26c547efba9b092e8dd94b83fb2b48
--- /dev/null
+++ b/chrome/browser/content_settings/web_site_settings_uma_util.cc
@@ -0,0 +1,34 @@
+// 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/content_settings/web_site_settings_uma_util.h"
+
+#include "base/metrics/histogram_macros.h"
+
+void WebSiteSettingsUmaUtil::LogPermissionChange(ContentSettingsType type,
+ ContentSetting setting) {
+ ContentSettingsTypeHistogram histogram_value =
+ ContentSettingTypeToHistogramValue(type);
+ DCHECK_NE(histogram_value, CONTENT_SETTINGS_TYPE_HISTOGRAM_INVALID);
+ UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Menu.PermissionChanged",
+ histogram_value,
+ CONTENT_SETTINGS_HISTOGRAM_NUM_TYPES);
+
+ if (setting == ContentSetting::CONTENT_SETTING_ALLOW) {
+ UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Menu.PermissionChanged.Allowed",
+ histogram_value,
+ CONTENT_SETTINGS_HISTOGRAM_NUM_TYPES);
+ } else if (setting == ContentSetting::CONTENT_SETTING_BLOCK) {
+ UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Menu.PermissionChanged.Blocked",
+ histogram_value,
+ CONTENT_SETTINGS_HISTOGRAM_NUM_TYPES);
+ } else if (setting == ContentSetting::CONTENT_SETTING_DEFAULT) {
+ UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Menu.PermissionChanged.Reset",
+ histogram_value,
+ CONTENT_SETTINGS_HISTOGRAM_NUM_TYPES);
+ } else {
+ NOTREACHED() << "Requested to log permission change " << type << " to "
+ << setting;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698