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

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

Issue 2762303002: Enable transmitting Fetch Requests over Mojo (Closed)
Patch Set: rebase Created 3 years, 9 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_types_struct_traits.cc
diff --git a/content/common/service_worker/service_worker_types_struct_traits.cc b/content/common/service_worker/service_worker_types_struct_traits.cc
index f88acbca35f1a491fca0542490316c04a3193143..3e40fd520d424eb7b8c1fe0d1cc4f52635ea2888 100644
--- a/content/common/service_worker/service_worker_types_struct_traits.cc
+++ b/content/common/service_worker/service_worker_types_struct_traits.cc
@@ -4,21 +4,55 @@
#include "content/common/service_worker/service_worker_types_struct_traits.h"
+#include "base/logging.h"
+
namespace mojo {
-content::mojom::ServiceWorkerProviderType
-EnumTraits<content::mojom::ServiceWorkerProviderType,
- content::ServiceWorkerProviderType>::
+using content::mojom::ServiceWorkerProviderType;
+
+ServiceWorkerProviderType
+EnumTraits<ServiceWorkerProviderType, content::ServiceWorkerProviderType>::
ToMojom(content::ServiceWorkerProviderType input) {
- return static_cast<content::mojom::ServiceWorkerProviderType>(input);
+ switch (input) {
+ case content::SERVICE_WORKER_PROVIDER_UNKNOWN:
+ return ServiceWorkerProviderType::SERVICE_WORKER_PROVIDER_UNKNOWN;
+ case content::SERVICE_WORKER_PROVIDER_FOR_WINDOW:
+ return ServiceWorkerProviderType::SERVICE_WORKER_PROVIDER_FOR_WINDOW;
+ case content::SERVICE_WORKER_PROVIDER_FOR_WORKER:
+ return ServiceWorkerProviderType::SERVICE_WORKER_PROVIDER_FOR_WORKER;
+ case content::SERVICE_WORKER_PROVIDER_FOR_SHARED_WORKER:
+ return ServiceWorkerProviderType::
+ SERVICE_WORKER_PROVIDER_FOR_SHARED_WORKER;
+ case content::SERVICE_WORKER_PROVIDER_FOR_CONTROLLER:
+ return ServiceWorkerProviderType::SERVICE_WORKER_PROVIDER_FOR_CONTROLLER;
+ }
+
+ NOTREACHED();
+ return ServiceWorkerProviderType::SERVICE_WORKER_PROVIDER_UNKNOWN;
}
-bool EnumTraits<content::mojom::ServiceWorkerProviderType,
- content::ServiceWorkerProviderType>::
- FromMojom(content::mojom::ServiceWorkerProviderType input,
+bool EnumTraits<ServiceWorkerProviderType, content::ServiceWorkerProviderType>::
+ FromMojom(ServiceWorkerProviderType input,
content::ServiceWorkerProviderType* out) {
- *out = static_cast<content::ServiceWorkerProviderType>(input);
- return true;
+ switch (input) {
+ case ServiceWorkerProviderType::SERVICE_WORKER_PROVIDER_UNKNOWN:
+ *out = content::SERVICE_WORKER_PROVIDER_UNKNOWN;
+ return true;
+ case ServiceWorkerProviderType::SERVICE_WORKER_PROVIDER_FOR_WINDOW:
+ *out = content::SERVICE_WORKER_PROVIDER_FOR_WINDOW;
+ return true;
+ case ServiceWorkerProviderType::SERVICE_WORKER_PROVIDER_FOR_WORKER:
+ *out = content::SERVICE_WORKER_PROVIDER_FOR_WORKER;
+ return true;
+ case ServiceWorkerProviderType::SERVICE_WORKER_PROVIDER_FOR_SHARED_WORKER:
+ *out = content::SERVICE_WORKER_PROVIDER_FOR_SHARED_WORKER;
+ return true;
+ case ServiceWorkerProviderType::SERVICE_WORKER_PROVIDER_FOR_CONTROLLER:
+ *out = content::SERVICE_WORKER_PROVIDER_FOR_CONTROLLER;
+ return true;
+ }
+
+ return false;
}
} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698