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.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
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.
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.
28 #ifndef PageClientImpl_h
29 #define PageClientImpl_h
31 #include "KeyBindingTranslator.h"
32 #include "PageClient.h"
33 #include "WebPageProxy.h"
34 #include "WindowsKeyboardCodes.h"
35 #include <WebCore/IntSize.h>
40 class DrawingAreaProxy;
41 class WebPageNamespace;
43 class PageClientImpl : public PageClient {
46 static PassOwnPtr<PageClientImpl> create(GtkWidget* viewWidget)
48 return adoptPtr(new PageClientImpl(viewWidget));
51 GtkWidget* viewWidget() { return m_viewWidget; }
54 PageClientImpl(GtkWidget*);
56 virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy();
57 virtual void setViewNeedsDisplay(const WebCore::IntRect&);
58 virtual void displayView();
59 virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
60 virtual WebCore::IntSize viewSize();
61 virtual bool isViewWindowActive();
62 virtual bool isViewFocused();
63 virtual bool isViewVisible();
64 virtual bool isViewInWindow();
65 virtual void processDidCrash();
66 virtual void didRelaunchProcess();
67 virtual void pageClosed();
68 virtual void takeFocus(bool direction);
69 virtual void toolTipChanged(const WTF::String&, const WTF::String&);
70 virtual void setCursor(const WebCore::Cursor&);
71 virtual void setCursorHiddenUntilMouseMoves(bool);
72 virtual void setViewportArguments(const WebCore::ViewportArguments&);
73 virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo);
74 virtual void clearAllEditCommands();
75 virtual bool canUndoRedo(WebPageProxy::UndoOrRedo);
76 virtual void executeUndoRedo(WebPageProxy::UndoOrRedo);
77 virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&);
78 virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&);
79 virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&);
80 virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&);
81 virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled);
82 virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*);
83 virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*);
84 virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut);
85 virtual void didChangeScrollbarsForMainFrame() const;
86 virtual void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects);
87 virtual void getEditorCommandsForKeyEvent(const NativeWebKeyboardEvent&, const AtomicString&, Vector<WTF::String>&);
88 virtual void findStringInCustomRepresentation(const String&, FindOptions, unsigned);
89 virtual void countStringMatchesInCustomRepresentation(const String&, FindOptions, unsigned);
91 #if USE(ACCELERATED_COMPOSITING)
92 virtual void pageDidEnterAcceleratedCompositing();
93 virtual void pageDidLeaveAcceleratedCompositing();
96 virtual void didCommitLoadForMainFrame(bool useCustomRepresentation);
97 virtual void didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference&);
98 virtual double customRepresentationZoomFactor();
99 virtual void setCustomRepresentationZoomFactor(double);
101 // Members of PageClientImpl class
102 GtkWidget* m_viewWidget;
103 WebCore::KeyBindingTranslator m_keyBindingTranslator;
106 } // namespace WebKit
108 #endif // PageClientImpl_h