| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 return 0; | 62 return 0; |
| 63 } | 63 } |
| 64 | 64 |
| 65 bool MediaControlsChromium::initializeControls(Document& document) | 65 bool MediaControlsChromium::initializeControls(Document& document) |
| 66 { | 66 { |
| 67 // Create an enclosing element for the panel so we can visually offset the c
ontrols correctly. | 67 // Create an enclosing element for the panel so we can visually offset the c
ontrols correctly. |
| 68 RefPtr<MediaControlPanelEnclosureElement> enclosure = MediaControlPanelEnclo
sureElement::create(document); | 68 RefPtr<MediaControlPanelEnclosureElement> enclosure = MediaControlPanelEnclo
sureElement::create(document); |
| 69 | 69 |
| 70 RefPtr<MediaControlPanelElement> panel = MediaControlPanelElement::create(do
cument); | 70 RefPtr<MediaControlPanelElement> panel = MediaControlPanelElement::create(do
cument); |
| 71 | 71 |
| 72 TrackExceptionState es; | 72 TrackExceptionState exceptionState; |
| 73 | 73 |
| 74 RefPtr<MediaControlPlayButtonElement> playButton = MediaControlPlayButtonEle
ment::create(document); | 74 RefPtr<MediaControlPlayButtonElement> playButton = MediaControlPlayButtonEle
ment::create(document); |
| 75 m_playButton = playButton.get(); | 75 m_playButton = playButton.get(); |
| 76 panel->appendChild(playButton.release(), es); | 76 panel->appendChild(playButton.release(), exceptionState); |
| 77 if (es.hadException()) | 77 if (exceptionState.hadException()) |
| 78 return false; | 78 return false; |
| 79 | 79 |
| 80 RefPtr<MediaControlTimelineElement> timeline = MediaControlTimelineElement::
create(document, this); | 80 RefPtr<MediaControlTimelineElement> timeline = MediaControlTimelineElement::
create(document, this); |
| 81 m_timeline = timeline.get(); | 81 m_timeline = timeline.get(); |
| 82 panel->appendChild(timeline.release(), es); | 82 panel->appendChild(timeline.release(), exceptionState); |
| 83 if (es.hadException()) | 83 if (exceptionState.hadException()) |
| 84 return false; | 84 return false; |
| 85 | 85 |
| 86 RefPtr<MediaControlCurrentTimeDisplayElement> currentTimeDisplay = MediaCont
rolCurrentTimeDisplayElement::create(document); | 86 RefPtr<MediaControlCurrentTimeDisplayElement> currentTimeDisplay = MediaCont
rolCurrentTimeDisplayElement::create(document); |
| 87 m_currentTimeDisplay = currentTimeDisplay.get(); | 87 m_currentTimeDisplay = currentTimeDisplay.get(); |
| 88 m_currentTimeDisplay->hide(); | 88 m_currentTimeDisplay->hide(); |
| 89 panel->appendChild(currentTimeDisplay.release(), es); | 89 panel->appendChild(currentTimeDisplay.release(), exceptionState); |
| 90 if (es.hadException()) | 90 if (exceptionState.hadException()) |
| 91 return false; | 91 return false; |
| 92 | 92 |
| 93 RefPtr<MediaControlTimeRemainingDisplayElement> durationDisplay = MediaContr
olTimeRemainingDisplayElement::create(document); | 93 RefPtr<MediaControlTimeRemainingDisplayElement> durationDisplay = MediaContr
olTimeRemainingDisplayElement::create(document); |
| 94 m_durationDisplay = durationDisplay.get(); | 94 m_durationDisplay = durationDisplay.get(); |
| 95 panel->appendChild(durationDisplay.release(), es); | 95 panel->appendChild(durationDisplay.release(), exceptionState); |
| 96 if (es.hadException()) | 96 if (exceptionState.hadException()) |
| 97 return false; | 97 return false; |
| 98 | 98 |
| 99 RefPtr<MediaControlPanelMuteButtonElement> panelMuteButton = MediaControlPan
elMuteButtonElement::create(document, this); | 99 RefPtr<MediaControlPanelMuteButtonElement> panelMuteButton = MediaControlPan
elMuteButtonElement::create(document, this); |
| 100 m_panelMuteButton = panelMuteButton.get(); | 100 m_panelMuteButton = panelMuteButton.get(); |
| 101 panel->appendChild(panelMuteButton.release(), es); | 101 panel->appendChild(panelMuteButton.release(), exceptionState); |
| 102 if (es.hadException()) | 102 if (exceptionState.hadException()) |
| 103 return false; | 103 return false; |
| 104 | 104 |
| 105 RefPtr<MediaControlPanelVolumeSliderElement> slider = MediaControlPanelVolum
eSliderElement::create(document); | 105 RefPtr<MediaControlPanelVolumeSliderElement> slider = MediaControlPanelVolum
eSliderElement::create(document); |
| 106 m_volumeSlider = slider.get(); | 106 m_volumeSlider = slider.get(); |
| 107 m_volumeSlider->setClearMutedOnUserInteraction(true); | 107 m_volumeSlider->setClearMutedOnUserInteraction(true); |
| 108 panel->appendChild(slider.release(), es); | 108 panel->appendChild(slider.release(), exceptionState); |
| 109 if (es.hadException()) | 109 if (exceptionState.hadException()) |
| 110 return false; | 110 return false; |
| 111 | 111 |
| 112 if (RenderTheme::theme().supportsClosedCaptioning()) { | 112 if (RenderTheme::theme().supportsClosedCaptioning()) { |
| 113 RefPtr<MediaControlToggleClosedCaptionsButtonElement> toggleClosedCaptio
nsButton = MediaControlToggleClosedCaptionsButtonElement::create(document, this)
; | 113 RefPtr<MediaControlToggleClosedCaptionsButtonElement> toggleClosedCaptio
nsButton = MediaControlToggleClosedCaptionsButtonElement::create(document, this)
; |
| 114 m_toggleClosedCaptionsButton = toggleClosedCaptionsButton.get(); | 114 m_toggleClosedCaptionsButton = toggleClosedCaptionsButton.get(); |
| 115 panel->appendChild(toggleClosedCaptionsButton.release(), es); | 115 panel->appendChild(toggleClosedCaptionsButton.release(), exceptionState)
; |
| 116 if (es.hadException()) | 116 if (exceptionState.hadException()) |
| 117 return false; | 117 return false; |
| 118 } | 118 } |
| 119 | 119 |
| 120 RefPtr<MediaControlFullscreenButtonElement> fullscreenButton = MediaControlF
ullscreenButtonElement::create(document); | 120 RefPtr<MediaControlFullscreenButtonElement> fullscreenButton = MediaControlF
ullscreenButtonElement::create(document); |
| 121 m_fullScreenButton = fullscreenButton.get(); | 121 m_fullScreenButton = fullscreenButton.get(); |
| 122 panel->appendChild(fullscreenButton.release(), es); | 122 panel->appendChild(fullscreenButton.release(), exceptionState); |
| 123 if (es.hadException()) | 123 if (exceptionState.hadException()) |
| 124 return false; | 124 return false; |
| 125 | 125 |
| 126 m_panel = panel.get(); | 126 m_panel = panel.get(); |
| 127 enclosure->appendChild(panel.release(), es); | 127 enclosure->appendChild(panel.release(), exceptionState); |
| 128 if (es.hadException()) | 128 if (exceptionState.hadException()) |
| 129 return false; | 129 return false; |
| 130 | 130 |
| 131 m_enclosure = enclosure.get(); | 131 m_enclosure = enclosure.get(); |
| 132 appendChild(enclosure.release(), es); | 132 appendChild(enclosure.release(), exceptionState); |
| 133 if (es.hadException()) | 133 if (exceptionState.hadException()) |
| 134 return false; | 134 return false; |
| 135 | 135 |
| 136 return true; | 136 return true; |
| 137 } | 137 } |
| 138 | 138 |
| 139 void MediaControlsChromium::setMediaController(MediaControllerInterface* control
ler) | 139 void MediaControlsChromium::setMediaController(MediaControllerInterface* control
ler) |
| 140 { | 140 { |
| 141 if (m_mediaController == controller) | 141 if (m_mediaController == controller) |
| 142 return; | 142 return; |
| 143 | 143 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 216 |
| 217 void MediaControlsChromium::insertTextTrackContainer(PassRefPtr<MediaControlText
TrackContainerElement> textTrackContainer) | 217 void MediaControlsChromium::insertTextTrackContainer(PassRefPtr<MediaControlText
TrackContainerElement> textTrackContainer) |
| 218 { | 218 { |
| 219 // Insert it before the first controller element so it always displays behin
d the controls. | 219 // Insert it before the first controller element so it always displays behin
d the controls. |
| 220 // In the Chromium case, that's the enclosure element. | 220 // In the Chromium case, that's the enclosure element. |
| 221 insertBefore(textTrackContainer, m_enclosure); | 221 insertBefore(textTrackContainer, m_enclosure); |
| 222 } | 222 } |
| 223 | 223 |
| 224 | 224 |
| 225 } | 225 } |
| OLD | NEW |