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 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 610 if (mediaControls()) | 610 if (mediaControls()) |
| 611 mediaControls()->onControlsListUpdated(); | 611 mediaControls()->onControlsListUpdated(); |
| 612 } | 612 } |
| 613 } else if (name == preloadAttr) { | 613 } else if (name == preloadAttr) { |
| 614 setPlayerPreload(); | 614 setPlayerPreload(); |
| 615 } else if (name == disableremoteplaybackAttr) { | 615 } else if (name == disableremoteplaybackAttr) { |
| 616 // This attribute is an extension described in the Remote Playback API spec. | 616 // This attribute is an extension described in the Remote Playback API spec. |
| 617 // Please see: https://w3c.github.io/remote-playback | 617 // Please see: https://w3c.github.io/remote-playback |
| 618 UseCounter::count(document(), UseCounter::DisableRemotePlaybackAttribute); | 618 UseCounter::count(document(), UseCounter::DisableRemotePlaybackAttribute); |
| 619 if (params.oldValue != params.newValue) { | 619 if (params.oldValue != params.newValue) { |
| 620 if (m_webMediaPlayer) { | 620 // Don't inform |m_webMediaPlayer| this change if Media Remoting is |
| 621 // explicitly disabled by user. | |
| 622 if (m_webMediaPlayer && !isMediaRemotingDisabled()) { | |
|
mlamouri (slow - plz ping)
2017/04/07 13:18:32
Instead of leaking the media remoting logic into H
xjz
2017/04/07 23:07:01
Done. Removed the check. Yes, this is already hand
| |
| 621 m_webMediaPlayer->requestRemotePlaybackDisabled( | 623 m_webMediaPlayer->requestRemotePlaybackDisabled( |
| 622 !params.newValue.isNull()); | 624 !params.newValue.isNull()); |
| 623 } | 625 } |
| 624 // TODO(mlamouri): there is no direct API to expose if | 626 // TODO(mlamouri): there is no direct API to expose if |
| 625 // disableRemotePLayback attribute has changed. It will require a direct | 627 // disableRemotePLayback attribute has changed. It will require a direct |
| 626 // access to MediaControls for the moment. | 628 // access to MediaControls for the moment. |
| 627 if (mediaControls()) | 629 if (mediaControls()) |
| 628 mediaControls()->onDisableRemotePlaybackAttributeChanged(); | 630 mediaControls()->onDisableRemotePlaybackAttributeChanged(); |
| 629 } | 631 } |
| 630 } else { | 632 } else { |
| (...skipping 2924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3555 return true; | 3557 return true; |
| 3556 } | 3558 } |
| 3557 | 3559 |
| 3558 return false; | 3560 return false; |
| 3559 } | 3561 } |
| 3560 | 3562 |
| 3561 bool HTMLMediaElement::textTracksVisible() const { | 3563 bool HTMLMediaElement::textTracksVisible() const { |
| 3562 return m_textTracksVisible; | 3564 return m_textTracksVisible; |
| 3563 } | 3565 } |
| 3564 | 3566 |
| 3565 static void assertShadowRootChildren(ShadowRoot& shadowRoot) { | 3567 // static |
| 3568 void HTMLMediaElement::assertShadowRootChildren(ShadowRoot& shadowRoot) { | |
| 3566 #if DCHECK_IS_ON() | 3569 #if DCHECK_IS_ON() |
| 3567 // There can be up to two children, either or both of the text | 3570 // There can be up to three children: media remoting interstitial, text track |
| 3568 // track container and media controls. If both are present, the | 3571 // container, media controls. The mediaControls has to be the last child if |
| 3569 // text track container must be the first child. | 3572 // present, and has to be the next sibling of the text track container if both |
| 3573 // present. | |
| 3570 unsigned numberOfChildren = shadowRoot.countChildren(); | 3574 unsigned numberOfChildren = shadowRoot.countChildren(); |
| 3571 DCHECK_LE(numberOfChildren, 2u); | 3575 DCHECK_LE(numberOfChildren, 3u); |
| 3572 Node* firstChild = shadowRoot.firstChild(); | 3576 Node* firstChild = shadowRoot.firstChild(); |
| 3573 Node* lastChild = shadowRoot.lastChild(); | 3577 Node* lastChild = shadowRoot.lastChild(); |
| 3574 if (numberOfChildren == 1) { | 3578 if (numberOfChildren == 1) { |
| 3575 DCHECK(firstChild->isTextTrackContainer() || firstChild->isMediaControls()); | 3579 DCHECK(firstChild->isTextTrackContainer() || |
| 3580 firstChild->isMediaControls() || | |
| 3581 firstChild->isMediaRemotingInterstitial()); | |
| 3576 } else if (numberOfChildren == 2) { | 3582 } else if (numberOfChildren == 2) { |
| 3577 DCHECK(firstChild->isTextTrackContainer()); | 3583 DCHECK(firstChild->isTextTrackContainer() || |
| 3584 firstChild->isMediaRemotingInterstitial()); | |
| 3585 DCHECK(lastChild->isTextTrackContainer() || lastChild->isMediaControls()); | |
| 3586 if (firstChild->isTextTrackContainer()) | |
| 3587 DCHECK(lastChild->isMediaControls()); | |
| 3588 } else if (numberOfChildren == 3) { | |
| 3589 Node* secondChild = firstChild->nextSibling(); | |
| 3590 DCHECK(firstChild->isMediaRemotingInterstitial()); | |
| 3591 DCHECK(secondChild->isTextTrackContainer()); | |
| 3578 DCHECK(lastChild->isMediaControls()); | 3592 DCHECK(lastChild->isMediaControls()); |
| 3579 } | 3593 } |
| 3580 #endif | 3594 #endif |
| 3581 } | 3595 } |
| 3582 | 3596 |
| 3583 TextTrackContainer& HTMLMediaElement::ensureTextTrackContainer() { | 3597 TextTrackContainer& HTMLMediaElement::ensureTextTrackContainer() { |
| 3584 ShadowRoot& shadowRoot = ensureUserAgentShadowRoot(); | 3598 ShadowRoot& shadowRoot = ensureUserAgentShadowRoot(); |
| 3585 assertShadowRootChildren(shadowRoot); | 3599 assertShadowRootChildren(shadowRoot); |
| 3586 | 3600 |
| 3587 Node* firstChild = shadowRoot.firstChild(); | 3601 Node* firstChild = shadowRoot.firstChild(); |
| 3588 if (firstChild && firstChild->isTextTrackContainer()) | 3602 if (firstChild && firstChild->isTextTrackContainer()) |
| 3589 return toTextTrackContainer(*firstChild); | 3603 return toTextTrackContainer(*firstChild); |
| 3604 Node* toBeInsertedBefore = firstChild; | |
| 3605 | |
| 3606 if (firstChild->isMediaRemotingInterstitial()) { | |
| 3607 Node* secondChild = firstChild->nextSibling(); | |
| 3608 if (secondChild && secondChild->isTextTrackContainer()) | |
| 3609 return toTextTrackContainer(*secondChild); | |
| 3610 toBeInsertedBefore = secondChild; | |
| 3611 } | |
| 3590 | 3612 |
| 3591 TextTrackContainer* textTrackContainer = | 3613 TextTrackContainer* textTrackContainer = |
| 3592 TextTrackContainer::create(document()); | 3614 TextTrackContainer::create(document()); |
| 3593 | 3615 |
| 3594 // The text track container should be inserted before the media controls, | 3616 // The text track container should be inserted before the media controls, |
| 3595 // so that they are rendered behind them. | 3617 // so that they are rendered behind them. |
| 3596 shadowRoot.insertBefore(textTrackContainer, firstChild); | 3618 shadowRoot.insertBefore(textTrackContainer, toBeInsertedBefore); |
| 3597 | 3619 |
| 3598 assertShadowRootChildren(shadowRoot); | 3620 assertShadowRootChildren(shadowRoot); |
| 3599 | 3621 |
| 3600 return *textTrackContainer; | 3622 return *textTrackContainer; |
| 3601 } | 3623 } |
| 3602 | 3624 |
| 3603 void HTMLMediaElement::updateTextTrackDisplay() { | 3625 void HTMLMediaElement::updateTextTrackDisplay() { |
| 3604 BLINK_MEDIA_LOG << "updateTextTrackDisplay(" << (void*)this << ")"; | 3626 BLINK_MEDIA_LOG << "updateTextTrackDisplay(" << (void*)this << ")"; |
| 3605 | 3627 |
| 3606 ensureTextTrackContainer().updateDisplay( | 3628 ensureTextTrackContainer().updateDisplay( |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4192 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); | 4214 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); |
| 4193 } | 4215 } |
| 4194 | 4216 |
| 4195 void HTMLMediaElement::viewportFillDebouncerTimerFired(TimerBase*) { | 4217 void HTMLMediaElement::viewportFillDebouncerTimerFired(TimerBase*) { |
| 4196 m_mostlyFillingViewport = true; | 4218 m_mostlyFillingViewport = true; |
| 4197 if (m_webMediaPlayer) | 4219 if (m_webMediaPlayer) |
| 4198 m_webMediaPlayer->becameDominantVisibleContent(m_mostlyFillingViewport); | 4220 m_webMediaPlayer->becameDominantVisibleContent(m_mostlyFillingViewport); |
| 4199 } | 4221 } |
| 4200 | 4222 |
| 4201 } // namespace blink | 4223 } // namespace blink |
| OLD | NEW |