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

Unified Diff: ui/display/mojo/display_mode_struct_traits.cc

Issue 2646213002: Write mojom and StructTraits for DisplaySnapshot. (Closed)
Patch Set: use FILE_PATH_LITERAL to create base::FilePath::StringType 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 side-by-side diff with in-line comments
Download patch
Index: ui/display/mojo/display_mode_struct_traits.cc
diff --git a/ui/display/mojo/display_mode_struct_traits.cc b/ui/display/mojo/display_mode_struct_traits.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7b43a49aa02a17b8f820103992ea6a47ff2a52d5
--- /dev/null
+++ b/ui/display/mojo/display_mode_struct_traits.cc
@@ -0,0 +1,29 @@
+// 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_MODE_STRUCT_TRAITS_CC_
kylechar 2017/02/09 15:05:53 Again, remove this.
thanhph1 2017/02/10 19:54:32 Done.
+#define UI_DISPLAY_MOJO_DISPLAY_MODE_STRUCT_TRAITS_CC_
+
+#include "ui/display/mojo/display_mode_struct_traits.h"
kylechar 2017/02/09 15:05:53 Please read the style guide section on includes an
thanhph1 2017/02/10 19:54:31 I removed a duplicated include size.h
+#include "ui/gfx/geometry/mojo/geometry_struct_traits.h"
+#include "ui/gfx/geometry/size.h"
+
+namespace mojo {
+
+// static
+bool StructTraits<display::mojom::DisplayModeDataView,
+ std::unique_ptr<display::DisplayMode>>::
+ Read(display::mojom::DisplayModeDataView data,
+ std::unique_ptr<display::DisplayMode>* out) {
+ gfx::Size size;
+ if (!data.ReadSize(&size))
+ return false;
+ *out = base::MakeUnique<display::DisplayMode>(size, data.is_interlaced(),
+ data.refresh_rate());
+ return true;
+};
+
+} // namespace mojo
+
+#endif // UI_DISPLAY_MOJO_DISPLAY_MODE_STRUCT_TRAITS_CC_

Powered by Google App Engine
This is Rietveld 408576698