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

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

Issue 2367393002: Migrating MediaSession messages to mojo (Closed)
Patch Set: better type mapping (experimental, should move to a separate CL) 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/Source/platform/mojo/WebSizeStructTraits.h
diff --git a/third_party/WebKit/Source/platform/mojo/WebSizeStructTraits.h b/third_party/WebKit/Source/platform/mojo/WebSizeStructTraits.h
new file mode 100644
index 0000000000000000000000000000000000000000..a15dd63f62df780671fbc2365e4bce9bd91d41a0
--- /dev/null
+++ b/third_party/WebKit/Source/platform/mojo/WebSizeStructTraits.h
@@ -0,0 +1,28 @@
+// 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 WebSizeStructTraits_h
+#define WebSizeStructTraits_h
+
+#include "public/platform/WebSize.h"
+#include "ui/gfx/geometry/mojo/geometry.mojom-blink.h"
+
+namespace mojo {
+
+template <>
+struct StructTraits<gfx::mojom::blink::Size::DataView, ::blink::WebSize> {
+ static int width(const ::blink::WebSize& size) { return size.width; }
+ static int height(const ::blink::WebSize& size) { return size.height; }
+ static bool Read(gfx::mojom::blink::Size::DataView data, ::blink::WebSize* out) {
+ if (data.width() < 0 || data.height() < 0)
+ return false;
+ out->width = data.width();
+ out->height = data.height();
+ return true;
+ }
+};
+
+}
+
+#endif // WebSizeStructTraits_h

Powered by Google App Engine
This is Rietveld 408576698