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

Unified Diff: third_party/WebKit/Source/core/html/shadow/MediaControlsMediaEventListener.cpp

Issue 2539023002: Media Controls: Use events to update controls for closed captions. (Closed)
Patch Set: ready for review Created 4 years 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/shadow/MediaControlsMediaEventListener.cpp
diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControlsMediaEventListener.cpp b/third_party/WebKit/Source/core/html/shadow/MediaControlsMediaEventListener.cpp
index 154591d58a1b3a10bdccae55c949efae85858152..c9da64a9860dea386cd8e284c72a5e5b96d7d9d4 100644
--- a/third_party/WebKit/Source/core/html/shadow/MediaControlsMediaEventListener.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/MediaControlsMediaEventListener.cpp
@@ -7,6 +7,7 @@
#include "core/events/Event.h"
#include "core/html/HTMLMediaElement.h"
#include "core/html/shadow/MediaControls.h"
+#include "core/html/track/TextTrackList.h"
namespace blink {
@@ -23,6 +24,12 @@ MediaControlsMediaEventListener::MediaControlsMediaEventListener(
false);
m_mediaControls->m_mediaElement->addEventListener(EventTypeNames::pause, this,
false);
+
+ // TextTracks events.
+ TextTrackList* textTracks = m_mediaControls->m_mediaElement->textTracks();
+ textTracks->addEventListener(EventTypeNames::addtrack, this, false);
+ textTracks->addEventListener(EventTypeNames::change, this, false);
+ textTracks->addEventListener(EventTypeNames::removetrack, this, false);
}
bool MediaControlsMediaEventListener::operator==(
@@ -54,6 +61,17 @@ void MediaControlsMediaEventListener::handleEvent(
return;
}
+ // TextTracks events.
+ if (event->type() == EventTypeNames::addtrack ||
+ event->type() == EventTypeNames::removetrack) {
+ m_mediaControls->onTextTracksAddedRemoved();
+ return;
+ }
+ if (event->type() == EventTypeNames::change) {
+ m_mediaControls->onTextTracksChanged();
+ return;
+ }
+
NOTREACHED();
}

Powered by Google App Engine
This is Rietveld 408576698