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

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

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

Powered by Google App Engine
This is Rietveld 408576698