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

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

Issue 1082533002: Support text track selection in video controls (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 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 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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 , m_haveFiredLoadedData(false) 342 , m_haveFiredLoadedData(false)
343 , m_autoplaying(true) 343 , m_autoplaying(true)
344 , m_muted(false) 344 , m_muted(false)
345 , m_paused(true) 345 , m_paused(true)
346 , m_seeking(false) 346 , m_seeking(false)
347 , m_sentStalledEvent(false) 347 , m_sentStalledEvent(false)
348 , m_sentEndEvent(false) 348 , m_sentEndEvent(false)
349 , m_closedCaptionsVisible(false) 349 , m_closedCaptionsVisible(false)
350 , m_completelyLoaded(false) 350 , m_completelyLoaded(false)
351 , m_havePreparedToPlay(false) 351 , m_havePreparedToPlay(false)
352 , m_didPerformAutomaticTrackSelection(false)
352 , m_tracksAreReady(true) 353 , m_tracksAreReady(true)
353 , m_haveVisibleTextTrack(false) 354 , m_haveVisibleTextTrack(false)
354 , m_processingPreferenceChange(false) 355 , m_processingPreferenceChange(false)
355 , m_remoteRoutesAvailable(false) 356 , m_remoteRoutesAvailable(false)
356 , m_playingRemotely(false) 357 , m_playingRemotely(false)
357 #if ENABLE(OILPAN) 358 #if ENABLE(OILPAN)
358 , m_isFinalizing(false) 359 , m_isFinalizing(false)
359 , m_closeMediaSourceWhenFinalizing(false) 360 , m_closeMediaSourceWhenFinalizing(false)
360 #endif 361 #endif
361 , m_initialPlayWithoutUserGestures(false) 362 , m_initialPlayWithoutUserGestures(false)
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 // Mark this track as "configured" so configureTextTracks won't change the m ode again. 1161 // Mark this track as "configured" so configureTextTracks won't change the m ode again.
1161 if (track->trackType() == TextTrack::TrackElement) 1162 if (track->trackType() == TextTrack::TrackElement)
1162 track->setHasBeenConfigured(true); 1163 track->setHasBeenConfigured(true);
1163 1164
1164 configureTextTrackDisplay(AssumeVisibleChange); 1165 configureTextTrackDisplay(AssumeVisibleChange);
1165 1166
1166 ASSERT(textTracks()->contains(track)); 1167 ASSERT(textTracks()->contains(track));
1167 textTracks()->scheduleChangeEvent(); 1168 textTracks()->scheduleChangeEvent();
1168 } 1169 }
1169 1170
1171 void HTMLMediaElement::disableAutomaticTextTrackSelection()
1172 {
1173 m_didPerformAutomaticTrackSelection = true;
1174 }
1175
1170 bool HTMLMediaElement::isSafeToLoadURL(const KURL& url, InvalidURLAction actionI fInvalid) 1176 bool HTMLMediaElement::isSafeToLoadURL(const KURL& url, InvalidURLAction actionI fInvalid)
1171 { 1177 {
1172 if (!url.isValid()) { 1178 if (!url.isValid()) {
1173 WTF_LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%p, %s) -> FALSE becau se url is invalid", this, urlForLoggingMedia(url).utf8().data()); 1179 WTF_LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%p, %s) -> FALSE becau se url is invalid", this, urlForLoggingMedia(url).utf8().data());
1174 return false; 1180 return false;
1175 } 1181 }
1176 1182
1177 LocalFrame* frame = document().frame(); 1183 LocalFrame* frame = document().frame();
1178 if (!frame || !document().securityOrigin()->canDisplay(url)) { 1184 if (!frame || !document().securityOrigin()->canDisplay(url)) {
1179 if (actionIfInvalid == Complain) 1185 if (actionIfInvalid == Complain)
(...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after
2474 size_t index = m_textTracksWhenResourceSelectionBegan.find(textTrack.get()); 2480 size_t index = m_textTracksWhenResourceSelectionBegan.find(textTrack.get());
2475 if (index != kNotFound) 2481 if (index != kNotFound)
2476 m_textTracksWhenResourceSelectionBegan.remove(index); 2482 m_textTracksWhenResourceSelectionBegan.remove(index);
2477 } 2483 }
2478 2484
2479 void HTMLMediaElement::honorUserPreferencesForAutomaticTextTrackSelection() 2485 void HTMLMediaElement::honorUserPreferencesForAutomaticTextTrackSelection()
2480 { 2486 {
2481 if (!m_textTracks || !m_textTracks->length()) 2487 if (!m_textTracks || !m_textTracks->length())
2482 return; 2488 return;
2483 2489
2490 if (m_didPerformAutomaticTrackSelection)
2491 return;
2492
2484 AutomaticTrackSelection::Configuration configuration; 2493 AutomaticTrackSelection::Configuration configuration;
2485 if (m_processingPreferenceChange) 2494 if (m_processingPreferenceChange)
2486 configuration.disableCurrentlyEnabledTracks = true; 2495 configuration.disableCurrentlyEnabledTracks = true;
2487 if (m_closedCaptionsVisible) 2496 if (m_closedCaptionsVisible)
2488 configuration.forceEnableSubtitleOrCaptionTrack = true; 2497 configuration.forceEnableSubtitleOrCaptionTrack = true;
2489 2498
2490 AutomaticTrackSelection trackSelection(configuration); 2499 AutomaticTrackSelection trackSelection(configuration);
2491 trackSelection.perform(*m_textTracks); 2500 trackSelection.perform(*m_textTracks);
2492 2501
2493 textTracksChanged(); 2502 textTracksChanged();
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after
3659 3668
3660 #if ENABLE(WEB_AUDIO) 3669 #if ENABLE(WEB_AUDIO)
3661 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) 3670 void HTMLMediaElement::clearWeakMembers(Visitor* visitor)
3662 { 3671 {
3663 if (!visitor->isHeapObjectAlive(m_audioSourceNode) && audioSourceProvider()) 3672 if (!visitor->isHeapObjectAlive(m_audioSourceNode) && audioSourceProvider())
3664 audioSourceProvider()->setClient(nullptr); 3673 audioSourceProvider()->setClient(nullptr);
3665 } 3674 }
3666 #endif 3675 #endif
3667 3676
3668 } 3677 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698