OLD | NEW |
(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 #include "chrome/common/extensions/media_parser_struct_traits.h" |
| 6 #include "mojo/public/cpp/bindings/array_data_view.h" |
| 7 |
| 8 namespace { |
| 9 |
| 10 using TypeImageDataView = extensions::mojom::AttachedImageDataView; |
| 11 using TypeImage = ::metadata::AttachedImage; |
| 12 |
| 13 } // namespace |
| 14 |
| 15 namespace mojo { |
| 16 |
| 17 // static |
| 18 bool StructTraits<TypeImageDataView, TypeImage>::Read(TypeImageDataView view, |
| 19 TypeImage* out) { |
| 20 if (!view.ReadType(&out->type)) |
| 21 return false; |
| 22 |
| 23 ArrayDataView<uint8_t> data; |
| 24 view.GetDataDataView(&data); |
| 25 |
| 26 out->data.assign(reinterpret_cast<const char*>(data.data()), data.size()); |
| 27 return true; |
| 28 } |
| 29 |
| 30 } // namespace mojo |
OLD | NEW |