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

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

Issue 1118613002: Hook up Android closed captions 'enabled' setting to Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed comments from tkent 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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 { 368 {
369 ASSERT(RuntimeEnabledFeatures::mediaEnabled()); 369 ASSERT(RuntimeEnabledFeatures::mediaEnabled());
370 370
371 WTF_LOG(Media, "HTMLMediaElement::HTMLMediaElement(%p)", this); 371 WTF_LOG(Media, "HTMLMediaElement::HTMLMediaElement(%p)", this);
372 372
373 if (document.settings() && document.settings()->mediaPlaybackRequiresUserGes ture()) 373 if (document.settings() && document.settings()->mediaPlaybackRequiresUserGes ture())
374 m_userGestureRequiredForPlay = true; 374 m_userGestureRequiredForPlay = true;
375 375
376 setHasCustomStyleCallbacks(); 376 setHasCustomStyleCallbacks();
377 addElementToDocumentMap(this, &document); 377 addElementToDocumentMap(this, &document);
378
379 #if OS(ANDROID)
380 // The OS setting for closed captions state is only available on Android, iO S
381 // and OSX. Set closed captions visibility based on OS text tracks state onl y if the platform
382 // is Android because the setting is currently only plumbed down on Android.
383 Settings* settings = document.settings();
384 if (settings)
385 m_closedCaptionsVisible = settings->textTracksEnabled();
386 #endif
378 } 387 }
379 388
380 HTMLMediaElement::~HTMLMediaElement() 389 HTMLMediaElement::~HTMLMediaElement()
381 { 390 {
382 WTF_LOG(Media, "HTMLMediaElement::~HTMLMediaElement(%p)", this); 391 WTF_LOG(Media, "HTMLMediaElement::~HTMLMediaElement(%p)", this);
383 392
384 #if ENABLE(OILPAN) 393 #if ENABLE(OILPAN)
385 // If the HTMLMediaElement dies with the document we are not 394 // If the HTMLMediaElement dies with the document we are not
386 // allowed to touch the document to adjust delay load event counts 395 // allowed to touch the document to adjust delay load event counts
387 // because the document could have been already 396 // because the document could have been already
(...skipping 3002 matching lines...) Expand 10 before | Expand all | Expand 10 after
3390 break; 3399 break;
3391 } 3400 }
3392 } 3401 }
3393 3402
3394 if (assumption == AssumeNoVisibleChange 3403 if (assumption == AssumeNoVisibleChange
3395 && m_haveVisibleTextTrack == haveVisibleTextTrack) { 3404 && m_haveVisibleTextTrack == haveVisibleTextTrack) {
3396 cueTimeline().updateActiveCues(currentTime()); 3405 cueTimeline().updateActiveCues(currentTime());
3397 return; 3406 return;
3398 } 3407 }
3399 m_haveVisibleTextTrack = haveVisibleTextTrack; 3408 m_haveVisibleTextTrack = haveVisibleTextTrack;
3409
3410 #if !OS(ANDROID)
3400 m_closedCaptionsVisible = m_haveVisibleTextTrack; 3411 m_closedCaptionsVisible = m_haveVisibleTextTrack;
3412 #else
3413 // Set closed captions visible during initial load only if the video has a
3414 // visible text track and when the android platform closed captions are enab led.
3415 Settings* settings = document().settings();
3416 if (settings)
3417 m_closedCaptionsVisible = m_haveVisibleTextTrack && settings->textTracks Enabled();
3418 #endif
3401 3419
3402 if (!m_haveVisibleTextTrack && !mediaControls()) 3420 if (!m_haveVisibleTextTrack && !mediaControls())
3403 return; 3421 return;
3404 3422
3405 if (mediaControls()) 3423 if (mediaControls())
3406 mediaControls()->changedClosedCaptionsVisibility(); 3424 mediaControls()->changedClosedCaptionsVisibility();
3407 3425
3408 cueTimeline().updateActiveCues(currentTime()); 3426 cueTimeline().updateActiveCues(currentTime());
3409 3427
3410 // Note: The "time marches on" algorithm (updateActiveCues) runs the "rules 3428 // Note: The "time marches on" algorithm (updateActiveCues) runs the "rules
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
3665 3683
3666 #if ENABLE(WEB_AUDIO) 3684 #if ENABLE(WEB_AUDIO)
3667 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) 3685 void HTMLMediaElement::clearWeakMembers(Visitor* visitor)
3668 { 3686 {
3669 if (!visitor->isHeapObjectAlive(m_audioSourceNode) && audioSourceProvider()) 3687 if (!visitor->isHeapObjectAlive(m_audioSourceNode) && audioSourceProvider())
3670 audioSourceProvider()->setClient(nullptr); 3688 audioSourceProvider()->setClient(nullptr);
3671 } 3689 }
3672 #endif 3690 #endif
3673 3691
3674 } 3692 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698