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

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

Issue 2615423002: Convert utility process ParseMediaMetadata IPC to mojo (Closed)
Patch Set: Patch for review. 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..141738a920485993cf3855e0e0034eb0772724ae
--- /dev/null
+++ b/chrome/common/extensions/media_parser_struct_traits.h
@@ -0,0 +1,38 @@
+// 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"
+
+namespace mojo {
+
+using AttachedImageData = extensions::mojom::AttachedImageDataView;
tibell 2017/01/09 03:55:52 Do we allow using in .h files? Doesn't it pollute
Noel Gordon 2017/01/09 14:54:19 Done.
+
+template <>
+struct StructTraits<AttachedImageData, metadata::AttachedImage> {
+ static const std::string& type(const metadata::AttachedImage& image) {
+ return image.type;
+ }
+
+ static const std::string& data(const metadata::AttachedImage& image) {
+ return image.data;
+ }
+
+ static bool Read(AttachedImageData view, metadata::AttachedImage* out) {
+ if (!view.ReadType(&out->type))
+ return false;
+ if (!view.ReadData(&out->data))
+ return false;
+ return true;
+ }
+};
+
+} // namespace mojo
+
+#endif // CHROME_COMMON_EXTENSIONS_MEDIA_PARSER_STRUCT_TRAITS_H_

Powered by Google App Engine
This is Rietveld 408576698