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

Unified Diff: components/content_settings/core/browser/host_content_settings_map.cc

Issue 2250713003: Add metrics for schemes of content setting exceptions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 4 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: components/content_settings/core/browser/host_content_settings_map.cc
diff --git a/components/content_settings/core/browser/host_content_settings_map.cc b/components/content_settings/core/browser/host_content_settings_map.cc
index 6b56ae6e7f863dec90f9a3cc482015fefa96ccb3..f5a47a8b15b82776c2f59f6f1f7b1b47e11db571 100644
--- a/components/content_settings/core/browser/host_content_settings_map.cc
+++ b/components/content_settings/core/browser/host_content_settings_map.cc
@@ -173,7 +173,7 @@ HostContentSettingsMap::HostContentSettingsMap(PrefService* prefs,
MigrateKeygenSettings();
- RecordNumberOfExceptions();
+ RecordExceptionMetrics();
}
// static
@@ -497,7 +497,7 @@ void HostContentSettingsMap::MigrateKeygenSettings() {
}
}
-void HostContentSettingsMap::RecordNumberOfExceptions() {
+void HostContentSettingsMap::RecordExceptionMetrics() {
for (const content_settings::WebsiteSettingsInfo* info :
*content_settings::WebsiteSettingsRegistry::GetInstance()) {
ContentSettingsType content_type = info->type();
@@ -507,6 +507,17 @@ void HostContentSettingsMap::RecordNumberOfExceptions() {
GetSettingsForOneType(content_type, std::string(), &settings);
size_t num_exceptions = 0;
for (const ContentSettingPatternSource& setting_entry : settings) {
+ // Skip default settings.
+ if (setting_entry.primary_pattern == ContentSettingsPattern::Wildcard() &&
+ setting_entry.secondary_pattern ==
+ ContentSettingsPattern::Wildcard()) {
+ continue;
+ }
+
+ UMA_HISTOGRAM_ENUMERATION("ContentSettings.ExceptionScheme",
+ setting_entry.primary_pattern.GetScheme(),
+ ContentSettingsPattern::SCHEME_MAX);
+
if (setting_entry.source == "preference")
++num_exceptions;
}

Powered by Google App Engine
This is Rietveld 408576698