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

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

Issue 2657723002: [Blink, Media] Added controlsList to HTMLMediaElement (Closed)
Patch Set: rebased Created 3 years, 9 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 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
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
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 (m_controlsList->value() != fastGetAttribute(controlsAttr))
602 m_controlsList->setValue(fastGetAttribute(controlsAttr));
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
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 setAttribute(controlsAttr, m_controlsList->value());
2451 }
2452
2440 double HTMLMediaElement::volume() const { 2453 double HTMLMediaElement::volume() const {
2441 return m_volume; 2454 return m_volume;
2442 } 2455 }
2443 2456
2444 void HTMLMediaElement::setVolume(double vol, ExceptionState& exceptionState) { 2457 void HTMLMediaElement::setVolume(double vol, ExceptionState& exceptionState) {
2445 BLINK_MEDIA_LOG << "setVolume(" << (void*)this << ", " << vol << ")"; 2458 BLINK_MEDIA_LOG << "setVolume(" << (void*)this << ", " << vol << ")";
2446 2459
2447 if (m_volume == vol) 2460 if (m_volume == vol)
2448 return; 2461 return;
2449 2462
(...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after
3816 visitor->trace(m_textTracks); 3829 visitor->trace(m_textTracks);
3817 visitor->trace(m_textTracksWhenResourceSelectionBegan); 3830 visitor->trace(m_textTracksWhenResourceSelectionBegan);
3818 visitor->trace(m_playPromiseResolvers); 3831 visitor->trace(m_playPromiseResolvers);
3819 visitor->trace(m_playPromiseResolveList); 3832 visitor->trace(m_playPromiseResolveList);
3820 visitor->trace(m_playPromiseRejectList); 3833 visitor->trace(m_playPromiseRejectList);
3821 visitor->trace(m_audioSourceProvider); 3834 visitor->trace(m_audioSourceProvider);
3822 visitor->trace(m_autoplayUmaHelper); 3835 visitor->trace(m_autoplayUmaHelper);
3823 visitor->trace(m_srcObject); 3836 visitor->trace(m_srcObject);
3824 visitor->trace(m_autoplayVisibilityObserver); 3837 visitor->trace(m_autoplayVisibilityObserver);
3825 visitor->trace(m_mediaControls); 3838 visitor->trace(m_mediaControls);
3839 visitor->trace(m_controlsList);
3826 visitor->template registerWeakMembers<HTMLMediaElement, 3840 visitor->template registerWeakMembers<HTMLMediaElement,
3827 &HTMLMediaElement::clearWeakMembers>( 3841 &HTMLMediaElement::clearWeakMembers>(
3828 this); 3842 this);
3829 Supplementable<HTMLMediaElement>::trace(visitor); 3843 Supplementable<HTMLMediaElement>::trace(visitor);
3830 HTMLElement::trace(visitor); 3844 HTMLElement::trace(visitor);
3831 SuspendableObject::trace(visitor); 3845 SuspendableObject::trace(visitor);
3832 } 3846 }
3833 3847
3834 DEFINE_TRACE_WRAPPERS(HTMLMediaElement) { 3848 DEFINE_TRACE_WRAPPERS(HTMLMediaElement) {
3835 visitor->traceWrappers(m_videoTracks); 3849 visitor->traceWrappers(m_videoTracks);
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
4175 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); 4189 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE);
4176 } 4190 }
4177 4191
4178 void HTMLMediaElement::viewportFillDebouncerTimerFired(TimerBase*) { 4192 void HTMLMediaElement::viewportFillDebouncerTimerFired(TimerBase*) {
4179 m_mostlyFillingViewport = true; 4193 m_mostlyFillingViewport = true;
4180 if (m_webMediaPlayer) 4194 if (m_webMediaPlayer)
4181 m_webMediaPlayer->becameDominantVisibleContent(m_mostlyFillingViewport); 4195 m_webMediaPlayer->becameDominantVisibleContent(m_mostlyFillingViewport);
4182 } 4196 }
4183 4197
4184 } // namespace blink 4198 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698