Chromium Code Reviews| Index: third_party/WebKit/Source/modules/mediasession/MediaMetadataSanitizer.cpp |
| diff --git a/third_party/WebKit/Source/modules/mediasession/MediaMetadataSanitizer.cpp b/third_party/WebKit/Source/modules/mediasession/MediaMetadataSanitizer.cpp |
| index d079eee2b1ddafbcfd7352b4ba301eb445d67e11..86b86b04884227de53ad9db5075816ada96a5c03 100644 |
| --- a/third_party/WebKit/Source/modules/mediasession/MediaMetadataSanitizer.cpp |
| +++ b/third_party/WebKit/Source/modules/mediasession/MediaMetadataSanitizer.cpp |
| @@ -59,21 +59,19 @@ bool checkMediaImageSrcSanity(const KURL& src, ExecutionContext* context) { |
| // Sanitize MediaImage and do mojo serialization. Returns null when |
| // |image.src()| is bad. |
| blink::mojom::blink::MediaImagePtr sanitizeMediaImageAndConvertToMojo( |
| - const MediaImage* image, |
| + const MediaImage& image, |
| ExecutionContext* context) { |
| - DCHECK(image); |
| - |
| blink::mojom::blink::MediaImagePtr mojoImage; |
| - KURL url = KURL(ParsedURLString, image->src()); |
| + KURL url = KURL(ParsedURLString, image.src()); |
|
Zhiqiang Zhang (Slow)
2017/01/04 16:05:24
Resolve to absolute URL if we decide to do it here
mlamouri (slow - plz ping)
2017/01/05 15:40:20
I did it when we set. Though, this code assumes it
|
| if (!checkMediaImageSrcSanity(url, context)) |
| return mojoImage; |
| mojoImage = blink::mojom::blink::MediaImage::New(); |
| mojoImage->src = url; |
| - mojoImage->type = image->type().left(kMaxImageTypeLength); |
| + mojoImage->type = image.type().left(kMaxImageTypeLength); |
| for (const auto& webSize : |
| - WebIconSizesParser::parseIconSizes(image->sizes())) { |
| + WebIconSizesParser::parseIconSizes(image.sizes())) { |
| mojoImage->sizes.append(webSize); |
| if (mojoImage->sizes.size() == kMaxNumberOfImageSizes) { |
| context->addConsoleMessage(ConsoleMessage::create( |
| @@ -101,9 +99,9 @@ MediaMetadataSanitizer::sanitizeAndConvertToMojo(const MediaMetadata* metadata, |
| mojoMetadata->artist = metadata->artist().left(kMaxStringLength); |
| mojoMetadata->album = metadata->album().left(kMaxStringLength); |
| - for (const auto image : metadata->artwork()) { |
| + for (const MediaImage& image : metadata->artwork()) { |
| blink::mojom::blink::MediaImagePtr mojoImage = |
| - sanitizeMediaImageAndConvertToMojo(image.get(), context); |
| + sanitizeMediaImageAndConvertToMojo(image, context); |
| if (!mojoImage.is_null()) |
| mojoMetadata->artwork.append(std::move(mojoImage)); |
| if (mojoMetadata->artwork.size() == kMaxNumberOfMediaImages) { |