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

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: addressed comments 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..004bc52c19bfd848b3d3945614acdc3e23bd9dd1 100644
--- a/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp
+++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp
@@ -643,6 +643,15 @@ 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 in product help is showing.
+ if (MediaElement().GetDocument().GetFrame() &&
+ MediaElement()
+ .GetDocument()
+ .GetFrame()
+ ->IsDownloadMediaInProductHelpVisibleForElement(MediaElement())) {
+ return false;
+ }
+
return true;
}
@@ -971,6 +980,7 @@ void MediaControlsImpl::OnPlay() {
UpdatePlayState();
timeline_->SetPosition(MediaElement().currentTime());
UpdateCurrentTimeDisplay();
+ MaybeDispatchDownloadIPHTrigger();
}
void MediaControlsImpl::OnPlaying() {
@@ -1216,6 +1226,31 @@ void MediaControlsImpl::HideAllMenus() {
text_track_list_->SetVisible(false);
}
+void MediaControlsImpl::MaybeDispatchDownloadIPHTrigger() {
+ if (download_button_->IsWanted() && !MediaElement().paused() &&
+ MediaElement().GetDocument().GetFrame()) {
+ MediaElement().GetDocument().GetFrame()->ShowDownloadMediaInProductHelp(
+ MediaElement());
+ if (!ShouldHideMediaControls())
+ MaybeShow();
+ }
+}
+
+bool MediaControlsImpl::GetDownloadButtonRect(IntRect& rect) {
+ if (!IsVisible())
+ return false;
+ if (!download_button_->IsWanted())
+ return false;
+
+ rect = download_button_->VisibleBoundsInVisualViewport();
+ return true;
+}
+
+void MediaControlsImpl::InProductHelpDisabled() {
+ if (ShouldHideMediaControls())
+ StartHideMediaControlsTimer();
+}
+
DEFINE_TRACE(MediaControlsImpl) {
visitor->Trace(element_mutation_callback_);
visitor->Trace(resize_observer_);

Powered by Google App Engine
This is Rietveld 408576698