| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/content_settings/web_site_settings_uma_util.h" | 5 #include "chrome/browser/content_settings/web_site_settings_uma_util.h" |
| 6 | 6 |
| 7 #include <stddef.h> |
| 8 |
| 7 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 8 | 10 |
| 9 void WebSiteSettingsUmaUtil::LogPermissionChange(ContentSettingsType type, | 11 void WebSiteSettingsUmaUtil::LogPermissionChange(ContentSettingsType type, |
| 10 ContentSetting setting) { | 12 ContentSetting setting) { |
| 11 size_t num_values; | 13 size_t num_values; |
| 12 int histogram_value = ContentSettingTypeToHistogramValue(type, &num_values); | 14 int histogram_value = ContentSettingTypeToHistogramValue(type, &num_values); |
| 13 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Menu.PermissionChanged", | 15 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Menu.PermissionChanged", |
| 14 histogram_value, num_values); | 16 histogram_value, num_values); |
| 15 | 17 |
| 16 if (setting == ContentSetting::CONTENT_SETTING_ALLOW) { | 18 if (setting == ContentSetting::CONTENT_SETTING_ALLOW) { |
| 17 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Menu.PermissionChanged.Allowed", | 19 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Menu.PermissionChanged.Allowed", |
| 18 histogram_value, num_values); | 20 histogram_value, num_values); |
| 19 } else if (setting == ContentSetting::CONTENT_SETTING_BLOCK) { | 21 } else if (setting == ContentSetting::CONTENT_SETTING_BLOCK) { |
| 20 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Menu.PermissionChanged.Blocked", | 22 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Menu.PermissionChanged.Blocked", |
| 21 histogram_value, num_values); | 23 histogram_value, num_values); |
| 22 } else if (setting == ContentSetting::CONTENT_SETTING_DEFAULT) { | 24 } else if (setting == ContentSetting::CONTENT_SETTING_DEFAULT) { |
| 23 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Menu.PermissionChanged.Reset", | 25 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Menu.PermissionChanged.Reset", |
| 24 histogram_value, num_values); | 26 histogram_value, num_values); |
| 25 } else { | 27 } else { |
| 26 NOTREACHED() << "Requested to log permission change " << type << " to " | 28 NOTREACHED() << "Requested to log permission change " << type << " to " |
| 27 << setting; | 29 << setting; |
| 28 } | 30 } |
| 29 } | 31 } |
| OLD | NEW |