Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 457 m_playingRemotely(false), | 457 m_playingRemotely(false), |
| 458 m_inOverlayFullscreenVideo(false), | 458 m_inOverlayFullscreenVideo(false), |
| 459 m_mostlyFillingViewport(false), | 459 m_mostlyFillingViewport(false), |
| 460 m_audioTracks(this, AudioTrackList::create(*this)), | 460 m_audioTracks(this, AudioTrackList::create(*this)), |
| 461 m_videoTracks(this, VideoTrackList::create(*this)), | 461 m_videoTracks(this, VideoTrackList::create(*this)), |
| 462 m_textTracks(this, nullptr), | 462 m_textTracks(this, nullptr), |
| 463 m_audioSourceNode(nullptr), | 463 m_audioSourceNode(nullptr), |
| 464 m_autoplayUmaHelper(AutoplayUmaHelper::create(this)), | 464 m_autoplayUmaHelper(AutoplayUmaHelper::create(this)), |
| 465 m_remotePlaybackClient(nullptr), | 465 m_remotePlaybackClient(nullptr), |
| 466 m_autoplayVisibilityObserver(nullptr), | 466 m_autoplayVisibilityObserver(nullptr), |
| 467 m_mediaControls(nullptr) { | 467 m_mediaControls(nullptr), |
| 468 m_controlsList(HTMLMediaElementControlsList::create(this)) { | |
| 468 BLINK_MEDIA_LOG << "HTMLMediaElement(" << (void*)this << ")"; | 469 BLINK_MEDIA_LOG << "HTMLMediaElement(" << (void*)this << ")"; |
| 469 | 470 |
| 470 m_lockedPendingUserGesture = computeLockedPendingUserGesture(document); | 471 m_lockedPendingUserGesture = computeLockedPendingUserGesture(document); |
| 471 m_lockedPendingUserGestureIfCrossOriginExperimentEnabled = | 472 m_lockedPendingUserGestureIfCrossOriginExperimentEnabled = |
| 472 isDocumentCrossOrigin(document); | 473 isDocumentCrossOrigin(document); |
| 473 | 474 |
| 474 LocalFrame* frame = document.frame(); | 475 LocalFrame* frame = document.frame(); |
| 475 if (frame) { | 476 if (frame) { |
| 476 m_remotePlaybackClient = | 477 m_remotePlaybackClient = |
| 477 frame->loader().client()->createWebRemotePlaybackClient(*this); | 478 frame->loader().client()->createWebRemotePlaybackClient(*this); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 590 << ", srcAttr, old=" << params.oldValue | 591 << ", srcAttr, old=" << params.oldValue |
| 591 << ", new=" << params.newValue << ")"; | 592 << ", new=" << params.newValue << ")"; |
| 592 // Trigger a reload, as long as the 'src' attribute is present. | 593 // Trigger a reload, as long as the 'src' attribute is present. |
| 593 if (!params.newValue.isNull()) { | 594 if (!params.newValue.isNull()) { |
| 594 m_ignorePreloadNone = false; | 595 m_ignorePreloadNone = false; |
| 595 invokeLoadAlgorithm(); | 596 invokeLoadAlgorithm(); |
| 596 } | 597 } |
| 597 } else if (name == controlsAttr) { | 598 } else if (name == controlsAttr) { |
| 598 UseCounter::count(document(), | 599 UseCounter::count(document(), |
| 599 UseCounter::HTMLMediaElementControlsAttribute); | 600 UseCounter::HTMLMediaElementControlsAttribute); |
| 601 if (params.oldValue != params.newValue) | |
| 602 m_controlsList->setValue(params.newValue); | |
| 600 updateControlsVisibility(); | 603 updateControlsVisibility(); |
| 601 } else if (name == preloadAttr) { | 604 } else if (name == preloadAttr) { |
| 602 setPlayerPreload(); | 605 setPlayerPreload(); |
| 603 } else if (name == disableremoteplaybackAttr) { | 606 } else if (name == disableremoteplaybackAttr) { |
| 604 // This attribute is an extension described in the Remote Playback API spec. | 607 // This attribute is an extension described in the Remote Playback API spec. |
| 605 // Please see: https://w3c.github.io/remote-playback | 608 // Please see: https://w3c.github.io/remote-playback |
| 606 UseCounter::count(document(), UseCounter::DisableRemotePlaybackAttribute); | 609 UseCounter::count(document(), UseCounter::DisableRemotePlaybackAttribute); |
| 607 if (params.oldValue != params.newValue) { | 610 if (params.oldValue != params.newValue) { |
| 608 if (m_webMediaPlayer) { | 611 if (m_webMediaPlayer) { |
| 609 m_webMediaPlayer->requestRemotePlaybackDisabled( | 612 m_webMediaPlayer->requestRemotePlaybackDisabled( |
| (...skipping 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2430 if (recordMetrics == RecordMetricsBehavior::DoRecord) | 2433 if (recordMetrics == RecordMetricsBehavior::DoRecord) |
| 2431 showControlsHistogram().count(MediaControlsShowNoScript); | 2434 showControlsHistogram().count(MediaControlsShowNoScript); |
| 2432 return true; | 2435 return true; |
| 2433 } | 2436 } |
| 2434 | 2437 |
| 2435 if (recordMetrics == RecordMetricsBehavior::DoRecord) | 2438 if (recordMetrics == RecordMetricsBehavior::DoRecord) |
| 2436 showControlsHistogram().count(MediaControlsShowNotShown); | 2439 showControlsHistogram().count(MediaControlsShowNotShown); |
| 2437 return false; | 2440 return false; |
| 2438 } | 2441 } |
| 2439 | 2442 |
| 2443 DOMTokenList* HTMLMediaElement::controlsList() const { | |
| 2444 return m_controlsList.get(); | |
| 2445 } | |
| 2446 | |
| 2447 void HTMLMediaElement::controlsListValueWasSet() { | |
| 2448 // Update the attribute value which will update the controls visibility. | |
| 2449 if (fastGetAttribute(controlsAttr) != m_controlsList->value()) { | |
| 2450 setSynchronizedLazyAttribute(controlsAttr, m_controlsList->value()); | |
|
mlamouri (slow - plz ping)
2017/03/03 10:38:41
I guess this needs to be updated?
whywhat
2017/03/03 16:04:55
Yes, done.
| |
| 2451 updateControlsVisibility(); | |
| 2452 } | |
| 2453 } | |
| 2454 | |
| 2440 double HTMLMediaElement::volume() const { | 2455 double HTMLMediaElement::volume() const { |
| 2441 return m_volume; | 2456 return m_volume; |
| 2442 } | 2457 } |
| 2443 | 2458 |
| 2444 void HTMLMediaElement::setVolume(double vol, ExceptionState& exceptionState) { | 2459 void HTMLMediaElement::setVolume(double vol, ExceptionState& exceptionState) { |
| 2445 BLINK_MEDIA_LOG << "setVolume(" << (void*)this << ", " << vol << ")"; | 2460 BLINK_MEDIA_LOG << "setVolume(" << (void*)this << ", " << vol << ")"; |
| 2446 | 2461 |
| 2447 if (m_volume == vol) | 2462 if (m_volume == vol) |
| 2448 return; | 2463 return; |
| 2449 | 2464 |
| (...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3816 visitor->trace(m_textTracks); | 3831 visitor->trace(m_textTracks); |
| 3817 visitor->trace(m_textTracksWhenResourceSelectionBegan); | 3832 visitor->trace(m_textTracksWhenResourceSelectionBegan); |
| 3818 visitor->trace(m_playPromiseResolvers); | 3833 visitor->trace(m_playPromiseResolvers); |
| 3819 visitor->trace(m_playPromiseResolveList); | 3834 visitor->trace(m_playPromiseResolveList); |
| 3820 visitor->trace(m_playPromiseRejectList); | 3835 visitor->trace(m_playPromiseRejectList); |
| 3821 visitor->trace(m_audioSourceProvider); | 3836 visitor->trace(m_audioSourceProvider); |
| 3822 visitor->trace(m_autoplayUmaHelper); | 3837 visitor->trace(m_autoplayUmaHelper); |
| 3823 visitor->trace(m_srcObject); | 3838 visitor->trace(m_srcObject); |
| 3824 visitor->trace(m_autoplayVisibilityObserver); | 3839 visitor->trace(m_autoplayVisibilityObserver); |
| 3825 visitor->trace(m_mediaControls); | 3840 visitor->trace(m_mediaControls); |
| 3841 visitor->trace(m_controlsList); | |
| 3826 visitor->template registerWeakMembers<HTMLMediaElement, | 3842 visitor->template registerWeakMembers<HTMLMediaElement, |
| 3827 &HTMLMediaElement::clearWeakMembers>( | 3843 &HTMLMediaElement::clearWeakMembers>( |
| 3828 this); | 3844 this); |
| 3829 Supplementable<HTMLMediaElement>::trace(visitor); | 3845 Supplementable<HTMLMediaElement>::trace(visitor); |
| 3830 HTMLElement::trace(visitor); | 3846 HTMLElement::trace(visitor); |
| 3831 SuspendableObject::trace(visitor); | 3847 SuspendableObject::trace(visitor); |
| 3832 } | 3848 } |
| 3833 | 3849 |
| 3834 DEFINE_TRACE_WRAPPERS(HTMLMediaElement) { | 3850 DEFINE_TRACE_WRAPPERS(HTMLMediaElement) { |
| 3835 visitor->traceWrappers(m_videoTracks); | 3851 visitor->traceWrappers(m_videoTracks); |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4175 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); | 4191 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); |
| 4176 } | 4192 } |
| 4177 | 4193 |
| 4178 void HTMLMediaElement::viewportFillDebouncerTimerFired(TimerBase*) { | 4194 void HTMLMediaElement::viewportFillDebouncerTimerFired(TimerBase*) { |
| 4179 m_mostlyFillingViewport = true; | 4195 m_mostlyFillingViewport = true; |
| 4180 if (m_webMediaPlayer) | 4196 if (m_webMediaPlayer) |
| 4181 m_webMediaPlayer->becameDominantVisibleContent(m_mostlyFillingViewport); | 4197 m_webMediaPlayer->becameDominantVisibleContent(m_mostlyFillingViewport); |
| 4182 } | 4198 } |
| 4183 | 4199 |
| 4184 } // namespace blink | 4200 } // namespace blink |
| OLD | NEW |