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

Side by Side Diff: services/ui/public/interfaces/display/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: Move unit test target. 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 SERVICES_UI_PUBLIC_INTERFACES_DISPLAY_DISPLAY_STRUCT_TRAITS_H_
6 #define SERVICES_UI_PUBLIC_INTERFACES_DISPLAY_DISPLAY_STRUCT_TRAITS_H_
7
8 #include "ui/display/display.h"
9 #include "services/ui/public/interfaces/display/display.mojom.h"
10
11 namespace mojo {
12
13 template <>
14 struct EnumTraits<display::mojom::Rotation, display::Display::Rotation> {
15 static display::mojom::Rotation ToMojom(display::Display::Rotation type);
16 static bool FromMojom(display::mojom::Rotation type,
17 display::Display::Rotation* output);
18 };
19
20 template <>
21 struct EnumTraits<display::mojom::TouchSupport,
22 display::Display::TouchSupport> {
23 static display::mojom::TouchSupport ToMojom(
24 display::Display::TouchSupport type);
25 static bool FromMojom(display::mojom::TouchSupport type,
26 display::Display::TouchSupport* output);
27 };
28
29 template <>
30 struct StructTraits<display::mojom::Display, display::Display> {
31 static int64_t id(const display::Display& display) { return display.id(); }
32
33 static const gfx::Rect& bounds(const display::Display& display) {
34 return display.bounds();
35 }
36
37 static const gfx::Rect& work_area(const display::Display& display) {
38 return display.work_area();
39 }
40
41 static float device_scale_factor(const display::Display& display) {
42 return display.device_scale_factor();
43 }
44
45 static display::Display::Rotation rotation(const display::Display& display) {
46 return display.rotation();
47 }
48
49 static display::Display::TouchSupport touch_support(
50 const display::Display& display) {
51 return display.touch_support();
52 }
53
54 static const gfx::Size& maximum_cursor_size(const display::Display& display) {
55 return display.maximum_cursor_size();
56 }
57
58 static bool Read(display::mojom::DisplayDataView data, display::Display* out);
59 };
60
61 } // namespace mojo
62
63 #endif // SERVICES_UI_PUBLIC_INTERFACES_DISPLAY_DISPLAY_STRUCT_TRAITS_H_
OLDNEW
« no previous file with comments | « services/ui/public/interfaces/display/display.typemap ('k') | services/ui/public/interfaces/display/display_struct_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698