| 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 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 984 recordMetrics(CastOverlayMetrics::Created); | 984 recordMetrics(CastOverlayMetrics::Created); |
| 985 setIsPlayingRemotely(false); | 985 setIsPlayingRemotely(false); |
| 986 } | 986 } |
| 987 | 987 |
| 988 MediaControlCastButtonElement* MediaControlCastButtonElement::create( | 988 MediaControlCastButtonElement* MediaControlCastButtonElement::create( |
| 989 MediaControls& mediaControls, | 989 MediaControls& mediaControls, |
| 990 bool isOverlayButton) { | 990 bool isOverlayButton) { |
| 991 MediaControlCastButtonElement* button = | 991 MediaControlCastButtonElement* button = |
| 992 new MediaControlCastButtonElement(mediaControls, isOverlayButton); | 992 new MediaControlCastButtonElement(mediaControls, isOverlayButton); |
| 993 button->ensureUserAgentShadowRoot(); | 993 button->ensureUserAgentShadowRoot(); |
| 994 button->setShadowPseudoId(isOverlayButton |
| 995 ? "-internal-media-controls-overlay-cast-button" |
| 996 : "-internal-media-controls-cast-button"); |
| 994 button->setType(InputTypeNames::button); | 997 button->setType(InputTypeNames::button); |
| 995 return button; | 998 return button; |
| 996 } | 999 } |
| 997 | 1000 |
| 998 void MediaControlCastButtonElement::defaultEventHandler(Event* event) { | 1001 void MediaControlCastButtonElement::defaultEventHandler(Event* event) { |
| 999 if (event->type() == EventTypeNames::click) { | 1002 if (event->type() == EventTypeNames::click) { |
| 1000 if (m_isOverlayButton) | 1003 if (m_isOverlayButton) |
| 1001 Platform::current()->recordAction( | 1004 Platform::current()->recordAction( |
| 1002 UserMetricsAction("Media.Controls.CastOverlay")); | 1005 UserMetricsAction("Media.Controls.CastOverlay")); |
| 1003 else | 1006 else |
| 1004 Platform::current()->recordAction( | 1007 Platform::current()->recordAction( |
| 1005 UserMetricsAction("Media.Controls.Cast")); | 1008 UserMetricsAction("Media.Controls.Cast")); |
| 1006 | 1009 |
| 1007 if (m_isOverlayButton && !m_clickUseCounted) { | 1010 if (m_isOverlayButton && !m_clickUseCounted) { |
| 1008 m_clickUseCounted = true; | 1011 m_clickUseCounted = true; |
| 1009 recordMetrics(CastOverlayMetrics::Clicked); | 1012 recordMetrics(CastOverlayMetrics::Clicked); |
| 1010 } | 1013 } |
| 1011 if (mediaElement().isPlayingRemotely()) { | 1014 if (mediaElement().isPlayingRemotely()) { |
| 1012 mediaElement().requestRemotePlaybackControl(); | 1015 mediaElement().requestRemotePlaybackControl(); |
| 1013 } else { | 1016 } else { |
| 1014 mediaElement().requestRemotePlayback(); | 1017 mediaElement().requestRemotePlayback(); |
| 1015 } | 1018 } |
| 1016 } | 1019 } |
| 1017 MediaControlInputElement::defaultEventHandler(event); | 1020 MediaControlInputElement::defaultEventHandler(event); |
| 1018 } | 1021 } |
| 1019 | 1022 |
| 1020 const AtomicString& MediaControlCastButtonElement::shadowPseudoId() const { | |
| 1021 DEFINE_STATIC_LOCAL(AtomicString, id_nonOverlay, | |
| 1022 ("-internal-media-controls-cast-button")); | |
| 1023 DEFINE_STATIC_LOCAL(AtomicString, id_overlay, | |
| 1024 ("-internal-media-controls-overlay-cast-button")); | |
| 1025 return m_isOverlayButton ? id_overlay : id_nonOverlay; | |
| 1026 } | |
| 1027 | |
| 1028 void MediaControlCastButtonElement::setIsPlayingRemotely( | 1023 void MediaControlCastButtonElement::setIsPlayingRemotely( |
| 1029 bool isPlayingRemotely) { | 1024 bool isPlayingRemotely) { |
| 1030 if (isPlayingRemotely) { | 1025 if (isPlayingRemotely) { |
| 1031 if (m_isOverlayButton) { | 1026 if (m_isOverlayButton) { |
| 1032 setDisplayType(MediaOverlayCastOnButton); | 1027 setDisplayType(MediaOverlayCastOnButton); |
| 1033 } else { | 1028 } else { |
| 1034 setDisplayType(MediaCastOnButton); | 1029 setDisplayType(MediaCastOnButton); |
| 1035 } | 1030 } |
| 1036 } else { | 1031 } else { |
| 1037 if (m_isOverlayButton) { | 1032 if (m_isOverlayButton) { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 MediaControlCurrentTimeDisplayElement* | 1098 MediaControlCurrentTimeDisplayElement* |
| 1104 MediaControlCurrentTimeDisplayElement::create(MediaControls& mediaControls) { | 1099 MediaControlCurrentTimeDisplayElement::create(MediaControls& mediaControls) { |
| 1105 MediaControlCurrentTimeDisplayElement* element = | 1100 MediaControlCurrentTimeDisplayElement* element = |
| 1106 new MediaControlCurrentTimeDisplayElement(mediaControls); | 1101 new MediaControlCurrentTimeDisplayElement(mediaControls); |
| 1107 element->setShadowPseudoId( | 1102 element->setShadowPseudoId( |
| 1108 AtomicString("-webkit-media-controls-current-time-display")); | 1103 AtomicString("-webkit-media-controls-current-time-display")); |
| 1109 return element; | 1104 return element; |
| 1110 } | 1105 } |
| 1111 | 1106 |
| 1112 } // namespace blink | 1107 } // namespace blink |
| OLD | NEW |