| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2011, 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 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 this, | 144 this, |
| 145 &MediaControls::hideMediaControlsTimerFired), | 145 &MediaControls::hideMediaControlsTimerFired), |
| 146 m_hideTimerBehaviorFlags(IgnoreNone), | 146 m_hideTimerBehaviorFlags(IgnoreNone), |
| 147 m_isMouseOverControls(false), | 147 m_isMouseOverControls(false), |
| 148 m_isPausedForScrubbing(false), | 148 m_isPausedForScrubbing(false), |
| 149 m_panelWidthChangedTimer(TaskRunnerHelper::get(TaskType::UnspecedTimer, | 149 m_panelWidthChangedTimer(TaskRunnerHelper::get(TaskType::UnspecedTimer, |
| 150 &mediaElement.document()), | 150 &mediaElement.document()), |
| 151 this, | 151 this, |
| 152 &MediaControls::panelWidthChangedTimerFired), | 152 &MediaControls::panelWidthChangedTimerFired), |
| 153 m_panelWidth(0), | 153 m_panelWidth(0), |
| 154 m_keepShowingUntilTimerFires(false) {} | 154 m_keepShowingUntilTimerFires(false) { |
| 155 LOG(INFO) << "MediaControls ctor"; |
| 156 } |
| 155 | 157 |
| 156 MediaControls* MediaControls::create(HTMLMediaElement& mediaElement, | 158 MediaControls* MediaControls::create(HTMLMediaElement& mediaElement, |
| 157 ShadowRoot& shadowRoot) { | 159 ShadowRoot& shadowRoot) { |
| 160 // TRACE_EVENT0("Blink", "CreateControls"); |
| 161 |
| 158 MediaControls* controls = new MediaControls(mediaElement); | 162 MediaControls* controls = new MediaControls(mediaElement); |
| 159 controls->setShadowPseudoId(AtomicString("-webkit-media-controls")); | 163 controls->setShadowPseudoId(AtomicString("-webkit-media-controls")); |
| 160 controls->initializeControls(); | 164 controls->initializeControls(); |
| 161 controls->reset(); | 165 controls->reset(); |
| 162 | 166 |
| 163 // Initialize the orientation lock when going fullscreen feature. | 167 // Initialize the orientation lock when going fullscreen feature. |
| 164 if (RuntimeEnabledFeatures::videoFullscreenOrientationLockEnabled() && | 168 if (RuntimeEnabledFeatures::videoFullscreenOrientationLockEnabled() && |
| 165 mediaElement.isHTMLVideoElement()) { | 169 mediaElement.isHTMLVideoElement()) { |
| 166 controls->m_orientationLockDelegate = | 170 controls->m_orientationLockDelegate = |
| 167 new MediaControlsOrientationLockDelegate( | 171 new MediaControlsOrientationLockDelegate( |
| 168 toHTMLVideoElement(mediaElement)); | 172 toHTMLVideoElement(mediaElement)); |
| 169 } | 173 } |
| 170 | 174 |
| 171 shadowRoot.appendChild(controls); | 175 shadowRoot.appendChild(controls); |
| 172 return controls; | 176 return controls; |
| 173 } | 177 } |
| 174 | 178 |
| 179 MediaControls::~MediaControls() { |
| 180 LOG(INFO) << "~MediaControls"; |
| 181 } |
| 182 |
| 175 // The media controls DOM structure looks like: | 183 // The media controls DOM structure looks like: |
| 176 // | 184 // |
| 177 // MediaControls | 185 // MediaControls |
| 178 // (-webkit-media-controls) | 186 // (-webkit-media-controls) |
| 179 // +-MediaControlOverlayEnclosureElement | 187 // +-MediaControlOverlayEnclosureElement |
| 180 // | (-webkit-media-controls-overlay-enclosure) | 188 // | (-webkit-media-controls-overlay-enclosure) |
| 181 // | +-MediaControlOverlayPlayButtonElement | 189 // | +-MediaControlOverlayPlayButtonElement |
| 182 // | | (-webkit-media-controls-overlay-play-button) | 190 // | | (-webkit-media-controls-overlay-play-button) |
| 183 // | | {if mediaControlsOverlayPlayButtonEnabled} | 191 // | | {if mediaControlsOverlayPlayButtonEnabled} |
| 184 // | \-MediaControlCastButtonElement | 192 // | \-MediaControlCastButtonElement |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 onTextTracksAddedOrRemoved(); | 378 onTextTracksAddedOrRemoved(); |
| 371 | 379 |
| 372 m_fullscreenButton->setIsWanted(shouldShowFullscreenButton(mediaElement())); | 380 m_fullscreenButton->setIsWanted(shouldShowFullscreenButton(mediaElement())); |
| 373 | 381 |
| 374 refreshCastButtonVisibilityWithoutUpdate(); | 382 refreshCastButtonVisibilityWithoutUpdate(); |
| 375 | 383 |
| 376 m_downloadButton->setIsWanted( | 384 m_downloadButton->setIsWanted( |
| 377 m_downloadButton->shouldDisplayDownloadButton()); | 385 m_downloadButton->shouldDisplayDownloadButton()); |
| 378 } | 386 } |
| 379 | 387 |
| 388 void MediaControls::detach() { |
| 389 m_windowEventListener->stop(); |
| 390 m_mediaEventListener->detach(); |
| 391 if (m_orientationLockDelegate) |
| 392 m_orientationLockDelegate->detach(); |
| 393 } |
| 394 |
| 380 LayoutObject* MediaControls::layoutObjectForTextTrackLayout() { | 395 LayoutObject* MediaControls::layoutObjectForTextTrackLayout() { |
| 381 return m_panel->layoutObject(); | 396 return m_panel->layoutObject(); |
| 382 } | 397 } |
| 383 | 398 |
| 384 void MediaControls::show() { | 399 void MediaControls::show() { |
| 385 makeOpaque(); | 400 makeOpaque(); |
| 386 m_panel->setIsWanted(true); | 401 m_panel->setIsWanted(true); |
| 387 m_panel->setIsDisplayed(true); | 402 m_panel->setIsDisplayed(true); |
| 388 if (m_overlayPlayButton) | 403 if (m_overlayPlayButton) |
| 389 m_overlayPlayButton->updateDisplayType(); | 404 m_overlayPlayButton->updateDisplayType(); |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 void MediaControls::hideAllMenus() { | 965 void MediaControls::hideAllMenus() { |
| 951 m_windowEventListener->stop(); | 966 m_windowEventListener->stop(); |
| 952 | 967 |
| 953 if (m_overflowList->isWanted()) | 968 if (m_overflowList->isWanted()) |
| 954 m_overflowList->setIsWanted(false); | 969 m_overflowList->setIsWanted(false); |
| 955 if (m_textTrackList->isWanted()) | 970 if (m_textTrackList->isWanted()) |
| 956 m_textTrackList->setVisible(false); | 971 m_textTrackList->setVisible(false); |
| 957 } | 972 } |
| 958 | 973 |
| 959 DEFINE_TRACE(MediaControls) { | 974 DEFINE_TRACE(MediaControls) { |
| 975 LOG(INFO) << "MediaControls::trace"; |
| 960 visitor->trace(m_mediaElement); | 976 visitor->trace(m_mediaElement); |
| 961 visitor->trace(m_panel); | 977 visitor->trace(m_panel); |
| 962 visitor->trace(m_overlayPlayButton); | 978 visitor->trace(m_overlayPlayButton); |
| 963 visitor->trace(m_overlayEnclosure); | 979 visitor->trace(m_overlayEnclosure); |
| 964 visitor->trace(m_playButton); | 980 visitor->trace(m_playButton); |
| 965 visitor->trace(m_currentTimeDisplay); | 981 visitor->trace(m_currentTimeDisplay); |
| 966 visitor->trace(m_timeline); | 982 visitor->trace(m_timeline); |
| 967 visitor->trace(m_muteButton); | 983 visitor->trace(m_muteButton); |
| 968 visitor->trace(m_volumeSlider); | 984 visitor->trace(m_volumeSlider); |
| 969 visitor->trace(m_toggleClosedCaptionsButton); | 985 visitor->trace(m_toggleClosedCaptionsButton); |
| 970 visitor->trace(m_fullscreenButton); | 986 visitor->trace(m_fullscreenButton); |
| 971 visitor->trace(m_downloadButton); | 987 visitor->trace(m_downloadButton); |
| 972 visitor->trace(m_durationDisplay); | 988 visitor->trace(m_durationDisplay); |
| 973 visitor->trace(m_enclosure); | 989 visitor->trace(m_enclosure); |
| 974 visitor->trace(m_textTrackList); | 990 visitor->trace(m_textTrackList); |
| 975 visitor->trace(m_overflowMenu); | 991 visitor->trace(m_overflowMenu); |
| 976 visitor->trace(m_overflowList); | 992 visitor->trace(m_overflowList); |
| 977 visitor->trace(m_castButton); | 993 visitor->trace(m_castButton); |
| 978 visitor->trace(m_overlayCastButton); | 994 visitor->trace(m_overlayCastButton); |
| 979 visitor->trace(m_mediaEventListener); | 995 visitor->trace(m_mediaEventListener); |
| 980 visitor->trace(m_windowEventListener); | 996 visitor->trace(m_windowEventListener); |
| 981 visitor->trace(m_orientationLockDelegate); | 997 visitor->trace(m_orientationLockDelegate); |
| 982 HTMLDivElement::trace(visitor); | 998 HTMLDivElement::trace(visitor); |
| 983 } | 999 } |
| 984 | 1000 |
| 985 } // namespace blink | 1001 } // namespace blink |
| OLD | NEW |