• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2010 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 
21 #ifndef QWEBKITPLATFORMPLUGIN_H
22 #define QWEBKITPLATFORMPLUGIN_H
23 
24 /*
25  *  Warning: The contents of this file is not  part of the public QtWebKit API
26  *  and may be changed from version to version or even be completely removed.
27 */
28 
29 #include <QColor>
30 #include <QObject>
31 #include <QUrl>
32 #if defined(WTF_USE_QT_MULTIMEDIA) && WTF_USE_QT_MULTIMEDIA
33 #include <QMediaPlayer>
34 #endif
35 
36 class QWebSelectData
37 {
38 public:
~QWebSelectData()39     virtual ~QWebSelectData() {}
40 
41     enum ItemType { Option, Group, Separator };
42 
43     virtual ItemType itemType(int) const = 0;
44     virtual QString itemText(int index) const = 0;
45     virtual QString itemToolTip(int index) const = 0;
46     virtual bool itemIsEnabled(int index) const = 0;
47     virtual bool itemIsSelected(int index) const = 0;
48     virtual int itemCount() const = 0;
49     virtual bool multiple() const = 0;
50     virtual QColor backgroundColor() const = 0;
51     virtual QColor foregroundColor() const = 0;
52     virtual QColor itemBackgroundColor(int index) const = 0;
53     virtual QColor itemForegroundColor(int index) const = 0;
54 };
55 
56 class QWebSelectMethod : public QObject
57 {
58     Q_OBJECT
59 public:
~QWebSelectMethod()60     virtual ~QWebSelectMethod() {}
61 
62     virtual void show(const QWebSelectData&) = 0;
63     virtual void hide() = 0;
64 
65 Q_SIGNALS:
66     void selectItem(int index, bool allowMultiplySelections, bool shift);
67     void didHide();
68 };
69 
70 class QWebNotificationData
71 {
72 public:
~QWebNotificationData()73     virtual ~QWebNotificationData() {}
74 
75     virtual const QString title() const = 0;
76     virtual const QString message() const = 0;
77     virtual const QByteArray iconData() const = 0;
78     virtual const QUrl openerPageUrl() const = 0;
79 };
80 
81 class QWebNotificationPresenter : public QObject
82 {
83     Q_OBJECT
84 public:
QWebNotificationPresenter()85     QWebNotificationPresenter() {}
~QWebNotificationPresenter()86     virtual ~QWebNotificationPresenter() {}
87 
88     virtual void showNotification(const QWebNotificationData*) = 0;
89 
90 Q_SIGNALS:
91     void notificationClosed();
92     void notificationClicked();
93 };
94 
95 class QWebHapticFeedbackPlayer: public QObject
96 {
97     Q_OBJECT
98 public:
QWebHapticFeedbackPlayer()99     QWebHapticFeedbackPlayer() {}
~QWebHapticFeedbackPlayer()100     virtual ~QWebHapticFeedbackPlayer() {}
101 
102     enum HapticStrength {
103         None, Weak, Medium, Strong
104     };
105 
106     enum HapticEvent {
107         Press, Release
108     };
109 
110     virtual void playHapticFeedback(const HapticEvent, const QString& hapticType, const HapticStrength) = 0;
111 };
112 
113 class QWebTouchModifier : public QObject
114 {
115     Q_OBJECT
116 public:
~QWebTouchModifier()117     virtual ~QWebTouchModifier() {}
118 
119     enum PaddingDirection {
120         Up, Right, Down, Left
121     };
122 
123     virtual unsigned hitTestPaddingForTouch(const PaddingDirection) const = 0;
124 };
125 
126 #if defined(WTF_USE_QT_MULTIMEDIA) && WTF_USE_QT_MULTIMEDIA
127 class QWebFullScreenVideoHandler : public QObject {
128     Q_OBJECT
129 public:
QWebFullScreenVideoHandler()130     QWebFullScreenVideoHandler() {}
~QWebFullScreenVideoHandler()131     virtual ~QWebFullScreenVideoHandler() {}
132     virtual bool requiresFullScreenForVideoPlayback() const = 0;
133 
134 Q_SIGNALS:
135     void fullScreenClosed();
136 
137 public Q_SLOTS:
138     virtual void enterFullScreen(QMediaPlayer*) = 0;
139     virtual void exitFullScreen() = 0;
140 };
141 #endif
142 
143 class QWebKitPlatformPlugin
144 {
145 public:
~QWebKitPlatformPlugin()146     virtual ~QWebKitPlatformPlugin() {}
147 
148     enum Extension {
149         MultipleSelections,
150         Notifications,
151         Haptics,
152         TouchInteraction,
153         FullScreenVideoPlayer
154     };
155 
156     virtual bool supportsExtension(Extension extension) const = 0;
157     virtual QObject* createExtension(Extension extension) const = 0;
158 };
159 
160 QT_BEGIN_NAMESPACE
161 Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.7");
162 QT_END_NAMESPACE
163 
164 #endif // QWEBKITPLATFORMPLUGIN_H
165