1/* 2 * Copyright (C) 2014 Apple Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 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. 24 */ 25 26 27#ifndef WebVideoFullscreenModelMediaElement_h 28#define WebVideoFullscreenModelMediaElement_h 29 30#if PLATFORM(IOS) 31 32#include <WebCore/EventListener.h> 33#include <WebCore/FloatRect.h> 34#include <WebCore/PlatformLayer.h> 35#include <WebCore/WebVideoFullscreenModel.h> 36#include <wtf/RefPtr.h> 37#include <wtf/RetainPtr.h> 38#include <wtf/Vector.h> 39 40namespace WebCore { 41class HTMLMediaElement; 42class TextTrack; 43class WebVideoFullscreenInterface; 44 45class WebVideoFullscreenModelMediaElement : public WebVideoFullscreenModel, public EventListener { 46public: 47 WebVideoFullscreenModelMediaElement(); 48 virtual ~WebVideoFullscreenModelMediaElement(); 49 void setWebVideoFullscreenInterface(WebVideoFullscreenInterface* interface) {m_videoFullscreenInterface = interface;} 50 void setMediaElement(HTMLMediaElement*); 51 void setVideoFullscreenLayer(PlatformLayer*); 52 53 virtual void handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event*) override; 54 void updateForEventName(const WTF::AtomicString&); 55 bool operator==(const EventListener& rhs) override 56 {return static_cast<WebCore::EventListener*>(this) == &rhs;} 57 58 virtual void play() override; 59 virtual void pause() override; 60 virtual void togglePlayState() override; 61 virtual void beginScrubbing() override; 62 virtual void endScrubbing() override; 63 virtual void seekToTime(double time) override; 64 virtual void fastSeek(double time) override; 65 virtual void beginScanningForward() override; 66 virtual void beginScanningBackward() override; 67 virtual void endScanning() override; 68 virtual void requestExitFullscreen() override; 69 virtual void setVideoLayerFrame(FloatRect) override; 70 virtual void setVideoLayerGravity(WebVideoFullscreenModel::VideoGravity) override; 71 virtual void selectAudioMediaOption(uint64_t index) override; 72 virtual void selectLegibleMediaOption(uint64_t index) override; 73 74private: 75 static const Vector<WTF::AtomicString>& observedEventNames(); 76 const WTF::AtomicString& eventNameAll(); 77 78 RefPtr<HTMLMediaElement> m_mediaElement; 79 RetainPtr<PlatformLayer> m_videoFullscreenLayer; 80 bool m_isListening; 81 WebVideoFullscreenInterface* m_videoFullscreenInterface; 82 FloatRect m_videoFrame; 83 Vector<RefPtr<TextTrack>> m_legibleTracksForMenu; 84 85 void updateLegibleOptions(); 86}; 87 88} 89 90#endif 91 92#endif 93