Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(787)

Side by Side Diff: third_party/WebKit/Source/modules/mediasession/MediaImage.cpp

Issue 2492823003: Print console warnings when MediaSession message is dirty (Closed)
Patch Set: nit Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "modules/mediasession/MediaImage.h" 5 #include "modules/mediasession/MediaImage.h"
6 6
7 #include "core/dom/ExecutionContext.h" 7 #include "core/dom/ExecutionContext.h"
8 #include "core/inspector/ConsoleMessage.h"
8 #include "modules/mediasession/MediaImageInit.h" 9 #include "modules/mediasession/MediaImageInit.h"
10 #include "platform/weborigin/KURL.h"
11 #include "wtf/text/StringOperators.h"
9 12
10 namespace blink { 13 namespace blink {
11 14
12 // static 15 // static
13 MediaImage* MediaImage::create(ExecutionContext* context, 16 MediaImage* MediaImage::create(ExecutionContext* context,
14 const MediaImageInit& image) { 17 const MediaImageInit& image) {
15 return new MediaImage(context, image); 18 return new MediaImage(context, image);
16 } 19 }
17 20
18 MediaImage::MediaImage(ExecutionContext* context, const MediaImageInit& image) { 21 MediaImage::MediaImage(ExecutionContext* context, const MediaImageInit& image) {
19 m_src = context->completeURL(image.src()); 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 }
20 m_sizes = image.sizes(); 28 m_sizes = image.sizes();
21 m_type = image.type(); 29 m_type = image.type();
22 } 30 }
23 31
24 String MediaImage::src() const { 32 String MediaImage::src() const {
25 return m_src; 33 return m_src;
26 } 34 }
27 35
28 String MediaImage::sizes() const { 36 String MediaImage::sizes() const {
29 return m_sizes; 37 return m_sizes;
30 } 38 }
31 39
32 String MediaImage::type() const { 40 String MediaImage::type() const {
33 return m_type; 41 return m_type;
34 } 42 }
35 43
36 } // namespace blink 44 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698