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

Unified Diff: content/public/common/push_messaging_status.cc

Issue 366323002: Push API: use an enum to indicate status. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Tweak mock error message. Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/common/push_messaging_status.h ('k') | content/renderer/push_messaging_dispatcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/common/push_messaging_status.cc
diff --git a/content/public/common/push_messaging_status.cc b/content/public/common/push_messaging_status.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0040072bc0806e7ff883b298b2ca2a6ca8f894f3
--- /dev/null
+++ b/content/public/common/push_messaging_status.cc
@@ -0,0 +1,38 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/public/common/push_messaging_status.h"
+
+#include "base/logging.h"
+
+namespace content {
+
+const char* PushMessagingStatusToString(PushMessagingStatus status) {
+ switch (status) {
+ case PUSH_MESSAGING_STATUS_OK:
+ return "Operation has succeeded";
+
+ case PUSH_MESSAGING_STATUS_REGISTRATION_FAILED_NO_SERVICE_WORKER:
+ return "Registration failed - no Service Worker";
+
+ case PUSH_MESSAGING_STATUS_REGISTRATION_FAILED_SERVICE_NOT_AVAILABLE:
+ return "Registration failed - push service not available";
+
+ case PUSH_MESSAGING_STATUS_REGISTRATION_FAILED_LIMIT_REACHED:
+ return "Registration failed - registration limit has been reached";
+
+ case PUSH_MESSAGING_STATUS_REGISTRATION_FAILED_PERMISSION_DENIED:
+ return "Registration failed - permission denied";
+
+ case PUSH_MESSAGING_STATUS_REGISTRATION_FAILED_SERVICE_ERROR:
+ return "Registration failed - push service error";
+
+ case PUSH_MESSAGING_STATUS_ERROR:
+ return "Operation has failed (unspecified reason)";
+ }
+ NOTREACHED();
+ return "";
+}
+
+} // namespace content
« no previous file with comments | « content/public/common/push_messaging_status.h ('k') | content/renderer/push_messaging_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698