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

Unified Diff: content/common/service_worker/service_worker_type_converters.cc

Issue 1220943003: [Background Sync] Use Mojo IPC to fire background sync events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mek
Patch Set: Rebase after cr/1221503003 landed Created 5 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
Index: content/common/service_worker/service_worker_type_converters.cc
diff --git a/content/common/service_worker/service_worker_type_converters.cc b/content/common/service_worker/service_worker_type_converters.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e3a8896a1f2167fdad970ec30545d3cd21d9df25
--- /dev/null
+++ b/content/common/service_worker/service_worker_type_converters.cc
@@ -0,0 +1,30 @@
+// Copyright 2015 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/common/service_worker/service_worker_type_converters.h"
+
+#include "base/logging.h"
+
+namespace mojo {
+
+// TODO(iclelland): Make these enums equivalent so that conversion can be a
+// static cast.
+content::ServiceWorkerStatusCode
+TypeConverter<content::ServiceWorkerStatusCode,
+ content::ServiceWorkerEventStatus>::
+ Convert(content::ServiceWorkerEventStatus status) {
+ content::ServiceWorkerStatusCode status_code = content::SERVICE_WORKER_OK;
Marijn Kruisselbrink 2015/07/17 17:12:15 Should the default really be SERVICE_WORKER_OK? It
iclelland 2015/07/20 16:06:16 Hence the NOTREACHED() further down -- the value h
+ if (status == content::SERVICE_WORKER_EVENT_STATUS_COMPLETED) {
+ status_code = content::SERVICE_WORKER_OK;
+ } else if (status == content::SERVICE_WORKER_EVENT_STATUS_REJECTED) {
+ status_code = content::SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED;
+ } else if (status == content::SERVICE_WORKER_EVENT_STATUS_ABORTED) {
+ status_code = content::SERVICE_WORKER_ERROR_ABORT;
+ } else {
+ NOTREACHED();
+ }
+ return status_code;
+}
+
+} // namespace

Powered by Google App Engine
This is Rietveld 408576698