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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp

Issue 1079323002: Support text track selection in video controls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments from fs Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 , m_shouldDelayLoadEvent(false) 321 , m_shouldDelayLoadEvent(false)
322 , m_haveFiredLoadedData(false) 322 , m_haveFiredLoadedData(false)
323 , m_autoplaying(true) 323 , m_autoplaying(true)
324 , m_muted(false) 324 , m_muted(false)
325 , m_paused(true) 325 , m_paused(true)
326 , m_seeking(false) 326 , m_seeking(false)
327 , m_sentStalledEvent(false) 327 , m_sentStalledEvent(false)
328 , m_sentEndEvent(false) 328 , m_sentEndEvent(false)
329 , m_closedCaptionsVisible(false) 329 , m_closedCaptionsVisible(false)
330 , m_havePreparedToPlay(false) 330 , m_havePreparedToPlay(false)
331 , m_didPerformAutomaticTrackSelection(false)
331 , m_tracksAreReady(true) 332 , m_tracksAreReady(true)
332 , m_processingPreferenceChange(false) 333 , m_processingPreferenceChange(false)
333 , m_remoteRoutesAvailable(false) 334 , m_remoteRoutesAvailable(false)
334 , m_playingRemotely(false) 335 , m_playingRemotely(false)
335 , m_isFinalizing(false) 336 , m_isFinalizing(false)
336 , m_initialPlayWithoutUserGesture(false) 337 , m_initialPlayWithoutUserGesture(false)
337 , m_autoplayMediaCounted(false) 338 , m_autoplayMediaCounted(false)
338 , m_inOverlayFullscreenVideo(false) 339 , m_inOverlayFullscreenVideo(false)
339 , m_audioTracks(AudioTrackList::create(*this)) 340 , m_audioTracks(AudioTrackList::create(*this))
340 , m_videoTracks(VideoTrackList::create(*this)) 341 , m_videoTracks(VideoTrackList::create(*this))
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 // Mark this track as "configured" so configureTextTracks won't change the m ode again. 1167 // Mark this track as "configured" so configureTextTracks won't change the m ode again.
1167 if (track->trackType() == TextTrack::TrackElement) 1168 if (track->trackType() == TextTrack::TrackElement)
1168 track->setHasBeenConfigured(true); 1169 track->setHasBeenConfigured(true);
1169 1170
1170 configureTextTrackDisplay(); 1171 configureTextTrackDisplay();
1171 1172
1172 ASSERT(textTracks()->contains(track)); 1173 ASSERT(textTracks()->contains(track));
1173 textTracks()->scheduleChangeEvent(); 1174 textTracks()->scheduleChangeEvent();
1174 } 1175 }
1175 1176
1177 void HTMLMediaElement::disableAutomaticTextTrackSelection()
1178 {
1179 m_didPerformAutomaticTrackSelection = true;
philipj_slow 2016/03/01 13:01:16 This is a bit of a lie, automatic track selection
srivats 2016/03/30 00:46:42 Done.
1180 }
1181
1176 bool HTMLMediaElement::isSafeToLoadURL(const KURL& url, InvalidURLAction actionI fInvalid) 1182 bool HTMLMediaElement::isSafeToLoadURL(const KURL& url, InvalidURLAction actionI fInvalid)
1177 { 1183 {
1178 if (!url.isValid()) { 1184 if (!url.isValid()) {
1179 WTF_LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%p, %s) -> FALSE becau se url is invalid", this, urlForLoggingMedia(url).utf8().data()); 1185 WTF_LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%p, %s) -> FALSE becau se url is invalid", this, urlForLoggingMedia(url).utf8().data());
1180 return false; 1186 return false;
1181 } 1187 }
1182 1188
1183 LocalFrame* frame = document().frame(); 1189 LocalFrame* frame = document().frame();
1184 if (!frame || !document().securityOrigin()->canDisplay(url)) { 1190 if (!frame || !document().securityOrigin()->canDisplay(url)) {
1185 if (actionIfInvalid == Complain) 1191 if (actionIfInvalid == Complain)
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after
2490 size_t index = m_textTracksWhenResourceSelectionBegan.find(textTrack); 2496 size_t index = m_textTracksWhenResourceSelectionBegan.find(textTrack);
2491 if (index != kNotFound) 2497 if (index != kNotFound)
2492 m_textTracksWhenResourceSelectionBegan.remove(index); 2498 m_textTracksWhenResourceSelectionBegan.remove(index);
2493 } 2499 }
2494 2500
2495 void HTMLMediaElement::honorUserPreferencesForAutomaticTextTrackSelection() 2501 void HTMLMediaElement::honorUserPreferencesForAutomaticTextTrackSelection()
2496 { 2502 {
2497 if (!m_textTracks || !m_textTracks->length()) 2503 if (!m_textTracks || !m_textTracks->length())
2498 return; 2504 return;
2499 2505
2506 if (m_didPerformAutomaticTrackSelection)
2507 return;
2508
2500 AutomaticTrackSelection::Configuration configuration; 2509 AutomaticTrackSelection::Configuration configuration;
2501 if (m_processingPreferenceChange) 2510 if (m_processingPreferenceChange)
2502 configuration.disableCurrentlyEnabledTracks = true; 2511 configuration.disableCurrentlyEnabledTracks = true;
2503 if (m_closedCaptionsVisible) 2512 if (m_closedCaptionsVisible)
2504 configuration.forceEnableSubtitleOrCaptionTrack = true; 2513 configuration.forceEnableSubtitleOrCaptionTrack = true;
2505 2514
2506 Settings* settings = document().settings(); 2515 Settings* settings = document().settings();
2507 if (settings) 2516 if (settings)
2508 configuration.textTrackKindUserPreference = settings->textTrackKindUserP reference(); 2517 configuration.textTrackKindUserPreference = settings->textTrackKindUserP reference();
2509 2518
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after
3628 { 3637 {
3629 visitor->trace(m_client); 3638 visitor->trace(m_client);
3630 } 3639 }
3631 3640
3632 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) 3641 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl)
3633 { 3642 {
3634 visitor->trace(m_client); 3643 visitor->trace(m_client);
3635 } 3644 }
3636 3645
3637 } // namespace blink 3646 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698