Chromium Code Reviews| 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_MOJO_DISPLAY_SNAPSHOT_MOJO_STRUCT_TRAITS_H_ | |
| 6 #define UI_DISPLAY_MOJO_DISPLAY_SNAPSHOT_MOJO_STRUCT_TRAITS_H_ | |
| 7 | |
| 8 #include "ui/display/mojo/display_snapshot_mojo.h" | |
| 9 #include "ui/display/mojo/display_snapshot_mojo.mojom.h" | |
| 10 #include "ui/display/types/display_mode.h" | |
| 11 | |
| 12 namespace mojo { | |
| 13 | |
| 14 template <> | |
| 15 struct StructTraits<display::mojom::DisplaySnapshotMojoDataView, | |
| 16 std::unique_ptr<display::DisplaySnapshotMojo>> { | |
| 17 static int64_t display_id( | |
| 18 const std::unique_ptr<display::DisplaySnapshotMojo>& display_snapshot) { | |
| 19 return display_snapshot->display_id(); | |
| 20 } | |
| 21 | |
| 22 static gfx::Point origin( | |
| 23 const std::unique_ptr<display::DisplaySnapshotMojo>& display_snapshot) { | |
| 24 return display_snapshot->origin(); | |
| 25 } | |
| 26 | |
| 27 static gfx::Size physical_size( | |
| 28 const std::unique_ptr<display::DisplaySnapshotMojo>& display_snapshot) { | |
| 29 return display_snapshot->physical_size(); | |
| 30 } | |
| 31 | |
| 32 static display::DisplayConnectionType type( | |
| 33 const std::unique_ptr<display::DisplaySnapshotMojo>& display_snapshot) { | |
| 34 return display_snapshot->type(); | |
| 35 } | |
| 36 | |
| 37 static bool is_aspect_preserving_scaling( | |
| 38 const std::unique_ptr<display::DisplaySnapshotMojo>& display_snapshot) { | |
| 39 return display_snapshot->is_aspect_preserving_scaling(); | |
| 40 } | |
| 41 | |
| 42 static bool has_overscan( | |
| 43 const std::unique_ptr<display::DisplaySnapshotMojo>& display_snapshot) { | |
| 44 return display_snapshot->has_overscan(); | |
| 45 } | |
| 46 | |
| 47 static bool has_color_correction_matrix( | |
| 48 const std::unique_ptr<display::DisplaySnapshotMojo>& display_snapshot) { | |
| 49 return display_snapshot->has_color_correction_matrix(); | |
| 50 } | |
| 51 | |
| 52 static std::string display_name( | |
| 53 const std::unique_ptr<display::DisplaySnapshotMojo>& display_snapshot) { | |
| 54 return display_snapshot->display_name(); | |
| 55 } | |
| 56 | |
| 57 static const base::FilePath sys_path( | |
| 58 const std::unique_ptr<display::DisplaySnapshotMojo>& display_snapshot) { | |
| 59 return display_snapshot->sys_path(); | |
| 60 } | |
| 61 | |
| 62 static bool compare_display_mode( | |
|
kylechar
2017/02/10 21:40:30
I meant move the the whole function to the .cc fil
thanhph1
2017/02/13 20:09:12
This makes sense. I use operator==. Thanks!
| |
| 63 const display::DisplayMode& display_mode_lhs, | |
| 64 const display::DisplayMode& display_mode_rhs); | |
| 65 | |
| 66 static std::vector<uint8_t> edid( | |
| 67 const std::unique_ptr<display::DisplaySnapshotMojo>& display_snapshot) { | |
| 68 return display_snapshot->edid(); | |
| 69 } | |
| 70 | |
| 71 static std::vector<std::unique_ptr<display::DisplayMode>> modes( | |
| 72 const std::unique_ptr<display::DisplaySnapshotMojo>& display_snapshot); | |
| 73 | |
| 74 static int64_t current_mode_index( | |
| 75 const std::unique_ptr<display::DisplaySnapshotMojo>& display_snapshot); | |
| 76 | |
| 77 static int64_t native_mode_index( | |
| 78 const std::unique_ptr<display::DisplaySnapshotMojo>& display_snapshot); | |
| 79 | |
| 80 static int64_t product_id( | |
| 81 const std::unique_ptr<display::DisplaySnapshotMojo>& display_snapshot) { | |
| 82 return display_snapshot->product_id(); | |
| 83 } | |
| 84 | |
| 85 static bool Read(display::mojom::DisplaySnapshotMojoDataView data, | |
| 86 std::unique_ptr<display::DisplaySnapshotMojo>* out); | |
| 87 }; | |
| 88 | |
| 89 } // namespace mojo | |
| 90 | |
| 91 #endif // UI_DISPLAY_MOJO_DISPLAY_SNAPSHOT_MOJO_STRUCT_TRAITS_H_ | |
| OLD | NEW |