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

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

Issue 2352173004: Mojoify FetchEvent of Service Worker. (Closed)
Patch Set: incorporated dcheng's comment Created 4 years, 2 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/common/service_worker/service_worker_status_code_traits.h ('k') | content/common/typemaps.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/service_worker/service_worker_status_code_traits.cc
diff --git a/content/common/service_worker/service_worker_status_code_traits.cc b/content/common/service_worker/service_worker_status_code_traits.cc
new file mode 100644
index 0000000000000000000000000000000000000000..65f26ae52e9b4832acdf839cefa3d9982787d5d0
--- /dev/null
+++ b/content/common/service_worker/service_worker_status_code_traits.cc
@@ -0,0 +1,51 @@
+// Copyright 2016 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_status_code_traits.h"
+
+#include "base/logging.h"
+#include "content/common/service_worker/service_worker_status_code.h"
+#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_event_status.mojom.h"
+
+namespace mojo {
+
+// static
+blink::mojom::ServiceWorkerEventStatus EnumTraits<
+ blink::mojom::ServiceWorkerEventStatus,
+ content::ServiceWorkerStatusCode>::ToMojom(content::ServiceWorkerStatusCode
+ input) {
+ switch (input) {
+ case content::SERVICE_WORKER_OK:
+ return blink::mojom::ServiceWorkerEventStatus::COMPLETED;
+ case content::SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED:
+ return blink::mojom::ServiceWorkerEventStatus::REJECTED;
+ case content::SERVICE_WORKER_ERROR_ABORT:
+ return blink::mojom::ServiceWorkerEventStatus::ABORTED;
+ default:
+ NOTREACHED() << "Unexpected ServiceWorkerStatusCode: " << input;
+ return blink::mojom::ServiceWorkerEventStatus::ABORTED;
+ }
+}
+
+// static
+bool EnumTraits<blink::mojom::ServiceWorkerEventStatus,
+ content::ServiceWorkerStatusCode>::
+ FromMojom(blink::mojom::ServiceWorkerEventStatus input,
+ content::ServiceWorkerStatusCode* out) {
+ switch (input) {
+ case blink::mojom::ServiceWorkerEventStatus::COMPLETED:
+ *out = content::SERVICE_WORKER_OK;
+ return true;
+ case blink::mojom::ServiceWorkerEventStatus::REJECTED:
+ *out = content::SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED;
+ return true;
+ case blink::mojom::ServiceWorkerEventStatus::ABORTED:
+ *out = content::SERVICE_WORKER_ERROR_ABORT;
+ return true;
+ }
+ NOTREACHED();
+ return false;
+}
+
+} // namespace content
« no previous file with comments | « content/common/service_worker/service_worker_status_code_traits.h ('k') | content/common/typemaps.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698