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

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

Issue 778243002: Push API: Return cached registration if available. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@store2
Patch Set: Add test, refactor and rebase Created 6 years 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.
11 enum PushRegistrationStatus { 11 enum PushRegistrationStatus {
12 // Registration was successful. 12 // Registration was successful.
13 PUSH_REGISTRATION_STATUS_SUCCESS = 0, 13 PUSH_REGISTRATION_STATUS_SUCCESS = 0,
14 14
15 // A successful registration was already cached in Service Worker storage.
16 PUSH_REGISTRATION_STATUS_SUCCESS_FROM_CACHE = 1,
17
15 // Registration failed because there is no Service Worker. 18 // Registration failed because there is no Service Worker.
16 PUSH_REGISTRATION_STATUS_NO_SERVICE_WORKER = 1, 19 PUSH_REGISTRATION_STATUS_NO_SERVICE_WORKER = 2,
17 20
18 // Registration failed because the push service is not available. 21 // Registration failed because the push service is not available.
19 PUSH_REGISTRATION_STATUS_SERVICE_NOT_AVAILABLE = 2, 22 PUSH_REGISTRATION_STATUS_SERVICE_NOT_AVAILABLE = 3,
20 23
21 // Registration failed because the maximum number of registratons has been 24 // Registration failed because the maximum number of registratons has been
22 // reached. 25 // reached.
23 PUSH_REGISTRATION_STATUS_LIMIT_REACHED = 3, 26 PUSH_REGISTRATION_STATUS_LIMIT_REACHED = 4,
24 27
25 // Registration failed because permission was denied. 28 // Registration failed because permission was denied.
26 PUSH_REGISTRATION_STATUS_PERMISSION_DENIED = 4, 29 PUSH_REGISTRATION_STATUS_PERMISSION_DENIED = 5,
27 30
28 // Registration failed in the push service implemented by the embedder. 31 // Registration failed in the push service implemented by the embedder.
29 PUSH_REGISTRATION_STATUS_SERVICE_ERROR = 5, 32 PUSH_REGISTRATION_STATUS_SERVICE_ERROR = 6,
30 33
31 // Registration failed because no sender id was provided by the page. 34 // Registration failed because no sender id was provided by the page.
32 PUSH_REGISTRATION_STATUS_NO_SENDER_ID = 6, 35 PUSH_REGISTRATION_STATUS_NO_SENDER_ID = 7,
33 36
34 // Registration succeeded, but we failed to persist it. 37 // Registration succeeded, but we failed to persist it.
35 PUSH_REGISTRATION_STATUS_STORAGE_ERROR = 7, 38 PUSH_REGISTRATION_STATUS_STORAGE_ERROR = 8,
36 39
37 // NOTE: Do not renumber these as that would confuse interpretation of 40 // NOTE: Do not renumber these as that would confuse interpretation of
38 // previously logged data. When making changes, also update the enum list 41 // previously logged data. When making changes, also update the enum list
39 // in tools/metrics/histograms/histograms.xml to keep it in sync, and 42 // in tools/metrics/histograms/histograms.xml to keep it in sync, and
40 // update PUSH_REGISTRATION_STATUS_LAST below. 43 // update PUSH_REGISTRATION_STATUS_LAST below.
41 44
42 // Used for IPC message range checks. 45 // Used for IPC message range checks.
43 PUSH_REGISTRATION_STATUS_LAST = PUSH_REGISTRATION_STATUS_STORAGE_ERROR 46 PUSH_REGISTRATION_STATUS_LAST = PUSH_REGISTRATION_STATUS_STORAGE_ERROR
44 }; 47 };
45 48
(...skipping 16 matching lines...) Expand all
62 65
63 // Used for IPC message range checks. 66 // Used for IPC message range checks.
64 PUSH_DELIVERY_STATUS_LAST = PUSH_DELIVERY_STATUS_EVENT_WAITUNTIL_REJECTED 67 PUSH_DELIVERY_STATUS_LAST = PUSH_DELIVERY_STATUS_EVENT_WAITUNTIL_REJECTED
65 }; 68 };
66 69
67 const char* PushRegistrationStatusToString(PushRegistrationStatus status); 70 const char* PushRegistrationStatusToString(PushRegistrationStatus status);
68 71
69 } // namespace content 72 } // namespace content
70 73
71 #endif // CONTENT_PUBLIC_COMMON_PUSH_MESSAGING_STATUS_H_ 74 #endif // CONTENT_PUBLIC_COMMON_PUSH_MESSAGING_STATUS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698