Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / content / public / common / push_messaging_status.cc
bloba0aa99eaa4668fbeb21db4fc4d5b09049b2f7dee
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
3 // found in the LICENSE file.
5 #include "content/public/common/push_messaging_status.h"
7 #include "base/logging.h"
9 namespace content {
11 const char* PushRegistrationStatusToString(PushRegistrationStatus status) {
12 switch (status) {
13 case PUSH_REGISTRATION_STATUS_SUCCESS_FROM_PUSH_SERVICE:
14 return "Registration successful - from push service";
16 case PUSH_REGISTRATION_STATUS_NO_SERVICE_WORKER:
17 return "Registration failed - no Service Worker";
19 case PUSH_REGISTRATION_STATUS_SERVICE_NOT_AVAILABLE:
20 return "Registration failed - push service not available";
22 case PUSH_REGISTRATION_STATUS_LIMIT_REACHED:
23 return "Registration failed - registration limit has been reached";
25 case PUSH_REGISTRATION_STATUS_PERMISSION_DENIED:
26 return "Registration failed - permission denied";
28 case PUSH_REGISTRATION_STATUS_SERVICE_ERROR:
29 return "Registration failed - push service error";
31 case PUSH_REGISTRATION_STATUS_NO_SENDER_ID:
32 return "Registration failed - no sender id provided";
34 case PUSH_REGISTRATION_STATUS_STORAGE_ERROR:
35 return "Registration failed - storage error";
37 case PUSH_REGISTRATION_STATUS_SUCCESS_FROM_CACHE:
38 return "Registration successful - from cache";
40 case PUSH_REGISTRATION_STATUS_NETWORK_ERROR:
41 return "Registration failed - could not connect to push server";
43 case PUSH_REGISTRATION_STATUS_INCOGNITO_PERMISSION_DENIED:
44 // We split this out for UMA, but it must be indistinguishable to JS.
45 return PushRegistrationStatusToString(
46 PUSH_REGISTRATION_STATUS_PERMISSION_DENIED);
48 case PUSH_REGISTRATION_STATUS_PUBLIC_KEY_UNAVAILABLE:
49 return "Registration failed - could not retrieve the public key";
51 NOTREACHED();
52 return "";
55 const char* PushUnregistrationStatusToString(PushUnregistrationStatus status) {
56 switch (status) {
57 case PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTERED:
58 return "Unregistration successful - from push service";
60 case PUSH_UNREGISTRATION_STATUS_SUCCESS_WAS_NOT_REGISTERED:
61 return "Unregistration successful - was not registered";
63 case PUSH_UNREGISTRATION_STATUS_PENDING_NETWORK_ERROR:
64 return "Unregistration pending - a network error occurred, but it will "
65 "be retried until it succeeds";
67 case PUSH_UNREGISTRATION_STATUS_NO_SERVICE_WORKER:
68 return "Unregistration failed - no Service Worker";
70 case PUSH_UNREGISTRATION_STATUS_SERVICE_NOT_AVAILABLE:
71 return "Unregistration failed - push service not available";
73 case PUSH_UNREGISTRATION_STATUS_PENDING_SERVICE_ERROR:
74 return "Unregistration pending - a push service error occurred, but it "
75 "will be retried until it succeeds";
77 case PUSH_UNREGISTRATION_STATUS_STORAGE_ERROR:
78 return "Unregistration failed - storage error";
80 case PUSH_UNREGISTRATION_STATUS_NETWORK_ERROR:
81 return "Unregistration failed - could not connect to push server";
83 NOTREACHED();
84 return "";
87 } // namespace content