Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / content / public / common / push_messaging_status.h
blob2f9f6c138ca80339e69f4c0df511101d56cfbf92
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_
8 namespace content {
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
27 // reached.
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 // Registration failed because the public key could not be retrieved.
53 PUSH_REGISTRATION_STATUS_PUBLIC_KEY_UNAVAILABLE = 11,
55 // NOTE: Do not renumber these as that would confuse interpretation of
56 // previously logged data. When making changes, also update the enum list
57 // in tools/metrics/histograms/histograms.xml to keep it in sync, and
58 // update PUSH_REGISTRATION_STATUS_LAST below.
60 PUSH_REGISTRATION_STATUS_LAST =
61 PUSH_REGISTRATION_STATUS_INCOGNITO_PERMISSION_DENIED
64 // Push unregistration success/error codes for internal use & reporting in UMA.
65 enum PushUnregistrationStatus {
66 // The unregistration was successful.
67 PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTERED = 0,
69 // Unregistration was unnecessary, as the registration was not found.
70 PUSH_UNREGISTRATION_STATUS_SUCCESS_WAS_NOT_REGISTERED = 1,
72 // The unregistration did not happen because of a network error, but will be
73 // retried until it succeeds.
74 PUSH_UNREGISTRATION_STATUS_PENDING_NETWORK_ERROR = 2,
76 // Unregistration failed because there is no Service Worker.
77 PUSH_UNREGISTRATION_STATUS_NO_SERVICE_WORKER = 3,
79 // Unregistration failed because the push service is not available.
80 PUSH_UNREGISTRATION_STATUS_SERVICE_NOT_AVAILABLE = 4,
82 // Unregistration failed in the push service implemented by the embedder, but
83 // will be retried until it succeeds.
84 PUSH_UNREGISTRATION_STATUS_PENDING_SERVICE_ERROR = 5,
86 // Unregistration succeeded, but we failed to clear Service Worker storage.
87 PUSH_UNREGISTRATION_STATUS_STORAGE_ERROR = 6,
89 // Unregistration failed due to a network error.
90 PUSH_UNREGISTRATION_STATUS_NETWORK_ERROR = 7,
92 // NOTE: Do not renumber these as that would confuse interpretation of
93 // previously logged data. When making changes, also update the enum list
94 // in tools/metrics/histograms/histograms.xml to keep it in sync, and
95 // update PUSH_UNREGISTRATION_STATUS_LAST below.
97 PUSH_UNREGISTRATION_STATUS_LAST = PUSH_UNREGISTRATION_STATUS_NETWORK_ERROR
100 // Push getregistration success/error codes for internal use & reporting in UMA.
101 enum PushGetRegistrationStatus {
102 // Getting the registration was successful.
103 PUSH_GETREGISTRATION_STATUS_SUCCESS = 0,
105 // Getting the registration failed because the push service is not available.
106 PUSH_GETREGISTRATION_STATUS_SERVICE_NOT_AVAILABLE = 1,
108 // Getting the registration failed because we failed to read from storage.
109 PUSH_GETREGISTRATION_STATUS_STORAGE_ERROR = 2,
111 // Getting the registration failed because there is no push registration.
112 PUSH_GETREGISTRATION_STATUS_REGISTRATION_NOT_FOUND = 3,
114 // Getting the registration failed because the push service isn't available in
115 // incognito, but we tell JS registration not found to not reveal incognito.
116 PUSH_GETREGISTRATION_STATUS_INCOGNITO_REGISTRATION_NOT_FOUND = 4,
118 // Registration failed because the public key could not be retrieved.
119 PUSH_GETREGISTRATION_STATUS_PUBLIC_KEY_UNAVAILABLE = 5,
121 // NOTE: Do not renumber these as that would confuse interpretation of
122 // previously logged data. When making changes, also update the enum list
123 // in tools/metrics/histograms/histograms.xml to keep it in sync, and
124 // update PUSH_GETREGISTRATION_STATUS_LAST below.
126 PUSH_GETREGISTRATION_STATUS_LAST =
127 PUSH_GETREGISTRATION_STATUS_INCOGNITO_REGISTRATION_NOT_FOUND
130 // Push message event success/error codes for internal use & reporting in UMA.
131 enum PushDeliveryStatus {
132 // The message was successfully delivered.
133 PUSH_DELIVERY_STATUS_SUCCESS = 0,
135 // The message could not be delivered because it was invalid.
136 PUSH_DELIVERY_STATUS_INVALID_MESSAGE = 1,
138 // The message could not be delivered because the app id was unknown.
139 PUSH_DELIVERY_STATUS_UNKNOWN_APP_ID = 2,
141 // The message could not be delivered because origin no longer has permission.
142 PUSH_DELIVERY_STATUS_PERMISSION_DENIED = 3,
144 // The message could not be delivered because no service worker was found.
145 PUSH_DELIVERY_STATUS_NO_SERVICE_WORKER = 4,
147 // The message could not be delivered because of a service worker error.
148 PUSH_DELIVERY_STATUS_SERVICE_WORKER_ERROR = 5,
150 // The message was delivered, but the Service Worker passed a Promise to
151 // event.waitUntil that got rejected.
152 PUSH_DELIVERY_STATUS_EVENT_WAITUNTIL_REJECTED = 6,
154 // NOTE: Do not renumber these as that would confuse interpretation of
155 // previously logged data. When making changes, also update the enum list
156 // in tools/metrics/histograms/histograms.xml to keep it in sync, and
157 // update PUSH_DELIVERY_STATUS_LAST below.
159 PUSH_DELIVERY_STATUS_LAST = PUSH_DELIVERY_STATUS_EVENT_WAITUNTIL_REJECTED
162 // Push message user visible tracking for reporting in UMA.
163 enum PushUserVisibleStatus {
164 // A notification was required and one (or more) were shown.
165 PUSH_USER_VISIBLE_STATUS_REQUIRED_AND_SHOWN = 0,
167 // A notification was not required, but one (or more) were shown anyway.
168 PUSH_USER_VISIBLE_STATUS_NOT_REQUIRED_BUT_SHOWN = 1,
170 // A notification was not required and none were shown.
171 PUSH_USER_VISIBLE_STATUS_NOT_REQUIRED_AND_NOT_SHOWN = 2,
173 // A notification was required, but none were shown. Fortunately, the site has
174 // been well behaved recently so it was glossed over.
175 PUSH_USER_VISIBLE_STATUS_REQUIRED_BUT_NOT_SHOWN_USED_GRACE = 3,
177 // A notification was required, but none were shown. Unfortunately, the site
178 // has run out of grace, so we had to show the user a generic notification.
179 PUSH_USER_VISIBLE_STATUS_REQUIRED_BUT_NOT_SHOWN_GRACE_EXCEEDED = 4,
181 // NOTE: Do not renumber these as that would confuse interpretation of
182 // previously logged data. When making changes, also update the enum list
183 // in tools/metrics/histograms/histograms.xml to keep it in sync, and
184 // update PUSH_USER_VISIBLE_STATUS_LAST below.
186 PUSH_USER_VISIBLE_STATUS_LAST =
187 PUSH_USER_VISIBLE_STATUS_REQUIRED_BUT_NOT_SHOWN_GRACE_EXCEEDED
190 const char* PushRegistrationStatusToString(PushRegistrationStatus status);
192 const char* PushUnregistrationStatusToString(PushUnregistrationStatus status);
194 } // namespace content
196 #endif // CONTENT_PUBLIC_COMMON_PUSH_MESSAGING_STATUS_H_