Index: ui/gfx/mojo/icc_profile_struct_traits.cc |
diff --git a/ui/gfx/mojo/icc_profile_struct_traits.cc b/ui/gfx/mojo/icc_profile_struct_traits.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..eec4aadc2e2da075b4e290775a0a42cfb4067f6e |
--- /dev/null |
+++ b/ui/gfx/mojo/icc_profile_struct_traits.cc |
@@ -0,0 +1,27 @@ |
+// Copyright 2016 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. |
+ |
+#include "ui/gfx/mojo/icc_profile_struct_traits.h" |
+ |
+#include <algorithm> |
+ |
+#include "mojo/public/cpp/bindings/string_data_view.h" |
+ |
+namespace mojo { |
+ |
+using Traits = StructTraits<gfx::mojom::ICCProfileDataView, gfx::ICCProfile>; |
+ |
+// static |
+bool Traits::Read(gfx::mojom::ICCProfileDataView data, gfx::ICCProfile* out) { |
+ out->valid_ = data.valid(); |
+ out->id_ = data.id(); |
+ |
+ mojo::StringDataView view; |
+ data.GetDataDataView(&view); |
+ out->data_.resize(view.size()); |
+ std::copy(view.storage(), view.storage() + view.size(), out->data_.begin()); |
+ return true; |
+} |
+ |
+} // namespace mojo |