1 // Copyright 2014 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 #ifndef CONTENT_PUBLIC_COMMON_PUSH_MESSAGING_STATUS_H_
6 #define CONTENT_PUBLIC_COMMON_PUSH_MESSAGING_STATUS_H_
10 // Push registration success/error codes for internal use & reporting in UMA.
11 enum PushRegistrationStatus
{
12 // New successful registration (there was not yet a registration cached in
13 // Service Worker storage, so the browser successfully registered with the
14 // push service. This is likely to be a new push registration, though it's
15 // possible that the push service had its own cache (for example if Chrome's
16 // app data was cleared, we might have forgotten about a registration that the
17 // push service still stores).
18 PUSH_REGISTRATION_STATUS_SUCCESS_FROM_PUSH_SERVICE
= 0,
20 // Registration failed because there is no Service Worker.
21 PUSH_REGISTRATION_STATUS_NO_SERVICE_WORKER
= 1,
23 // Registration failed because the push service is not available.
24 PUSH_REGISTRATION_STATUS_SERVICE_NOT_AVAILABLE
= 2,
26 // Registration failed because the maximum number of registratons has been
28 PUSH_REGISTRATION_STATUS_LIMIT_REACHED
= 3,
30 // Registration failed because permission was denied.
31 PUSH_REGISTRATION_STATUS_PERMISSION_DENIED
= 4,
33 // Registration failed in the push service implemented by the embedder.
34 PUSH_REGISTRATION_STATUS_SERVICE_ERROR
= 5,
36 // Registration failed because no sender id was provided by the page.
37 PUSH_REGISTRATION_STATUS_NO_SENDER_ID
= 6,
39 // Registration succeeded, but we failed to persist it.
40 PUSH_REGISTRATION_STATUS_STORAGE_ERROR
= 7,
42 // A successful registration was already cached in Service Worker storage.
43 PUSH_REGISTRATION_STATUS_SUCCESS_FROM_CACHE
= 8,
45 // Registration failed due to a network error.
46 PUSH_REGISTRATION_STATUS_NETWORK_ERROR
= 9,
48 // Registration failed because the push service is not available in incognito,
49 // but we tell JS that permission was denied to not reveal incognito.
50 PUSH_REGISTRATION_STATUS_INCOGNITO_PERMISSION_DENIED
= 10,
52 // NOTE: Do not renumber these as that would confuse interpretation of
53 // previously logged data. When making changes, also update the enum list
54 // in tools/metrics/histograms/histograms.xml to keep it in sync, and
55 // update PUSH_REGISTRATION_STATUS_LAST below.
57 PUSH_REGISTRATION_STATUS_LAST
=
58 PUSH_REGISTRATION_STATUS_INCOGNITO_PERMISSION_DENIED
61 // Push unregistration success/error codes for internal use & reporting in UMA.
62 enum PushUnregistrationStatus
{
63 // The unregistration was successful.
64 PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTERED
= 0,
66 // Unregistration was unnecessary, as the registration was not found.
67 PUSH_UNREGISTRATION_STATUS_SUCCESS_WAS_NOT_REGISTERED
= 1,
69 // The unregistration did not happen because of a network error, but will be
70 // retried until it succeeds.
71 PUSH_UNREGISTRATION_STATUS_PENDING_NETWORK_ERROR
= 2,
73 // Unregistration failed because there is no Service Worker.
74 PUSH_UNREGISTRATION_STATUS_NO_SERVICE_WORKER
= 3,
76 // Unregistration failed because the push service is not available.
77 PUSH_UNREGISTRATION_STATUS_SERVICE_NOT_AVAILABLE
= 4,
79 // Unregistration failed in the push service implemented by the embedder, but
80 // will be retried until it succeeds.
81 PUSH_UNREGISTRATION_STATUS_PENDING_SERVICE_ERROR
= 5,
83 // Unregistration succeeded, but we failed to clear Service Worker storage.
84 PUSH_UNREGISTRATION_STATUS_STORAGE_ERROR
= 6,
86 // Unregistration failed due to a network error.
87 PUSH_UNREGISTRATION_STATUS_NETWORK_ERROR
= 7,
89 // NOTE: Do not renumber these as that would confuse interpretation of
90 // previously logged data. When making changes, also update the enum list
91 // in tools/metrics/histograms/histograms.xml to keep it in sync, and
92 // update PUSH_UNREGISTRATION_STATUS_LAST below.
94 PUSH_UNREGISTRATION_STATUS_LAST
= PUSH_UNREGISTRATION_STATUS_NETWORK_ERROR
97 // Push getregistration success/error codes for internal use & reporting in UMA.
98 enum PushGetRegistrationStatus
{
99 // Getting the registration was successful.
100 PUSH_GETREGISTRATION_STATUS_SUCCESS
= 0,
102 // Getting the registration failed because the push service is not available.
103 PUSH_GETREGISTRATION_STATUS_SERVICE_NOT_AVAILABLE
= 1,
105 // Getting the registration failed because we failed to read from storage.
106 PUSH_GETREGISTRATION_STATUS_STORAGE_ERROR
= 2,
108 // Getting the registration failed because there is no push registration.
109 PUSH_GETREGISTRATION_STATUS_REGISTRATION_NOT_FOUND
= 3,
111 // Getting the registration failed because the push service isn't available in
112 // incognito, but we tell JS registration not found to not reveal incognito.
113 PUSH_GETREGISTRATION_STATUS_INCOGNITO_REGISTRATION_NOT_FOUND
= 4,
115 // NOTE: Do not renumber these as that would confuse interpretation of
116 // previously logged data. When making changes, also update the enum list
117 // in tools/metrics/histograms/histograms.xml to keep it in sync, and
118 // update PUSH_GETREGISTRATION_STATUS_LAST below.
120 PUSH_GETREGISTRATION_STATUS_LAST
=
121 PUSH_GETREGISTRATION_STATUS_INCOGNITO_REGISTRATION_NOT_FOUND
124 // Push message event success/error codes for internal use & reporting in UMA.
125 enum PushDeliveryStatus
{
126 // The message was successfully delivered.
127 PUSH_DELIVERY_STATUS_SUCCESS
= 0,
129 // The message could not be delivered because it was invalid.
130 PUSH_DELIVERY_STATUS_INVALID_MESSAGE
= 1,
132 // The message could not be delivered because the app id was unknown.
133 PUSH_DELIVERY_STATUS_UNKNOWN_APP_ID
= 2,
135 // The message could not be delivered because origin no longer has permission.
136 PUSH_DELIVERY_STATUS_PERMISSION_DENIED
= 3,
138 // The message could not be delivered because no service worker was found.
139 PUSH_DELIVERY_STATUS_NO_SERVICE_WORKER
= 4,
141 // The message could not be delivered because of a service worker error.
142 PUSH_DELIVERY_STATUS_SERVICE_WORKER_ERROR
= 5,
144 // The message was delivered, but the Service Worker passed a Promise to
145 // event.waitUntil that got rejected.
146 PUSH_DELIVERY_STATUS_EVENT_WAITUNTIL_REJECTED
= 6,
148 // NOTE: Do not renumber these as that would confuse interpretation of
149 // previously logged data. When making changes, also update the enum list
150 // in tools/metrics/histograms/histograms.xml to keep it in sync, and
151 // update PUSH_DELIVERY_STATUS_LAST below.
153 PUSH_DELIVERY_STATUS_LAST
= PUSH_DELIVERY_STATUS_EVENT_WAITUNTIL_REJECTED
156 // Push message user visible tracking for reporting in UMA.
157 enum PushUserVisibleStatus
{
158 // A notification was required and one (or more) were shown.
159 PUSH_USER_VISIBLE_STATUS_REQUIRED_AND_SHOWN
= 0,
161 // A notification was not required, but one (or more) were shown anyway.
162 PUSH_USER_VISIBLE_STATUS_NOT_REQUIRED_BUT_SHOWN
= 1,
164 // A notification was not required and none were shown.
165 PUSH_USER_VISIBLE_STATUS_NOT_REQUIRED_AND_NOT_SHOWN
= 2,
167 // A notification was required, but none were shown. Fortunately, the site has
168 // been well behaved recently so it was glossed over.
169 PUSH_USER_VISIBLE_STATUS_REQUIRED_BUT_NOT_SHOWN_USED_GRACE
= 3,
171 // A notification was required, but none were shown. Unfortunately, the site
172 // has run out of grace, so we had to show the user a generic notification.
173 PUSH_USER_VISIBLE_STATUS_REQUIRED_BUT_NOT_SHOWN_GRACE_EXCEEDED
= 4,
175 // NOTE: Do not renumber these as that would confuse interpretation of
176 // previously logged data. When making changes, also update the enum list
177 // in tools/metrics/histograms/histograms.xml to keep it in sync, and
178 // update PUSH_USER_VISIBLE_STATUS_LAST below.
180 PUSH_USER_VISIBLE_STATUS_LAST
=
181 PUSH_USER_VISIBLE_STATUS_REQUIRED_BUT_NOT_SHOWN_GRACE_EXCEEDED
184 const char* PushRegistrationStatusToString(PushRegistrationStatus status
);
186 const char* PushUnregistrationStatusToString(PushUnregistrationStatus status
);
188 } // namespace content
190 #endif // CONTENT_PUBLIC_COMMON_PUSH_MESSAGING_STATUS_H_