Chromium Code Reviews| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 MediaControlMuteButtonElement* muteButton = MediaControlMuteButtonElement::c reate(*this); | 216 MediaControlMuteButtonElement* muteButton = MediaControlMuteButtonElement::c reate(*this); |
| 217 m_muteButton = muteButton; | 217 m_muteButton = muteButton; |
| 218 panel->appendChild(muteButton); | 218 panel->appendChild(muteButton); |
| 219 | 219 |
| 220 MediaControlVolumeSliderElement* slider = MediaControlVolumeSliderElement::c reate(*this); | 220 MediaControlVolumeSliderElement* slider = MediaControlVolumeSliderElement::c reate(*this); |
| 221 m_volumeSlider = slider; | 221 m_volumeSlider = slider; |
| 222 panel->appendChild(slider); | 222 panel->appendChild(slider); |
| 223 if (m_allowHiddenVolumeControls && preferHiddenVolumeControls(document())) | 223 if (m_allowHiddenVolumeControls && preferHiddenVolumeControls(document())) |
| 224 m_volumeSlider->setIsWanted(false); | 224 m_volumeSlider->setIsWanted(false); |
| 225 | 225 |
| 226 MediaControlToggleClosedCaptionsButtonElement* toggleClosedCaptionsButton = MediaControlToggleClosedCaptionsButtonElement::create(*this); | |
| 227 m_toggleClosedCaptionsButton = toggleClosedCaptionsButton; | |
| 228 panel->appendChild(toggleClosedCaptionsButton); | |
| 229 | |
| 230 MediaControlCastButtonElement* castButton = MediaControlCastButtonElement::c reate(*this, false); | |
| 231 m_castButton = castButton; | |
| 232 panel->appendChild(castButton); | |
| 233 | |
| 234 MediaControlFullscreenButtonElement* fullscreenButton = MediaControlFullscre enButtonElement::create(*this); | 226 MediaControlFullscreenButtonElement* fullscreenButton = MediaControlFullscre enButtonElement::create(*this); |
| 235 m_fullscreenButton = fullscreenButton; | 227 m_fullscreenButton = fullscreenButton; |
| 236 panel->appendChild(fullscreenButton); | 228 panel->appendChild(fullscreenButton); |
| 237 | 229 |
| 238 MediaControlDownloadButtonElement* downloadButton = MediaControlDownloadButt onElement::create(*this); | 230 MediaControlDownloadButtonElement* downloadButton = MediaControlDownloadButt onElement::create(*this); |
| 239 m_downloadButton = downloadButton; | 231 m_downloadButton = downloadButton; |
| 240 panel->appendChild(downloadButton); | 232 panel->appendChild(downloadButton); |
| 241 | 233 |
| 234 MediaControlCastButtonElement* castButton = MediaControlCastButtonElement::c reate(*this, false); | |
| 235 m_castButton = castButton; | |
| 236 panel->appendChild(castButton); | |
| 237 | |
| 238 MediaControlToggleClosedCaptionsButtonElement* toggleClosedCaptionsButton = MediaControlToggleClosedCaptionsButtonElement::create(*this); | |
| 239 m_toggleClosedCaptionsButton = toggleClosedCaptionsButton; | |
| 240 panel->appendChild(toggleClosedCaptionsButton); | |
| 241 | |
| 242 m_panel = panel; | 242 m_panel = panel; |
| 243 enclosure->appendChild(panel); | 243 enclosure->appendChild(panel); |
| 244 | 244 |
| 245 m_enclosure = enclosure; | 245 m_enclosure = enclosure; |
| 246 appendChild(enclosure); | 246 appendChild(enclosure); |
| 247 | 247 |
| 248 MediaControlTextTrackListElement* textTrackList = MediaControlTextTrackListE lement::create(*this); | 248 MediaControlTextTrackListElement* textTrackList = MediaControlTextTrackListE lement::create(*this); |
| 249 m_textTrackList = textTrackList; | 249 m_textTrackList = textTrackList; |
| 250 appendChild(textTrackList); | 250 appendChild(textTrackList); |
| 251 | 251 |
| 252 MediaControlOverflowMenuButtonElement* overflowMenu = MediaControlOverflowMe nuButtonElement::create(*this); | 252 MediaControlOverflowMenuButtonElement* overflowMenu = MediaControlOverflowMe nuButtonElement::create(*this); |
| 253 m_overflowMenu = overflowMenu; | 253 m_overflowMenu = overflowMenu; |
| 254 panel->appendChild(overflowMenu); | 254 panel->appendChild(overflowMenu); |
| 255 | 255 |
| 256 MediaControlOverflowMenuListElement* overflowList = MediaControlOverflowMenu ListElement::create(*this); | 256 MediaControlOverflowMenuListElement* overflowList = MediaControlOverflowMenu ListElement::create(*this); |
| 257 m_overflowList = overflowList; | 257 m_overflowList = overflowList; |
| 258 appendChild(overflowList); | 258 appendChild(overflowList); |
| 259 | 259 |
| 260 // The order in which we append elements to the overflow list does matter. | 260 // The order in which we append elements to the overflow list does matter. |
|
whywhat
2016/09/16 14:18:55
nit: perhaps explain _how_ it matters. That the la
kdsilva
2016/09/16 15:25:03
Done.
| |
| 261 m_overflowList->appendChild(m_playButton->createOverflowElement(*this, Media ControlPlayButtonElement::create(*this))); | |
| 262 m_overflowList->appendChild(m_fullscreenButton->createOverflowElement(*this, MediaControlFullscreenButtonElement::create(*this))); | |
| 263 m_overflowList->appendChild(m_downloadButton->createOverflowElement(*this, M ediaControlDownloadButtonElement::create(*this))); | |
| 261 m_overflowList->appendChild(m_muteButton->createOverflowElement(*this, Media ControlMuteButtonElement::create(*this))); | 264 m_overflowList->appendChild(m_muteButton->createOverflowElement(*this, Media ControlMuteButtonElement::create(*this))); |
| 262 m_overflowList->appendChild(m_castButton->createOverflowElement(*this, Media ControlCastButtonElement::create(*this, false))); | 265 m_overflowList->appendChild(m_castButton->createOverflowElement(*this, Media ControlCastButtonElement::create(*this, false))); |
| 263 m_overflowList->appendChild(m_toggleClosedCaptionsButton->createOverflowElem ent(*this, MediaControlToggleClosedCaptionsButtonElement::create(*this))); | 266 m_overflowList->appendChild(m_toggleClosedCaptionsButton->createOverflowElem ent(*this, MediaControlToggleClosedCaptionsButtonElement::create(*this))); |
| 264 m_overflowList->appendChild(m_fullscreenButton->createOverflowElement(*this, MediaControlFullscreenButtonElement::create(*this))); | |
| 265 m_overflowList->appendChild(m_playButton->createOverflowElement(*this, Media ControlPlayButtonElement::create(*this))); | |
| 266 m_overflowList->appendChild(m_downloadButton->createOverflowElement(*this, M ediaControlDownloadButtonElement::create(*this))); | |
| 267 } | 267 } |
| 268 | 268 |
| 269 void MediaControls::reset() | 269 void MediaControls::reset() |
| 270 { | 270 { |
| 271 EventDispatchForbiddenScope::AllowUserAgentEvents allowEventsInShadow; | 271 EventDispatchForbiddenScope::AllowUserAgentEvents allowEventsInShadow; |
| 272 const bool useNewUi = RuntimeEnabledFeatures::newMediaPlaybackUiEnabled(); | 272 const bool useNewUi = RuntimeEnabledFeatures::newMediaPlaybackUiEnabled(); |
| 273 BatchedControlUpdate batch(this); | 273 BatchedControlUpdate batch(this); |
| 274 | 274 |
| 275 m_allowHiddenVolumeControls = useNewUi; | 275 m_allowHiddenVolumeControls = useNewUi; |
| 276 | 276 |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 709 | 709 |
| 710 if (!RuntimeEnabledFeatures::newMediaPlaybackUiEnabled()) | 710 if (!RuntimeEnabledFeatures::newMediaPlaybackUiEnabled()) |
| 711 return; | 711 return; |
| 712 | 712 |
| 713 // Controls that we'll hide / show, in order of decreasing priority. | 713 // Controls that we'll hide / show, in order of decreasing priority. |
| 714 MediaControlElement* elements[] = { | 714 MediaControlElement* elements[] = { |
| 715 // Exclude m_overflowMenu; we handle it specially. | 715 // Exclude m_overflowMenu; we handle it specially. |
| 716 m_playButton.get(), | 716 m_playButton.get(), |
| 717 m_fullscreenButton.get(), | 717 m_fullscreenButton.get(), |
| 718 m_downloadButton.get(), | 718 m_downloadButton.get(), |
| 719 m_toggleClosedCaptionsButton.get(), | 719 m_toggleClosedCaptionsButton.get(), |
|
whywhat
2016/09/16 14:18:55
nit: forgot to delete this one?
kdsilva
2016/09/16 15:25:03
Done.
| |
| 720 m_timeline.get(), | 720 m_timeline.get(), |
| 721 m_muteButton.get(), | |
| 722 m_volumeSlider.get(), | |
| 723 m_toggleClosedCaptionsButton.get(), | |
| 724 m_castButton.get(), | |
| 721 m_currentTimeDisplay.get(), | 725 m_currentTimeDisplay.get(), |
| 722 m_volumeSlider.get(), | |
| 723 m_castButton.get(), | |
| 724 m_muteButton.get(), | |
| 725 m_durationDisplay.get(), | 726 m_durationDisplay.get(), |
| 726 }; | 727 }; |
| 727 | 728 |
| 728 int usedWidth = 0; | 729 int usedWidth = 0; |
| 729 | 730 |
| 730 // Assume that all controls require 48px, unless we can get the computed | 731 // Assume that all controls require 48px, unless we can get the computed |
| 731 // style for the play button. Since the play button or overflow is always | 732 // style for the play button. Since the play button or overflow is always |
| 732 // shown, one of the two buttons should be available the first time we're | 733 // shown, one of the two buttons should be available the first time we're |
| 733 // called after layout. This will | 734 // called after layout. This will |
| 734 // also be the first time we have m_panelWidth!=0, so it won't matter if | 735 // also be the first time we have m_panelWidth!=0, so it won't matter if |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 866 visitor->trace(m_enclosure); | 867 visitor->trace(m_enclosure); |
| 867 visitor->trace(m_textTrackList); | 868 visitor->trace(m_textTrackList); |
| 868 visitor->trace(m_overflowMenu); | 869 visitor->trace(m_overflowMenu); |
| 869 visitor->trace(m_overflowList); | 870 visitor->trace(m_overflowList); |
| 870 visitor->trace(m_castButton); | 871 visitor->trace(m_castButton); |
| 871 visitor->trace(m_overlayCastButton); | 872 visitor->trace(m_overlayCastButton); |
| 872 HTMLDivElement::trace(visitor); | 873 HTMLDivElement::trace(visitor); |
| 873 } | 874 } |
| 874 | 875 |
| 875 } // namespace blink | 876 } // namespace blink |
| OLD | NEW |