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

Unified Diff: third_party/WebKit/public/platform/ReferrerPolicyEnumTraits.h

Issue 2363573002: Move ViewHostMsg_CreateWindow to mojom (Closed)
Patch Set: . Created 4 years, 3 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/public/platform/ReferrerPolicyEnumTraits.h
diff --git a/third_party/WebKit/public/platform/ReferrerPolicyEnumTraits.h b/third_party/WebKit/public/platform/ReferrerPolicyEnumTraits.h
new file mode 100644
index 0000000000000000000000000000000000000000..5b0327072a573247f8cd2dbadf5495fe9fdc5e7a
--- /dev/null
+++ b/third_party/WebKit/public/platform/ReferrerPolicyEnumTraits.h
@@ -0,0 +1,73 @@
+// 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.
+
+#ifndef ReferrerPolicyEnumTraits_h
+#define ReferrerPolicyEnumTraits_h
+
+#include "base/logging.h"
+#include "mojo/public/cpp/bindings/enum_traits.h"
+#include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
+#include "third_party/WebKit/public/platform/referrer.mojom-shared.h"
+
+namespace mojo {
+
+template <>
+struct EnumTraits<::blink::mojom::ReferrerPolicy, ::blink::WebReferrerPolicy> {
dcheng 2016/09/27 23:09:42 Is it possible to place this in namespace blink an
Ken Rockot(use gerrit already) 2016/09/28 00:20:05 I'm not sure I understand what you mean. Do you me
dcheng 2016/09/28 00:30:51 Sorry, to clarify, can we do: namespace blink {
Ken Rockot(use gerrit already) 2016/09/28 01:15:24 As discussed off thread, this is a no-go since ADL
+ static ::blink::mojom::ReferrerPolicy ToMojom(::blink::WebReferrerPolicy policy)
+ {
+ switch (policy) {
+ case ::blink::WebReferrerPolicyAlways:
+ return ::blink::mojom::ReferrerPolicy::ALWAYS;
+ case ::blink::WebReferrerPolicyDefault:
+ return ::blink::mojom::ReferrerPolicy::DEFAULT;
+ case ::blink::WebReferrerPolicyNoReferrerWhenDowngrade:
+ return ::blink::mojom::ReferrerPolicy::NO_REFERRER_WHEN_DOWNGRADE;
+ case ::blink::WebReferrerPolicyNever:
+ return ::blink::mojom::ReferrerPolicy::NEVER;
+ case ::blink::WebReferrerPolicyOrigin:
+ return ::blink::mojom::ReferrerPolicy::ORIGIN;
+ case ::blink::WebReferrerPolicyOriginWhenCrossOrigin:
+ return ::blink::mojom::ReferrerPolicy::ORIGIN_WHEN_CROSS_ORIGIN;
+ case ::blink::WebReferrerPolicyNoReferrerWhenDowngradeOriginWhenCrossOrigin:
+ return ::blink::mojom::ReferrerPolicy::NO_REFERRER_WHEN_DOWNGRADE_ORIGIN_WHEN_CROSS_ORIGIN;
+ default:
+ NOTREACHED();
+ return ::blink::mojom::ReferrerPolicy::DEFAULT;
+ }
+ }
+
+ static bool FromMojom(::blink::mojom::ReferrerPolicy policy, ::blink::WebReferrerPolicy* out)
+ {
+ switch (policy) {
+ case ::blink::mojom::ReferrerPolicy::ALWAYS:
+ *out = ::blink::WebReferrerPolicyAlways;
+ return true;
+ case ::blink::mojom::ReferrerPolicy::DEFAULT:
+ *out = ::blink::WebReferrerPolicyDefault;
+ return true;
+ case ::blink::mojom::ReferrerPolicy::NO_REFERRER_WHEN_DOWNGRADE:
+ *out = ::blink::WebReferrerPolicyNoReferrerWhenDowngrade;
+ return true;
+ case ::blink::mojom::ReferrerPolicy::NEVER:
+ *out = ::blink::WebReferrerPolicyNever;
+ return true;
+ case ::blink::mojom::ReferrerPolicy::ORIGIN:
+ *out = ::blink::WebReferrerPolicyOrigin;
+ return true;
+ case ::blink::mojom::ReferrerPolicy::ORIGIN_WHEN_CROSS_ORIGIN:
+ *out = ::blink::WebReferrerPolicyOriginWhenCrossOrigin;
+ return true;
+ case ::blink::mojom::ReferrerPolicy::NO_REFERRER_WHEN_DOWNGRADE_ORIGIN_WHEN_CROSS_ORIGIN:
+ *out = ::blink::WebReferrerPolicyNoReferrerWhenDowngradeOriginWhenCrossOrigin;
+ return true;
+ default:
+ NOTREACHED();
+ return false;
+ }
+ }
+};
+
+} // namespace mojo
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698