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

Side by Side 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 unified diff | Download patch
OLDNEW
(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 #ifndef CHROME_COMMON_EXTENSIONS_MEDIA_PARSER_STRUCT_TRAITS_H_
6 #define CHROME_COMMON_EXTENSIONS_MEDIA_PARSER_STRUCT_TRAITS_H_
7
8 #include <string>
9
10 #include "chrome/common/extensions/media_parser.mojom.h"
11 #include "chrome/common/media_galleries/metadata_types.h"
12
13 namespace mojo {
14
15 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.
16
17 template <>
18 struct StructTraits<AttachedImageData, metadata::AttachedImage> {
19 static const std::string& type(const metadata::AttachedImage& image) {
20 return image.type;
21 }
22
23 static const std::string& data(const metadata::AttachedImage& image) {
24 return image.data;
25 }
26
27 static bool Read(AttachedImageData view, metadata::AttachedImage* out) {
28 if (!view.ReadType(&out->type))
29 return false;
30 if (!view.ReadData(&out->data))
31 return false;
32 return true;
33 }
34 };
35
36 } // namespace mojo
37
38 #endif // CHROME_COMMON_EXTENSIONS_MEDIA_PARSER_STRUCT_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698