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

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

Issue 2636073002: Create mojom and StructTraits for ui/display/types/display_mode.cc (Closed)
Patch Set: Change structure not to use display_mode_mojo.(cc|h). Instead, use friend class in display_mode.h. 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
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_MODE_STRUCT_TRAITS_H_
6 #define UI_DISPLAY_MOJO_DISPLAY_MODE_STRUCT_TRAITS_H_
7
8 #include "ui/display/types/display_mode.h"
9 #include "ui/display/mojo/display_mode.mojom.h"
10 #include "ui/gfx/geometry/size.h"
11
12 namespace mojo {
13
14 template <>
15 struct StructTraits<display::mojom::DisplayModeDataView,
16 display::DisplayMode> {
kylechar 2017/01/25 16:59:45 Please run "git cl format".
thanhph1 2017/01/25 20:28:39 Done.
17 static const gfx::Size& size(
18 const display::DisplayMode& display_mode) {
19 return display_mode.size();
20 }
21
22 static bool is_interlaced(const display::DisplayMode& display_mode) {
23 return display_mode.is_interlaced();
24 }
25
26 static float refresh_rate(const display::DisplayMode& display_mode) {
27 return display_mode.refresh_rate();
28 }
29
30 static bool Read(display::mojom::DisplayModeDataView data,
31 display::DisplayMode* out) {
32 if (!data.ReadSize(&out->size_ ))
33 return false;
34
35 out->is_interlaced_ = data.is_interlaced();
36 out->refresh_rate_ = data.refresh_rate();
37
38 return true;
39 }
40 };
41
42 } // namespace mojo
43
44 #endif // UI_DISPLAY_MOJO_DISPLAY_MODE_STRUCT_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698