1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MOJO_EXAMPLES_PEPPER_CONTAINER_APP_TYPE_CONVERTERS_H_
6 #define MOJO_EXAMPLES_PEPPER_CONTAINER_APP_TYPE_CONVERTERS_H_
8 #include "mojo/public/cpp/bindings/type_converter.h"
9 #include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom.h"
10 #include "ppapi/c/pp_point.h"
11 #include "ppapi/c/pp_rect.h"
12 #include "ppapi/c/pp_size.h"
17 struct TypeConverter<PointPtr, PP_Point> {
18 static PointPtr Convert(const PP_Point& input) {
19 PointPtr point(Point::New());
27 struct TypeConverter<PP_Point, PointPtr> {
28 static PP_Point Convert(const PointPtr& input) {
30 return PP_MakePoint(0, 0);
31 return PP_MakePoint(static_cast<int32_t>(input->x),
32 static_cast<int32_t>(input->y));
37 struct TypeConverter<SizePtr, PP_Size> {
38 static SizePtr Convert(const PP_Size& input) {
39 SizePtr size(Size::New());
40 size->width = input.width;
41 size->height = input.height;
47 struct TypeConverter<PP_Size, SizePtr> {
48 static PP_Size Convert(const SizePtr& input) {
50 return PP_MakeSize(0, 0);
51 return PP_MakeSize(static_cast<int32_t>(input->width),
52 static_cast<int32_t>(input->height));
57 struct TypeConverter<RectPtr, PP_Rect> {
58 static RectPtr Convert(const PP_Rect& input) {
59 RectPtr rect(Rect::New());
60 rect->x = input.point.x;
61 rect->y = input.point.y;
62 rect->width = input.size.width;
63 rect->height = input.size.height;
69 struct TypeConverter<PP_Rect, SizePtr> {
70 static PP_Rect Convert(const SizePtr& input) {
72 return PP_MakeRectFromXYWH(0, 0, 0, 0);
73 return PP_MakeRectFromXYWH(0, 0, input->width, input->height);
79 #endif // MOJO_EXAMPLES_PEPPER_CONTAINER_APP_TYPE_CONVERTERS_H_