OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_PUBLIC_COMMON_PUSH_MESSAGING_STATUS_H_ | 5 #ifndef CONTENT_PUBLIC_COMMON_PUSH_MESSAGING_STATUS_H_ |
6 #define CONTENT_PUBLIC_COMMON_PUSH_MESSAGING_STATUS_H_ | 6 #define CONTENT_PUBLIC_COMMON_PUSH_MESSAGING_STATUS_H_ |
7 | 7 |
8 namespace content { | 8 namespace content { |
9 | 9 |
10 // Push registration success / error codes for internal use & reporting in UMA. | 10 // Push registration success/error codes for internal use & reporting in UMA. |
11 enum PushRegistrationStatus { | 11 enum PushRegistrationStatus { |
12 // New successful registration (there was not yet a registration cached in | 12 // New successful registration (there was not yet a registration cached in |
13 // Service Worker storage, so the browser successfully registered with the | 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 | 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 | 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 | 16 // app data was cleared, we might have forgotten about a registration that the |
17 // push service still stores). | 17 // push service still stores). |
18 PUSH_REGISTRATION_STATUS_SUCCESS_FROM_PUSH_SERVICE = 0, | 18 PUSH_REGISTRATION_STATUS_SUCCESS_FROM_PUSH_SERVICE = 0, |
19 | 19 |
20 // Registration failed because there is no Service Worker. | 20 // Registration failed because there is no Service Worker. |
(...skipping 14 matching lines...) Expand all Loading... |
35 | 35 |
36 // Registration failed because no sender id was provided by the page. | 36 // Registration failed because no sender id was provided by the page. |
37 PUSH_REGISTRATION_STATUS_NO_SENDER_ID = 6, | 37 PUSH_REGISTRATION_STATUS_NO_SENDER_ID = 6, |
38 | 38 |
39 // Registration succeeded, but we failed to persist it. | 39 // Registration succeeded, but we failed to persist it. |
40 PUSH_REGISTRATION_STATUS_STORAGE_ERROR = 7, | 40 PUSH_REGISTRATION_STATUS_STORAGE_ERROR = 7, |
41 | 41 |
42 // A successful registration was already cached in Service Worker storage. | 42 // A successful registration was already cached in Service Worker storage. |
43 PUSH_REGISTRATION_STATUS_SUCCESS_FROM_CACHE = 8, | 43 PUSH_REGISTRATION_STATUS_SUCCESS_FROM_CACHE = 8, |
44 | 44 |
| 45 // Registration failed due to a network error. |
| 46 PUSH_REGISTRATION_STATUS_NETWORK_ERROR = 9, |
| 47 |
| 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, |
| 51 |
45 // NOTE: Do not renumber these as that would confuse interpretation of | 52 // NOTE: Do not renumber these as that would confuse interpretation of |
46 // previously logged data. When making changes, also update the enum list | 53 // previously logged data. When making changes, also update the enum list |
47 // in tools/metrics/histograms/histograms.xml to keep it in sync, and | 54 // in tools/metrics/histograms/histograms.xml to keep it in sync, and |
48 // update PUSH_REGISTRATION_STATUS_LAST below. | 55 // update PUSH_REGISTRATION_STATUS_LAST below. |
49 | 56 |
50 // Used for IPC message range checks. | 57 PUSH_REGISTRATION_STATUS_LAST = |
51 PUSH_REGISTRATION_STATUS_LAST = PUSH_REGISTRATION_STATUS_SUCCESS_FROM_CACHE | 58 PUSH_REGISTRATION_STATUS_INCOGNITO_PERMISSION_DENIED |
52 }; | 59 }; |
53 | 60 |
54 // Push unregistration success / error codes for internal use & reporting. | 61 // Push unregistration success/error codes for internal use & reporting in UMA. |
55 enum PushUnregistrationStatus { | 62 enum PushUnregistrationStatus { |
56 // The unregistration was successful. | 63 // The unregistration was successful. |
57 PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTER, | 64 PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTERED = 0, |
58 | 65 |
59 // The registration did not happen because of a network error, but will be | 66 // Unregistration was unnecessary, as the registration was not found. |
| 67 PUSH_UNREGISTRATION_STATUS_SUCCESS_WAS_NOT_REGISTERED = 1, |
| 68 |
| 69 // The unregistration did not happen because of a network error, but will be |
60 // retried until it succeeds. | 70 // retried until it succeeds. |
61 PUSH_UNREGISTRATION_STATUS_SUCCESS_WILL_RETRY_NETWORK_ERROR, | 71 PUSH_UNREGISTRATION_STATUS_PENDING_WILL_RETRY_NETWORK_ERROR = 2, |
62 | 72 |
63 // The registration was not registered. | 73 // Unregistration failed because there is no Service Worker. |
64 PUSH_UNREGISTRATION_STATUS_SUCCESS_WAS_NOT_REGISTERED, | 74 PUSH_UNREGISTRATION_STATUS_NO_SERVICE_WORKER = 3, |
65 | 75 |
66 // The unregistration did not happen because of a network error. | 76 // Unregistration failed because the push service is not available. |
67 PUSH_UNREGISTRATION_STATUS_NETWORK_ERROR, | 77 PUSH_UNREGISTRATION_STATUS_SERVICE_NOT_AVAILABLE = 4, |
68 | 78 |
69 // The unregistration did not happen because of a miscellaneous error. | 79 // Unregistration failed in the push service implemented by the embedder. |
70 PUSH_UNREGISTRATION_STATUS_UNKNOWN_ERROR, | 80 PUSH_UNREGISTRATION_STATUS_SERVICE_ERROR = 5, |
| 81 |
| 82 // Unregistration succeeded, but we failed to clear Service Worker storage. |
| 83 PUSH_UNREGISTRATION_STATUS_STORAGE_ERROR = 6, |
| 84 |
| 85 // Unregistration failed due to a network error. |
| 86 PUSH_UNREGISTRATION_STATUS_NETWORK_ERROR = 7, |
| 87 |
| 88 // NOTE: Do not renumber these as that would confuse interpretation of |
| 89 // previously logged data. When making changes, also update the enum list |
| 90 // in tools/metrics/histograms/histograms.xml to keep it in sync, and |
| 91 // update PUSH_UNREGISTRATION_STATUS_LAST below. |
| 92 |
| 93 PUSH_UNREGISTRATION_STATUS_LAST = PUSH_UNREGISTRATION_STATUS_NETWORK_ERROR |
71 }; | 94 }; |
72 | 95 |
73 // Push get registration success / error codes for internal use. | 96 // Push getregistration success/error codes for internal use & reporting in UMA. |
74 enum PushGetRegistrationStatus { | 97 enum PushGetRegistrationStatus { |
75 // Getting the registration was successful. | 98 // Getting the registration was successful. |
76 PUSH_GETREGISTRATION_STATUS_SUCCESS, | 99 PUSH_GETREGISTRATION_STATUS_SUCCESS = 0, |
| 100 |
| 101 // Getting the registration failed because the push service is not available. |
| 102 PUSH_GETREGISTRATION_STATUS_SERVICE_NOT_AVAILABLE = 1, |
| 103 |
| 104 // Getting the registration failed because we failed to read from storage. |
| 105 PUSH_GETREGISTRATION_STATUS_STORAGE_ERROR = 2, |
77 | 106 |
78 // Getting the registration failed because there is no push registration. | 107 // Getting the registration failed because there is no push registration. |
79 PUSH_GETREGISTRATION_STATUS_REGISTRATION_NOT_FOUND, | 108 PUSH_GETREGISTRATION_STATUS_REGISTRATION_NOT_FOUND = 3, |
80 | 109 |
81 // Getting the registration failed because of a service worker error. | 110 // Getting the registration failed because the push service isn't available in |
82 PUSH_GETREGISTRATION_STATUS_SERVICE_WORKER_ERROR, | 111 // incognito, but we tell JS registration not found to not reveal incognito. |
| 112 PUSH_GETREGISTRATION_STATUS_INCOGNITO_REGISTRATION_NOT_FOUND = 4, |
83 | 113 |
84 // When making changes, update PUSH_GETREGISTRATION_STATUS_LAST below. | 114 // NOTE: Do not renumber these as that would confuse interpretation of |
| 115 // previously logged data. When making changes, also update the enum list |
| 116 // in tools/metrics/histograms/histograms.xml to keep it in sync, and |
| 117 // update PUSH_GETREGISTRATION_STATUS_LAST below. |
85 | 118 |
86 // Used for IPC message range checks. | |
87 PUSH_GETREGISTRATION_STATUS_LAST = | 119 PUSH_GETREGISTRATION_STATUS_LAST = |
88 PUSH_GETREGISTRATION_STATUS_SERVICE_WORKER_ERROR | 120 PUSH_GETREGISTRATION_STATUS_INCOGNITO_REGISTRATION_NOT_FOUND |
89 }; | 121 }; |
90 | 122 |
91 // Push message delivery success / error codes for internal use. | 123 // Push message event success/error codes for internal use & reporting in UMA. |
92 enum PushDeliveryStatus { | 124 enum PushDeliveryStatus { |
93 // The message was successfully delivered. | 125 // The message was successfully delivered. |
94 PUSH_DELIVERY_STATUS_SUCCESS, | 126 PUSH_DELIVERY_STATUS_SUCCESS = 0, |
95 | 127 |
96 // The message could not be delivered because it was invalid. | 128 // The message could not be delivered because it was invalid. |
97 PUSH_DELIVERY_STATUS_INVALID_MESSAGE, | 129 PUSH_DELIVERY_STATUS_INVALID_MESSAGE = 1, |
98 | 130 |
99 // The message could not be delivered because the app id was unknown. | 131 // The message could not be delivered because the app id was unknown. |
100 PUSH_DELIVERY_STATUS_UNKNOWN_APP_ID, | 132 PUSH_DELIVERY_STATUS_UNKNOWN_APP_ID = 2, |
101 | 133 |
102 // The message could not be delivered because origin no longer has permission. | 134 // The message could not be delivered because origin no longer has permission. |
103 PUSH_DELIVERY_STATUS_PERMISSION_DENIED, | 135 PUSH_DELIVERY_STATUS_PERMISSION_DENIED = 3, |
104 | 136 |
105 // The message could not be delivered because no service worker was found. | 137 // The message could not be delivered because no service worker was found. |
106 PUSH_DELIVERY_STATUS_NO_SERVICE_WORKER, | 138 PUSH_DELIVERY_STATUS_NO_SERVICE_WORKER = 4, |
107 | 139 |
108 // The message could not be delivered because of a service worker error. | 140 // The message could not be delivered because of a service worker error. |
109 PUSH_DELIVERY_STATUS_SERVICE_WORKER_ERROR, | 141 PUSH_DELIVERY_STATUS_SERVICE_WORKER_ERROR = 5, |
110 | 142 |
111 // The message was delivered, but the Service Worker passed a Promise to | 143 // The message was delivered, but the Service Worker passed a Promise to |
112 // event.waitUntil that got rejected. | 144 // event.waitUntil that got rejected. |
113 PUSH_DELIVERY_STATUS_EVENT_WAITUNTIL_REJECTED, | 145 PUSH_DELIVERY_STATUS_EVENT_WAITUNTIL_REJECTED = 6, |
114 | 146 |
115 // When making changes, update PUSH_DELIVERY_STATUS_LAST below. | 147 // NOTE: Do not renumber these as that would confuse interpretation of |
| 148 // previously logged data. When making changes, also update the enum list |
| 149 // in tools/metrics/histograms/histograms.xml to keep it in sync, and |
| 150 // update PUSH_DELIVERY_STATUS_LAST below. |
116 | 151 |
117 // Used for IPC message range checks. | |
118 PUSH_DELIVERY_STATUS_LAST = PUSH_DELIVERY_STATUS_EVENT_WAITUNTIL_REJECTED | 152 PUSH_DELIVERY_STATUS_LAST = PUSH_DELIVERY_STATUS_EVENT_WAITUNTIL_REJECTED |
119 }; | 153 }; |
120 | 154 |
121 // Push message user visible tracking for reporting in UMA. | 155 // Push message user visible tracking for reporting in UMA. |
122 enum PushUserVisibleStatus { | 156 enum PushUserVisibleStatus { |
123 // A notification was required and one (or more) were shown. | 157 // A notification was required and one (or more) were shown. |
124 PUSH_USER_VISIBLE_STATUS_REQUIRED_AND_SHOWN = 0, | 158 PUSH_USER_VISIBLE_STATUS_REQUIRED_AND_SHOWN = 0, |
125 | 159 |
126 // A notification was not required, but one (or more) were shown anyway. | 160 // A notification was not required, but one (or more) were shown anyway. |
127 PUSH_USER_VISIBLE_STATUS_NOT_REQUIRED_BUT_SHOWN = 1, | 161 PUSH_USER_VISIBLE_STATUS_NOT_REQUIRED_BUT_SHOWN = 1, |
128 | 162 |
129 // A notification was not required and none were shown. | 163 // A notification was not required and none were shown. |
130 PUSH_USER_VISIBLE_STATUS_NOT_REQUIRED_AND_NOT_SHOWN = 2, | 164 PUSH_USER_VISIBLE_STATUS_NOT_REQUIRED_AND_NOT_SHOWN = 2, |
131 | 165 |
132 // A notification was required, but none were shown. Fortunately, the site has | 166 // A notification was required, but none were shown. Fortunately, the site has |
133 // been well behaved recently so it was glossed over. | 167 // been well behaved recently so it was glossed over. |
134 PUSH_USER_VISIBLE_STATUS_REQUIRED_BUT_NOT_SHOWN_USED_GRACE = 3, | 168 PUSH_USER_VISIBLE_STATUS_REQUIRED_BUT_NOT_SHOWN_USED_GRACE = 3, |
135 | 169 |
136 // A notification was required, but none were shown. Unfortunately, the site | 170 // A notification was required, but none were shown. Unfortunately, the site |
137 // has run out of grace, so we had to show the user a generic notification. | 171 // has run out of grace, so we had to show the user a generic notification. |
138 PUSH_USER_VISIBLE_STATUS_REQUIRED_BUT_NOT_SHOWN_GRACE_EXCEEDED = 4, | 172 PUSH_USER_VISIBLE_STATUS_REQUIRED_BUT_NOT_SHOWN_GRACE_EXCEEDED = 4, |
139 | 173 |
140 // NOTE: Do not renumber these as that would confuse interpretation of | 174 // NOTE: Do not renumber these as that would confuse interpretation of |
141 // previously logged data. When making changes, also update the enum list | 175 // previously logged data. When making changes, also update the enum list |
142 // in tools/metrics/histograms/histograms.xml to keep it in sync, and | 176 // in tools/metrics/histograms/histograms.xml to keep it in sync, and |
143 // update PUSH_USER_VISIBLE_STATUS_LAST below. | 177 // update PUSH_USER_VISIBLE_STATUS_LAST below. |
144 | 178 |
145 // Used for IPC message range checks. | |
146 PUSH_USER_VISIBLE_STATUS_LAST = | 179 PUSH_USER_VISIBLE_STATUS_LAST = |
147 PUSH_USER_VISIBLE_STATUS_REQUIRED_BUT_NOT_SHOWN_GRACE_EXCEEDED | 180 PUSH_USER_VISIBLE_STATUS_REQUIRED_BUT_NOT_SHOWN_GRACE_EXCEEDED |
148 }; | 181 }; |
149 | 182 |
150 const char* PushRegistrationStatusToString(PushRegistrationStatus status); | 183 const char* PushRegistrationStatusToString(PushRegistrationStatus status); |
151 | 184 |
| 185 const char* PushUnregistrationStatusToString(PushUnregistrationStatus status); |
| 186 |
152 } // namespace content | 187 } // namespace content |
153 | 188 |
154 #endif // CONTENT_PUBLIC_COMMON_PUSH_MESSAGING_STATUS_H_ | 189 #endif // CONTENT_PUBLIC_COMMON_PUSH_MESSAGING_STATUS_H_ |
OLD | NEW |