| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 if (event->type() == EventTypeNames::click) { | 288 if (event->type() == EventTypeNames::click) { |
| 289 if (mediaElement().muted()) | 289 if (mediaElement().muted()) |
| 290 Platform::current()->recordAction(UserMetricsAction("Media.Controls.
Unmute")); | 290 Platform::current()->recordAction(UserMetricsAction("Media.Controls.
Unmute")); |
| 291 else | 291 else |
| 292 Platform::current()->recordAction(UserMetricsAction("Media.Controls.
Mute")); | 292 Platform::current()->recordAction(UserMetricsAction("Media.Controls.
Mute")); |
| 293 | 293 |
| 294 mediaElement().setMuted(!mediaElement().muted()); | 294 mediaElement().setMuted(!mediaElement().muted()); |
| 295 event->setDefaultHandled(); | 295 event->setDefaultHandled(); |
| 296 } | 296 } |
| 297 | 297 |
| 298 HTMLInputElement::defaultEventHandler(event); | 298 MediaControlInputElement::defaultEventHandler(event); |
| 299 } | 299 } |
| 300 | 300 |
| 301 void MediaControlMuteButtonElement::updateDisplayType() | 301 void MediaControlMuteButtonElement::updateDisplayType() |
| 302 { | 302 { |
| 303 setDisplayType(mediaElement().muted() ? MediaUnMuteButton : MediaMuteButton)
; | 303 setDisplayType(mediaElement().muted() ? MediaUnMuteButton : MediaMuteButton)
; |
| 304 updateOverflowString(); | 304 updateOverflowString(); |
| 305 } | 305 } |
| 306 | 306 |
| 307 WebLocalizedString::Name MediaControlMuteButtonElement::getOverflowStringName() | 307 WebLocalizedString::Name MediaControlMuteButtonElement::getOverflowStringName() |
| 308 { | 308 { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 338 // Allow play attempts for plain src= media to force a reload in the err
or state. This allows potential | 338 // Allow play attempts for plain src= media to force a reload in the err
or state. This allows potential |
| 339 // recovery for transient network and decoder resource issues. | 339 // recovery for transient network and decoder resource issues. |
| 340 const String& url = mediaElement().currentSrc().getString(); | 340 const String& url = mediaElement().currentSrc().getString(); |
| 341 if (mediaElement().error() && !HTMLMediaElement::isMediaStreamURL(url) &
& !HTMLMediaSource::lookup(url)) | 341 if (mediaElement().error() && !HTMLMediaElement::isMediaStreamURL(url) &
& !HTMLMediaSource::lookup(url)) |
| 342 mediaElement().load(); | 342 mediaElement().load(); |
| 343 | 343 |
| 344 mediaElement().togglePlayState(); | 344 mediaElement().togglePlayState(); |
| 345 updateDisplayType(); | 345 updateDisplayType(); |
| 346 event->setDefaultHandled(); | 346 event->setDefaultHandled(); |
| 347 } | 347 } |
| 348 HTMLInputElement::defaultEventHandler(event); | 348 MediaControlInputElement::defaultEventHandler(event); |
| 349 } | 349 } |
| 350 | 350 |
| 351 void MediaControlPlayButtonElement::updateDisplayType() | 351 void MediaControlPlayButtonElement::updateDisplayType() |
| 352 { | 352 { |
| 353 setDisplayType(mediaElement().paused() ? MediaPlayButton : MediaPauseButton)
; | 353 setDisplayType(mediaElement().paused() ? MediaPlayButton : MediaPauseButton)
; |
| 354 updateOverflowString(); | 354 updateOverflowString(); |
| 355 } | 355 } |
| 356 | 356 |
| 357 WebLocalizedString::Name MediaControlPlayButtonElement::getOverflowStringName() | 357 WebLocalizedString::Name MediaControlPlayButtonElement::getOverflowStringName() |
| 358 { | 358 { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 | 417 |
| 418 void MediaControlToggleClosedCaptionsButtonElement::updateDisplayType() | 418 void MediaControlToggleClosedCaptionsButtonElement::updateDisplayType() |
| 419 { | 419 { |
| 420 bool captionsVisible = mediaElement().textTracksVisible(); | 420 bool captionsVisible = mediaElement().textTracksVisible(); |
| 421 setDisplayType(captionsVisible ? MediaHideClosedCaptionsButton : MediaShowCl
osedCaptionsButton); | 421 setDisplayType(captionsVisible ? MediaHideClosedCaptionsButton : MediaShowCl
osedCaptionsButton); |
| 422 } | 422 } |
| 423 | 423 |
| 424 void MediaControlToggleClosedCaptionsButtonElement::defaultEventHandler(Event* e
vent) | 424 void MediaControlToggleClosedCaptionsButtonElement::defaultEventHandler(Event* e
vent) |
| 425 { | 425 { |
| 426 if (event->type() == EventTypeNames::click) { | 426 if (event->type() == EventTypeNames::click) { |
| 427 // If the user opens up the closed captions menu from the overfow menu, | |
| 428 // the overflow menu should no longer be visible. | |
| 429 if (mediaControls().overflowMenuVisible()) | |
| 430 mediaControls().toggleOverflowMenu(); | |
| 431 mediaControls().toggleTextTrackList(); | 427 mediaControls().toggleTextTrackList(); |
| 432 updateDisplayType(); | 428 updateDisplayType(); |
| 433 event->setDefaultHandled(); | 429 event->setDefaultHandled(); |
| 434 } | 430 } |
| 435 | 431 |
| 436 HTMLInputElement::defaultEventHandler(event); | 432 MediaControlInputElement::defaultEventHandler(event); |
| 437 } | 433 } |
| 438 | 434 |
| 439 WebLocalizedString::Name MediaControlToggleClosedCaptionsButtonElement::getOverf
lowStringName() | 435 WebLocalizedString::Name MediaControlToggleClosedCaptionsButtonElement::getOverf
lowStringName() |
| 440 { | 436 { |
| 441 return WebLocalizedString::OverflowMenuCaptions; | 437 return WebLocalizedString::OverflowMenuCaptions; |
| 442 } | 438 } |
| 443 | 439 |
| 444 // ---------------------------- | 440 // ---------------------------- |
| 445 | 441 |
| 446 MediaControlTextTrackListElement::MediaControlTextTrackListElement(MediaControls
& mediaControls) | 442 MediaControlTextTrackListElement::MediaControlTextTrackListElement(MediaControls
& mediaControls) |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 if (event->type() == EventTypeNames::click) { | 596 if (event->type() == EventTypeNames::click) { |
| 601 if (mediaControls().overflowMenuVisible()) | 597 if (mediaControls().overflowMenuVisible()) |
| 602 Platform::current()->recordAction(UserMetricsAction("Media.Controls.
OverflowClose")); | 598 Platform::current()->recordAction(UserMetricsAction("Media.Controls.
OverflowClose")); |
| 603 else | 599 else |
| 604 Platform::current()->recordAction(UserMetricsAction("Media.Controls.
OverflowOpen")); | 600 Platform::current()->recordAction(UserMetricsAction("Media.Controls.
OverflowOpen")); |
| 605 | 601 |
| 606 mediaControls().toggleOverflowMenu(); | 602 mediaControls().toggleOverflowMenu(); |
| 607 event->setDefaultHandled(); | 603 event->setDefaultHandled(); |
| 608 } | 604 } |
| 609 | 605 |
| 610 HTMLInputElement::defaultEventHandler(event); | 606 MediaControlInputElement::defaultEventHandler(event); |
| 611 } | 607 } |
| 612 | 608 |
| 613 // ---------------------------- | 609 // ---------------------------- |
| 614 MediaControlOverflowMenuListElement::MediaControlOverflowMenuListElement(MediaCo
ntrols& mediaControls) | 610 MediaControlOverflowMenuListElement::MediaControlOverflowMenuListElement(MediaCo
ntrols& mediaControls) |
| 615 : MediaControlDivElement(mediaControls, MediaOverflowList) | 611 : MediaControlDivElement(mediaControls, MediaOverflowList) |
| 616 { | 612 { |
| 617 } | 613 } |
| 618 | 614 |
| 619 MediaControlOverflowMenuListElement* MediaControlOverflowMenuListElement::create
(MediaControls& mediaControls) | 615 MediaControlOverflowMenuListElement* MediaControlOverflowMenuListElement::create
(MediaControls& mediaControls) |
| 620 { | 616 { |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 if (event->type() == EventTypeNames::click) { | 851 if (event->type() == EventTypeNames::click) { |
| 856 if (mediaElement().isFullscreen()) { | 852 if (mediaElement().isFullscreen()) { |
| 857 Platform::current()->recordAction(UserMetricsAction("Media.Controls.
ExitFullscreen")); | 853 Platform::current()->recordAction(UserMetricsAction("Media.Controls.
ExitFullscreen")); |
| 858 mediaElement().exitFullscreen(); | 854 mediaElement().exitFullscreen(); |
| 859 } else { | 855 } else { |
| 860 Platform::current()->recordAction(UserMetricsAction("Media.Controls.
EnterFullscreen")); | 856 Platform::current()->recordAction(UserMetricsAction("Media.Controls.
EnterFullscreen")); |
| 861 mediaElement().enterFullscreen(); | 857 mediaElement().enterFullscreen(); |
| 862 } | 858 } |
| 863 event->setDefaultHandled(); | 859 event->setDefaultHandled(); |
| 864 } | 860 } |
| 865 HTMLInputElement::defaultEventHandler(event); | 861 MediaControlInputElement::defaultEventHandler(event); |
| 866 } | 862 } |
| 867 | 863 |
| 868 void MediaControlFullscreenButtonElement::setIsFullscreen(bool isFullscreen) | 864 void MediaControlFullscreenButtonElement::setIsFullscreen(bool isFullscreen) |
| 869 { | 865 { |
| 870 setDisplayType(isFullscreen ? MediaExitFullscreenButton : MediaEnterFullscre
enButton); | 866 setDisplayType(isFullscreen ? MediaExitFullscreenButton : MediaEnterFullscre
enButton); |
| 871 } | 867 } |
| 872 | 868 |
| 873 WebLocalizedString::Name MediaControlFullscreenButtonElement::getOverflowStringN
ame() | 869 WebLocalizedString::Name MediaControlFullscreenButtonElement::getOverflowStringN
ame() |
| 874 { | 870 { |
| 875 if (mediaElement().isFullscreen()) | 871 if (mediaElement().isFullscreen()) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 906 if (m_isOverlayButton && !m_clickUseCounted) { | 902 if (m_isOverlayButton && !m_clickUseCounted) { |
| 907 m_clickUseCounted = true; | 903 m_clickUseCounted = true; |
| 908 recordMetrics(CastOverlayMetrics::Clicked); | 904 recordMetrics(CastOverlayMetrics::Clicked); |
| 909 } | 905 } |
| 910 if (mediaElement().isPlayingRemotely()) { | 906 if (mediaElement().isPlayingRemotely()) { |
| 911 mediaElement().requestRemotePlaybackControl(); | 907 mediaElement().requestRemotePlaybackControl(); |
| 912 } else { | 908 } else { |
| 913 mediaElement().requestRemotePlayback(); | 909 mediaElement().requestRemotePlayback(); |
| 914 } | 910 } |
| 915 } | 911 } |
| 916 HTMLInputElement::defaultEventHandler(event); | 912 MediaControlInputElement::defaultEventHandler(event); |
| 917 } | 913 } |
| 918 | 914 |
| 919 const AtomicString& MediaControlCastButtonElement::shadowPseudoId() const | 915 const AtomicString& MediaControlCastButtonElement::shadowPseudoId() const |
| 920 { | 916 { |
| 921 DEFINE_STATIC_LOCAL(AtomicString, id_nonOverlay, ("-internal-media-controls-
cast-button")); | 917 DEFINE_STATIC_LOCAL(AtomicString, id_nonOverlay, ("-internal-media-controls-
cast-button")); |
| 922 DEFINE_STATIC_LOCAL(AtomicString, id_overlay, ("-internal-media-controls-ove
rlay-cast-button")); | 918 DEFINE_STATIC_LOCAL(AtomicString, id_overlay, ("-internal-media-controls-ove
rlay-cast-button")); |
| 923 return m_isOverlayButton ? id_overlay : id_nonOverlay; | 919 return m_isOverlayButton ? id_overlay : id_nonOverlay; |
| 924 } | 920 } |
| 925 | 921 |
| 926 void MediaControlCastButtonElement::setIsPlayingRemotely(bool isPlayingRemotely) | 922 void MediaControlCastButtonElement::setIsPlayingRemotely(bool isPlayingRemotely) |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 999 } | 995 } |
| 1000 | 996 |
| 1001 MediaControlCurrentTimeDisplayElement* MediaControlCurrentTimeDisplayElement::cr
eate(MediaControls& mediaControls) | 997 MediaControlCurrentTimeDisplayElement* MediaControlCurrentTimeDisplayElement::cr
eate(MediaControls& mediaControls) |
| 1002 { | 998 { |
| 1003 MediaControlCurrentTimeDisplayElement* element = new MediaControlCurrentTime
DisplayElement(mediaControls); | 999 MediaControlCurrentTimeDisplayElement* element = new MediaControlCurrentTime
DisplayElement(mediaControls); |
| 1004 element->setShadowPseudoId(AtomicString("-webkit-media-controls-current-time
-display")); | 1000 element->setShadowPseudoId(AtomicString("-webkit-media-controls-current-time
-display")); |
| 1005 return element; | 1001 return element; |
| 1006 } | 1002 } |
| 1007 | 1003 |
| 1008 } // namespace blink | 1004 } // namespace blink |
| OLD | NEW |