Chromium Code Reviews| 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> | |
| 9 | |
| 10 #include "base/optional.h" | |
| 8 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 9 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 13 #include "content/public/common/manifest.h" | |
| 10 | 14 |
| 11 namespace content { | 15 namespace content { |
| 12 | 16 |
| 13 // The MediaMetadata is a structure carrying information associated to a | 17 // The MediaMetadata is a structure carrying information associated to a |
| 14 // content::MediaSession. | 18 // content::MediaSession. |
| 15 struct CONTENT_EXPORT MediaMetadata { | 19 struct CONTENT_EXPORT MediaMetadata { |
| 20 // TODO(zqzhang): move |Manifest::Icon| to a common place. | |
|
palmer
2016/06/20 21:34:21
It's good to have a crbug link.
Zhiqiang Zhang (Slow)
2016/06/21 11:08:42
Done.
| |
| 21 using Artwork = Manifest::Icon; | |
| 22 | |
| 16 MediaMetadata(); | 23 MediaMetadata(); |
| 17 ~MediaMetadata(); | 24 ~MediaMetadata(); |
| 18 | 25 |
| 19 bool operator==(const MediaMetadata& other) const; | 26 bool operator==(const MediaMetadata& other) const; |
| 20 bool operator!=(const MediaMetadata& other) const; | 27 bool operator!=(const MediaMetadata& other) const; |
| 21 | 28 |
| 29 // Apply validity checks and sanitize |artwork|. Returns null if | |
| 30 // |artwork| does not pass validity checks. | |
| 31 static base::Optional<Artwork> SanitizeArtwork(const Artwork& artwork); | |
| 32 | |
| 22 // Title associated to the MediaSession. | 33 // Title associated to the MediaSession. |
| 23 base::string16 title; | 34 base::string16 title; |
| 24 | 35 |
| 25 // Artist associated to the MediaSession. | 36 // Artist associated to the MediaSession. |
| 26 base::string16 artist; | 37 base::string16 artist; |
| 27 | 38 |
| 28 // Album associated to the MediaSession. | 39 // Album associated to the MediaSession. |
| 29 base::string16 album; | 40 base::string16 album; |
| 30 | 41 |
| 42 std::vector<Artwork> artwork; | |
|
palmer
2016/06/20 21:34:21
Nit: Since this is a vector, I might call it |artw
Zhiqiang Zhang (Slow)
2016/06/21 11:08:42
Yes. The naming here is confusing, which comes fro
| |
| 43 | |
| 31 // Maximum length for all the strings inside the MediaMetadata when it is sent | 44 // Maximum length for all the strings inside the MediaMetadata when it is sent |
| 32 // over IPC. The renderer process should truncate the strings before sending | 45 // over IPC. The renderer process should truncate the strings before sending |
| 33 // the MediaMetadata and the browser process must do the same when receiving | 46 // the MediaMetadata and the browser process must do the same when receiving |
| 34 // it. | 47 // it. |
| 35 static const size_t kMaxIPCStringLength; | 48 static const size_t kMaxIPCStringLength; |
| 49 // Maximum size of Artwork. The renderer process should remove the sizes in | |
| 50 // artwork that are out of bound before sending the MediaMetadata and the | |
| 51 // browser process must do the same when receiving it. | |
| 52 static const int kMaxIconSize; | |
| 36 }; | 53 }; |
| 37 | 54 |
| 38 } // namespace content | 55 } // namespace content |
| 39 | 56 |
| 40 #endif // CONTENT_PUBLIC_COMMON_MEDIA_METADATA_H_ | 57 #endif // CONTENT_PUBLIC_COMMON_MEDIA_METADATA_H_ |
| OLD | NEW |