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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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); |
600 updateControlsVisibility(); | 601 updateControlsVisibility(); |
| 602 } else if (name == controlslistAttr) { |
| 603 UseCounter::count(document(), |
| 604 UseCounter::HTMLMediaElementControlsListAttribute); |
| 605 if (params.oldValue != params.newValue) { |
| 606 m_controlsList->setValue(params.newValue); |
| 607 if (mediaControls()) |
| 608 mediaControls()->onControlsListUpdated(); |
| 609 } |
601 } else if (name == preloadAttr) { | 610 } else if (name == preloadAttr) { |
602 setPlayerPreload(); | 611 setPlayerPreload(); |
603 } else if (name == disableremoteplaybackAttr) { | 612 } else if (name == disableremoteplaybackAttr) { |
604 // This attribute is an extension described in the Remote Playback API spec. | 613 // This attribute is an extension described in the Remote Playback API spec. |
605 // Please see: https://w3c.github.io/remote-playback | 614 // Please see: https://w3c.github.io/remote-playback |
606 UseCounter::count(document(), UseCounter::DisableRemotePlaybackAttribute); | 615 UseCounter::count(document(), UseCounter::DisableRemotePlaybackAttribute); |
607 if (params.oldValue != params.newValue) { | 616 if (params.oldValue != params.newValue) { |
608 if (m_webMediaPlayer) { | 617 if (m_webMediaPlayer) { |
609 m_webMediaPlayer->requestRemotePlaybackDisabled( | 618 m_webMediaPlayer->requestRemotePlaybackDisabled( |
610 !params.newValue.isNull()); | 619 !params.newValue.isNull()); |
(...skipping 1819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2430 if (recordMetrics == RecordMetricsBehavior::DoRecord) | 2439 if (recordMetrics == RecordMetricsBehavior::DoRecord) |
2431 showControlsHistogram().count(MediaControlsShowNoScript); | 2440 showControlsHistogram().count(MediaControlsShowNoScript); |
2432 return true; | 2441 return true; |
2433 } | 2442 } |
2434 | 2443 |
2435 if (recordMetrics == RecordMetricsBehavior::DoRecord) | 2444 if (recordMetrics == RecordMetricsBehavior::DoRecord) |
2436 showControlsHistogram().count(MediaControlsShowNotShown); | 2445 showControlsHistogram().count(MediaControlsShowNotShown); |
2437 return false; | 2446 return false; |
2438 } | 2447 } |
2439 | 2448 |
| 2449 HTMLMediaElementControlsList* HTMLMediaElement::controlsList() const { |
| 2450 return m_controlsList.get(); |
| 2451 } |
| 2452 |
| 2453 void HTMLMediaElement::controlsListValueWasSet() { |
| 2454 if (fastGetAttribute(controlslistAttr) == m_controlsList->value()) |
| 2455 return; |
| 2456 |
| 2457 setSynchronizedLazyAttribute(controlslistAttr, m_controlsList->value()); |
| 2458 if (mediaControls()) |
| 2459 mediaControls()->onControlsListUpdated(); |
| 2460 } |
| 2461 |
2440 double HTMLMediaElement::volume() const { | 2462 double HTMLMediaElement::volume() const { |
2441 return m_volume; | 2463 return m_volume; |
2442 } | 2464 } |
2443 | 2465 |
2444 void HTMLMediaElement::setVolume(double vol, ExceptionState& exceptionState) { | 2466 void HTMLMediaElement::setVolume(double vol, ExceptionState& exceptionState) { |
2445 BLINK_MEDIA_LOG << "setVolume(" << (void*)this << ", " << vol << ")"; | 2467 BLINK_MEDIA_LOG << "setVolume(" << (void*)this << ", " << vol << ")"; |
2446 | 2468 |
2447 if (m_volume == vol) | 2469 if (m_volume == vol) |
2448 return; | 2470 return; |
2449 | 2471 |
(...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3816 visitor->trace(m_textTracks); | 3838 visitor->trace(m_textTracks); |
3817 visitor->trace(m_textTracksWhenResourceSelectionBegan); | 3839 visitor->trace(m_textTracksWhenResourceSelectionBegan); |
3818 visitor->trace(m_playPromiseResolvers); | 3840 visitor->trace(m_playPromiseResolvers); |
3819 visitor->trace(m_playPromiseResolveList); | 3841 visitor->trace(m_playPromiseResolveList); |
3820 visitor->trace(m_playPromiseRejectList); | 3842 visitor->trace(m_playPromiseRejectList); |
3821 visitor->trace(m_audioSourceProvider); | 3843 visitor->trace(m_audioSourceProvider); |
3822 visitor->trace(m_autoplayUmaHelper); | 3844 visitor->trace(m_autoplayUmaHelper); |
3823 visitor->trace(m_srcObject); | 3845 visitor->trace(m_srcObject); |
3824 visitor->trace(m_autoplayVisibilityObserver); | 3846 visitor->trace(m_autoplayVisibilityObserver); |
3825 visitor->trace(m_mediaControls); | 3847 visitor->trace(m_mediaControls); |
| 3848 visitor->trace(m_controlsList); |
3826 visitor->template registerWeakMembers<HTMLMediaElement, | 3849 visitor->template registerWeakMembers<HTMLMediaElement, |
3827 &HTMLMediaElement::clearWeakMembers>( | 3850 &HTMLMediaElement::clearWeakMembers>( |
3828 this); | 3851 this); |
3829 Supplementable<HTMLMediaElement>::trace(visitor); | 3852 Supplementable<HTMLMediaElement>::trace(visitor); |
3830 HTMLElement::trace(visitor); | 3853 HTMLElement::trace(visitor); |
3831 SuspendableObject::trace(visitor); | 3854 SuspendableObject::trace(visitor); |
3832 } | 3855 } |
3833 | 3856 |
3834 DEFINE_TRACE_WRAPPERS(HTMLMediaElement) { | 3857 DEFINE_TRACE_WRAPPERS(HTMLMediaElement) { |
3835 visitor->traceWrappers(m_videoTracks); | 3858 visitor->traceWrappers(m_videoTracks); |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4175 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); | 4198 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); |
4176 } | 4199 } |
4177 | 4200 |
4178 void HTMLMediaElement::viewportFillDebouncerTimerFired(TimerBase*) { | 4201 void HTMLMediaElement::viewportFillDebouncerTimerFired(TimerBase*) { |
4179 m_mostlyFillingViewport = true; | 4202 m_mostlyFillingViewport = true; |
4180 if (m_webMediaPlayer) | 4203 if (m_webMediaPlayer) |
4181 m_webMediaPlayer->becameDominantVisibleContent(m_mostlyFillingViewport); | 4204 m_webMediaPlayer->becameDominantVisibleContent(m_mostlyFillingViewport); |
4182 } | 4205 } |
4183 | 4206 |
4184 } // namespace blink | 4207 } // namespace blink |
OLD | NEW |