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 // Registration was successful. | 12 // New successful registration (there was not yet a registration cached in |
13 PUSH_REGISTRATION_STATUS_SUCCESS = 0, | 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, |
14 | 19 |
15 // Registration failed because there is no Service Worker. | 20 // Registration failed because there is no Service Worker. |
16 PUSH_REGISTRATION_STATUS_NO_SERVICE_WORKER = 1, | 21 PUSH_REGISTRATION_STATUS_NO_SERVICE_WORKER = 1, |
17 | 22 |
18 // Registration failed because the push service is not available. | 23 // Registration failed because the push service is not available. |
19 PUSH_REGISTRATION_STATUS_SERVICE_NOT_AVAILABLE = 2, | 24 PUSH_REGISTRATION_STATUS_SERVICE_NOT_AVAILABLE = 2, |
20 | 25 |
21 // Registration failed because the maximum number of registratons has been | 26 // Registration failed because the maximum number of registratons has been |
22 // reached. | 27 // reached. |
23 PUSH_REGISTRATION_STATUS_LIMIT_REACHED = 3, | 28 PUSH_REGISTRATION_STATUS_LIMIT_REACHED = 3, |
24 | 29 |
25 // Registration failed because permission was denied. | 30 // Registration failed because permission was denied. |
26 PUSH_REGISTRATION_STATUS_PERMISSION_DENIED = 4, | 31 PUSH_REGISTRATION_STATUS_PERMISSION_DENIED = 4, |
27 | 32 |
28 // Registration failed in the push service implemented by the embedder. | 33 // Registration failed in the push service implemented by the embedder. |
29 PUSH_REGISTRATION_STATUS_SERVICE_ERROR = 5, | 34 PUSH_REGISTRATION_STATUS_SERVICE_ERROR = 5, |
30 | 35 |
31 // Registration failed because no sender id was provided by the page. | 36 // Registration failed because no sender id was provided by the page. |
32 PUSH_REGISTRATION_STATUS_NO_SENDER_ID = 6, | 37 PUSH_REGISTRATION_STATUS_NO_SENDER_ID = 6, |
33 | 38 |
34 // Registration succeeded, but we failed to persist it. | 39 // Registration succeeded, but we failed to persist it. |
35 PUSH_REGISTRATION_STATUS_STORAGE_ERROR = 7, | 40 PUSH_REGISTRATION_STATUS_STORAGE_ERROR = 7, |
36 | 41 |
| 42 // A successful registration was already cached in Service Worker storage. |
| 43 PUSH_REGISTRATION_STATUS_SUCCESS_FROM_CACHE = 8, |
| 44 |
37 // NOTE: Do not renumber these as that would confuse interpretation of | 45 // NOTE: Do not renumber these as that would confuse interpretation of |
38 // previously logged data. When making changes, also update the enum list | 46 // previously logged data. When making changes, also update the enum list |
39 // in tools/metrics/histograms/histograms.xml to keep it in sync, and | 47 // in tools/metrics/histograms/histograms.xml to keep it in sync, and |
40 // update PUSH_REGISTRATION_STATUS_LAST below. | 48 // update PUSH_REGISTRATION_STATUS_LAST below. |
41 | 49 |
42 // Used for IPC message range checks. | 50 // Used for IPC message range checks. |
43 PUSH_REGISTRATION_STATUS_LAST = PUSH_REGISTRATION_STATUS_STORAGE_ERROR | 51 PUSH_REGISTRATION_STATUS_LAST = PUSH_REGISTRATION_STATUS_SUCCESS_FROM_CACHE |
44 }; | 52 }; |
45 | 53 |
46 // Push message delivery success / error codes for internal use. | 54 // Push message delivery success / error codes for internal use. |
47 enum PushDeliveryStatus { | 55 enum PushDeliveryStatus { |
48 // The message was successfully delivered. | 56 // The message was successfully delivered. |
49 PUSH_DELIVERY_STATUS_SUCCESS, | 57 PUSH_DELIVERY_STATUS_SUCCESS, |
50 | 58 |
51 // The message could not be delivered because no service worker was found. | 59 // The message could not be delivered because no service worker was found. |
52 PUSH_DELIVERY_STATUS_NO_SERVICE_WORKER, | 60 PUSH_DELIVERY_STATUS_NO_SERVICE_WORKER, |
53 | 61 |
54 // The message could not be delivered because of a service worker error. | 62 // The message could not be delivered because of a service worker error. |
55 PUSH_DELIVERY_STATUS_SERVICE_WORKER_ERROR, | 63 PUSH_DELIVERY_STATUS_SERVICE_WORKER_ERROR, |
56 | 64 |
57 // The message was delivered, but the Service Worker passed a Promise to | 65 // The message was delivered, but the Service Worker passed a Promise to |
58 // event.waitUntil that got rejected. | 66 // event.waitUntil that got rejected. |
59 PUSH_DELIVERY_STATUS_EVENT_WAITUNTIL_REJECTED, | 67 PUSH_DELIVERY_STATUS_EVENT_WAITUNTIL_REJECTED, |
60 | 68 |
61 // When making changes, update PUSH_DELIVERY_STATUS_LAST below. | 69 // When making changes, update PUSH_DELIVERY_STATUS_LAST below. |
62 | 70 |
63 // Used for IPC message range checks. | 71 // Used for IPC message range checks. |
64 PUSH_DELIVERY_STATUS_LAST = PUSH_DELIVERY_STATUS_EVENT_WAITUNTIL_REJECTED | 72 PUSH_DELIVERY_STATUS_LAST = PUSH_DELIVERY_STATUS_EVENT_WAITUNTIL_REJECTED |
65 }; | 73 }; |
66 | 74 |
67 const char* PushRegistrationStatusToString(PushRegistrationStatus status); | 75 const char* PushRegistrationStatusToString(PushRegistrationStatus status); |
68 | 76 |
69 } // namespace content | 77 } // namespace content |
70 | 78 |
71 #endif // CONTENT_PUBLIC_COMMON_PUSH_MESSAGING_STATUS_H_ | 79 #endif // CONTENT_PUBLIC_COMMON_PUSH_MESSAGING_STATUS_H_ |
OLD | NEW |