OLD | NEW |
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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 void MediaControlPanelElement::transitionTimerFired(Timer<MediaControlPanelEleme
nt>*) | 175 void MediaControlPanelElement::transitionTimerFired(Timer<MediaControlPanelEleme
nt>*) |
176 { | 176 { |
177 if (!m_opaque) | 177 if (!m_opaque) |
178 setIsWanted(false); | 178 setIsWanted(false); |
179 | 179 |
180 stopTimer(); | 180 stopTimer(); |
181 } | 181 } |
182 | 182 |
183 void MediaControlPanelElement::didBecomeVisible() | 183 void MediaControlPanelElement::didBecomeVisible() |
184 { | 184 { |
185 ASSERT(m_isDisplayed && m_opaque); | 185 DCHECK(m_isDisplayed && m_opaque); |
186 mediaElement().mediaControlsDidBecomeVisible(); | 186 mediaElement().mediaControlsDidBecomeVisible(); |
187 } | 187 } |
188 | 188 |
189 void MediaControlPanelElement::makeOpaque() | 189 void MediaControlPanelElement::makeOpaque() |
190 { | 190 { |
191 if (m_opaque) | 191 if (m_opaque) |
192 return; | 192 return; |
193 | 193 |
194 setInlineStyleProperty(CSSPropertyOpacity, 1.0, CSSPrimitiveValue::UnitType:
:Number); | 194 setInlineStyleProperty(CSSPropertyOpacity, 1.0, CSSPrimitiveValue::UnitType:
:Number); |
195 m_opaque = true; | 195 m_opaque = true; |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 { | 436 { |
437 if (event->type() == EventTypeNames::change) { | 437 if (event->type() == EventTypeNames::change) { |
438 // Identify which input element was selected and set track to showing | 438 // Identify which input element was selected and set track to showing |
439 Node* target = event->target()->toNode(); | 439 Node* target = event->target()->toNode(); |
440 if (!target || !target->isElementNode()) | 440 if (!target || !target->isElementNode()) |
441 return; | 441 return; |
442 | 442 |
443 disableShowingTextTracks(); | 443 disableShowingTextTracks(); |
444 int trackIndex = toElement(target)->getIntegralAttribute(trackIndexAttrN
ame()); | 444 int trackIndex = toElement(target)->getIntegralAttribute(trackIndexAttrN
ame()); |
445 if (trackIndex != trackIndexOffValue) { | 445 if (trackIndex != trackIndexOffValue) { |
446 ASSERT(trackIndex >= 0); | 446 DCHECK_GE(trackIndex, 0); |
447 showTextTrackAtIndex(trackIndex); | 447 showTextTrackAtIndex(trackIndex); |
448 mediaElement().disableAutomaticTextTrackSelection(); | 448 mediaElement().disableAutomaticTextTrackSelection(); |
449 } | 449 } |
450 | 450 |
451 mediaControls().toggleTextTrackList(); | 451 mediaControls().toggleTextTrackList(); |
452 event->setDefaultHandled(); | 452 event->setDefaultHandled(); |
453 } | 453 } |
454 MediaControlDivElement::defaultEventHandler(event); | 454 MediaControlDivElement::defaultEventHandler(event); |
455 } | 455 } |
456 | 456 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 | 519 |
520 trackItem->appendChild(trackItemInput); | 520 trackItem->appendChild(trackItemInput); |
521 String trackLabel = getTextTrackLabel(track); | 521 String trackLabel = getTextTrackLabel(track); |
522 trackItem->appendChild(Text::create(document(), trackLabel)); | 522 trackItem->appendChild(Text::create(document(), trackLabel)); |
523 // Add a track kind marker icon if there are multiple tracks with the same l
abel or if the track has no label. | 523 // Add a track kind marker icon if there are multiple tracks with the same l
abel or if the track has no label. |
524 if (track && (track->label().isEmpty() || hasDuplicateLabel(track))) { | 524 if (track && (track->label().isEmpty() || hasDuplicateLabel(track))) { |
525 HTMLSpanElement* trackKindMarker = HTMLSpanElement::create(document()); | 525 HTMLSpanElement* trackKindMarker = HTMLSpanElement::create(document()); |
526 if (track->kind() == track->captionsKeyword()) { | 526 if (track->kind() == track->captionsKeyword()) { |
527 trackKindMarker->setShadowPseudoId(AtomicString("-internal-media-con
trols-text-track-list-kind-captions")); | 527 trackKindMarker->setShadowPseudoId(AtomicString("-internal-media-con
trols-text-track-list-kind-captions")); |
528 } else { | 528 } else { |
529 ASSERT(track->kind() == track->subtitlesKeyword()); | 529 DCHECK_EQ(track->kind(), track->subtitlesKeyword()); |
530 trackKindMarker->setShadowPseudoId(AtomicString("-internal-media-con
trols-text-track-list-kind-subtitles")); | 530 trackKindMarker->setShadowPseudoId(AtomicString("-internal-media-con
trols-text-track-list-kind-subtitles")); |
531 } | 531 } |
532 trackItem->appendChild(trackKindMarker); | 532 trackItem->appendChild(trackKindMarker); |
533 } | 533 } |
534 return trackItem; | 534 return trackItem; |
535 } | 535 } |
536 | 536 |
537 void MediaControlTextTrackListElement::refreshTextTrackListMenu() | 537 void MediaControlTextTrackListElement::refreshTextTrackListMenu() |
538 { | 538 { |
539 if (!mediaElement().hasClosedCaptions() || !mediaElement().textTracksAreRead
y()) | 539 if (!mediaElement().hasClosedCaptions() || !mediaElement().textTracksAreRead
y()) |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 if (m_isOverlayButton) { | 798 if (m_isOverlayButton) { |
799 setDisplayType(MediaOverlayCastOffButton); | 799 setDisplayType(MediaOverlayCastOffButton); |
800 } else { | 800 } else { |
801 setDisplayType(MediaCastOffButton); | 801 setDisplayType(MediaCastOffButton); |
802 } | 802 } |
803 } | 803 } |
804 } | 804 } |
805 | 805 |
806 void MediaControlCastButtonElement::tryShowOverlay() | 806 void MediaControlCastButtonElement::tryShowOverlay() |
807 { | 807 { |
808 ASSERT(m_isOverlayButton); | 808 DCHECK(m_isOverlayButton); |
809 | 809 |
810 setIsWanted(true); | 810 setIsWanted(true); |
811 if (elementFromCenter(*this) != &mediaElement()) { | 811 if (elementFromCenter(*this) != &mediaElement()) { |
812 setIsWanted(false); | 812 setIsWanted(false); |
813 return; | 813 return; |
814 } | 814 } |
815 | 815 |
816 ASSERT(isWanted()); | 816 DCHECK(isWanted()); |
817 if (!m_showUseCounted) { | 817 if (!m_showUseCounted) { |
818 m_showUseCounted = true; | 818 m_showUseCounted = true; |
819 recordMetrics(CastOverlayMetrics::Shown); | 819 recordMetrics(CastOverlayMetrics::Shown); |
820 } | 820 } |
821 } | 821 } |
822 | 822 |
823 bool MediaControlCastButtonElement::keepEventInNode(Event* event) | 823 bool MediaControlCastButtonElement::keepEventInNode(Event* event) |
824 { | 824 { |
825 return isUserInteractionEvent(event); | 825 return isUserInteractionEvent(event); |
826 } | 826 } |
827 | 827 |
828 void MediaControlCastButtonElement::recordMetrics(CastOverlayMetrics metric) | 828 void MediaControlCastButtonElement::recordMetrics(CastOverlayMetrics metric) |
829 { | 829 { |
830 ASSERT(m_isOverlayButton); | 830 DCHECK(m_isOverlayButton); |
831 DEFINE_STATIC_LOCAL(EnumerationHistogram, overlayHistogram, ("Cast.Sender.Ov
erlay", static_cast<int>(CastOverlayMetrics::Count))); | 831 DEFINE_STATIC_LOCAL(EnumerationHistogram, overlayHistogram, ("Cast.Sender.Ov
erlay", static_cast<int>(CastOverlayMetrics::Count))); |
832 overlayHistogram.count(static_cast<int>(metric)); | 832 overlayHistogram.count(static_cast<int>(metric)); |
833 } | 833 } |
834 | 834 |
835 // ---------------------------- | 835 // ---------------------------- |
836 | 836 |
837 MediaControlTimeRemainingDisplayElement::MediaControlTimeRemainingDisplayElement
(MediaControls& mediaControls) | 837 MediaControlTimeRemainingDisplayElement::MediaControlTimeRemainingDisplayElement
(MediaControls& mediaControls) |
838 : MediaControlTimeDisplayElement(mediaControls, MediaTimeRemainingDisplay) | 838 : MediaControlTimeDisplayElement(mediaControls, MediaTimeRemainingDisplay) |
839 { | 839 { |
840 } | 840 } |
(...skipping 13 matching lines...) Expand all Loading... |
854 } | 854 } |
855 | 855 |
856 MediaControlCurrentTimeDisplayElement* MediaControlCurrentTimeDisplayElement::cr
eate(MediaControls& mediaControls) | 856 MediaControlCurrentTimeDisplayElement* MediaControlCurrentTimeDisplayElement::cr
eate(MediaControls& mediaControls) |
857 { | 857 { |
858 MediaControlCurrentTimeDisplayElement* element = new MediaControlCurrentTime
DisplayElement(mediaControls); | 858 MediaControlCurrentTimeDisplayElement* element = new MediaControlCurrentTime
DisplayElement(mediaControls); |
859 element->setShadowPseudoId(AtomicString("-webkit-media-controls-current-time
-display")); | 859 element->setShadowPseudoId(AtomicString("-webkit-media-controls-current-time
-display")); |
860 return element; | 860 return element; |
861 } | 861 } |
862 | 862 |
863 } // namespace blink | 863 } // namespace blink |
OLD | NEW |