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