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

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

Issue 2898543002: media_controls: Add UI for showing a promo bubble on a control button. (Closed)
Patch Set: make animation work Created 3 years, 7 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 2f32c0510fc28434d2ae7adb85c8c19b4a0dfffc..b3cb2bafd63c6d4f833b83f013c092d488645b0f 100644
--- a/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp
+++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp
@@ -51,6 +51,7 @@
#include "modules/media_controls/MediaControlsOrientationLockDelegate.h"
#include "modules/media_controls/MediaControlsRotateToFullscreenDelegate.h"
#include "modules/media_controls/MediaControlsWindowEventListener.h"
+#include "modules/media_controls/elements/MediaControlButtonPromoElements.h"
#include "modules/media_controls/elements/MediaControlCastButtonElement.h"
#include "modules/media_controls/elements/MediaControlCurrentTimeDisplayElement.h"
#include "modules/media_controls/elements/MediaControlDownloadButtonElement.h"
@@ -423,8 +424,11 @@ void MediaControlsImpl::InitializeControls() {
fullscreen_button_ = new MediaControlFullscreenButtonElement(*this);
panel_->AppendChild(fullscreen_button_);
+ download_button_container_ = new MediaControlDownloadButtonContainer(*this);
+ panel_->AppendChild(download_button_container_);
+
download_button_ = new MediaControlDownloadButtonElement(*this);
- panel_->AppendChild(download_button_);
+ download_button_container_->AppendChild(download_button_);
cast_button_ = new MediaControlCastButtonElement(*this, false);
panel_->AppendChild(cast_button_);
@@ -465,6 +469,19 @@ void MediaControlsImpl::InitializeControls() {
*this, new MediaControlToggleClosedCaptionsButtonElement(*this)));
}
+void MediaControlsImpl::CreateDownloadButtonPromoUI() {
+ download_promo_container_ = new MediaControlButtonPromoContainer(
+ *this, kMediaDownloadButtonPromoText,
+ WebLocalizedString::kDownloadButtonPromoText);
+ download_button_container_->AppendChild(download_promo_container_);
+}
+
+void MediaControlsImpl::UpdateDownloadButtonWantedState() {
+ bool should_display = download_button_->ShouldDisplayDownloadButton();
+ download_button_->SetIsWanted(should_display);
+ download_button_container_->SetIsWanted(should_display);
+}
+
Node::InsertionNotificationRequest MediaControlsImpl::InsertedInto(
ContainerNode* root) {
if (!MediaElement().isConnected())
@@ -559,9 +576,7 @@ void MediaControlsImpl::OnControlsListUpdated() {
fullscreen_button_->SetIsWanted(ShouldShowFullscreenButton(MediaElement()));
RefreshCastButtonVisibilityWithoutUpdate();
-
- download_button_->SetIsWanted(
- download_button_->ShouldDisplayDownloadButton());
+ UpdateDownloadButtonWantedState();
}
LayoutObject* MediaControlsImpl::PanelLayoutObject() {
@@ -1169,8 +1184,7 @@ void MediaControlsImpl::NetworkStateChanged() {
// Update the display state of the download button in case we now have a
// source or no longer have a source.
- download_button_->SetIsWanted(
- download_button_->ShouldDisplayDownloadButton());
+ UpdateDownloadButtonWantedState();
}
bool MediaControlsImpl::OverflowMenuVisible() {
@@ -1208,6 +1222,8 @@ DEFINE_TRACE(MediaControlsImpl) {
visitor->Trace(toggle_closed_captions_button_);
visitor->Trace(fullscreen_button_);
visitor->Trace(download_button_);
+ visitor->Trace(download_button_container_);
+ visitor->Trace(download_promo_container_);
visitor->Trace(duration_display_);
visitor->Trace(enclosure_);
visitor->Trace(text_track_list_);

Powered by Google App Engine
This is Rietveld 408576698