15af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke/* 25af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 35af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke * 45af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke * This library is free software; you can redistribute it and/or 55af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke * modify it under the terms of the GNU Library General Public 65af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke * License as published by the Free Software Foundation; either 75af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke * version 2 of the License, or (at your option) any later version. 85af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke * 95af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke * This library is distributed in the hope that it will be useful, 105af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke * but WITHOUT ANY WARRANTY; without even the implied warranty of 115af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 125af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke * Library General Public License for more details. 135af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke * 145af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke * You should have received a copy of the GNU Library General Public License 155af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke * along with this library; see the file COPYING.LIB. If not, write to 165af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 175af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke * Boston, MA 02110-1301, USA. 185af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke * 195af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke */ 205af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke#ifndef WEBPLUGIN_H 215af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke#define WEBPLUGIN_H 225af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke 235af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke#include "qwebkitplatformplugin.h" 24545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch#include "WebNotificationPresenter.h" 255af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke 265af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke#include <QDialog> 272daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#if defined(WTF_USE_QT_MULTIMEDIA) && WTF_USE_QT_MULTIMEDIA 2865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#include <QVideoWidget> 2965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif 305af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke 315af96e2c7b73ebc627c6894727826a7576d31758Leon Clarkeclass QListWidgetItem; 325af96e2c7b73ebc627c6894727826a7576d31758Leon Clarkeclass QListWidget; 335af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke 345af96e2c7b73ebc627c6894727826a7576d31758Leon Clarkeclass Popup : public QDialog { 355af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke Q_OBJECT 365af96e2c7b73ebc627c6894727826a7576d31758Leon Clarkepublic: 375af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke Popup(const QWebSelectData& data) : m_data(data) { setModal(true); } 385af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke 395af96e2c7b73ebc627c6894727826a7576d31758Leon Clarkesignals: 405af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke void itemClicked(int idx); 415af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke 425af96e2c7b73ebc627c6894727826a7576d31758Leon Clarkeprotected slots: 435af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke void onItemSelected(QListWidgetItem* item); 445af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke 455af96e2c7b73ebc627c6894727826a7576d31758Leon Clarkeprotected: 465af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke void populateList(); 475af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke 485af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke const QWebSelectData& m_data; 495af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke QListWidget* m_list; 505af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke}; 515af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke 525af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke 535af96e2c7b73ebc627c6894727826a7576d31758Leon Clarkeclass SingleSelectionPopup : public Popup { 545af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke Q_OBJECT 555af96e2c7b73ebc627c6894727826a7576d31758Leon Clarkepublic: 565af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke SingleSelectionPopup(const QWebSelectData& data); 575af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke}; 585af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke 595af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke 605af96e2c7b73ebc627c6894727826a7576d31758Leon Clarkeclass MultipleSelectionPopup : public Popup { 615af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke Q_OBJECT 625af96e2c7b73ebc627c6894727826a7576d31758Leon Clarkepublic: 635af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke MultipleSelectionPopup(const QWebSelectData& data); 645af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke}; 655af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke 665af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke 675af96e2c7b73ebc627c6894727826a7576d31758Leon Clarkeclass WebPopup : public QWebSelectMethod { 685af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke Q_OBJECT 695af96e2c7b73ebc627c6894727826a7576d31758Leon Clarkepublic: 705af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke WebPopup(); 715af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke ~WebPopup(); 725af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke 735af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke virtual void show(const QWebSelectData& data); 745af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke virtual void hide(); 755af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke 765af96e2c7b73ebc627c6894727826a7576d31758Leon Clarkeprivate slots: 775af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke void popupClosed(); 785af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke void itemClicked(int idx); 795af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke 805af96e2c7b73ebc627c6894727826a7576d31758Leon Clarkeprivate: 815af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke Popup* m_popup; 825af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke 835af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke Popup* createPopup(const QWebSelectData& data); 845af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke Popup* createSingleSelectionPopup(const QWebSelectData& data); 855af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke Popup* createMultipleSelectionPopup(const QWebSelectData& data); 865af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke}; 875af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke 8828040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhuclass TouchModifier : public QWebTouchModifier 8928040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu{ 9028040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu Q_OBJECT 9128040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhupublic: 9228040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu unsigned hitTestPaddingForTouch(const PaddingDirection direction) const { 9328040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu // Use 10 as padding in each direction but Up. 9428040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu if (direction == QWebTouchModifier::Up) 9528040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu return 15; 9628040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu return 10; 9728040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu } 9828040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu}; 9928040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu 1002daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#if defined(WTF_USE_QT_MULTIMEDIA) && WTF_USE_QT_MULTIMEDIA 10165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochclass FullScreenVideoWidget : public QVideoWidget { 10265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch Q_OBJECT 10365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochpublic: 10465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch FullScreenVideoWidget(QMediaPlayer*); 10565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch virtual ~FullScreenVideoWidget() {} 10665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch 10765f03d4f644ce73618e5f4f50dd694b26f55ae12Ben MurdochQ_SIGNALS: 10865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch void fullScreenClosed(); 10965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch 11065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochprotected: 11165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch bool event(QEvent*); 11265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch void keyPressEvent(QKeyEvent*); 11365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch 11465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochprivate: 11565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch QMediaPlayer* m_mediaPlayer; // not owned 11665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch}; 11765f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch 11865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochclass FullScreenVideoHandler : public QWebFullScreenVideoHandler { 11965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch Q_OBJECT 12065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochpublic: 12165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch FullScreenVideoHandler(); 12265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch virtual ~FullScreenVideoHandler(); 12365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch bool requiresFullScreenForVideoPlayback() const; 12465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch 12565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochpublic Q_SLOTS: 12665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch void enterFullScreen(QMediaPlayer*); 12765f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch void exitFullScreen(); 12865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch 12965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochprivate: 13065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch FullScreenVideoWidget* m_mediaWidget; // owned 13165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch}; 13265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif 13365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch 1345af96e2c7b73ebc627c6894727826a7576d31758Leon Clarkeclass WebPlugin : public QObject, public QWebKitPlatformPlugin 1355af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke{ 1365af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke Q_OBJECT 1375af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke Q_INTERFACES(QWebKitPlatformPlugin) 1385af96e2c7b73ebc627c6894727826a7576d31758Leon Clarkepublic: 1395af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke virtual bool supportsExtension(Extension extension) const; 140bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen virtual QObject* createExtension(Extension extension) const; 1415af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke}; 1425af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke 1435af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke#endif // WEBPLUGIN_H 144