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

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

Issue 2123613002: Add a mojom/StructTrait for display::Display. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comments. Created 4 years, 5 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
OLDNEW
(Empty)
1 // Copyright 2016 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_STRUCT_TRAITS_H_
6 #define UI_DISPLAY_MOJO_DISPLAY_STRUCT_TRAITS_H_
7
8 #include "ui/display/display.h"
9 #include "ui/display/mojo/display.mojom.h"
10
11 namespace mojo {
12
13 template <>
14 struct EnumTraits<display::mojom::DisplayRotation, display::Display::Rotation> {
15 static display::mojom::DisplayRotation ToMojom(
16 display::Display::Rotation type);
17 static bool FromMojom(display::mojom::DisplayRotation type,
18 display::Display::Rotation* output);
19 };
20
21 template <>
22 struct EnumTraits<display::mojom::TouchSupport,
23 display::Display::TouchSupport> {
24 static display::mojom::TouchSupport ToMojom(
25 display::Display::TouchSupport type);
26 static bool FromMojom(display::mojom::TouchSupport type,
27 display::Display::TouchSupport* output);
28 };
29
30 template <>
31 struct StructTraits<display::mojom::Display, display::Display> {
32 static int64_t id(const display::Display& display) { return display.id(); }
33
34 static const gfx::Rect& bounds(const display::Display& display) {
35 return display.bounds();
36 }
37
38 static const gfx::Rect& work_area(const display::Display& display) {
39 return display.work_area();
40 }
41
42 static float device_scale_factor(const display::Display& display) {
43 return display.device_scale_factor();
44 }
45
46 static display::Display::Rotation rotation(const display::Display& display) {
47 return display.rotation();
48 }
49
50 static display::Display::TouchSupport touch_support(
51 const display::Display& display) {
52 return display.touch_support();
53 }
54
55 static const gfx::Size& maximum_cursor_size(const display::Display& display) {
56 return display.maximum_cursor_size();
57 }
58
59 static bool Read(display::mojom::DisplayDataView data, display::Display* out);
60 };
61
62 } // namespace mojo
63
64 #endif // UI_DISPLAY_MOJO_DISPLAY_STRUCT_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698