Chromium Code Reviews| 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 9bf2b7bd75b07965ea592663da13bd45c8245d39..83e54ba916090f610984288b7c2d4ec31e737219 100644 |
| --- a/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp |
| +++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp |
| @@ -29,6 +29,7 @@ |
| #include "bindings/core/v8/ExceptionState.h" |
| #include "core/dom/ClientRect.h" |
| #include "core/dom/Fullscreen.h" |
| +#include "core/dom/MediaIPHManager.h" |
| #include "core/dom/MutationCallback.h" |
| #include "core/dom/MutationObserver.h" |
| #include "core/dom/MutationObserverInit.h" |
| @@ -643,6 +644,10 @@ bool MediaControlsImpl::ShouldHideMediaControls(unsigned behavior_flags) const { |
| if (text_track_list_->IsWanted() || overflow_list_->IsWanted()) |
| return false; |
| + // Don't hide the media controls while the iph is showing. |
| + if (iph_active_) |
| + return false; |
| + |
| return true; |
| } |
| @@ -971,6 +976,7 @@ void MediaControlsImpl::OnPlay() { |
| UpdatePlayState(); |
| timeline_->SetPosition(MediaElement().currentTime()); |
| UpdateCurrentTimeDisplay(); |
| + MaybeDispatchDownloadIPHTrigger(); |
| } |
| void MediaControlsImpl::OnPlaying() { |
| @@ -1216,6 +1222,40 @@ void MediaControlsImpl::HideAllMenus() { |
| text_track_list_->SetVisible(false); |
| } |
| +void MediaControlsImpl::MaybeDispatchDownloadIPHTrigger() { |
| + if (!iph_trigger_observed_ && download_button_->IsWanted() && |
| + !MediaElement().paused() && |
| + MediaElement().GetDocument().GetMediaIPHManager() && |
| + MediaElement() |
| + .GetDocument() |
| + .GetMediaIPHManager() |
| + ->IPHTriggerObservedOnElement(MediaElement())) { |
| + iph_active_ = true; |
| + iph_trigger_observed_ = true; |
| + MaybeShow(); |
|
chrishtr
2017/06/23 00:39:44
Why call MaybeShow and MakeOpaque?
Khushal
2017/06/23 02:11:06
MakeOpaque is unnecessary. There should be an asse
Khushal
2017/06/28 05:32:38
Done.
|
| + MakeOpaque(); |
| + } |
| +} |
| + |
| +bool MediaControlsImpl::GetDownloadButtonRect(IntRect& rect) { |
| + if (!IsVisible()) |
| + return false; |
| + if (!download_button_->IsWanted()) |
| + return false; |
| + |
| + rect = download_button_->VisibleBoundsInVisualViewport(); |
| + return true; |
| +} |
| + |
| +void MediaControlsImpl::IPHDisabled() { |
| + if (!iph_active_) |
| + return; |
| + |
| + iph_active_ = false; |
| + if (ShouldHideMediaControls()) |
| + StartHideMediaControlsTimer(); |
| +} |
| + |
| DEFINE_TRACE(MediaControlsImpl) { |
| visitor->Trace(element_mutation_callback_); |
| visitor->Trace(resize_observer_); |