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

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

Issue 2379993003: Mojo C++ bindings: make String16 and gfx::Size available in Blink (Closed)
Patch Set: addressed esprehn and rockot's comments Created 4 years, 2 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/WebGeometryStructTraits.h
diff --git a/third_party/WebKit/Source/platform/mojo/WebGeometryStructTraits.h b/third_party/WebKit/Source/platform/mojo/WebGeometryStructTraits.h
new file mode 100644
index 0000000000000000000000000000000000000000..70a8f4230bdc461d3a14af970c94ec34ac169e89
--- /dev/null
+++ b/third_party/WebKit/Source/platform/mojo/WebGeometryStructTraits.h
@@ -0,0 +1,29 @@
+// 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 WebGeometryStructTraits_h
+#define WebGeometryStructTraits_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,
Ken Rockot(use gerrit already) 2016/10/04 18:20:29 nit: Probably should move this out-of-line.
Zhiqiang Zhang (Slow) 2016/10/04 20:06:22 Done.
+ ::blink::WebSize* out) {
+ if (data.width() < 0 || data.height() < 0)
+ return false;
+ out->width = data.width();
+ out->height = data.height();
+ return true;
+ }
+};
+
+} // namespace mojo
+
+#endif // WebGeometryStructTraits_h

Powered by Google App Engine
This is Rietveld 408576698