1 // Copyright 2018 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.
4 
5 #ifndef CHROME_BROWSER_NOTIFICATIONS_WIN_NOTIFICATION_METRICS_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_WIN_NOTIFICATION_METRICS_H_
7 
8 namespace notifications_uma {
9 
10 // These values are persisted to logs. Entries should not be renumbered and
11 // numeric values should never be reused.
12 enum class DisplayStatus {
13   SUCCESS = 0,
14   RO_ACTIVATE_FAILED = 1,
15   CONVERSION_FAILED_INSPECTABLE_TO_XML_IO = 2,
16   LOAD_XML_FAILED = 3,
17   CONVERSION_FAILED_XML_IO_TO_XML = 4,
18   CREATE_FACTORY_FAILED = 5,
19   CREATE_TOAST_NOTIFICATION_FAILED = 6,
20   CREATE_TOAST_NOTIFICATION2_FAILED = 7,
21   SETTING_GROUP_FAILED = 8,
22   SETTING_TAG_FAILED = 9,
23   GET_GROUP_FAILED = 10,
24   GET_TAG_FAILED = 11,
25   SUPPRESS_POPUP_FAILED = 12,
26   ADD_TOAST_DISMISS_HANDLER_FAILED = 13,
27   ADD_TOAST_ERROR_HANDLER_FAILED = 14,
28   SHOWING_TOAST_FAILED = 15,
29   CREATE_TOAST_NOTIFICATION_MANAGER_FAILED = 16,
30   CREATE_TOAST_NOTIFIER_WITH_ID_FAILED = 17,
31   DEPRECATED_DISABLED_FOR_APPLICATION = 18,
32   DEPRECATED_DISABLED_FOR_USER = 19,
33   DEPRECATED_DISABLED_BY_GROUP_POLICY = 20,
34   DEPRECATED_DISABLED_BY_MANIFEST = 21,
35   COUNT  // Must be the final value.
36 };
37 
38 // These values are persisted to logs. Entries should not be renumbered and
39 // numeric values should never be reused.
40 enum class CloseStatus {
41   SUCCESS = 0,
42   GET_TOAST_HISTORY_FAILED = 1,
43   REMOVING_TOAST_FAILED = 2,
44   COUNT  // Must be the final value.
45 };
46 
47 // These values are persisted to logs. Entries should not be renumbered and
48 // numeric values should never be reused.
49 enum class HistoryStatus {
50   SUCCESS = 0,
51   CREATE_TOAST_NOTIFICATION_MANAGER_FAILED = 1,
52   QUERY_TOAST_MANAGER_STATISTICS2_FAILED = 2,
53   GET_TOAST_HISTORY_FAILED = 3,
54   COUNT  // Must be the final value.
55 };
56 
57 // These values are persisted to logs. Entries should not be renumbered and
58 // numeric values should never be reused.
59 enum class GetDisplayedStatus {
60   SUCCESS = 0,
61   SUCCESS_WITH_GET_AT_FAILURE = 1,
62   GET_TOAST_HISTORY_FAILED = 2,
63   QUERY_TOAST_NOTIFICATION_HISTORY2_FAILED = 3,
64   GET_HISTORY_WITH_ID_FAILED = 4,
65   GET_SIZE_FAILED = 5,
66   COUNT  // Must be the final value.
67 };
68 
69 // These values are persisted to logs. Entries should not be renumbered and
70 // numeric values should never be reused.
71 enum class GetDisplayedLaunchIdStatus {
72   SUCCESS = 0,
73   DECODE_LAUNCH_ID_FAILED = 1,
74   COUNT  // Must be the final value.
75 };
76 
77 // These values are persisted to logs. Entries should not be renumbered and
78 // numeric values should never be reused.
79 enum class GetNotificationLaunchIdStatus {
80   SUCCESS = 0,
81   NOTIFICATION_GET_CONTENT_FAILED = 1,
82   GET_ELEMENTS_BY_TAG_FAILED = 2,
83   MISSING_TOAST_ELEMENT_IN_DOC = 3,
84   ITEM_AT_FAILED = 4,
85   GET_ATTRIBUTES_FAILED = 5,
86   GET_NAMED_ITEM_FAILED = 6,
87   GET_FIRST_CHILD_FAILED = 7,
88   GET_NODE_VALUE_FAILED = 8,
89   CONVERSION_TO_PROP_VALUE_FAILED = 9,
90   GET_STRING_FAILED = 10,
91   GET_NAMED_ITEM_NULL = 11,
92   GET_FIRST_CHILD_NULL = 12,
93   COUNT  // Must be the final value.
94 };
95 
96 // These values are persisted to logs. Entries should not be renumbered and
97 // numeric values should never be reused.
98 enum class GetSettingPolicy {
99   ENABLED = 0,
100   DISABLED_FOR_APPLICATION = 1,
101   DISABLED_FOR_USER = 2,
102   DISABLED_BY_GROUP_POLICY = 3,
103   DISABLED_BY_MANIFEST = 4,
104   COUNT  // Must be the final value.
105 };
106 
107 // These values are persisted to logs. Entries should not be renumbered and
108 // numeric values should never be reused.
109 enum class GetSettingStatus {
110   SUCCESS = 0,
111   UNKNOWN_FAILURE = 1,
112   COUNT  // Must be the final value.
113 };
114 
115 // These values are persisted to logs. Entries should not be renumbered and
116 // numeric values should never be reused.
117 enum class ActivationStatus {
118   SUCCESS = 0,
119   DEPRECATED_GET_PROFILE_ID_INVALID_LAUNCH_ID = 1,
120   DEPRECATED_ACTIVATION_INVALID_LAUNCH_ID = 2,
121   INVALID_LAUNCH_ID = 3,
122   COUNT  // Must be the final value.
123 };
124 
125 // These values are persisted to logs. Entries should not be renumbered and
126 // numeric values should never be reused.
127 enum class HandleEventStatus {
128   SUCCESS = 0,
129   HANDLE_EVENT_LAUNCH_ID_INVALID = 1,
130   COUNT  // Must be the final value.
131 };
132 
133 // These values are persisted to logs. Entries should not be renumbered and
134 // numeric values should never be reused.
135 enum class SetReadyCallbackStatus {
136   SUCCESS = 0,
137   SHORTCUT_MISCONFIGURATION = 1 << 0,
138   COM_SERVER_MISCONFIGURATION = 1 << 1,
139   COM_NOT_INITIALIZED = 1 << 2,
140   COUNT = 1 << 3  // Must be the final value.
141 };
142 
143 // These values are persisted to logs. Entries should not be renumbered and
144 // numeric values should never be reused.
145 enum class OnDismissedStatus {
146   SUCCESS = 0,
147   GET_DISMISSAL_REASON_FAILED = 1,
148   COUNT  // Must be the final value.
149 };
150 
151 // These values are persisted to logs. Entries should not be renumbered and
152 // numeric values should never be reused.
153 enum class OnFailedStatus {
154   SUCCESS = 0,
155   GET_ERROR_CODE_FAILED = 1,
156   COUNT  // Must be the final value.
157 };
158 
159 // Methods to log histograms (to detect error rates in Native Notifications on
160 // Windows).
161 void LogDisplayHistogram(DisplayStatus status);
162 void LogCloseHistogram(CloseStatus status);
163 void LogHistoryHistogram(HistoryStatus status);
164 void LogGetDisplayedStatus(GetDisplayedStatus status);
165 void LogGetDisplayedLaunchIdStatus(GetDisplayedLaunchIdStatus status);
166 void LogGetNotificationLaunchIdStatus(GetNotificationLaunchIdStatus status);
167 void LogGetSettingPolicy(GetSettingPolicy policy);
168 void LogGetSettingStatus(GetSettingStatus status);
169 void LogHandleEventStatus(HandleEventStatus status);
170 void LogActivationStatus(ActivationStatus status);
171 void LogSetReadyCallbackStatus(SetReadyCallbackStatus status);
172 void LogOnDismissedStatus(OnDismissedStatus status);
173 void LogOnFailedStatus(OnFailedStatus status);
174 
175 }  // namespace notifications_uma
176 
177 #endif  // CHROME_BROWSER_NOTIFICATIONS_WIN_NOTIFICATION_METRICS_H_
178