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

Side by Side 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: Respond to comments 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. 2 * Copyright (C) 2009 Apple Inc.
3 * Copyright (C) 2009 Google Inc. 3 * Copyright (C) 2009 Google Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 return false; 328 return false;
329 329
330 static Image* mediaClosedCaptionButton = platformResource("mediaplayerClosed Caption"); 330 static Image* mediaClosedCaptionButton = platformResource("mediaplayerClosed Caption");
331 static Image* mediaClosedCaptionButtonDisabled = platformResource("mediaplay erClosedCaptionDisabled"); 331 static Image* mediaClosedCaptionButtonDisabled = platformResource("mediaplay erClosedCaptionDisabled");
332 332
333 if (mediaElement->closedCaptionsVisible()) 333 if (mediaElement->closedCaptionsVisible())
334 return paintMediaButton(paintInfo.context, rect, mediaClosedCaptionButto n); 334 return paintMediaButton(paintInfo.context, rect, mediaClosedCaptionButto n);
335 335
336 return paintMediaButton(paintInfo.context, rect, mediaClosedCaptionButtonDis abled); 336 return paintMediaButton(paintInfo.context, rect, mediaClosedCaptionButtonDis abled);
337 } 337 }
338 static bool paintMediaCastButton(RenderObject* object, const PaintInfo& paintInf o, const IntRect& rect)
339 {
340 HTMLMediaElement* mediaElement = toParentMediaElement(object);
341 if (!mediaElement)
342 return false;
338 343
344 static Image* mediaCastOnButton = platformResource("mediaplayerCastOn");
345 static Image* mediaCastOffButton = platformResource("mediaplayerCastOff");
346
347 if (mediaElement->isPlayingRemotely()) {
348 return paintMediaButton(paintInfo.context, rect, mediaCastOnButton);
349 }
350
351 return paintMediaButton(paintInfo.context, rect, mediaCastOffButton);
352
353 }
354
355 static bool paintMediaOverlayCastButton(RenderObject* object, const PaintInfo& p aintInfo, const IntRect& rect)
acolwell GONE FROM CHROMIUM 2014/09/10 23:35:23 This looks identical to the method above. Why do w
aberent 2014/09/11 16:38:19 Done.
356 {
357 HTMLMediaElement* mediaElement = toParentMediaElement(object);
358 if (!mediaElement)
359 return false;
360
361 static Image* mediaCastOnButton = platformResource("mediaplayerCastOn");
362 static Image* mediaCastOffButton = platformResource("mediaplayerCastOff");
363
364 if (mediaElement->isPlayingRemotely()) {
365 return paintMediaButton(paintInfo.context, rect, mediaCastOnButton);
366 }
367
368 return paintMediaButton(paintInfo.context, rect, mediaCastOffButton);
369
370 }
339 371
340 bool RenderMediaControls::paintMediaControlsPart(MediaControlElementType part, R enderObject* object, const PaintInfo& paintInfo, const IntRect& rect) 372 bool RenderMediaControls::paintMediaControlsPart(MediaControlElementType part, R enderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
341 { 373 {
342 switch (part) { 374 switch (part) {
343 case MediaMuteButton: 375 case MediaMuteButton:
344 case MediaUnMuteButton: 376 case MediaUnMuteButton:
345 return paintMediaMuteButton(object, paintInfo, rect); 377 return paintMediaMuteButton(object, paintInfo, rect);
346 case MediaPauseButton: 378 case MediaPauseButton:
347 case MediaPlayButton: 379 case MediaPlayButton:
348 return paintMediaPlayButton(object, paintInfo, rect); 380 return paintMediaPlayButton(object, paintInfo, rect);
349 case MediaShowClosedCaptionsButton: 381 case MediaShowClosedCaptionsButton:
350 return paintMediaToggleClosedCaptionsButton(object, paintInfo, rect); 382 return paintMediaToggleClosedCaptionsButton(object, paintInfo, rect);
351 case MediaSlider: 383 case MediaSlider:
352 return paintMediaSlider(object, paintInfo, rect); 384 return paintMediaSlider(object, paintInfo, rect);
353 case MediaSliderThumb: 385 case MediaSliderThumb:
354 return paintMediaSliderThumb(object, paintInfo, rect); 386 return paintMediaSliderThumb(object, paintInfo, rect);
355 case MediaVolumeSlider: 387 case MediaVolumeSlider:
356 return paintMediaVolumeSlider(object, paintInfo, rect); 388 return paintMediaVolumeSlider(object, paintInfo, rect);
357 case MediaVolumeSliderThumb: 389 case MediaVolumeSliderThumb:
358 return paintMediaVolumeSliderThumb(object, paintInfo, rect); 390 return paintMediaVolumeSliderThumb(object, paintInfo, rect);
359 case MediaEnterFullscreenButton: 391 case MediaEnterFullscreenButton:
360 case MediaExitFullscreenButton: 392 case MediaExitFullscreenButton:
361 return paintMediaFullscreenButton(object, paintInfo, rect); 393 return paintMediaFullscreenButton(object, paintInfo, rect);
362 case MediaOverlayPlayButton: 394 case MediaOverlayPlayButton:
363 return paintMediaOverlayPlayButton(object, paintInfo, rect); 395 return paintMediaOverlayPlayButton(object, paintInfo, rect);
396 case MediaCastOffButton:
397 case MediaCastOnButton:
398 return paintMediaCastButton(object, paintInfo, rect);
399 case MediaOverlayCastOffButton:
400 case MediaOverlayCastOnButton:
401 return paintMediaOverlayCastButton(object, paintInfo, rect);
364 case MediaVolumeSliderContainer: 402 case MediaVolumeSliderContainer:
365 case MediaTimelineContainer: 403 case MediaTimelineContainer:
366 case MediaCurrentTimeDisplay: 404 case MediaCurrentTimeDisplay:
367 case MediaTimeRemainingDisplay: 405 case MediaTimeRemainingDisplay:
368 case MediaControlsPanel: 406 case MediaControlsPanel:
369 case MediaStatusDisplay: 407 case MediaStatusDisplay:
370 case MediaHideClosedCaptionsButton: 408 case MediaHideClosedCaptionsButton:
371 case MediaTextTrackDisplayContainer: 409 case MediaTextTrackDisplayContainer:
372 case MediaTextTrackDisplay: 410 case MediaTextTrackDisplay:
373 case MediaFullScreenVolumeSlider: 411 case MediaFullScreenVolumeSlider:
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 { 472 {
435 return formatChromiumMediaControlsTime(time, time); 473 return formatChromiumMediaControlsTime(time, time);
436 } 474 }
437 475
438 String RenderMediaControls::formatMediaControlsCurrentTime(float currentTime, fl oat duration) 476 String RenderMediaControls::formatMediaControlsCurrentTime(float currentTime, fl oat duration)
439 { 477 {
440 return formatChromiumMediaControlsTime(currentTime, duration); 478 return formatChromiumMediaControlsTime(currentTime, duration);
441 } 479 }
442 480
443 } // namespace blink 481 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698