| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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 UI_DISPLAY_MOJO_DISPLAY_MODE_STRUCT_TRAITS_H_ | 5 #ifndef UI_DISPLAY_MOJO_DISPLAY_MODE_STRUCT_TRAITS_H_ |
| 6 #define UI_DISPLAY_MOJO_DISPLAY_MODE_STRUCT_TRAITS_H_ | 6 #define UI_DISPLAY_MOJO_DISPLAY_MODE_STRUCT_TRAITS_H_ |
| 7 | 7 |
| 8 #include "ui/display/types/display_mode.h" | 8 #include "ui/display/types/display_mode.h" |
| 9 #include "ui/display/mojo/display_mode.mojom.h" | 9 #include "ui/display/mojo/display_mode.mojom.h" |
| 10 #include "ui/gfx/geometry/size.h" | 10 #include "ui/gfx/geometry/size.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 const std::unique_ptr<display::DisplayMode>& display_mode) { | 23 const std::unique_ptr<display::DisplayMode>& display_mode) { |
| 24 return display_mode->is_interlaced(); | 24 return display_mode->is_interlaced(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 static float refresh_rate( | 27 static float refresh_rate( |
| 28 const std::unique_ptr<display::DisplayMode>& display_mode) { | 28 const std::unique_ptr<display::DisplayMode>& display_mode) { |
| 29 return display_mode->refresh_rate(); | 29 return display_mode->refresh_rate(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 static bool Read(display::mojom::DisplayModeDataView data, | 32 static bool Read(display::mojom::DisplayModeDataView data, |
| 33 std::unique_ptr<display::DisplayMode>* out) { | 33 std::unique_ptr<display::DisplayMode>* out); |
| 34 gfx::Size size; | |
| 35 if (!data.ReadSize(&size)) | |
| 36 return false; | |
| 37 *out = base::MakeUnique<display::DisplayMode>(size, data.is_interlaced(), | |
| 38 data.refresh_rate()); | |
| 39 return true; | |
| 40 } | |
| 41 }; | 34 }; |
| 42 | 35 |
| 43 } // namespace mojo | 36 } // namespace mojo |
| 44 | 37 |
| 45 #endif // UI_DISPLAY_MOJO_DISPLAY_MODE_STRUCT_TRAITS_H_ | 38 #endif // UI_DISPLAY_MOJO_DISPLAY_MODE_STRUCT_TRAITS_H_ |
| OLD | NEW |