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

Unified Diff: Source/core/rendering/RenderMediaControls.cpp

Issue 291163004: Implement media cast buttons (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Reenable previously crashing tests - now fixed Created 6 years, 3 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
« no previous file with comments | « Source/core/html/shadow/MediaControls.cpp ('k') | Source/core/rendering/RenderTheme.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderMediaControls.cpp
diff --git a/Source/core/rendering/RenderMediaControls.cpp b/Source/core/rendering/RenderMediaControls.cpp
index b08ee2e510ee3163c9c7fc9bc86fe6523a72aa0e..9124b8745353b370af37ff92ec7b038d568e2168 100644
--- a/Source/core/rendering/RenderMediaControls.cpp
+++ b/Source/core/rendering/RenderMediaControls.cpp
@@ -339,7 +339,22 @@ static bool paintMediaToggleClosedCaptionsButton(RenderObject* object, const Pai
return paintMediaButton(paintInfo.context, rect, mediaClosedCaptionButtonDisabled);
}
+static bool paintMediaCastButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
+{
+ HTMLMediaElement* mediaElement = toParentMediaElement(object);
+ if (!mediaElement)
+ return false;
+
+ static Image* mediaCastOnButton = platformResource("mediaplayerCastOn");
+ static Image* mediaCastOffButton = platformResource("mediaplayerCastOff");
+ if (mediaElement->isPlayingRemotely()) {
+ return paintMediaButton(paintInfo.context, rect, mediaCastOnButton);
+ }
+
+ return paintMediaButton(paintInfo.context, rect, mediaCastOffButton);
+
+}
bool RenderMediaControls::paintMediaControlsPart(MediaControlElementType part, RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
{
@@ -365,6 +380,11 @@ bool RenderMediaControls::paintMediaControlsPart(MediaControlElementType part, R
return paintMediaFullscreenButton(object, paintInfo, rect);
case MediaOverlayPlayButton:
return paintMediaOverlayPlayButton(object, paintInfo, rect);
+ case MediaCastOffButton:
+ case MediaCastOnButton:
+ case MediaOverlayCastOffButton:
+ case MediaOverlayCastOnButton:
+ return paintMediaCastButton(object, paintInfo, rect);
case MediaVolumeSliderContainer:
case MediaTimelineContainer:
case MediaCurrentTimeDisplay:
« no previous file with comments | « Source/core/html/shadow/MediaControls.cpp ('k') | Source/core/rendering/RenderTheme.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698