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

Unified Diff: content/common/service_worker/service_worker_event_status_struct_traits.h

Issue 2168513004: [DO NOT COMMIT] ServiceWorker: First touch of mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove an unnecessary file Created 4 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_event_status_struct_traits.h
diff --git a/content/common/service_worker/service_worker_event_status_struct_traits.h b/content/common/service_worker/service_worker_event_status_struct_traits.h
new file mode 100644
index 0000000000000000000000000000000000000000..42023f8ba6bf170fbe820db3c8cc934ebd7ffd95
--- /dev/null
+++ b/content/common/service_worker/service_worker_event_status_struct_traits.h
@@ -0,0 +1,42 @@
+// 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.
+
+#ifndef CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_EVENT_STATUS_STRUCT_TRAITS_H_
+#define CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_EVENT_STATUS_STRUCT_TRAITS_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 {
+
+template <>
+struct CONTENT_EXPORT EnumTraits<blink::mojom::ServiceWorkerEventStatus, content::ServiceWorkerStatusCode> {
+
+ static blink::mojom::ServiceWorkerEventStatus ToMojom(content::ServiceWorkerStatusCode input) {
+ NOTIMPLEMENTED();
+ return blink::mojom::ServiceWorkerEventStatus::ABORTED;
+ }
+
+ static bool FromMojom(blink::mojom::ServiceWorkerEventStatus input, content::ServiceWorkerStatusCode* output) {
+ switch (input) {
+ case blink::mojom::ServiceWorkerEventStatus::COMPLETED:
+ *output = content::SERVICE_WORKER_OK;
+ return true;
+ case blink::mojom::ServiceWorkerEventStatus::REJECTED:
+ *output = content::SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED;
+ return true;
+ case blink::mojom::ServiceWorkerEventStatus::ABORTED:
+ *output = content::SERVICE_WORKER_ERROR_ABORT;
+ return true;
+ }
+ // We received an unexpected value back. This can theoretically happen as
+ // mojo doesn't validate enum values.
+ *output = content::SERVICE_WORKER_ERROR_IPC_FAILED;
+ return false;
+ }
+};
+
+} // namespace mojo
+
+#endif // CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_EVENT_STATUS_STRUCT_TRAITS_H_

Powered by Google App Engine
This is Rietveld 408576698