2011-04-06 Alexis Menard <alexis.menard@openbossa.org>
[WebKit-https.git] / Source / WebKit / qt / WebCoreSupport / FullScreenVideoQt.h
1 /*
2  * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB.  If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19
20 #ifndef FullScreenVideoQt_h
21 #define FullScreenVideoQt_h
22
23 #include "qwebkitplatformplugin.h"
24 #include <QObject>
25 #include <wtf/Platform.h>
26
27 QT_BEGIN_NAMESPACE
28 class QGraphicsVideoItem;
29 class QMediaPlayer;
30 QT_END_NAMESPACE
31
32 namespace WebCore {
33
34 class ChromeClientQt;
35 class FullScreenVideoWidget;
36 class HTMLVideoElement;
37 class Node;
38 #if USE(QT_MULTIMEDIA)
39 class MediaPlayerPrivateQt;
40 #endif
41
42 // We do not use ENABLE or USE because moc does not expand these macros.
43 #if defined(WTF_USE_GSTREAMER) && WTF_USE_GSTREAMER
44 class FullScreenVideoWindow;
45
46 class GStreamerFullScreenVideoHandler : public QObject {
47     Q_OBJECT
48 public:
49     GStreamerFullScreenVideoHandler();
50     ~GStreamerFullScreenVideoHandler() { }
51     void setVideoElement(HTMLVideoElement*);
52
53     void enterFullScreen();
54     void exitFullScreen();
55
56 public Q_SLOTS:
57     void windowClosed();
58
59 private:
60     HTMLVideoElement* m_videoElement;
61     FullScreenVideoWindow* m_fullScreenWidget;
62 };
63 #endif
64
65 // We do not use ENABLE or USE because moc does not expand these macros.
66 #if defined(WTF_USE_QT_MULTIMEDIA) && WTF_USE_QT_MULTIMEDIA
67 class DefaultFullScreenVideoHandler : public QWebFullScreenVideoHandler {
68     Q_OBJECT
69 public:
70     DefaultFullScreenVideoHandler();
71     virtual ~DefaultFullScreenVideoHandler();
72     bool requiresFullScreenForVideoPlayback() const;
73
74 public Q_SLOTS:
75     void enterFullScreen(QMediaPlayer*);
76     void exitFullScreen();
77
78 private:
79     static bool s_shouldForceFullScreenVideoPlayback;
80     FullScreenVideoWidget *m_fullScreenWidget;
81 };
82 #endif
83
84 class FullScreenVideoQt : public QObject {
85     Q_OBJECT
86 public:
87     FullScreenVideoQt(ChromeClientQt*);
88     ~FullScreenVideoQt();
89
90     virtual void enterFullScreenForNode(Node*);
91     virtual void exitFullScreenForNode(Node*);
92     bool requiresFullScreenForVideoPlayback();
93     bool isValid() const;
94
95 private:
96 #if USE(QT_MULTIMEDIA)
97     MediaPlayerPrivateQt* mediaPlayer();
98 #endif
99
100 private slots:
101     void aboutToClose();
102
103 private:
104     ChromeClientQt* m_chromeClient;
105     HTMLVideoElement* m_videoElement;
106 #if USE(QT_MULTIMEDIA)
107     QWebFullScreenVideoHandler* m_FullScreenVideoHandler;
108 #endif
109 #if USE(GSTREAMER)
110     GStreamerFullScreenVideoHandler* m_FullScreenVideoHandlerGStreamer;
111 #endif
112 };
113
114 }
115
116 #endif // FullScreenVideoQt_h