2 * Copyright (C) 2010 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
26 #ifndef PageClientImpl_h
27 #define PageClientImpl_h
29 #include "PageClient.h"
30 #include <wtf/RetainPtr.h>
33 @class WebEditorUndoTargetObjC;
37 class FindIndicatorWindow;
39 // NOTE: This does not use String::operator NSString*() since that function
40 // expects to be called on the thread running WebCore.
41 NSString* nsStringFromWebCoreString(const String&);
43 class PageClientImpl : public PageClient {
45 static PassOwnPtr<PageClientImpl> create(WKView*);
46 virtual ~PageClientImpl();
49 PageClientImpl(WKView*);
51 virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy();
52 virtual void setViewNeedsDisplay(const WebCore::IntRect&);
53 virtual void displayView();
54 virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
56 virtual WebCore::IntSize viewSize();
57 virtual bool isViewWindowActive();
58 virtual bool isViewFocused();
59 virtual bool isViewVisible();
60 virtual bool isViewInWindow();
62 virtual void processDidCrash();
63 virtual void pageClosed();
64 virtual void didRelaunchProcess();
65 virtual void takeFocus(bool direction);
66 virtual void toolTipChanged(const String& oldToolTip, const String& newToolTip);
67 virtual void setCursor(const WebCore::Cursor&);
68 virtual void setViewportArguments(const WebCore::ViewportArguments&);
70 virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo);
71 virtual void clearAllEditCommands();
72 virtual void interceptKeyEvent(const NativeWebKeyboardEvent& event, Vector<WebCore::KeypressCommand>& commandName, uint32_t selectionStart, uint32_t selectionEnd, Vector<WebCore::CompositionUnderline>& underlines);
73 virtual void setDragImage(const WebCore::IntPoint& clientPosition, const WebCore::IntSize& imageSize, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag);
75 virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&);
76 virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&);
78 virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled);
80 virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*);
81 virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*);
83 void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut);
85 virtual void enterAcceleratedCompositingMode(const LayerTreeContext&);
86 virtual void exitAcceleratedCompositingMode();
88 virtual void accessibilityWebProcessTokenReceived(const CoreIPC::DataReference&);
89 virtual void setComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled);
90 virtual void setAutodisplay(bool);
92 virtual CGContextRef containingWindowGraphicsContext();
94 virtual void didChangeScrollbarsForMainFrame() const;
96 virtual void didCommitLoadForMainFrame(bool useCustomRepresentation);
97 virtual void didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference&);
99 virtual double customRepresentationZoomFactor();
100 virtual void setCustomRepresentationZoomFactor(double);
102 virtual void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects);
104 virtual void didPerformDictionaryLookup(const String&, double scaleFactor, const DictionaryPopupInfo&);
107 RetainPtr<WebEditorUndoTargetObjC> m_undoTarget;
110 } // namespace WebKit
112 #endif // PageClientImpl_h