| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CONTENT_PUBLIC_COMMON_MEDIA_METADATA_H_ | 5 #ifndef CONTENT_PUBLIC_COMMON_MEDIA_METADATA_H_ |
| 6 #define CONTENT_PUBLIC_COMMON_MEDIA_METADATA_H_ | 6 #define CONTENT_PUBLIC_COMMON_MEDIA_METADATA_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 12 #include "content/public/common/manifest.h" | 12 #include "ui/gfx/geometry/size.h" |
| 13 #include "url/gurl.h" |
| 13 | 14 |
| 14 namespace content { | 15 namespace content { |
| 15 | 16 |
| 16 // The MediaMetadata is a structure carrying information associated to a | 17 // The MediaMetadata is a structure carrying information associated to a |
| 17 // content::MediaSession. | 18 // content::MediaSession. |
| 18 struct CONTENT_EXPORT MediaMetadata { | 19 struct CONTENT_EXPORT MediaMetadata { |
| 19 // TODO(zqzhang): move |Manifest::Icon| to a common place. See | 20 // Structure representing an MediaImage as per the MediaSession API, see: |
| 20 // https://crbug.com/621859. | 21 // https://wicg.github.io/mediasession/#dictdef-mediaimage |
| 21 using MediaImage = Manifest::Icon; | 22 struct CONTENT_EXPORT MediaImage { |
| 23 MediaImage(); |
| 24 MediaImage(const MediaImage& other); |
| 25 ~MediaImage(); |
| 26 |
| 27 bool operator==(const MediaImage& other) const; |
| 28 |
| 29 // MUST be a valid url. If an icon doesn't have a valid URL, it will not be |
| 30 // successfully parsed, thus will not be represented in the Manifest. |
| 31 GURL src; |
| 32 |
| 33 // Empty if the parsing failed or the field was not present. The type can be |
| 34 // any string and doesn't have to be a valid image MIME type at this point. |
| 35 // It is up to the consumer of the object to check if the type matches a |
| 36 // supported type. |
| 37 base::string16 type; |
| 38 |
| 39 // Empty if the parsing failed, the field was not present or empty. |
| 40 // The special value "any" is represented by gfx::Size(0, 0). |
| 41 std::vector<gfx::Size> sizes; |
| 42 }; |
| 22 | 43 |
| 23 MediaMetadata(); | 44 MediaMetadata(); |
| 24 ~MediaMetadata(); | 45 ~MediaMetadata(); |
| 25 | 46 |
| 26 MediaMetadata(const MediaMetadata& other); | 47 MediaMetadata(const MediaMetadata& other); |
| 27 | 48 |
| 28 bool operator==(const MediaMetadata& other) const; | 49 bool operator==(const MediaMetadata& other) const; |
| 29 bool operator!=(const MediaMetadata& other) const; | 50 bool operator!=(const MediaMetadata& other) const; |
| 30 | 51 |
| 31 // Title associated to the MediaSession. | 52 // Title associated to the MediaSession. |
| 32 base::string16 title; | 53 base::string16 title; |
| 33 | 54 |
| 34 // Artist associated to the MediaSession. | 55 // Artist associated to the MediaSession. |
| 35 base::string16 artist; | 56 base::string16 artist; |
| 36 | 57 |
| 37 // Album associated to the MediaSession. | 58 // Album associated to the MediaSession. |
| 38 base::string16 album; | 59 base::string16 album; |
| 39 | 60 |
| 40 // Artwork associated to the MediaSession. | 61 // Artwork associated to the MediaSession. |
| 41 std::vector<MediaImage> artwork; | 62 std::vector<MediaImage> artwork; |
| 42 }; | 63 }; |
| 43 | 64 |
| 44 } // namespace content | 65 } // namespace content |
| 45 | 66 |
| 46 #endif // CONTENT_PUBLIC_COMMON_MEDIA_METADATA_H_ | 67 #endif // CONTENT_PUBLIC_COMMON_MEDIA_METADATA_H_ |
| OLD | NEW |