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/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(const std::unique_ptr<display::DisplaySnapshotMojo>& | |
| 18 display_snapshot_mojo) { | |
| 19 return display_snapshot_mojo->display_id(); | |
| 20 } | |
| 21 | |
| 22 static gfx::Point origin(const std::unique_ptr<display::DisplaySnapshotMojo>& | |
|
kylechar
2017/02/13 22:01:24
Return const references if possible, which should
thanhph1
2017/02/14 20:20:53
Done.
| |
| 23 display_snapshot_mojo) { | |
| 24 return display_snapshot_mojo->origin(); | |
| 25 } | |
| 26 | |
| 27 static gfx::Size physical_size( | |
| 28 const std::unique_ptr<display::DisplaySnapshotMojo>& | |
| 29 display_snapshot_mojo) { | |
| 30 return display_snapshot_mojo->physical_size(); | |
| 31 } | |
| 32 | |
| 33 static display::DisplayConnectionType type( | |
| 34 const std::unique_ptr<display::DisplaySnapshotMojo>& | |
| 35 display_snapshot_mojo) { | |
| 36 return display_snapshot_mojo->type(); | |
| 37 } | |
| 38 | |
| 39 static bool is_aspect_preserving_scaling( | |
| 40 const std::unique_ptr<display::DisplaySnapshotMojo>& | |
| 41 display_snapshot_mojo) { | |
| 42 return display_snapshot_mojo->is_aspect_preserving_scaling(); | |
| 43 } | |
| 44 | |
| 45 static bool has_overscan(const std::unique_ptr<display::DisplaySnapshotMojo>& | |
| 46 display_snapshot_mojo) { | |
| 47 return display_snapshot_mojo->has_overscan(); | |
| 48 } | |
| 49 | |
| 50 static bool has_color_correction_matrix( | |
| 51 const std::unique_ptr<display::DisplaySnapshotMojo>& | |
| 52 display_snapshot_mojo) { | |
| 53 return display_snapshot_mojo->has_color_correction_matrix(); | |
| 54 } | |
| 55 | |
| 56 static std::string display_name( | |
| 57 const std::unique_ptr<display::DisplaySnapshotMojo>& | |
| 58 display_snapshot_mojo) { | |
| 59 return display_snapshot_mojo->display_name(); | |
| 60 } | |
| 61 | |
| 62 static const base::FilePath sys_path( | |
| 63 const std::unique_ptr<display::DisplaySnapshotMojo>& | |
| 64 display_snapshot_mojo) { | |
| 65 return display_snapshot_mojo->sys_path(); | |
| 66 } | |
| 67 | |
| 68 static std::vector<uint8_t> edid( | |
| 69 const std::unique_ptr<display::DisplaySnapshotMojo>& | |
| 70 display_snapshot_mojo) { | |
| 71 return display_snapshot_mojo->edid(); | |
| 72 } | |
| 73 | |
| 74 static std::vector<std::unique_ptr<display::DisplayMode>> modes( | |
| 75 const std::unique_ptr<display::DisplaySnapshotMojo>& | |
| 76 display_snapshot_mojo); | |
| 77 | |
| 78 static uint64_t current_mode_index( | |
| 79 const std::unique_ptr<display::DisplaySnapshotMojo>& | |
| 80 display_snapshot_mojo); | |
| 81 | |
| 82 static bool current_mode_exist( | |
|
kylechar
2017/02/13 22:01:24
has_current_mode
thanhph1
2017/02/14 20:20:53
Done.
| |
| 83 const std::unique_ptr<display::DisplaySnapshotMojo>& | |
| 84 display_snapshot_mojo) { | |
| 85 return display_snapshot_mojo->current_mode_exist(); | |
| 86 } | |
| 87 | |
| 88 static uint64_t native_mode_index( | |
| 89 const std::unique_ptr<display::DisplaySnapshotMojo>& | |
| 90 display_snapshot_mojo); | |
| 91 | |
| 92 static bool native_mode_exist( | |
|
kylechar
2017/02/13 22:01:24
has_native_mode
thanhph1
2017/02/14 20:20:53
Done.
| |
| 93 const std::unique_ptr<display::DisplaySnapshotMojo>& | |
| 94 display_snapshot_mojo) { | |
| 95 return display_snapshot_mojo->native_mode_exist(); | |
| 96 } | |
| 97 | |
| 98 static int64_t product_id(const std::unique_ptr<display::DisplaySnapshotMojo>& | |
| 99 display_snapshot_mojo) { | |
| 100 return display_snapshot_mojo->product_id(); | |
| 101 } | |
| 102 | |
| 103 static gfx::Size maximum_cursor_size( | |
| 104 const std::unique_ptr<display::DisplaySnapshotMojo>& | |
| 105 display_snapshot_mojo) { | |
| 106 return display_snapshot_mojo->maximum_cursor_size(); | |
| 107 } | |
| 108 | |
| 109 static bool Read(display::mojom::DisplaySnapshotMojoDataView data, | |
| 110 std::unique_ptr<display::DisplaySnapshotMojo>* out); | |
| 111 }; | |
| 112 | |
| 113 } // namespace mojo | |
| 114 | |
| 115 #endif // UI_DISPLAY_MOJO_DISPLAY_SNAPSHOT_MOJO_STRUCT_TRAITS_H_ | |
| OLD | NEW |