Chromium Code Reviews| 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 978aff41c2b478be224d5ca13d801825741151ce..a6b9af22234043504b421513c626f4a85ebde375 100644 |
| --- a/components/content_settings/core/browser/host_content_settings_map.cc |
| +++ b/components/content_settings/core/browser/host_content_settings_map.cc |
| @@ -10,6 +10,7 @@ |
| #include "base/command_line.h" |
| #include "base/macros.h" |
| +#include "base/metrics/histogram_macros.h" |
| #include "base/stl_util.h" |
| #include "base/strings/string_util.h" |
| #include "base/strings/utf_string_conversions.h" |
| @@ -168,6 +169,8 @@ HostContentSettingsMap::HostContentSettingsMap(PrefService* prefs, |
| content_settings_providers_[DEFAULT_PROVIDER] = default_provider; |
| MigrateOldSettings(); |
| + |
| + CollectExceptionNumberUma(); |
| } |
| // static |
| @@ -487,6 +490,26 @@ void HostContentSettingsMap::MigrateOldSettings() { |
| } |
| } |
| +void HostContentSettingsMap::CollectExceptionNumberUma() { |
| + content_settings::ContentSettingsRegistry* registry = |
| + content_settings::ContentSettingsRegistry::GetInstance(); |
| + |
| + for (const content_settings::ContentSettingsInfo* info : *registry) { |
|
raymes
2016/04/12 23:22:39
If we're just going to record number of exceptions
lshang
2016/04/14 04:55:29
Done.
|
| + ContentSettingsType content_type = info->website_settings_info()->type(); |
| + const std::string type_name = info->website_settings_info()->name(); |
| + |
| + ContentSettingsForOneType settings; |
| + GetSettingsForOneType(content_type, std::string(), &settings); |
| + size_t num_exceptions = 0; |
| + for (const ContentSettingPatternSource& setting_entry : settings) { |
| + if (setting_entry.source == "preference") |
| + ++num_exceptions; |
| + } |
| + UMA_HISTOGRAM_COUNTS("ContentSettings.NumberOf" + type_name + "Exceptions", |
|
raymes
2016/04/12 23:22:39
I think a more standard naming convention would be
lshang
2016/04/14 04:55:29
Done.
|
| + num_exceptions); |
| + } |
| +} |
| + |
| ContentSetting HostContentSettingsMap::GetContentSettingAndMaybeUpdateLastUsage( |
| const GURL& primary_url, |
| const GURL& secondary_url, |