Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Side by Side Diff: ui/display/mojo/display_layout_struct_traits.h

Issue 2661663002: Add DisplayPlacement/Layout mojoms + StructTraits. (Closed)
Patch Set: Remove empty comments. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/display/mojo/display_layout.typemap ('k') | ui/display/mojo/display_layout_struct_traits.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_LAYOUT_STRUCT_TRAITS_H_
6 #define UI_DISPLAY_MOJO_DISPLAY_LAYOUT_STRUCT_TRAITS_H_
7
8 #include <memory>
9 #include <vector>
10
11 #include "ui/display/display_layout.h"
12 #include "ui/display/mojo/display_layout.mojom.h"
13
14 namespace mojo {
15
16 template <>
17 struct EnumTraits<display::mojom::Position,
18 display::DisplayPlacement::Position> {
19 static display::mojom::Position ToMojom(
20 display::DisplayPlacement::Position type);
21 static bool FromMojom(display::mojom::Position type,
22 display::DisplayPlacement::Position* output);
23 };
24
25 template <>
26 struct EnumTraits<display::mojom::OffsetReference,
27 display::DisplayPlacement::OffsetReference> {
28 static display::mojom::OffsetReference ToMojom(
29 display::DisplayPlacement::OffsetReference type);
30 static bool FromMojom(display::mojom::OffsetReference type,
31 display::DisplayPlacement::OffsetReference* output);
32 };
33
34 template <>
35 struct StructTraits<display::mojom::DisplayPlacementDataView,
36 display::DisplayPlacement> {
37 static int64_t display_id(const display::DisplayPlacement& placement) {
38 return placement.display_id;
39 }
40
41 static int64_t parent_display_id(const display::DisplayPlacement& placement) {
42 return placement.parent_display_id;
43 }
44
45 static display::DisplayPlacement::Position position(
46 const display::DisplayPlacement& placement) {
47 return placement.position;
48 }
49
50 static int offset(const display::DisplayPlacement& placement) {
51 return placement.offset;
52 }
53
54 static display::DisplayPlacement::OffsetReference offset_reference(
55 const display::DisplayPlacement& placement) {
56 return placement.offset_reference;
57 }
58
59 static bool Read(display::mojom::DisplayPlacementDataView data,
60 display::DisplayPlacement* out);
61 };
62
63 template <>
64 struct StructTraits<display::mojom::DisplayLayoutDataView,
65 std::unique_ptr<display::DisplayLayout>> {
66 static bool mirrored(const std::unique_ptr<display::DisplayLayout>& layout) {
67 return layout->mirrored;
68 }
69
70 static bool default_unified(
71 const std::unique_ptr<display::DisplayLayout>& layout) {
72 return layout->default_unified;
73 }
74
75 static int64_t primary_display_id(
76 const std::unique_ptr<display::DisplayLayout>& layout) {
77 return layout->primary_id;
78 }
79
80 static const std::vector<display::DisplayPlacement>& placement_list(
81 const std::unique_ptr<display::DisplayLayout>& layout) {
82 return layout->placement_list;
83 }
84
85 static bool Read(display::mojom::DisplayLayoutDataView data,
86 std::unique_ptr<display::DisplayLayout>* out);
87 };
88
89 } // namespace mojo
90
91 #endif // UI_DISPLAY_MOJO_DISPLAY_LAYOUT_STRUCT_TRAITS_H_
OLDNEW
« no previous file with comments | « ui/display/mojo/display_layout.typemap ('k') | ui/display/mojo/display_layout_struct_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698