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

Unified Diff: chrome/common/extensions/media_parser_struct_traits.cc

Issue 2615423002: Convert utility process ParseMediaMetadata IPC to mojo (Closed)
Patch Set: Security review comments. Created 3 years, 11 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
« no previous file with comments | « chrome/common/extensions/media_parser_struct_traits.h ('k') | chrome/common/extensions/typemaps.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/media_parser_struct_traits.cc
diff --git a/chrome/common/extensions/media_parser_struct_traits.cc b/chrome/common/extensions/media_parser_struct_traits.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a93fc262a8849835a19176142bf55676d51168b9
--- /dev/null
+++ b/chrome/common/extensions/media_parser_struct_traits.cc
@@ -0,0 +1,30 @@
+// 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.
+
+#include "chrome/common/extensions/media_parser_struct_traits.h"
+#include "mojo/public/cpp/bindings/array_data_view.h"
+
+namespace {
+
+using TypeImageDataView = extensions::mojom::AttachedImageDataView;
+using TypeImage = ::metadata::AttachedImage;
+
+} // namespace
+
+namespace mojo {
+
+// static
+bool StructTraits<TypeImageDataView, TypeImage>::Read(TypeImageDataView view,
+ TypeImage* out) {
+ if (!view.ReadType(&out->type))
+ return false;
+
+ ArrayDataView<uint8_t> data;
+ view.GetDataDataView(&data);
+
+ out->data.assign(reinterpret_cast<const char*>(data.data()), data.size());
+ return true;
+}
+
+} // namespace mojo
« no previous file with comments | « chrome/common/extensions/media_parser_struct_traits.h ('k') | chrome/common/extensions/typemaps.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698