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

Unified Diff: third_party/WebKit/Source/core/html/track/InbandTextTrack.cpp

Issue 1973343002: Clean up HTMLTrackElement.kind invalid/missing value default handling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/track/InbandTextTrack.cpp
diff --git a/third_party/WebKit/Source/core/html/track/InbandTextTrack.cpp b/third_party/WebKit/Source/core/html/track/InbandTextTrack.cpp
index ebc5f73ad3836605a5ece0ba6ecb185807c26c94..78cb2b7acb87945e1617735e8350e11fa85c25b1 100644
--- a/third_party/WebKit/Source/core/html/track/InbandTextTrack.cpp
+++ b/third_party/WebKit/Source/core/html/track/InbandTextTrack.cpp
@@ -25,51 +25,51 @@
#include "core/html/track/InbandTextTrack.h"
-#include "bindings/core/v8/ExceptionStatePlaceholder.h"
#include "core/html/HTMLMediaElement.h"
#include "core/html/track/vtt/VTTCue.h"
-#include "platform/Logging.h"
#include "public/platform/WebInbandTextTrack.h"
#include "public/platform/WebString.h"
-#include <math.h>
using blink::WebInbandTextTrack;
using blink::WebString;
namespace blink {
-InbandTextTrack* InbandTextTrack::create(WebInbandTextTrack* webTrack)
-{
- return new InbandTextTrack(webTrack);
-}
+namespace {
-InbandTextTrack::InbandTextTrack(WebInbandTextTrack* webTrack)
- : TextTrack(subtitlesKeyword(), webTrack->label(), webTrack->language(), webTrack->id(), InBand)
- , m_webTrack(webTrack)
+const AtomicString& textTrackKindToString(WebInbandTextTrack::Kind kind)
{
- m_webTrack->setClient(this);
-
- switch (m_webTrack->kind()) {
+ switch (kind) {
case WebInbandTextTrack::KindSubtitles:
- setKind(TextTrack::subtitlesKeyword());
- break;
+ return TextTrack::subtitlesKeyword();
case WebInbandTextTrack::KindCaptions:
- setKind(TextTrack::captionsKeyword());
- break;
+ return TextTrack::captionsKeyword();
case WebInbandTextTrack::KindDescriptions:
- setKind(TextTrack::descriptionsKeyword());
- break;
+ return TextTrack::descriptionsKeyword();
case WebInbandTextTrack::KindChapters:
- setKind(TextTrack::chaptersKeyword());
- break;
+ return TextTrack::chaptersKeyword();
case WebInbandTextTrack::KindMetadata:
- setKind(TextTrack::metadataKeyword());
- break;
+ return TextTrack::metadataKeyword();
case WebInbandTextTrack::KindNone:
default:
- ASSERT_NOT_REACHED();
break;
}
+ ASSERT_NOT_REACHED();
+ return TextTrack::subtitlesKeyword();
+}
+
+} // namespace
+
+InbandTextTrack* InbandTextTrack::create(WebInbandTextTrack* webTrack)
+{
+ return new InbandTextTrack(webTrack);
+}
+
+InbandTextTrack::InbandTextTrack(WebInbandTextTrack* webTrack)
+ : TextTrack(textTrackKindToString(webTrack->kind()), webTrack->label(), webTrack->language(), webTrack->id(), InBand)
+ , m_webTrack(webTrack)
+{
+ m_webTrack->setClient(this);
}
InbandTextTrack::~InbandTextTrack()
« no previous file with comments | « third_party/WebKit/Source/core/html/track/AudioTrack.cpp ('k') | third_party/WebKit/Source/core/html/track/TextTrack.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698