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

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: Merge Blink repo changes and addressed comments from philipj and UX Created 4 years, 10 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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 , m_haveFiredLoadedData(false) 316 , m_haveFiredLoadedData(false)
317 , m_autoplaying(true) 317 , m_autoplaying(true)
318 , m_muted(false) 318 , m_muted(false)
319 , m_paused(true) 319 , m_paused(true)
320 , m_seeking(false) 320 , m_seeking(false)
321 , m_sentStalledEvent(false) 321 , m_sentStalledEvent(false)
322 , m_sentEndEvent(false) 322 , m_sentEndEvent(false)
323 , m_closedCaptionsVisible(false) 323 , m_closedCaptionsVisible(false)
324 , m_completelyLoaded(false) 324 , m_completelyLoaded(false)
325 , m_havePreparedToPlay(false) 325 , m_havePreparedToPlay(false)
326 , m_didPerformAutomaticTrackSelection(false)
326 , m_tracksAreReady(true) 327 , m_tracksAreReady(true)
327 , m_haveVisibleTextTrack(false) 328 , m_haveVisibleTextTrack(false)
328 , m_processingPreferenceChange(false) 329 , m_processingPreferenceChange(false)
329 , m_remoteRoutesAvailable(false) 330 , m_remoteRoutesAvailable(false)
330 , m_playingRemotely(false) 331 , m_playingRemotely(false)
331 , m_isFinalizing(false) 332 , m_isFinalizing(false)
332 , m_initialPlayWithoutUserGesture(false) 333 , m_initialPlayWithoutUserGesture(false)
333 , m_autoplayMediaCounted(false) 334 , m_autoplayMediaCounted(false)
334 , m_inOverlayFullscreenVideo(false) 335 , m_inOverlayFullscreenVideo(false)
335 , m_audioTracks(AudioTrackList::create(*this)) 336 , m_audioTracks(AudioTrackList::create(*this))
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 // Mark this track as "configured" so configureTextTracks won't change the m ode again. 1162 // Mark this track as "configured" so configureTextTracks won't change the m ode again.
1162 if (track->trackType() == TextTrack::TrackElement) 1163 if (track->trackType() == TextTrack::TrackElement)
1163 track->setHasBeenConfigured(true); 1164 track->setHasBeenConfigured(true);
1164 1165
1165 configureTextTrackDisplay(); 1166 configureTextTrackDisplay();
1166 1167
1167 ASSERT(textTracks()->contains(track)); 1168 ASSERT(textTracks()->contains(track));
1168 textTracks()->scheduleChangeEvent(); 1169 textTracks()->scheduleChangeEvent();
1169 } 1170 }
1170 1171
1172 void HTMLMediaElement::disableAutomaticTextTrackSelection()
1173 {
1174 m_didPerformAutomaticTrackSelection = true;
1175 }
1176
1171 bool HTMLMediaElement::isSafeToLoadURL(const KURL& url, InvalidURLAction actionI fInvalid) 1177 bool HTMLMediaElement::isSafeToLoadURL(const KURL& url, InvalidURLAction actionI fInvalid)
1172 { 1178 {
1173 if (!url.isValid()) { 1179 if (!url.isValid()) {
1174 WTF_LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%p, %s) -> FALSE becau se url is invalid", this, urlForLoggingMedia(url).utf8().data()); 1180 WTF_LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%p, %s) -> FALSE becau se url is invalid", this, urlForLoggingMedia(url).utf8().data());
1175 return false; 1181 return false;
1176 } 1182 }
1177 1183
1178 LocalFrame* frame = document().frame(); 1184 LocalFrame* frame = document().frame();
1179 if (!frame || !document().securityOrigin()->canDisplay(url)) { 1185 if (!frame || !document().securityOrigin()->canDisplay(url)) {
1180 if (actionIfInvalid == Complain) 1186 if (actionIfInvalid == Complain)
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after
2487 size_t index = m_textTracksWhenResourceSelectionBegan.find(textTrack); 2493 size_t index = m_textTracksWhenResourceSelectionBegan.find(textTrack);
2488 if (index != kNotFound) 2494 if (index != kNotFound)
2489 m_textTracksWhenResourceSelectionBegan.remove(index); 2495 m_textTracksWhenResourceSelectionBegan.remove(index);
2490 } 2496 }
2491 2497
2492 void HTMLMediaElement::honorUserPreferencesForAutomaticTextTrackSelection() 2498 void HTMLMediaElement::honorUserPreferencesForAutomaticTextTrackSelection()
2493 { 2499 {
2494 if (!m_textTracks || !m_textTracks->length()) 2500 if (!m_textTracks || !m_textTracks->length())
2495 return; 2501 return;
2496 2502
2503 if (m_didPerformAutomaticTrackSelection)
2504 return;
2505
2497 AutomaticTrackSelection::Configuration configuration; 2506 AutomaticTrackSelection::Configuration configuration;
2498 if (m_processingPreferenceChange) 2507 if (m_processingPreferenceChange)
2499 configuration.disableCurrentlyEnabledTracks = true; 2508 configuration.disableCurrentlyEnabledTracks = true;
2500 if (m_closedCaptionsVisible) 2509 if (m_closedCaptionsVisible)
2501 configuration.forceEnableSubtitleOrCaptionTrack = true; 2510 configuration.forceEnableSubtitleOrCaptionTrack = true;
2502 2511
2503 Settings* settings = document().settings(); 2512 Settings* settings = document().settings();
2504 if (settings) 2513 if (settings)
2505 configuration.textTrackKindUserPreference = settings->textTrackKindUserP reference(); 2514 configuration.textTrackKindUserPreference = settings->textTrackKindUserP reference();
2506 2515
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after
3624 { 3633 {
3625 visitor->trace(m_client); 3634 visitor->trace(m_client);
3626 } 3635 }
3627 3636
3628 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) 3637 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl)
3629 { 3638 {
3630 visitor->trace(m_client); 3639 visitor->trace(m_client);
3631 } 3640 }
3632 3641
3633 } // namespace blink 3642 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698