OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_ARC_COMMON_APP_STRUCT_TRAITS_H_ | 5 #ifndef COMPONENTS_ARC_COMMON_APP_STRUCT_TRAITS_H_ |
6 #define COMPONENTS_ARC_COMMON_APP_STRUCT_TRAITS_H_ | 6 #define COMPONENTS_ARC_COMMON_APP_STRUCT_TRAITS_H_ |
7 | 7 |
8 #include "components/arc/common/app.mojom.h" | 8 #include "components/arc/common/app.mojom.h" |
9 #include "ui/gfx/geometry/rect.h" | 9 #include "ui/gfx/geometry/rect.h" |
10 | 10 |
11 namespace mojo { | 11 namespace mojo { |
12 | 12 |
13 template <> | 13 template <> |
14 struct StructTraits<arc::mojom::ScreenRect, gfx::Rect> { | 14 struct StructTraits<arc::mojom::ScreenRectDataView, gfx::Rect> { |
15 static int32_t left(const gfx::Rect& p) { return p.x(); } | 15 static int32_t left(const gfx::Rect& p) { return p.x(); } |
16 static int32_t top(const gfx::Rect& p) { return p.y(); } | 16 static int32_t top(const gfx::Rect& p) { return p.y(); } |
17 static int32_t right(const gfx::Rect& p) { return p.right(); } | 17 static int32_t right(const gfx::Rect& p) { return p.right(); } |
18 static int32_t bottom(const gfx::Rect& p) { return p.bottom(); } | 18 static int32_t bottom(const gfx::Rect& p) { return p.bottom(); } |
19 static bool Read(arc::mojom::ScreenRectDataView data, gfx::Rect* out); | 19 static bool Read(arc::mojom::ScreenRectDataView data, gfx::Rect* out); |
20 }; | 20 }; |
21 | 21 |
22 } // namespace mojo | 22 } // namespace mojo |
23 | 23 |
24 #endif // COMPONENTS_ARC_COMMON_APP_STRUCT_TRAITS_H_ | 24 #endif // COMPONENTS_ARC_COMMON_APP_STRUCT_TRAITS_H_ |
OLD | NEW |