| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| 11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
| 12 * | 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 #include "core/html/shadow/MediaControlsChromiumAndroid.h" | 27 #include "core/html/shadow/MediaControlsAndroid.h" |
| 28 | 28 |
| 29 #include "bindings/v8/ExceptionState.h" | 29 #include "bindings/v8/ExceptionState.h" |
| 30 #include "bindings/v8/ExceptionStatePlaceholder.h" | 30 #include "bindings/v8/ExceptionStatePlaceholder.h" |
| 31 | 31 |
| 32 namespace WebCore { | 32 namespace WebCore { |
| 33 | 33 |
| 34 MediaControlsChromiumAndroid::MediaControlsChromiumAndroid(Document& document) | 34 MediaControlsAndroid::MediaControlsAndroid(Document& document) |
| 35 : MediaControlsChromium(document) | 35 : MediaControls(document) |
| 36 , m_overlayPlayButton(0) | 36 , m_overlayPlayButton(0) |
| 37 , m_overlayEnclosure(0) | 37 , m_overlayEnclosure(0) |
| 38 { | 38 { |
| 39 } | 39 } |
| 40 | 40 |
| 41 PassRefPtr<MediaControls> MediaControls::create(Document& document) | 41 PassRefPtr<MediaControls> MediaControls::create(Document& document) |
| 42 { | 42 { |
| 43 return MediaControlsChromiumAndroid::createControls(document); | |
| 44 } | |
| 45 | |
| 46 PassRefPtr<MediaControlsChromiumAndroid> MediaControlsChromiumAndroid::createCon
trols(Document& document) | |
| 47 { | |
| 48 if (!document.page()) | 43 if (!document.page()) |
| 49 return 0; | 44 return 0; |
| 50 | 45 |
| 51 RefPtr<MediaControlsChromiumAndroid> controls = adoptRef(new MediaControlsCh
romiumAndroid(document)); | 46 RefPtr<MediaControlsAndroid> controls = adoptRef(new MediaControlsAndroid(do
cument)); |
| 52 | 47 |
| 53 TrackExceptionState exceptionState; | 48 TrackExceptionState exceptionState; |
| 54 | 49 |
| 55 RefPtr<MediaControlOverlayEnclosureElement> overlayEnclosure = MediaControlO
verlayEnclosureElement::create(document); | 50 RefPtr<MediaControlOverlayEnclosureElement> overlayEnclosure = MediaControlO
verlayEnclosureElement::create(document); |
| 56 RefPtr<MediaControlOverlayPlayButtonElement> overlayPlayButton = MediaContro
lOverlayPlayButtonElement::create(document); | 51 RefPtr<MediaControlOverlayPlayButtonElement> overlayPlayButton = MediaContro
lOverlayPlayButtonElement::create(document); |
| 57 controls->m_overlayPlayButton = overlayPlayButton.get(); | 52 controls->m_overlayPlayButton = overlayPlayButton.get(); |
| 58 overlayEnclosure->appendChild(overlayPlayButton.release(), exceptionState); | 53 overlayEnclosure->appendChild(overlayPlayButton.release(), exceptionState); |
| 59 if (exceptionState.hadException()) | 54 if (exceptionState.hadException()) |
| 60 return 0; | 55 return 0; |
| 61 | 56 |
| 62 controls->m_overlayEnclosure = overlayEnclosure.get(); | 57 controls->m_overlayEnclosure = overlayEnclosure.get(); |
| 63 controls->appendChild(overlayEnclosure.release(), exceptionState); | 58 controls->appendChild(overlayEnclosure.release(), exceptionState); |
| 64 if (exceptionState.hadException()) | 59 if (exceptionState.hadException()) |
| 65 return 0; | 60 return 0; |
| 66 | 61 |
| 67 if (controls->initializeControls(document)) | 62 if (controls->initializeControls(document)) |
| 68 return controls.release(); | 63 return controls.release(); |
| 69 | 64 |
| 70 return 0; | 65 return 0; |
| 71 } | 66 } |
| 72 | 67 |
| 73 void MediaControlsChromiumAndroid::setMediaController(MediaControllerInterface*
controller) | 68 void MediaControlsAndroid::setMediaController(MediaControllerInterface* controll
er) |
| 74 { | 69 { |
| 75 if (m_overlayPlayButton) | 70 if (m_overlayPlayButton) |
| 76 m_overlayPlayButton->setMediaController(controller); | 71 m_overlayPlayButton->setMediaController(controller); |
| 77 if (m_overlayEnclosure) | 72 if (m_overlayEnclosure) |
| 78 m_overlayEnclosure->setMediaController(controller); | 73 m_overlayEnclosure->setMediaController(controller); |
| 79 MediaControlsChromium::setMediaController(controller); | 74 MediaControls::setMediaController(controller); |
| 80 } | 75 } |
| 81 | 76 |
| 82 void MediaControlsChromiumAndroid::playbackStarted() | 77 void MediaControlsAndroid::playbackStarted() |
| 83 { | 78 { |
| 84 m_overlayPlayButton->updateDisplayType(); | 79 m_overlayPlayButton->updateDisplayType(); |
| 85 MediaControlsChromium::playbackStarted(); | 80 MediaControls::playbackStarted(); |
| 86 } | 81 } |
| 87 | 82 |
| 88 void MediaControlsChromiumAndroid::playbackStopped() | 83 void MediaControlsAndroid::playbackStopped() |
| 89 { | 84 { |
| 90 m_overlayPlayButton->updateDisplayType(); | 85 m_overlayPlayButton->updateDisplayType(); |
| 91 MediaControlsChromium::playbackStopped(); | 86 MediaControls::playbackStopped(); |
| 92 } | 87 } |
| 93 | 88 |
| 94 void MediaControlsChromiumAndroid::insertTextTrackContainer(PassRefPtr<MediaCont
rolTextTrackContainerElement> textTrackContainer) | 89 void MediaControlsAndroid::insertTextTrackContainer(PassRefPtr<MediaControlTextT
rackContainerElement> textTrackContainer) |
| 95 { | 90 { |
| 96 // Insert it before the overlay play button so it always displays behind it. | 91 // Insert it before the overlay play button so it always displays behind it. |
| 97 m_overlayEnclosure->insertBefore(textTrackContainer, m_overlayPlayButton); | 92 m_overlayEnclosure->insertBefore(textTrackContainer, m_overlayPlayButton); |
| 98 } | 93 } |
| 99 } | 94 } |
| OLD | NEW |