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

Unified Diff: third_party/WebKit/Source/platform/mojo/FetchAPIRequestStructTraits.h

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: third_party/WebKit/Source/platform/mojo/FetchAPIRequestStructTraits.h
diff --git a/third_party/WebKit/Source/platform/mojo/FetchAPIRequestStructTraits.h b/third_party/WebKit/Source/platform/mojo/FetchAPIRequestStructTraits.h
new file mode 100644
index 0000000000000000000000000000000000000000..1e723146b9e006db1b2a6d83a9a09e0b8ddc47ac
--- /dev/null
+++ b/third_party/WebKit/Source/platform/mojo/FetchAPIRequestStructTraits.h
@@ -0,0 +1,137 @@
+// Copyright 2017 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 FetchAPIRequestStructTraits_h
+#define FetchAPIRequestStructTraits_h
+
+#include "public/platform/WebURLRequest.h"
+#include "public/platform/modules/fetch/request.mojom-blink.h"
+#include "wtf/text/WTFString.h"
+
+namespace blink {
+class KURL;
+}
+
+namespace mojo {
+
+template <>
+struct EnumTraits<blink::mojom::FetchCredentialsMode,
+ blink::WebURLRequest::FetchCredentialsMode> {
+ static blink::mojom::FetchCredentialsMode ToMojom(
+ blink::WebURLRequest::FetchCredentialsMode input);
+
+ static bool FromMojom(blink::mojom::FetchCredentialsMode input,
+ blink::WebURLRequest::FetchCredentialsMode* out);
+};
+
+template <>
+struct EnumTraits<blink::mojom::FetchRedirectMode,
+ blink::WebURLRequest::FetchRedirectMode> {
+ static blink::mojom::FetchRedirectMode ToMojom(
+ blink::WebURLRequest::FetchRedirectMode input);
+
+ static bool FromMojom(blink::mojom::FetchRedirectMode input,
+ blink::WebURLRequest::FetchRedirectMode* out);
+};
+
+template <>
+struct EnumTraits<blink::mojom::FetchRequestMode,
+ blink::WebURLRequest::FetchRequestMode> {
+ static blink::mojom::FetchRequestMode ToMojom(
+ blink::WebURLRequest::FetchRequestMode input);
+
+ static bool FromMojom(blink::mojom::FetchRequestMode input,
+ blink::WebURLRequest::FetchRequestMode* out);
+};
+
+template <>
+struct EnumTraits<blink::mojom::RequestContextFrameType,
+ blink::WebURLRequest::FrameType> {
+ static blink::mojom::RequestContextFrameType ToMojom(
+ blink::WebURLRequest::FrameType input);
+
+ static bool FromMojom(blink::mojom::RequestContextFrameType input,
+ blink::WebURLRequest::FrameType* out);
+};
+
+template <>
+struct EnumTraits<blink::mojom::RequestContextType,
+ blink::WebURLRequest::RequestContext> {
+ static blink::mojom::RequestContextType ToMojom(
+ blink::WebURLRequest::RequestContext input);
+
+ static bool FromMojom(blink::mojom::RequestContextType input,
+ blink::WebURLRequest::RequestContext* out);
+};
+
+template <>
+struct StructTraits<blink::mojom::FetchAPIRequestDataView,
+ blink::WebServiceWorkerRequest> {
+ static void* SetUpContext(const blink::WebServiceWorkerRequest&);
+ static void TearDownContext(const blink::WebServiceWorkerRequest&,
+ void* context);
+
+ static blink::WebURLRequest::FetchRequestMode mode(
+ const blink::WebServiceWorkerRequest& request) {
+ return request.mode();
+ }
+
+ static bool is_main_resource_load(
+ const blink::WebServiceWorkerRequest& request) {
+ return request.isMainResourceLoad();
+ }
+
+ static blink::WebURLRequest::RequestContext request_context_type(
+ const blink::WebServiceWorkerRequest& request) {
+ return request.requestContext();
+ }
+
+ static blink::WebURLRequest::FrameType frame_type(
+ const blink::WebServiceWorkerRequest& request) {
+ return request.frameType();
+ }
+
+ static blink::KURL url(const blink::WebServiceWorkerRequest&);
+
+ static WTF::String method(const blink::WebServiceWorkerRequest&);
+
+ static const WTF::HashMap<WTF::String, WTF::String>& headers(
+ const blink::WebServiceWorkerRequest&,
+ void* context);
+
+ static WTF::String blob_uuid(const blink::WebServiceWorkerRequest&);
+
+ static uint64_t blob_size(const blink::WebServiceWorkerRequest&);
+
+ static const blink::Referrer& referrer(const blink::WebServiceWorkerRequest&);
+
+ static blink::WebURLRequest::FetchCredentialsMode credentials_mode(
+ const blink::WebServiceWorkerRequest& request) {
+ return request.credentialsMode();
+ }
+
+ static blink::WebURLRequest::FetchRedirectMode redirect_mode(
+ const blink::WebServiceWorkerRequest& request) {
+ return request.redirectMode();
+ }
+
+ static WTF::String client_id(const blink::WebServiceWorkerRequest&);
+
+ static bool is_reload(const blink::WebServiceWorkerRequest& request) {
+ return request.isReload();
+ }
+
+ // The |fetch_type| is not used by Blink yet.
+ static blink::mojom::blink::ServiceWorkerFetchType fetch_type(
+ const blink::WebServiceWorkerRequest& request) {
+ return blink::mojom::blink::ServiceWorkerFetchType::FETCH;
+ }
+
+ static bool Read(blink::mojom::FetchAPIRequestDataView,
+ blink::WebServiceWorkerRequest* output);
+};
+
+} // namespace mojo
+
+#endif // FetchAPIRequestStructTraits_h

Powered by Google App Engine
This is Rietveld 408576698