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

Unified Diff: third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp

Issue 2943983003: chrome/blink: Add functionality for in-product help for media elements. (Closed)
Patch Set: Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
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_);

Powered by Google App Engine
This is Rietveld 408576698