| 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 "modules/mediasession/MediaImage.h" | |
| 6 | |
| 7 #include "core/dom/ExecutionContext.h" | |
| 8 #include "core/inspector/ConsoleMessage.h" | |
| 9 #include "modules/mediasession/MediaImageInit.h" | |
| 10 #include "platform/weborigin/KURL.h" | |
| 11 #include "wtf/text/StringOperators.h" | |
| 12 | |
| 13 namespace blink { | |
| 14 | |
| 15 // static | |
| 16 MediaImage* MediaImage::create(ExecutionContext* context, | |
| 17 const MediaImageInit& image) { | |
| 18 return new MediaImage(context, image); | |
| 19 } | |
| 20 | |
| 21 MediaImage::MediaImage(ExecutionContext* context, const MediaImageInit& image) { | |
| 22 m_src = context->completeURL(image.src()); | |
| 23 if (!KURL(ParsedURLString, m_src).isValid()) { | |
| 24 context->addConsoleMessage( | |
| 25 ConsoleMessage::create(JSMessageSource, WarningMessageLevel, | |
| 26 "MediaImage src is invalid: " + image.src())); | |
| 27 } | |
| 28 m_sizes = image.sizes(); | |
| 29 m_type = image.type(); | |
| 30 } | |
| 31 | |
| 32 String MediaImage::src() const { | |
| 33 return m_src; | |
| 34 } | |
| 35 | |
| 36 String MediaImage::sizes() const { | |
| 37 return m_sizes; | |
| 38 } | |
| 39 | |
| 40 String MediaImage::type() const { | |
| 41 return m_type; | |
| 42 } | |
| 43 | |
| 44 } // namespace blink | |
| OLD | NEW |