IDBFactoryBackendProxy.h revision 563af33bc48281d19dce701398dbb88cb54fd7ec
1/* 2 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of 15 * its contributors may be used to endorse or promote products derived 16 * from this software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 19 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 */ 29#ifndef JSOBJECTS_H 30#define JSOBJECTS_H 31 32#include <qobject.h> 33#include <qdebug.h> 34#include <qpoint.h> 35#include <qstringlist.h> 36#include <qsize.h> 37 38class QWebFrame; 39namespace WebCore { 40 class DumpRenderTree; 41} 42class LayoutTestController : public QObject 43{ 44 Q_OBJECT 45public: 46 LayoutTestController(WebCore::DumpRenderTree *drt); 47 48 bool isLoading() const { return m_isLoading; } 49 void setLoading(bool loading) { m_isLoading = loading; } 50 51 bool shouldDumpAsText() const { return m_textDump; } 52 bool shouldDumpBackForwardList() const { return m_dumpBackForwardList; } 53 bool shouldDumpChildrenAsText() const { return m_dumpChildrenAsText; } 54 bool shouldWaitUntilDone() const { return m_waitForDone; } 55 bool canOpenWindows() const { return m_canOpenWindows; } 56 bool shouldDumpTitleChanges() const { return m_dumpTitleChanges; } 57 58 void reset(); 59 60protected: 61 void timerEvent(QTimerEvent *); 62 63signals: 64 void done(); 65 66public slots: 67 void maybeDump(bool ok); 68 void dumpAsText() { m_textDump = true; } 69 void dumpChildFramesAsText() { m_dumpChildrenAsText = true; } 70 void setCanOpenWindows() { m_canOpenWindows = true; } 71 void waitUntilDone(); 72 void notifyDone(); 73 void dumpBackForwardList() { m_dumpBackForwardList = true; } 74 void dumpEditingCallbacks(); 75 void dumpResourceLoadCallbacks(); 76 void queueBackNavigation(int howFarBackward); 77 void queueForwardNavigation(int howFarForward); 78 void queueLoad(const QString &url, const QString &target = QString()); 79 void queueReload(); 80 void queueScript(const QString &url); 81 void provisionalLoad(); 82 void setCloseRemainingWindowsWhenComplete(bool=false) {} 83 int windowCount(); 84 void display() {} 85 void clearBackForwardList(); 86 void dumpTitleChanges() { m_dumpTitleChanges = true; } 87 QString encodeHostName(const QString &host); 88 QString decodeHostName(const QString &host); 89 void dumpSelectionRect() const {} 90 void setJavaScriptProfilingEnabled(bool enable); 91 void setFixedLayoutSize(int width, int height); 92 void setUseFixedLayout(bool enable); 93 94 bool pauseAnimationAtTimeOnElementWithId(const QString &animationName, double time, const QString &elementId); 95 bool pauseTransitionAtTimeOnElementWithId(const QString &propertyName, double time, const QString &elementId); 96 unsigned numberOfActiveAnimations() const; 97 98private slots: 99 void processWork(); 100 101private: 102 bool m_isLoading; 103 bool m_textDump; 104 bool m_dumpBackForwardList; 105 bool m_dumpChildrenAsText; 106 bool m_canOpenWindows; 107 bool m_waitForDone; 108 bool m_dumpTitleChanges; 109 int m_timeoutTimer; 110 QWebFrame *m_topLoadingFrame; 111 WebCore::DumpRenderTree *m_drt; 112}; 113 114class QWebPage; 115class QWebFrame; 116 117class EventSender : public QObject 118{ 119 Q_OBJECT 120public: 121 EventSender(QWebPage *parent); 122 123public slots: 124 void mouseDown(); 125 void mouseUp(); 126 void mouseMoveTo(int x, int y); 127 void leapForward(int ms); 128 void keyDown(const QString &string, const QStringList &modifiers=QStringList()); 129 void clearKillRing() {} 130 131private: 132 QPoint m_mousePos; 133 QWebPage *m_page; 134 int m_timeLeap; 135 QWebFrame *frameUnderMouse() const; 136}; 137 138class TextInputController : public QObject 139{ 140 Q_OBJECT 141public: 142 TextInputController(QWebPage *parent); 143 144public slots: 145 void doCommand(const QString &command); 146// void setMarkedText(const QString &str, int from, int length); 147// bool hasMarkedText(); 148// void unmarkText(); 149// QList<int> markedRange(); 150// QList<int> selectedRange(); 151// void validAttributesForMarkedText(); 152// void inserText(const QString &); 153// void firstRectForCharacterRange(); 154// void characterIndexForPoint(int, int); 155// void substringFromRange(int, int); 156// void conversationIdentifier(); 157}; 158 159#endif 160