1/* 2 * Copyright (C) 2010, 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 program 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 program; 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 QtPageClient_h 22#define QtPageClient_h 23 24#include "FindIndicator.h" 25#include "PageClient.h" 26 27class QQuickWebView; 28 29namespace WebKit { 30 31class DrawingAreaProxy; 32class LayerTreeContext; 33class QtWebPageEventHandler; 34class DefaultUndoController; 35class ShareableBitmap; 36 37class QtPageClient : public PageClient { 38public: 39 QtPageClient(); 40 ~QtPageClient(); 41 42 void initialize(QQuickWebView*, QtWebPageEventHandler*, WebKit::DefaultUndoController*); 43 44 // QQuickWebView. 45 virtual void setViewNeedsDisplay(const WebCore::IntRect&); 46 virtual void didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect); 47 virtual WebCore::IntSize viewSize(); 48 virtual bool isViewFocused(); 49 virtual bool isViewVisible(); 50 virtual void pageDidRequestScroll(const WebCore::IntPoint&); 51 virtual void didChangeContentsSize(const WebCore::IntSize&); 52 virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&); 53 virtual void processDidCrash(); 54 virtual void didRelaunchProcess(); 55 virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy(); 56 virtual void handleDownloadRequest(DownloadProxy*); 57 virtual void handleApplicationSchemeRequest(PassRefPtr<QtRefCountedNetworkRequestData>); 58 virtual void handleAuthenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password); 59 virtual void handleCertificateVerificationRequest(const String& hostname, bool& ignoreErrors); 60 virtual void handleProxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password); 61 62 virtual void displayView(); 63 virtual bool canScrollView() { return false; } 64 virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset); 65 virtual bool isViewWindowActive(); 66 virtual bool isViewInWindow(); 67#if USE(ACCELERATED_COMPOSITING) 68 virtual void enterAcceleratedCompositingMode(const LayerTreeContext&); 69 virtual void exitAcceleratedCompositingMode(); 70 virtual void updateAcceleratedCompositingMode(const LayerTreeContext&); 71#endif // USE(ACCELERATED_COMPOSITING) 72 virtual void pageClosed() { } 73 virtual void preferencesDidChange() { } 74 virtual void startDrag(const WebCore::DragData&, PassRefPtr<ShareableBitmap> dragImage); 75 virtual void setCursor(const WebCore::Cursor&); 76 virtual void setCursorHiddenUntilMouseMoves(bool); 77 virtual void toolTipChanged(const String&, const String&); 78 79 // DefaultUndoController 80 virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo); 81 virtual void clearAllEditCommands(); 82 virtual bool canUndoRedo(WebPageProxy::UndoOrRedo); 83 virtual void executeUndoRedo(WebPageProxy::UndoOrRedo); 84 85 virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&); 86 virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&); 87 virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&); 88 virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&); 89 virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled) { } 90 virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*); 91 virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*); 92#if ENABLE(INPUT_TYPE_COLOR) 93 virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&); 94#endif 95 virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate) { } 96 virtual void didCommitLoadForMainFrame(bool useCustomRepresentation) { } 97 virtual void didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference&) { } 98 virtual double customRepresentationZoomFactor() { return 1; } 99 virtual void setCustomRepresentationZoomFactor(double) { } 100 virtual void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects); 101 virtual void findStringInCustomRepresentation(const String&, WebKit::FindOptions, unsigned maxMatchCount) { } 102 virtual void countStringMatchesInCustomRepresentation(const String&, WebKit::FindOptions, unsigned maxMatchCount) { } 103 virtual void pageTransitionViewportReady(); 104 virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&); 105 virtual void updateTextInputState(); 106 virtual void handleWillSetInputMethodState(); 107 virtual void doneWithGestureEvent(const WebGestureEvent&, bool wasEventHandled); 108#if ENABLE(TOUCH_EVENTS) 109 virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled); 110#endif 111 112private: 113 QQuickWebView* m_webView; 114 QtWebPageEventHandler* m_eventHandler; 115 DefaultUndoController* m_undoController; 116}; 117 118} // namespace WebKit 119 120#endif /* QtPageClient_h */ 121