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

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

Issue 2456993003: Improve caption button behavior for video player. (Closed)
Patch Set: Label string Created 4 years, 2 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/shadow/MediaControls.cpp
diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp b/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
index 9652b7e9ef2c5f24ffaaa634bc31ec9b6efccb3d..c5442303a5b4f54eef0020067b6a713ff0c840a8 100644
--- a/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
@@ -34,6 +34,7 @@
#include "core/html/HTMLMediaElement.h"
#include "core/html/shadow/MediaControlsWindowEventListener.h"
#include "core/html/track/TextTrackContainer.h"
+#include "core/html/track/TextTrackList.h"
#include "core/layout/LayoutObject.h"
#include "core/layout/LayoutTheme.h"
#include "platform/EventDispatchForbiddenScope.h"
@@ -556,6 +557,23 @@ void MediaControls::toggleTextTrackList() {
m_textTrackList->setVisible(!m_textTrackList->isWanted());
}
+void MediaControls::showTextTrackAtIndex(TextTrackList* trackList,
+ unsigned indexToEnable) {
+ if (indexToEnable >= trackList->length())
+ return;
+ TextTrack* track = trackList->anonymousIndexedGetter(indexToEnable);
+ if (track && track->canBeRendered())
+ track->setMode(TextTrack::showingKeyword());
+}
+
+void MediaControls::disableShowingTextTracks(TextTrackList* trackList) {
+ for (unsigned i = 0; i < trackList->length(); ++i) {
+ TextTrack* track = trackList->anonymousIndexedGetter(i);
+ if (track->mode() == TextTrack::showingKeyword())
+ track->setMode(TextTrack::disabledKeyword());
+ }
+}
+
void MediaControls::refreshCastButtonVisibility() {
refreshCastButtonVisibilityWithoutUpdate();
BatchedControlUpdate batch(this);

Powered by Google App Engine
This is Rietveld 408576698