| 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 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 #include "core/html/shadow/MediaControlsChromiumAndroid.h" | 27 #include "core/html/shadow/MediaControlsChromiumAndroid.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 MediaControlsChromiumAndroid::MediaControlsChromiumAndroid(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 bool MediaControlsChromiumAndroid::initializeControls(Document& document) |
| 42 { | 42 { |
| 43 return MediaControlsChromiumAndroid::createControls(document); | |
| 44 } | |
| 45 | |
| 46 PassRefPtr<MediaControlsChromiumAndroid> MediaControlsChromiumAndroid::createCon
trols(Document& document) | |
| 47 { | |
| 48 if (!document.page()) | |
| 49 return 0; | |
| 50 | |
| 51 RefPtr<MediaControlsChromiumAndroid> controls = adoptRef(new MediaControlsCh
romiumAndroid(document)); | |
| 52 | |
| 53 TrackExceptionState exceptionState; | 43 TrackExceptionState exceptionState; |
| 54 | 44 |
| 55 RefPtr<MediaControlOverlayEnclosureElement> overlayEnclosure = MediaControlO
verlayEnclosureElement::create(document); | 45 RefPtr<MediaControlOverlayEnclosureElement> overlayEnclosure = MediaControlO
verlayEnclosureElement::create(document); |
| 56 RefPtr<MediaControlOverlayPlayButtonElement> overlayPlayButton = MediaContro
lOverlayPlayButtonElement::create(document); | 46 RefPtr<MediaControlOverlayPlayButtonElement> overlayPlayButton = MediaContro
lOverlayPlayButtonElement::create(document); |
| 57 controls->m_overlayPlayButton = overlayPlayButton.get(); | 47 m_overlayPlayButton = overlayPlayButton.get(); |
| 58 overlayEnclosure->appendChild(overlayPlayButton.release(), exceptionState); | 48 overlayEnclosure->appendChild(overlayPlayButton.release(), exceptionState); |
| 59 if (exceptionState.hadException()) | 49 if (exceptionState.hadException()) |
| 60 return 0; | 50 return false; |
| 61 | 51 |
| 62 controls->m_overlayEnclosure = overlayEnclosure.get(); | 52 m_overlayEnclosure = overlayEnclosure.get(); |
| 63 controls->appendChild(overlayEnclosure.release(), exceptionState); | 53 appendChild(overlayEnclosure.release(), exceptionState); |
| 64 if (exceptionState.hadException()) | 54 if (exceptionState.hadException()) |
| 65 return 0; | 55 return false; |
| 66 | 56 |
| 67 if (controls->initializeControls(document)) | 57 return MediaControls::initializeControls(document); |
| 68 return controls.release(); | |
| 69 | |
| 70 return 0; | |
| 71 } | 58 } |
| 72 | 59 |
| 73 void MediaControlsChromiumAndroid::setMediaController(MediaControllerInterface*
controller) | 60 void MediaControlsChromiumAndroid::setMediaController(MediaControllerInterface*
controller) |
| 74 { | 61 { |
| 75 if (m_overlayPlayButton) | 62 if (m_overlayPlayButton) |
| 76 m_overlayPlayButton->setMediaController(controller); | 63 m_overlayPlayButton->setMediaController(controller); |
| 77 if (m_overlayEnclosure) | 64 if (m_overlayEnclosure) |
| 78 m_overlayEnclosure->setMediaController(controller); | 65 m_overlayEnclosure->setMediaController(controller); |
| 79 MediaControlsChromium::setMediaController(controller); | 66 MediaControls::setMediaController(controller); |
| 80 } | 67 } |
| 81 | 68 |
| 82 void MediaControlsChromiumAndroid::playbackStarted() | 69 void MediaControlsChromiumAndroid::playbackStarted() |
| 83 { | 70 { |
| 84 m_overlayPlayButton->updateDisplayType(); | 71 m_overlayPlayButton->updateDisplayType(); |
| 85 MediaControlsChromium::playbackStarted(); | 72 MediaControls::playbackStarted(); |
| 86 } | 73 } |
| 87 | 74 |
| 88 void MediaControlsChromiumAndroid::playbackStopped() | 75 void MediaControlsChromiumAndroid::playbackStopped() |
| 89 { | 76 { |
| 90 m_overlayPlayButton->updateDisplayType(); | 77 m_overlayPlayButton->updateDisplayType(); |
| 91 MediaControlsChromium::playbackStopped(); | 78 MediaControls::playbackStopped(); |
| 92 } | 79 } |
| 93 | 80 |
| 94 void MediaControlsChromiumAndroid::insertTextTrackContainer(PassRefPtr<MediaCont
rolTextTrackContainerElement> textTrackContainer) | 81 void MediaControlsChromiumAndroid::insertTextTrackContainer(PassRefPtr<MediaCont
rolTextTrackContainerElement> textTrackContainer) |
| 95 { | 82 { |
| 96 // Insert it before the overlay play button so it always displays behind it. | 83 // Insert it before the overlay play button so it always displays behind it. |
| 97 m_overlayEnclosure->insertBefore(textTrackContainer, m_overlayPlayButton); | 84 m_overlayEnclosure->insertBefore(textTrackContainer, m_overlayPlayButton); |
| 98 } | 85 } |
| 99 } | 86 } |
| OLD | NEW |