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

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

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
Index: chrome/common/extensions/media_parser_struct_traits.h
diff --git a/chrome/common/extensions/media_parser_struct_traits.h b/chrome/common/extensions/media_parser_struct_traits.h
new file mode 100644
index 0000000000000000000000000000000000000000..00cf5d44350ab49095d31002c96f394e47b68fad
--- /dev/null
+++ b/chrome/common/extensions/media_parser_struct_traits.h
@@ -0,0 +1,36 @@
+// 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 CHROME_COMMON_EXTENSIONS_MEDIA_PARSER_STRUCT_TRAITS_H_
+#define CHROME_COMMON_EXTENSIONS_MEDIA_PARSER_STRUCT_TRAITS_H_
+
+#include <string>
+
+#include "chrome/common/extensions/media_parser.mojom.h"
+#include "chrome/common/media_galleries/metadata_types.h"
+#include "mojo/public/cpp/bindings/array_traits_carray.h"
+
+namespace mojo {
+
+template <>
+struct StructTraits<extensions::mojom::AttachedImageDataView,
+ ::metadata::AttachedImage> {
+ static const std::string& type(const ::metadata::AttachedImage& image) {
+ return image.type;
+ }
+
+ static ConstCArray<uint8_t> data(const ::metadata::AttachedImage& image) {
+ // TODO(dcheng): perhaps metadata::AttachedImage should consider passing the
+ // image data around in a std::vector<uint8_t>.
+ return ConstCArray<uint8_t>(
+ image.data.size(), reinterpret_cast<const uint8_t*>(image.data.data()));
+ }
+
+ static bool Read(extensions::mojom::AttachedImageDataView view,
+ ::metadata::AttachedImage* out);
+};
+
+} // namespace mojo
+
+#endif // CHROME_COMMON_EXTENSIONS_MEDIA_PARSER_STRUCT_TRAITS_H_
« no previous file with comments | « chrome/common/extensions/media_parser.typemap ('k') | chrome/common/extensions/media_parser_struct_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698