OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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. |
| 4 |
| 5 #ifndef UI_DISPLAY_TYPES_MOJO_DISPLAY_MODE_MOJO_STRUCT_TRAITS_H_ |
| 6 #define UI_DISPLAY_TYPES_MOJO_DISPLAY_MODE_MOJO_STRUCT_TRAITS_H_ |
| 7 |
| 8 #include "ui/display/mojo/display_mode_mojo.h" |
| 9 #include "ui/display/mojo/display_mode_mojo.mojom.h" |
| 10 #include "ui/gfx/geometry/size.h" |
| 11 |
| 12 namespace mojo { |
| 13 |
| 14 template <> |
| 15 struct StructTraits<display::mojom::DisplayModeMojoDataView, |
| 16 display::DisplayModeMojo> { |
| 17 static const gfx::Size& size( |
| 18 const display::DisplayModeMojo& display_mode_mojo) { |
| 19 return display_mode_mojo.size(); |
| 20 } |
| 21 |
| 22 static bool is_interlaced(const display::DisplayModeMojo& display_mode_mojo) { |
| 23 return display_mode_mojo.is_interlaced(); |
| 24 } |
| 25 |
| 26 static float refresh_rate(const display::DisplayModeMojo& display_mode_mojo) { |
| 27 return display_mode_mojo.refresh_rate(); |
| 28 } |
| 29 |
| 30 static bool Read(display::mojom::DisplayModeMojoDataView data, |
| 31 display::DisplayModeMojo* out) { |
| 32 gfx::Size size; |
| 33 if (!data.ReadSize(&size)) |
| 34 return false; |
| 35 |
| 36 out->set_size(size); |
| 37 out->set_is_interlaced(data.is_interlaced()); |
| 38 out->set_refresh_rate(data.refresh_rate()); |
| 39 |
| 40 return true; |
| 41 } |
| 42 }; |
| 43 |
| 44 } // namespace mojo |
| 45 |
| 46 #endif // UI_DISPLAY_TYPES_MOJO_DISPLAY_MODE_MOJO_STRUCT_TRAITS_H_ |
OLD | NEW |