1/* 2 * Copyright (C) 2010 Apple Inc. All rights reserved. 3 * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. 4 * Copyright (C) 2011 Igalia S.L. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 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 * 15 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 19 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 * THE POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28#ifndef PageClientImpl_h 29#define PageClientImpl_h 30 31#include "KeyBindingTranslator.h" 32#include "PageClient.h" 33#include "WebPageProxy.h" 34#include "WindowsKeyboardCodes.h" 35#include <WebCore/IntSize.h> 36#include <gtk/gtk.h> 37 38namespace WebKit { 39 40class DrawingAreaProxy; 41class WebPageNamespace; 42 43class PageClientImpl : public PageClient { 44public: 45 ~PageClientImpl(); 46 static PassOwnPtr<PageClientImpl> create(GtkWidget* viewWidget) 47 { 48 return adoptPtr(new PageClientImpl(viewWidget)); 49 } 50 51 GtkWidget* viewWidget() { return m_viewWidget; } 52 53private: 54 explicit PageClientImpl(GtkWidget*); 55 56 virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy(); 57 virtual void setViewNeedsDisplay(const WebCore::IntRect&); 58 virtual void displayView(); 59 virtual bool canScrollView() { return false; } 60 virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset); 61 virtual WebCore::IntSize viewSize(); 62 virtual bool isViewWindowActive(); 63 virtual bool isViewFocused(); 64 virtual bool isViewVisible(); 65 virtual bool isViewInWindow(); 66 virtual void processDidCrash(); 67 virtual void didRelaunchProcess(); 68 virtual void pageClosed(); 69 virtual void preferencesDidChange(); 70 virtual void takeFocus(bool direction); 71 virtual void toolTipChanged(const WTF::String&, const WTF::String&); 72 virtual void setCursor(const WebCore::Cursor&); 73 virtual void setCursorHiddenUntilMouseMoves(bool); 74 virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&); 75 virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo); 76 virtual void clearAllEditCommands(); 77 virtual bool canUndoRedo(WebPageProxy::UndoOrRedo); 78 virtual void executeUndoRedo(WebPageProxy::UndoOrRedo); 79 virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&); 80 virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&); 81 virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&); 82 virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&); 83 virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled); 84 virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*); 85 virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*); 86#if ENABLE(INPUT_TYPE_COLOR) 87 virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& intialColor, const WebCore::IntRect&); 88#endif 89 virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate); 90 virtual void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects); 91 virtual void getEditorCommandsForKeyEvent(const NativeWebKeyboardEvent&, const AtomicString&, Vector<WTF::String>&); 92 virtual void findStringInCustomRepresentation(const String&, FindOptions, unsigned); 93 virtual void countStringMatchesInCustomRepresentation(const String&, FindOptions, unsigned); 94 virtual void updateTextInputState(); 95 virtual void startDrag(const WebCore::DragData&, PassRefPtr<ShareableBitmap> dragImage); 96 97#if USE(ACCELERATED_COMPOSITING) 98 virtual void enterAcceleratedCompositingMode(const LayerTreeContext&); 99 virtual void exitAcceleratedCompositingMode(); 100 virtual void updateAcceleratedCompositingMode(const LayerTreeContext&); 101#endif 102 103 virtual void didCommitLoadForMainFrame(bool useCustomRepresentation); 104 virtual void didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference&); 105 virtual double customRepresentationZoomFactor(); 106 virtual void setCustomRepresentationZoomFactor(double); 107 108 virtual void handleDownloadRequest(DownloadProxy*); 109 110 // Members of PageClientImpl class 111 GtkWidget* m_viewWidget; 112 WebCore::KeyBindingTranslator m_keyBindingTranslator; 113}; 114 115} // namespace WebKit 116 117#endif // PageClientImpl_h 118