Chromium Code Reviews| Index: ui/display/mojo/display_snapshot_mojo_struct_traits.h |
| diff --git a/ui/display/mojo/display_snapshot_mojo_struct_traits.h b/ui/display/mojo/display_snapshot_mojo_struct_traits.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ae66b68e62dd5fa0b6560365ae4c75a0c9aa4625 |
| --- /dev/null |
| +++ b/ui/display/mojo/display_snapshot_mojo_struct_traits.h |
| @@ -0,0 +1,91 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef UI_DISPLAY_MOJO_DISPLAY_SNAPSHOT_MOJO_STRUCT_TRAITS_H_ |
| +#define UI_DISPLAY_MOJO_DISPLAY_SNAPSHOT_MOJO_STRUCT_TRAITS_H_ |
| + |
| +#include "ui/display/mojo/display_snapshot_mojo.h" |
| +#include "ui/display/mojo/display_snapshot_mojo.mojom.h" |
| +#include "ui/display/types/display_mode.h" |
| + |
| +namespace mojo { |
| + |
| +template <> |
| +struct StructTraits<display::mojom::DisplaySnapshotMojoDataView, |
| + std::unique_ptr<display::DisplaySnapshotMojo>> { |
| + static int64_t display_id( |
| + const std::unique_ptr<display::DisplaySnapshotMojo>& display_snapshot) { |
| + return display_snapshot->display_id(); |
| + } |
| + |
| + static gfx::Point origin( |
| + const std::unique_ptr<display::DisplaySnapshotMojo>& display_snapshot) { |
| + return display_snapshot->origin(); |
| + } |
| + |
| + static gfx::Size physical_size( |
| + const std::unique_ptr<display::DisplaySnapshotMojo>& display_snapshot) { |
| + return display_snapshot->physical_size(); |
| + } |
| + |
| + static display::DisplayConnectionType type( |
| + const std::unique_ptr<display::DisplaySnapshotMojo>& display_snapshot) { |
| + return display_snapshot->type(); |
| + } |
| + |
| + static bool is_aspect_preserving_scaling( |
| + const std::unique_ptr<display::DisplaySnapshotMojo>& display_snapshot) { |
| + return display_snapshot->is_aspect_preserving_scaling(); |
| + } |
| + |
| + static bool has_overscan( |
| + const std::unique_ptr<display::DisplaySnapshotMojo>& display_snapshot) { |
| + return display_snapshot->has_overscan(); |
| + } |
| + |
| + static bool has_color_correction_matrix( |
| + const std::unique_ptr<display::DisplaySnapshotMojo>& display_snapshot) { |
| + return display_snapshot->has_color_correction_matrix(); |
| + } |
| + |
| + static std::string display_name( |
| + const std::unique_ptr<display::DisplaySnapshotMojo>& display_snapshot) { |
| + return display_snapshot->display_name(); |
| + } |
| + |
| + static const base::FilePath sys_path( |
| + const std::unique_ptr<display::DisplaySnapshotMojo>& display_snapshot) { |
| + return display_snapshot->sys_path(); |
| + } |
| + |
| + 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!
|
| + const display::DisplayMode& display_mode_lhs, |
| + const display::DisplayMode& display_mode_rhs); |
| + |
| + static std::vector<uint8_t> edid( |
| + const std::unique_ptr<display::DisplaySnapshotMojo>& display_snapshot) { |
| + return display_snapshot->edid(); |
| + } |
| + |
| + static std::vector<std::unique_ptr<display::DisplayMode>> modes( |
| + const std::unique_ptr<display::DisplaySnapshotMojo>& display_snapshot); |
| + |
| + static int64_t current_mode_index( |
| + const std::unique_ptr<display::DisplaySnapshotMojo>& display_snapshot); |
| + |
| + static int64_t native_mode_index( |
| + const std::unique_ptr<display::DisplaySnapshotMojo>& display_snapshot); |
| + |
| + static int64_t product_id( |
| + const std::unique_ptr<display::DisplaySnapshotMojo>& display_snapshot) { |
| + return display_snapshot->product_id(); |
| + } |
| + |
| + static bool Read(display::mojom::DisplaySnapshotMojoDataView data, |
| + std::unique_ptr<display::DisplaySnapshotMojo>* out); |
| +}; |
| + |
| +} // namespace mojo |
| + |
| +#endif // UI_DISPLAY_MOJO_DISPLAY_SNAPSHOT_MOJO_STRUCT_TRAITS_H_ |