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