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

Side by Side Diff: Source/core/html/shadow/MediaControlElements.cpp

Issue 291163004: Implement media cast buttons (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2012 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(MediaCo ntrols& mediaControls) 476 MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(MediaCo ntrols& mediaControls)
477 : MediaControlInputElement(mediaControls, MediaEnterFullscreenButton) 477 : MediaControlInputElement(mediaControls, MediaEnterFullscreenButton)
478 { 478 {
479 } 479 }
480 480
481 PassRefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> MediaControlFullscre enButtonElement::create(MediaControls& mediaControls) 481 PassRefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> MediaControlFullscre enButtonElement::create(MediaControls& mediaControls)
482 { 482 {
483 RefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> button = adoptRefWil lBeRefCountedGarbageCollected(new MediaControlFullscreenButtonElement(mediaContr ols)); 483 RefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> button = adoptRefWil lBeRefCountedGarbageCollected(new MediaControlFullscreenButtonElement(mediaContr ols));
484 button->ensureUserAgentShadowRoot(); 484 button->ensureUserAgentShadowRoot();
485 button->setType("button"); 485 button->setType("button");
486 button->hide(); 486 // button->hide();
487 return button.release(); 487 return button.release();
488 } 488 }
489 489
490 void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event) 490 void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event)
491 { 491 {
492 if (event->type() == EventTypeNames::click) { 492 if (event->type() == EventTypeNames::click) {
493 if (FullscreenElementStack::isActiveFullScreenElement(&mediaElement())) 493 if (FullscreenElementStack::isActiveFullScreenElement(&mediaElement()))
494 FullscreenElementStack::from(document()).webkitCancelFullScreen(); 494 FullscreenElementStack::from(document()).webkitCancelFullScreen();
495 else 495 else
496 FullscreenElementStack::from(document()).requestFullScreenForElement (&mediaElement(), 0, FullscreenElementStack::ExemptIFrameAllowFullScreenRequirem ent); 496 FullscreenElementStack::from(document()).requestFullScreenForElement (&mediaElement(), 0, FullscreenElementStack::ExemptIFrameAllowFullScreenRequirem ent);
497 event->setDefaultHandled(); 497 event->setDefaultHandled();
498 } 498 }
499 HTMLInputElement::defaultEventHandler(event); 499 HTMLInputElement::defaultEventHandler(event);
500 } 500 }
501 501
502 const AtomicString& MediaControlFullscreenButtonElement::shadowPseudoId() const 502 const AtomicString& MediaControlFullscreenButtonElement::shadowPseudoId() const
503 { 503 {
504 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-fullscreen-bu tton", AtomicString::ConstructFromLiteral)); 504 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-fullscreen-bu tton", AtomicString::ConstructFromLiteral));
505 return id; 505 return id;
506 } 506 }
507 507
508 void MediaControlFullscreenButtonElement::setIsFullscreen(bool isFullscreen) 508 void MediaControlFullscreenButtonElement::setIsFullscreen(bool isFullscreen)
509 { 509 {
510 setDisplayType(isFullscreen ? MediaExitFullscreenButton : MediaEnterFullscre enButton); 510 setDisplayType(isFullscreen ? MediaExitFullscreenButton : MediaEnterFullscre enButton);
511 } 511 }
512 512
513 // ---------------------------- 513 // ----------------------------
514 514
515 MediaControlCastOffButtonElement::MediaControlCastOffButtonElement(MediaControls & mediaControls)
516 : MediaControlInputElement(mediaControls, MediaCastOffButton)
517 {
518 }
519
520 PassRefPtrWillBeRawPtr<MediaControlCastOffButtonElement> MediaControlCastOffButt onElement::create(MediaControls& mediaControls)
521 {
522 RefPtrWillBeRawPtr<MediaControlCastOffButtonElement> button = adoptRefWillBe RefCountedGarbageCollected(new MediaControlCastOffButtonElement(mediaControls));
523 button->ensureUserAgentShadowRoot();
524 button->setType("button");
525 return button.release();
526 }
527
528 void MediaControlCastOffButtonElement::defaultEventHandler(Event* event)
529 {
530 if (event->type() == EventTypeNames::click) {
531 // if (FullscreenElementStack::isActiveFullScreenElement(&mediaElement()) )
532 // FullscreenElementStack::from(document()).webkitCancelFullScreen();
533 // else
534 // FullscreenElementStack::from(document()).requestFullScreenForEleme nt(&mediaElement(), 0, FullscreenElementStack::ExemptIFrameAllowFullScreenRequir ement);
535 // event->setDefaultHandled();
536 }
537 HTMLInputElement::defaultEventHandler(event);
538 }
539
540 const AtomicString& MediaControlCastOffButtonElement::shadowPseudoId() const
541 {
542 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-cast-off-butt on", AtomicString::ConstructFromLiteral));
543 return id;
544 }
545
546 void MediaControlCastOffButtonElement::setIsCasting(bool isCasting)
547 {
548 setDisplayType(isCasting ? MediaCastOnButton : MediaCastOffButton);
549 }
550
551 // ----------------------------
552
515 MediaControlTimeRemainingDisplayElement::MediaControlTimeRemainingDisplayElement (MediaControls& mediaControls) 553 MediaControlTimeRemainingDisplayElement::MediaControlTimeRemainingDisplayElement (MediaControls& mediaControls)
516 : MediaControlTimeDisplayElement(mediaControls, MediaTimeRemainingDisplay) 554 : MediaControlTimeDisplayElement(mediaControls, MediaTimeRemainingDisplay)
517 { 555 {
518 } 556 }
519 557
520 PassRefPtrWillBeRawPtr<MediaControlTimeRemainingDisplayElement> MediaControlTime RemainingDisplayElement::create(MediaControls& mediaControls) 558 PassRefPtrWillBeRawPtr<MediaControlTimeRemainingDisplayElement> MediaControlTime RemainingDisplayElement::create(MediaControls& mediaControls)
521 { 559 {
522 return adoptRefWillBeRefCountedGarbageCollected(new MediaControlTimeRemainin gDisplayElement(mediaControls)); 560 return adoptRefWillBeRefCountedGarbageCollected(new MediaControlTimeRemainin gDisplayElement(mediaControls));
523 } 561 }
524 562
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 float fontSize = smallestDimension * 0.05f; 713 float fontSize = smallestDimension * 0.05f;
676 if (fontSize != m_fontSize) { 714 if (fontSize != m_fontSize) {
677 m_fontSize = fontSize; 715 m_fontSize = fontSize;
678 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue: :CSS_PX); 716 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue: :CSS_PX);
679 } 717 }
680 } 718 }
681 719
682 // ---------------------------- 720 // ----------------------------
683 721
684 } // namespace WebCore 722 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698