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. 4 5 #include "content/public/common/push_messaging_status.h" 6 7 #include "base/logging.h" 8 9 namespace content { 10 11 const char* PushMessagingStatusToString(PushMessagingStatus status) { 12 switch (status) { 13 case PUSH_MESSAGING_STATUS_OK: 14 return "Operation has succeeded"; 15 16 case PUSH_MESSAGING_STATUS_REGISTRATION_FAILED_NO_SERVICE_WORKER: 17 return "Registration failed - no Service Worker"; 18 19 case PUSH_MESSAGING_STATUS_REGISTRATION_FAILED_SERVICE_NOT_AVAILABLE: 20 return "Registration failed - push service not available"; 21 22 case PUSH_MESSAGING_STATUS_REGISTRATION_FAILED_LIMIT_REACHED: 23 return "Registration failed - registration limit has been reached"; 24 25 case PUSH_MESSAGING_STATUS_REGISTRATION_FAILED_PERMISSION_DENIED: 26 return "Registration failed - permission denied"; 27 28 case PUSH_MESSAGING_STATUS_REGISTRATION_FAILED_SERVICE_ERROR: 29 return "Registration failed - push service error"; 30 31 case PUSH_MESSAGING_STATUS_MESSAGE_DELIVERY_FAILED_NO_SERVICE_WORKER: 32 return "Message delivery failed - no Service Worker"; 33 34 case PUSH_MESSAGING_STATUS_MESSAGE_DELIVERY_FAILED_SERVICE_WORKER_ERROR: 35 return "Message delivery failed - Service Worker error"; 36 37 case PUSH_MESSAGING_STATUS_ERROR: 38 return "Operation has failed (unspecified reason)"; 39 } 40 NOTREACHED(); 41 return ""; 42 } 43 44 } // namespace content 45