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_SERVICE_NOT_AVAILABLE_PERMISSION_DENIED = | |
Charlie Reis
2015/02/19 21:30:43
nit: This name seems unnecessarily long, given tha
johnme
2015/02/20 11:34:19
Done.
| |
51 10, | |
52 | |
45 // NOTE: Do not renumber these as that would confuse interpretation of | 53 // NOTE: Do not renumber these as that would confuse interpretation of |
46 // previously logged data. When making changes, also update the enum list | 54 // previously logged data. When making changes, also update the enum list |
47 // in tools/metrics/histograms/histograms.xml to keep it in sync, and | 55 // in tools/metrics/histograms/histograms.xml to keep it in sync, and |
48 // update PUSH_REGISTRATION_STATUS_LAST below. | 56 // update PUSH_REGISTRATION_STATUS_LAST below. |
49 | 57 |
50 // Used for IPC message range checks. | 58 PUSH_REGISTRATION_STATUS_LAST = |
51 PUSH_REGISTRATION_STATUS_LAST = PUSH_REGISTRATION_STATUS_SUCCESS_FROM_CACHE | 59 PUSH_REGISTRATION_STATUS_INCOGNITO_SERVICE_NOT_AVAILABLE_PERMISSION_DENIED |
52 }; | 60 }; |
53 | 61 |
54 // Push unregistration success / error codes for internal use & reporting. | 62 // Push unregistration success/error codes for internal use & reporting in UMA. |
55 enum PushUnregistrationStatus { | 63 enum PushUnregistrationStatus { |
56 // The unregistration was successful. | 64 // The unregistration was successful. |
57 PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTER, | 65 PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTERED = 0, |
58 | 66 |
59 // The registration did not happen because of a network error, but will be | 67 // The unregistration did not happen because of a network error, but will be |
60 // retried until it succeeds. | 68 // retried until it succeeds. |
61 PUSH_UNREGISTRATION_STATUS_SUCCESS_WILL_RETRY_NETWORK_ERROR, | 69 PUSH_UNREGISTRATION_STATUS_SUCCESS_WILL_RETRY_NETWORK_ERROR = 1, |
62 | 70 |
63 // The registration was not registered. | 71 // Unregistration was unnecessary, as the registration was not found. |
64 PUSH_UNREGISTRATION_STATUS_SUCCESS_WAS_NOT_REGISTERED, | 72 PUSH_UNREGISTRATION_STATUS_SUCCESS_WAS_NOT_REGISTERED = 2, |
65 | 73 |
66 // The unregistration did not happen because of a network error. | 74 // Unregistration failed because there is no Service Worker. |
67 PUSH_UNREGISTRATION_STATUS_NETWORK_ERROR, | 75 PUSH_UNREGISTRATION_STATUS_NO_SERVICE_WORKER = 3, |
68 | 76 |
69 // The unregistration did not happen because of a miscellaneous error. | 77 // Unregistration failed because the push service is not available. |
70 PUSH_UNREGISTRATION_STATUS_UNKNOWN_ERROR, | 78 PUSH_UNREGISTRATION_STATUS_SERVICE_NOT_AVAILABLE = 4, |
79 | |
80 // Unregistration failed in the push service implemented by the embedder. | |
81 PUSH_UNREGISTRATION_STATUS_SERVICE_ERROR = 5, | |
82 | |
83 // Unregistration succeeded, but we failed to clear Service Worker storage. | |
84 PUSH_UNREGISTRATION_STATUS_STORAGE_ERROR = 6, | |
85 | |
86 // Unregistration failed due to a network error. | |
87 PUSH_UNREGISTRATION_STATUS_NETWORK_ERROR = 7, | |
88 | |
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. | |
93 | |
94 PUSH_UNREGISTRATION_STATUS_LAST = PUSH_UNREGISTRATION_STATUS_NETWORK_ERROR | |
71 }; | 95 }; |
72 | 96 |
73 // Push get registration success / error codes for internal use. | 97 // Push getregistration success/error codes for internal use & reporting in UMA. |
74 enum PushGetRegistrationStatus { | 98 enum PushGetRegistrationStatus { |
75 // Getting the registration was successful. | 99 // Getting the registration was successful. |
76 PUSH_GETREGISTRATION_STATUS_SUCCESS, | 100 PUSH_GETREGISTRATION_STATUS_SUCCESS = 0, |
101 | |
102 // Getting the registration failed because the push service is not available. | |
103 PUSH_GETREGISTRATION_STATUS_SERVICE_NOT_AVAILABLE = 1, | |
104 | |
105 // Getting the registration failed because we failed to read from storage. | |
106 PUSH_GETREGISTRATION_STATUS_STORAGE_ERROR = 2, | |
77 | 107 |
78 // Getting the registration failed because there is no push registration. | 108 // Getting the registration failed because there is no push registration. |
79 PUSH_GETREGISTRATION_STATUS_REGISTRATION_NOT_FOUND, | 109 PUSH_GETREGISTRATION_STATUS_REGISTRATION_NOT_FOUND = 3, |
80 | 110 |
81 // Getting the registration failed because of a service worker error. | 111 // Getting the registration failed because the push service isn't available in |
82 PUSH_GETREGISTRATION_STATUS_SERVICE_WORKER_ERROR, | 112 // incognito, but we tell JS registration not found to not reveal incognito. |
113 PUSH_GETREGISTRATION_STATUS_INCOGNITO_SERVICE_NOT_AVAILABLE_REGISTRATION_NOT_F OUND | |
Charlie Reis
2015/02/19 21:30:43
Same. This cannot fit on an 80 char line.
johnme
2015/02/20 11:34:19
Done.
| |
114 = 4, | |
83 | 115 |
84 // When making changes, update PUSH_GETREGISTRATION_STATUS_LAST below. | 116 // NOTE: Do not renumber these as that would confuse interpretation of |
117 // previously logged data. When making changes, also update the enum list | |
118 // in tools/metrics/histograms/histograms.xml to keep it in sync, and | |
119 // update PUSH_GETREGISTRATION_STATUS_LAST below. | |
85 | 120 |
86 // Used for IPC message range checks. | |
87 PUSH_GETREGISTRATION_STATUS_LAST = | 121 PUSH_GETREGISTRATION_STATUS_LAST = |
88 PUSH_GETREGISTRATION_STATUS_SERVICE_WORKER_ERROR | 122 PUSH_GETREGISTRATION_STATUS_INCOGNITO_SERVICE_NOT_AVAILABLE_REGISTRATION_N OT_FOUND |
89 }; | 123 }; |
90 | 124 |
91 // Push message delivery success / error codes for internal use. | 125 // Push message event success/error codes for internal use & reporting in UMA. |
92 enum PushDeliveryStatus { | 126 enum PushDeliveryStatus { |
93 // The message was successfully delivered. | 127 // The message was successfully delivered. |
94 PUSH_DELIVERY_STATUS_SUCCESS, | 128 PUSH_DELIVERY_STATUS_SUCCESS = 0, |
95 | 129 |
96 // The message could not be delivered because it was invalid. | 130 // The message could not be delivered because it was invalid. |
97 PUSH_DELIVERY_STATUS_INVALID_MESSAGE, | 131 PUSH_DELIVERY_STATUS_INVALID_MESSAGE = 1, |
98 | 132 |
99 // The message could not be delivered because the app id was unknown. | 133 // The message could not be delivered because the app id was unknown. |
100 PUSH_DELIVERY_STATUS_UNKNOWN_APP_ID, | 134 PUSH_DELIVERY_STATUS_UNKNOWN_APP_ID = 2, |
101 | 135 |
102 // The message could not be delivered because origin no longer has permission. | 136 // The message could not be delivered because origin no longer has permission. |
103 PUSH_DELIVERY_STATUS_PERMISSION_DENIED, | 137 PUSH_DELIVERY_STATUS_PERMISSION_DENIED = 3, |
104 | 138 |
105 // The message could not be delivered because no service worker was found. | 139 // The message could not be delivered because no service worker was found. |
106 PUSH_DELIVERY_STATUS_NO_SERVICE_WORKER, | 140 PUSH_DELIVERY_STATUS_NO_SERVICE_WORKER = 4, |
107 | 141 |
108 // The message could not be delivered because of a service worker error. | 142 // The message could not be delivered because of a service worker error. |
109 PUSH_DELIVERY_STATUS_SERVICE_WORKER_ERROR, | 143 PUSH_DELIVERY_STATUS_SERVICE_WORKER_ERROR = 5, |
110 | 144 |
111 // The message was delivered, but the Service Worker passed a Promise to | 145 // The message was delivered, but the Service Worker passed a Promise to |
112 // event.waitUntil that got rejected. | 146 // event.waitUntil that got rejected. |
113 PUSH_DELIVERY_STATUS_EVENT_WAITUNTIL_REJECTED, | 147 PUSH_DELIVERY_STATUS_EVENT_WAITUNTIL_REJECTED = 6, |
114 | 148 |
115 // When making changes, update PUSH_DELIVERY_STATUS_LAST below. | 149 // NOTE: Do not renumber these as that would confuse interpretation of |
150 // previously logged data. When making changes, also update the enum list | |
151 // in tools/metrics/histograms/histograms.xml to keep it in sync, and | |
152 // update PUSH_DELIVERY_STATUS_LAST below. | |
116 | 153 |
117 // Used for IPC message range checks. | |
118 PUSH_DELIVERY_STATUS_LAST = PUSH_DELIVERY_STATUS_EVENT_WAITUNTIL_REJECTED | 154 PUSH_DELIVERY_STATUS_LAST = PUSH_DELIVERY_STATUS_EVENT_WAITUNTIL_REJECTED |
119 }; | 155 }; |
120 | 156 |
121 // Push message user visible tracking for reporting in UMA. | 157 // Push message user visible tracking for reporting in UMA. |
122 enum PushUserVisibleStatus { | 158 enum PushUserVisibleStatus { |
123 // A notification was required and one (or more) were shown. | 159 // A notification was required and one (or more) were shown. |
124 PUSH_USER_VISIBLE_STATUS_REQUIRED_AND_SHOWN = 0, | 160 PUSH_USER_VISIBLE_STATUS_REQUIRED_AND_SHOWN = 0, |
125 | 161 |
126 // A notification was not required, but one (or more) were shown anyway. | 162 // A notification was not required, but one (or more) were shown anyway. |
127 PUSH_USER_VISIBLE_STATUS_NOT_REQUIRED_BUT_SHOWN = 1, | 163 PUSH_USER_VISIBLE_STATUS_NOT_REQUIRED_BUT_SHOWN = 1, |
128 | 164 |
129 // A notification was not required and none were shown. | 165 // A notification was not required and none were shown. |
130 PUSH_USER_VISIBLE_STATUS_NOT_REQUIRED_AND_NOT_SHOWN = 2, | 166 PUSH_USER_VISIBLE_STATUS_NOT_REQUIRED_AND_NOT_SHOWN = 2, |
131 | 167 |
132 // A notification was required, but none were shown. Fortunately, the site has | 168 // A notification was required, but none were shown. Fortunately, the site has |
133 // been well behaved recently so it was glossed over. | 169 // been well behaved recently so it was glossed over. |
134 PUSH_USER_VISIBLE_STATUS_REQUIRED_BUT_NOT_SHOWN_USED_GRACE = 3, | 170 PUSH_USER_VISIBLE_STATUS_REQUIRED_BUT_NOT_SHOWN_USED_GRACE = 3, |
135 | 171 |
136 // A notification was required, but none were shown. Unfortunately, the site | 172 // 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. | 173 // 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, | 174 PUSH_USER_VISIBLE_STATUS_REQUIRED_BUT_NOT_SHOWN_GRACE_EXCEEDED = 4, |
139 | 175 |
140 // NOTE: Do not renumber these as that would confuse interpretation of | 176 // NOTE: Do not renumber these as that would confuse interpretation of |
141 // previously logged data. When making changes, also update the enum list | 177 // previously logged data. When making changes, also update the enum list |
142 // in tools/metrics/histograms/histograms.xml to keep it in sync, and | 178 // in tools/metrics/histograms/histograms.xml to keep it in sync, and |
143 // update PUSH_USER_VISIBLE_STATUS_LAST below. | 179 // update PUSH_USER_VISIBLE_STATUS_LAST below. |
144 | 180 |
145 // Used for IPC message range checks. | |
146 PUSH_USER_VISIBLE_STATUS_LAST = | 181 PUSH_USER_VISIBLE_STATUS_LAST = |
147 PUSH_USER_VISIBLE_STATUS_REQUIRED_BUT_NOT_SHOWN_GRACE_EXCEEDED | 182 PUSH_USER_VISIBLE_STATUS_REQUIRED_BUT_NOT_SHOWN_GRACE_EXCEEDED |
148 }; | 183 }; |
149 | 184 |
150 const char* PushRegistrationStatusToString(PushRegistrationStatus status); | 185 const char* PushRegistrationStatusToString(PushRegistrationStatus status); |
151 | 186 |
187 const char* PushUnregistrationStatusToString(PushUnregistrationStatus status); | |
188 | |
152 } // namespace content | 189 } // namespace content |
153 | 190 |
154 #endif // CONTENT_PUBLIC_COMMON_PUSH_MESSAGING_STATUS_H_ | 191 #endif // CONTENT_PUBLIC_COMMON_PUSH_MESSAGING_STATUS_H_ |
OLD | NEW |