OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 "public/platform/modules/mediasession/media_session.mojom-blink.h" |
| 6 |
| 7 namespace mojo { |
| 8 |
| 9 template <> |
| 10 struct StructTraits<blink::mojom::blink::MediaImage::DataView, |
| 11 ::blink::MojoMediaArtwork> { |
| 12 static const blink::KURL& src(const ::blink::MojoMediaArtwork& artwork) { |
| 13 return artwork.src; |
| 14 } |
| 15 |
| 16 static const blink::WebString& type( |
| 17 const ::blink::MojoMediaArtwork& artwork) { |
| 18 return artwork.type; |
| 19 } |
| 20 |
| 21 static const WTF::Vector<blink::WebSize>& sizes( |
| 22 const ::blink::MojoMediaArtwork& artwork) { |
| 23 return artwork.sizes; |
| 24 } |
| 25 |
| 26 static bool Read(blink::mojom::blink::MediaImage::DataView data, |
| 27 ::blink::MojoMediaArtwork* out) { |
| 28 if (!data.ReadSrc(&out->src)) |
| 29 return false; |
| 30 if (!data.ReadType(&out->type)) |
| 31 return false; |
| 32 if (!data.ReadSizes(&out->sizes)) |
| 33 return false; |
| 34 |
| 35 return true; |
| 36 } |
| 37 }; |
| 38 |
| 39 template <> |
| 40 struct StructTraits<blink::mojom::blink::MediaMetadata::DataView, |
| 41 ::blink::MojoMediaMetadata> { |
| 42 static const blink::WebString& title( |
| 43 const ::blink::MojoMediaMetadata& metadata) { |
| 44 return metadata.title; |
| 45 } |
| 46 |
| 47 static const blink::WebString& artist( |
| 48 const ::blink::MojoMediaMetadata& metadata) { |
| 49 return metadata.artist; |
| 50 } |
| 51 |
| 52 static const blink::WebString& album( |
| 53 const ::blink::MojoMediaMetadata& metadata) { |
| 54 return metadata.album; |
| 55 } |
| 56 |
| 57 static const WTF::Vector<::blink::MojoMediaArtwork>& artwork( |
| 58 const ::blink::MojoMediaMetadata& metadata) { |
| 59 return metadata.artwork; |
| 60 } |
| 61 |
| 62 static bool Read(blink::mojom::blink::MediaMetadata::DataView data, |
| 63 ::blink::MojoMediaMetadata* out) { |
| 64 if (!data.ReadTitle(&out->title)) |
| 65 return false; |
| 66 if (!data.ReadArtist(&out->artist)) |
| 67 return false; |
| 68 if (!data.ReadAlbum(&out->album)) |
| 69 return false; |
| 70 if (!data.ReadArtwork(&out->artwork)) |
| 71 return false; |
| 72 |
| 73 return true; |
| 74 } |
| 75 }; |
| 76 |
| 77 } // namespace mojo |
OLD | NEW |