| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/mediasession/MediaMetadata.h" | 5 #include "modules/mediasession/MediaMetadata.h" |
| 6 | 6 |
| 7 #include "core/dom/ExecutionContext.h" | 7 #include "core/dom/ExecutionContext.h" |
| 8 #include "modules/mediasession/MediaArtwork.h" | 8 #include "modules/mediasession/MediaImage.h" |
| 9 #include "modules/mediasession/MediaMetadataInit.h" | 9 #include "modules/mediasession/MediaMetadataInit.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 // static | 13 // static |
| 14 MediaMetadata* MediaMetadata::create(ExecutionContext* context, | 14 MediaMetadata* MediaMetadata::create(ExecutionContext* context, |
| 15 const MediaMetadataInit& metadata) { | 15 const MediaMetadataInit& metadata) { |
| 16 return new MediaMetadata(context, metadata); | 16 return new MediaMetadata(context, metadata); |
| 17 } | 17 } |
| 18 | 18 |
| 19 MediaMetadata::MediaMetadata(ExecutionContext* context, | 19 MediaMetadata::MediaMetadata(ExecutionContext* context, |
| 20 const MediaMetadataInit& metadata) { | 20 const MediaMetadataInit& metadata) { |
| 21 m_title = metadata.title(); | 21 m_title = metadata.title(); |
| 22 m_artist = metadata.artist(); | 22 m_artist = metadata.artist(); |
| 23 m_album = metadata.album(); | 23 m_album = metadata.album(); |
| 24 for (const auto& artwork : metadata.artwork()) | 24 for (const auto& image : metadata.artwork()) |
| 25 m_artwork.append(MediaArtwork::create(context, artwork)); | 25 m_artwork.append(MediaImage::create(context, image)); |
| 26 } | 26 } |
| 27 | 27 |
| 28 String MediaMetadata::title() const { | 28 String MediaMetadata::title() const { |
| 29 return m_title; | 29 return m_title; |
| 30 } | 30 } |
| 31 | 31 |
| 32 String MediaMetadata::artist() const { | 32 String MediaMetadata::artist() const { |
| 33 return m_artist; | 33 return m_artist; |
| 34 } | 34 } |
| 35 | 35 |
| 36 String MediaMetadata::album() const { | 36 String MediaMetadata::album() const { |
| 37 return m_album; | 37 return m_album; |
| 38 } | 38 } |
| 39 | 39 |
| 40 const HeapVector<Member<MediaArtwork>>& MediaMetadata::artwork() const { | 40 const HeapVector<Member<MediaImage>>& MediaMetadata::artwork() const { |
| 41 return m_artwork; | 41 return m_artwork; |
| 42 } | 42 } |
| 43 | 43 |
| 44 DEFINE_TRACE(MediaMetadata) { | 44 DEFINE_TRACE(MediaMetadata) { |
| 45 visitor->trace(m_artwork); | 45 visitor->trace(m_artwork); |
| 46 } | 46 } |
| 47 | 47 |
| 48 } // namespace blink | 48 } // namespace blink |
| OLD | NEW |