Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: content/public/common/push_messaging_status.h

Issue 2697793004: Push API: Validate storage before returning cached subscriptions (Closed)
Patch Set: Fix include Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 PUSH_REGISTRATION_STATUS_PUBLIC_KEY_UNAVAILABLE = 11, 54 PUSH_REGISTRATION_STATUS_PUBLIC_KEY_UNAVAILABLE = 11,
55 55
56 // Registration failed because the manifest could not be retrieved or was 56 // Registration failed because the manifest could not be retrieved or was
57 // empty. 57 // empty.
58 PUSH_REGISTRATION_STATUS_MANIFEST_EMPTY_OR_MISSING = 12, 58 PUSH_REGISTRATION_STATUS_MANIFEST_EMPTY_OR_MISSING = 12,
59 59
60 // Registration failed because a subscription with a different sender id 60 // Registration failed because a subscription with a different sender id
61 // already exists. 61 // already exists.
62 PUSH_REGISTRATION_STATUS_SENDER_ID_MISMATCH = 13, 62 PUSH_REGISTRATION_STATUS_SENDER_ID_MISMATCH = 13,
63 63
64 // Registration failed because storage was corrupt. It will be retried
65 // automatically after unsubscribing to fix the corruption.
66 PUSH_REGISTRATION_STATUS_STORAGE_CORRUPT = 14,
67
64 // NOTE: Do not renumber these as that would confuse interpretation of 68 // NOTE: Do not renumber these as that would confuse interpretation of
65 // previously logged data. When making changes, also update the enum list 69 // previously logged data. When making changes, also update the enum list
66 // in tools/metrics/histograms/histograms.xml to keep it in sync, and 70 // in tools/metrics/histograms/histograms.xml to keep it in sync, and
67 // update PUSH_REGISTRATION_STATUS_LAST below. 71 // update PUSH_REGISTRATION_STATUS_LAST below.
68 72
69 PUSH_REGISTRATION_STATUS_LAST = PUSH_REGISTRATION_STATUS_SENDER_ID_MISMATCH 73 PUSH_REGISTRATION_STATUS_LAST = PUSH_REGISTRATION_STATUS_STORAGE_CORRUPT
70 }; 74 };
71 75
72 // Push unregistration reason for reporting in UMA. Enum values can be added, 76 // Push unregistration reason for reporting in UMA. Enum values can be added,
73 // but must never be renumbered or deleted and reused. 77 // but must never be renumbered or deleted and reused.
74 enum PushUnregistrationReason { 78 enum PushUnregistrationReason {
75 // Should never happen. 79 // Should never happen.
76 PUSH_UNREGISTRATION_REASON_UNKNOWN = 0, 80 PUSH_UNREGISTRATION_REASON_UNKNOWN = 0,
77 81
78 // Unregistering because the website called the unsubscribe API. 82 // Unregistering because the website called the unsubscribe API.
79 PUSH_UNREGISTRATION_REASON_JAVASCRIPT_API = 1, 83 PUSH_UNREGISTRATION_REASON_JAVASCRIPT_API = 1,
80 84
81 // Unregistering because the user manually revoked permission. 85 // Unregistering because the user manually revoked permission.
82 PUSH_UNREGISTRATION_REASON_PERMISSION_REVOKED = 2, 86 PUSH_UNREGISTRATION_REASON_PERMISSION_REVOKED = 2,
83 87
84 // Automatic - incoming message's app id was unknown. 88 // Automatic - incoming message's app id was unknown.
85 PUSH_UNREGISTRATION_REASON_DELIVERY_UNKNOWN_APP_ID = 3, 89 PUSH_UNREGISTRATION_REASON_DELIVERY_UNKNOWN_APP_ID = 3,
86 90
87 // Automatic - incoming message's origin no longer has permission. 91 // Automatic - incoming message's origin no longer has permission.
88 PUSH_UNREGISTRATION_REASON_DELIVERY_PERMISSION_DENIED = 4, 92 PUSH_UNREGISTRATION_REASON_DELIVERY_PERMISSION_DENIED = 4,
89 93
90 // Automatic - incoming message's service worker was not found. 94 // Automatic - incoming message's service worker was not found.
91 PUSH_UNREGISTRATION_REASON_DELIVERY_NO_SERVICE_WORKER = 5, 95 PUSH_UNREGISTRATION_REASON_DELIVERY_NO_SERVICE_WORKER = 5,
92 96
93 // Automatic - GCM Store reset due to corruption. 97 // Automatic - GCM Store reset due to corruption.
94 PUSH_UNREGISTRATION_REASON_GCM_STORE_RESET = 6, 98 PUSH_UNREGISTRATION_REASON_GCM_STORE_RESET = 6,
95 99
96 // Unregistering because the service worker was unregistered. 100 // Unregistering because the service worker was unregistered.
97 PUSH_UNREGISTRATION_REASON_SERVICE_WORKER_UNREGISTERED = 7, 101 PUSH_UNREGISTRATION_REASON_SERVICE_WORKER_UNREGISTERED = 7,
98 102
103 // Website called subscribe API and the stored subscription was corrupt, so
104 // it is being unsubscribed in order to attempt a clean subscription.
105 PUSH_UNREGISTRATION_REASON_SUBSCRIBE_STORAGE_CORRUPT = 8,
106
107 // Website called getSubscription API and the stored subscription was corrupt.
108 PUSH_UNREGISTRATION_REASON_GET_SUBSCRIPTION_STORAGE_CORRUPT = 9,
109
99 // NOTE: Do not renumber these as that would confuse interpretation of 110 // NOTE: Do not renumber these as that would confuse interpretation of
100 // previously logged data. When making changes, also update the enum list 111 // previously logged data. When making changes, also update the enum list
101 // in tools/metrics/histograms/histograms.xml to keep it in sync, and 112 // in tools/metrics/histograms/histograms.xml to keep it in sync, and
102 // update PUSH_UNREGISTRATION_REASON_LAST below. 113 // update PUSH_UNREGISTRATION_REASON_LAST below.
103 114
104 PUSH_UNREGISTRATION_REASON_LAST = 115 PUSH_UNREGISTRATION_REASON_LAST =
105 PUSH_UNREGISTRATION_REASON_SERVICE_WORKER_UNREGISTERED 116 PUSH_UNREGISTRATION_REASON_GET_SUBSCRIPTION_STORAGE_CORRUPT
106 }; 117 };
107 118
108 // Push unregistration success/error codes for internal use & reporting in UMA. 119 // Push unregistration success/error codes for internal use & reporting in UMA.
109 // Enum values can be added, but must never be renumbered or deleted and reused. 120 // Enum values can be added, but must never be renumbered or deleted and reused.
110 enum PushUnregistrationStatus { 121 enum PushUnregistrationStatus {
111 // The unregistration was successful. 122 // The unregistration was successful.
112 PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTERED = 0, 123 PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTERED = 0,
113 124
114 // Unregistration was unnecessary, as the registration was not found. 125 // Unregistration was unnecessary, as the registration was not found.
115 PUSH_UNREGISTRATION_STATUS_SUCCESS_WAS_NOT_REGISTERED = 1, 126 PUSH_UNREGISTRATION_STATUS_SUCCESS_WAS_NOT_REGISTERED = 1,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 // Getting the registration failed because we failed to read from storage. 165 // Getting the registration failed because we failed to read from storage.
155 PUSH_GETREGISTRATION_STATUS_STORAGE_ERROR = 2, 166 PUSH_GETREGISTRATION_STATUS_STORAGE_ERROR = 2,
156 167
157 // Getting the registration failed because there is no push registration. 168 // Getting the registration failed because there is no push registration.
158 PUSH_GETREGISTRATION_STATUS_REGISTRATION_NOT_FOUND = 3, 169 PUSH_GETREGISTRATION_STATUS_REGISTRATION_NOT_FOUND = 3,
159 170
160 // Getting the registration failed because the push service isn't available in 171 // Getting the registration failed because the push service isn't available in
161 // incognito, but we tell JS registration not found to not reveal incognito. 172 // incognito, but we tell JS registration not found to not reveal incognito.
162 PUSH_GETREGISTRATION_STATUS_INCOGNITO_REGISTRATION_NOT_FOUND = 4, 173 PUSH_GETREGISTRATION_STATUS_INCOGNITO_REGISTRATION_NOT_FOUND = 4,
163 174
164 // Registration failed because the public key could not be retrieved. 175 // Getting the registration failed because public key could not be retrieved.
165 PUSH_GETREGISTRATION_STATUS_PUBLIC_KEY_UNAVAILABLE = 5, 176 // PUSH_GETREGISTRATION_STATUS_PUBLIC_KEY_UNAVAILABLE = 5,
177
178 // Getting the registration failed because storage was corrupt.
179 PUSH_GETREGISTRATION_STATUS_STORAGE_CORRUPT = 6,
166 180
167 // NOTE: Do not renumber these as that would confuse interpretation of 181 // NOTE: Do not renumber these as that would confuse interpretation of
168 // previously logged data. When making changes, also update the enum list 182 // previously logged data. When making changes, also update the enum list
169 // in tools/metrics/histograms/histograms.xml to keep it in sync, and 183 // in tools/metrics/histograms/histograms.xml to keep it in sync, and
170 // update PUSH_GETREGISTRATION_STATUS_LAST below. 184 // update PUSH_GETREGISTRATION_STATUS_LAST below.
171 185
172 PUSH_GETREGISTRATION_STATUS_LAST = 186 PUSH_GETREGISTRATION_STATUS_LAST = PUSH_GETREGISTRATION_STATUS_STORAGE_CORRUPT
173 PUSH_GETREGISTRATION_STATUS_PUBLIC_KEY_UNAVAILABLE
174 }; 187 };
175 188
176 // Push message event success/error codes for internal use & reporting in UMA. 189 // Push message event success/error codes for internal use & reporting in UMA.
177 // Enum values can be added, but must never be renumbered or deleted and reused. 190 // Enum values can be added, but must never be renumbered or deleted and reused.
178 enum PushDeliveryStatus { 191 enum PushDeliveryStatus {
179 // The message was successfully delivered. 192 // The message was successfully delivered.
180 PUSH_DELIVERY_STATUS_SUCCESS = 0, 193 PUSH_DELIVERY_STATUS_SUCCESS = 0,
181 194
182 // The message could not be delivered because the app id was unknown. 195 // The message could not be delivered because the app id was unknown.
183 PUSH_DELIVERY_STATUS_UNKNOWN_APP_ID = 2, 196 PUSH_DELIVERY_STATUS_UNKNOWN_APP_ID = 2,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 PUSH_USER_VISIBLE_STATUS_REQUIRED_BUT_NOT_SHOWN_GRACE_EXCEEDED 248 PUSH_USER_VISIBLE_STATUS_REQUIRED_BUT_NOT_SHOWN_GRACE_EXCEEDED
236 }; 249 };
237 250
238 const char* PushRegistrationStatusToString(PushRegistrationStatus status); 251 const char* PushRegistrationStatusToString(PushRegistrationStatus status);
239 252
240 const char* PushUnregistrationStatusToString(PushUnregistrationStatus status); 253 const char* PushUnregistrationStatusToString(PushUnregistrationStatus status);
241 254
242 } // namespace content 255 } // namespace content
243 256
244 #endif // CONTENT_PUBLIC_COMMON_PUSH_MESSAGING_STATUS_H_ 257 #endif // CONTENT_PUBLIC_COMMON_PUSH_MESSAGING_STATUS_H_
OLDNEW
« no previous file with comments | « content/public/browser/push_messaging_service.h ('k') | content/public/common/push_messaging_status.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698