Commit 5d97f053 authored by Mounir Lamouri's avatar Mounir Lamouri Committed by Commit Bot

Media Controls: hide Cast button in "immersive" mode.

While in VR mode, the Cast button should be hidden as the user can't
really use the feature.

Bug: 683352
Change-Id: I0402d9adb29521449a65152a486f73313f2d93ab
Reviewed-on: https://chromium-review.googlesource.com/980878Reviewed-by: default avatarTommy Steimel <steimel@chromium.org>
Commit-Queue: Mounir Lamouri <mlamouri@chromium.org>
Cr-Commit-Position: refs/heads/master@{#546140}
parent 2b0f4d4a
<!DOCTYPe html>
<title>Test that the cast button does not show up in immersive mode</title>
<script src='../../resources/testharness.js'></script>
<script src='../../resources/testharnessreport.js'></script>
<script src='../media-controls.js'></script>
<body></body>
<script>
async_test(t => {
var old_immersive = internals.settings.immersiveModeEnabled;
internals.settings.setImmersiveModeEnabled(true);
t.add_cleanup(() => {
internals.settings.setImmersiveModeEnabled(old_immersive);
});
var video = document.createElement('video');
video.controls = true;
document.body.appendChild(video);
video.src = '../content/test.ogv';
internals.mediaPlayerRemoteRouteAvailabilityChanged(video, true);
video.addEventListener('canplaythrough', t.step_func_done(e => {
assert_equals(castButton(video).style.display, 'none');
assert_not_equals(mediaControlsButton(video, 'panel').style.display, 'none');
}));
});
</script>
......@@ -163,11 +163,14 @@ 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.
// Explicitly do not show cast button when:
// - the mediaControlsEnabled setting is false, to make sure the overlay does
// not appear;
// - the immersiveModeEnabled setting is true.
Document& document = media_element.GetDocument();
if (document.GetSettings() &&
!document.GetSettings()->GetMediaControlsEnabled()) {
(!document.GetSettings()->GetMediaControlsEnabled() ||
document.GetSettings()->GetImmersiveModeEnabled())) {
return false;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment