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
3 // found in the LICENSE file.
5 #include "chrome/browser/content_settings/web_site_settings_uma_util.h"
7 #include "base/metrics/histogram_macros.h"
9 void WebSiteSettingsUmaUtil::LogPermissionChange(ContentSettingsType type
,
10 ContentSetting setting
) {
11 ContentSettingsTypeHistogram histogram_value
=
12 ContentSettingTypeToHistogramValue(type
);
13 DCHECK_NE(histogram_value
, CONTENT_SETTINGS_TYPE_HISTOGRAM_INVALID
);
14 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Menu.PermissionChanged",
16 CONTENT_SETTINGS_HISTOGRAM_NUM_TYPES
);
18 if (setting
== ContentSetting::CONTENT_SETTING_ALLOW
) {
19 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Menu.PermissionChanged.Allowed",
21 CONTENT_SETTINGS_HISTOGRAM_NUM_TYPES
);
22 } else if (setting
== ContentSetting::CONTENT_SETTING_BLOCK
) {
23 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Menu.PermissionChanged.Blocked",
25 CONTENT_SETTINGS_HISTOGRAM_NUM_TYPES
);
26 } else if (setting
== ContentSetting::CONTENT_SETTING_DEFAULT
) {
27 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Menu.PermissionChanged.Reset",
29 CONTENT_SETTINGS_HISTOGRAM_NUM_TYPES
);
31 NOTREACHED() << "Requested to log permission change " << type
<< " to "