Index: third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp |
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp b/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp |
index 227a699e50ef135548a91979550a1ffee8388c58..8e13a2904c5dd7abaf02dd82710005ee545620da 100644 |
--- a/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp |
+++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp |
@@ -111,28 +111,6 @@ bool ShouldShowFullscreenButton(const HTMLMediaElement& media_element) { |
return true; |
} |
-bool ShouldShowCastButton(HTMLMediaElement& media_element) { |
- if (media_element.FastHasAttribute(HTMLNames::disableremoteplaybackAttr)) |
- return false; |
- |
- // Explicitly do not show cast button when the mediaControlsEnabled setting is |
- // false to make sure the overlay does not appear. |
- Document& document = media_element.GetDocument(); |
- if (document.GetSettings() && |
- !document.GetSettings()->GetMediaControlsEnabled()) |
- return false; |
- |
- // The page disabled the button via the attribute. |
- if (media_element.ControlsListInternal()->ShouldHideRemotePlayback()) { |
- UseCounter::Count( |
- media_element.GetDocument(), |
- UseCounter::kHTMLMediaElementControlsListNoRemotePlayback); |
- return false; |
- } |
- |
- return media_element.HasRemoteRoutes(); |
-} |
- |
bool PreferHiddenVolumeControls(const Document& document) { |
return !document.GetSettings() || |
document.GetSettings()->GetPreferHiddenVolumeControls(); |
@@ -631,43 +609,15 @@ void MediaControlsImpl::RefreshCastButtonVisibility() { |
} |
void MediaControlsImpl::RefreshCastButtonVisibilityWithoutUpdate() { |
- if (!ShouldShowCastButton(MediaElement())) { |
- cast_button_->SetIsWanted(false); |
- overlay_cast_button_->SetIsWanted(false); |
- return; |
- } |
- |
- // The reason for the autoplay test is that some pages (e.g. vimeo.com) have |
- // an autoplay background video, which doesn't autoplay on Chrome for Android |
- // (we prevent it) so starts paused. In such cases we don't want to |
- // automatically show the cast button, since it looks strange and is unlikely |
- // to correspond with anything the user wants to do. If a user does want to |
- // cast a paused autoplay video then they can still do so by touching or |
- // clicking on the video, which will cause the cast button to appear. |
- if (!MediaElement().ShouldShowControls() && !MediaElement().Autoplay() && |
- MediaElement().paused()) { |
- // Note that this is a case where we add the overlay cast button |
- // without wanting the panel cast button. We depend on the fact |
- // that computeWhichControlsFit() won't change overlay cast button |
- // visibility in the case where the cast button isn't wanted. |
- // We don't call compute...() here, but it will be called as |
- // non-cast changes (e.g., resize) occur. If the panel button |
- // is shown, however, compute...() will take control of the |
- // overlay cast button if it needs to hide it from the panel. |
- overlay_cast_button_->TryShowOverlay(); |
- cast_button_->SetIsWanted(false); |
- } else if (MediaElement().ShouldShowControls()) { |
- overlay_cast_button_->SetIsWanted(false); |
- cast_button_->SetIsWanted(true); |
- } |
+ cast_button_->SetIsWanted(MediaElement().ShouldShowControls()); |
+ overlay_cast_button_->SetIsWanted(!MediaElement().ShouldShowControls()); |
} |
void MediaControlsImpl::ShowOverlayCastButtonIfNeeded() { |
- if (MediaElement().ShouldShowControls() || |
- !ShouldShowCastButton(MediaElement())) |
+ if (MediaElement().ShouldShowControls()) |
return; |
- overlay_cast_button_->TryShowOverlay(); |
+ overlay_cast_button_->SetIsWanted(true); |
ResetHideMediaControlsTimer(); |
} |
@@ -679,16 +629,6 @@ void MediaControlsImpl::ExitFullscreen() { |
Fullscreen::ExitFullscreen(GetDocument()); |
} |
-void MediaControlsImpl::StartedCasting() { |
- cast_button_->SetIsPlayingRemotely(true); |
- overlay_cast_button_->SetIsPlayingRemotely(true); |
-} |
- |
-void MediaControlsImpl::StoppedCasting() { |
- cast_button_->SetIsPlayingRemotely(false); |
- overlay_cast_button_->SetIsPlayingRemotely(false); |
-} |
- |
void MediaControlsImpl::DefaultEventHandler(Event* event) { |
HTMLDivElement::DefaultEventHandler(event); |