Index: third_party/WebKit/Source/platform/mojo/ReferrerStructTraits.h |
diff --git a/third_party/WebKit/Source/platform/mojo/ReferrerStructTraits.h b/third_party/WebKit/Source/platform/mojo/ReferrerStructTraits.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b283e9d718bc81319c221f750b166b8f723284f6 |
--- /dev/null |
+++ b/third_party/WebKit/Source/platform/mojo/ReferrerStructTraits.h |
@@ -0,0 +1,36 @@ |
+// 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 ReferrerStructTraits_h |
+#define ReferrerStructTraits_h |
+ |
+#include "platform/weborigin/Referrer.h" |
+#include "platform/weborigin/ReferrerPolicy.h" |
+#include "public/platform/WebReferrerPolicy.h" |
+#include "wtf/Assertions.h" |
+ |
+namespace mojo { |
+ |
+template <> |
+struct StructTraits<blink::mojom::ReferrerDataView, blink::Referrer> { |
+ static blink::KURL url(const blink::Referrer& referrer) { |
+ if (referrer.referrer == blink::Referrer::noReferrer()) |
+ return blink::KURL(); |
+ |
+ return blink::KURL(blink::KURL(), referrer.referrer); |
+ } |
+ |
+ // Equality of values is asserted in //Source/web/AssertMatchingEnums.cpp. |
+ static blink::WebReferrerPolicy policy(const blink::Referrer& referrer) { |
+ return static_cast<blink::WebReferrerPolicy>(referrer.referrerPolicy); |
+ } |
+ |
+ static bool Read(blink::mojom::ReferrerDataView, blink::Referrer* output) { |
+ return true; |
dcheng
2017/03/24 05:27:48
Is this empty because we expect to never deseriali
Peter Beverloo
2017/03/24 18:48:42
No, because it was after 9PM and I needed to get h
|
+ } |
+}; |
+ |
+} // namespace mojo |
+ |
+#endif // ReferrerStructTraits_h |