Commit 384abc65 authored by Finnur Thorarinsson's avatar Finnur Thorarinsson Committed by Commit Bot

Windows Native Notifications: UMA for settings.

Notifications can be disabled for a number of
reasons. This logs those reasons with UMA.

Bug: 734095
Change-Id: I05e61b287312a42707d78415d2186909fae87fb7
Reviewed-on: https://chromium-review.googlesource.com/980559Reviewed-by: default avatarXi Cheng <chengx@chromium.org>
Commit-Queue: Finnur Thorarinsson <finnur@chromium.org>
Cr-Commit-Position: refs/heads/master@{#546174}
parent 1726d77d
......@@ -310,6 +310,35 @@ class NotificationPlatformBridgeWinImpl
return;
}
winui::Notifications::NotificationSetting setting;
HRESULT hr = notifier_->get_Setting(&setting);
if (FAILED(hr)) {
LogDisplayHistogram(DisplayStatus::GET_NOTIFICATION_SETTING_FAILED);
DLOG(ERROR) << "Unable to fetch notification settings";
return;
}
switch (setting) {
case winui::Notifications::NotificationSetting_Enabled:
break;
case winui::Notifications::NotificationSetting_DisabledForApplication:
LogDisplayHistogram(DisplayStatus::DISABLED_FOR_APPLICATION);
DLOG(ERROR) << "Notification disabled for application";
return;
case winui::Notifications::NotificationSetting_DisabledForUser:
LogDisplayHistogram(DisplayStatus::DISABLED_FOR_USER);
DLOG(ERROR) << "Notification disabled for user";
return;
case winui::Notifications::NotificationSetting_DisabledByGroupPolicy:
LogDisplayHistogram(DisplayStatus::DISABLED_BY_GROUP_POLICY);
DLOG(ERROR) << "Notification disabled by group policy";
return;
case winui::Notifications::NotificationSetting_DisabledByManifest:
LogDisplayHistogram(DisplayStatus::DISABLED_BY_MANIFEST);
DLOG(ERROR) << "Notification disabled by manifest";
return;
}
NotificationLaunchId launch_id(notification_type, notification->id(),
profile_id, incognito,
notification->origin_url());
......@@ -317,8 +346,8 @@ class NotificationPlatformBridgeWinImpl
NotificationTemplateBuilder::Build(image_retainer_.get(), launch_id,
profile_id, *notification);
mswr::ComPtr<winui::Notifications::IToastNotification> toast;
HRESULT hr = GetToastNotification(*notification, *notification_template,
profile_id, incognito, &toast);
hr = GetToastNotification(*notification, *notification_template, profile_id,
incognito, &toast);
if (FAILED(hr)) {
// A histogram should have already been logged for this failure.
DLOG(ERROR) << "Unable to get a toast notification";
......
......@@ -28,6 +28,11 @@ enum class DisplayStatus {
SHOWING_TOAST_FAILED = 15,
CREATE_TOAST_NOTIFICATION_MANAGER_FAILED = 16,
CREATE_TOAST_NOTIFIER_WITH_ID_FAILED = 17,
GET_NOTIFICATION_SETTING_FAILED = 18,
DISABLED_FOR_APPLICATION = 19,
DISABLED_FOR_USER = 20,
DISABLED_BY_GROUP_POLICY = 21,
DISABLED_BY_MANIFEST = 22,
COUNT // Must be the final value.
};
......
......@@ -46863,6 +46863,11 @@ Full version information for the fingerprint enum values:
<int value="15" label="SHOWING_TOAST_FAILED"/>
<int value="16" label="CREATE_TOAST_NOTIFICATION_MANAGER_FAILED"/>
<int value="17" label="CREATE_TOAST_NOTIFIER_WITH_ID_FAILED"/>
<int value="18" label="GET_NOTIFICATION_SETTING_FAILED"/>
<int value="19" label="DISABLED_FOR_APPLICATION"/>
<int value="20" label="DISABLED_FOR_USER"/>
<int value="21" label="DISABLED_BY_GROUP_POLICY"/>
<int value="22" label="DISABLED_BY_MANIFEST"/>
</enum>
<enum name="WindowsNotificationGetDisplayedLaunchIdStatus">
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment