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.
29 #include "ShareableBitmap.h"
30 #include "WebPageProxy.h"
31 #include "WebPopupMenuProxy.h"
32 #include <wtf/Forward.h>
36 struct ViewportArguments;
41 class DrawingAreaProxy;
43 class NativeWebKeyboardEvent;
44 class NativeWebKeyboardEvent;
45 class WebContextMenuProxy;
46 class WebEditCommandProxy;
47 class WebPopupMenuProxy;
51 virtual ~PageClient() { }
53 // Create a new drawing area proxy for the given page.
54 virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy() = 0;
56 // Tell the view to invalidate the given rect. The rect is in view coordinates.
57 virtual void setViewNeedsDisplay(const WebCore::IntRect&) = 0;
59 // Tell the view to immediately display its invalid rect.
60 virtual void displayView() = 0;
62 // Tell the view to scroll scrollRect by scrollOffset.
63 virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset) = 0;
65 // Return the size of the view the page is associated with.
66 virtual WebCore::IntSize viewSize() = 0;
68 // Return whether the view's containing window is active.
69 virtual bool isViewWindowActive() = 0;
71 // Return whether the view is focused.
72 virtual bool isViewFocused() = 0;
74 // Return whether the view is visible.
75 virtual bool isViewVisible() = 0;
77 // Return whether the view is in a window.
78 virtual bool isViewInWindow() = 0;
80 virtual void processDidCrash() = 0;
81 virtual void didRelaunchProcess() = 0;
82 virtual void pageClosed() = 0;
84 virtual void takeFocus(bool direction) = 0;
85 virtual void toolTipChanged(const String&, const String&) = 0;
87 #if ENABLE(TILED_BACKING_STORE)
88 virtual void pageDidRequestScroll(const WebCore::IntSize&) = 0;
91 virtual void didChangeContentsSize(const WebCore::IntSize&) = 0;
92 virtual void didFindZoomableArea(const WebCore::IntRect&) = 0;
95 virtual void setCursor(const WebCore::Cursor&) = 0;
96 virtual void setViewportArguments(const WebCore::ViewportArguments&) = 0;
98 virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo) = 0;
99 virtual void clearAllEditCommands() = 0;
101 virtual void accessibilityWebProcessTokenReceived(const CoreIPC::DataReference&) = 0;
102 virtual void interceptKeyEvent(const NativeWebKeyboardEvent&, Vector<WebCore::KeypressCommand>& commandName, uint32_t selectionStart, uint32_t selectionEnd, Vector<WebCore::CompositionUnderline>& underlines) = 0;
103 virtual void setDragImage(const WebCore::IntPoint& clientPosition, const WebCore::IntSize& imageSize, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag) = 0;
106 virtual void compositionSelectionChanged(bool) = 0;
108 virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&) = 0;
109 virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&) = 0;
110 virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) = 0;
112 virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled) = 0;
114 virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*) = 0;
115 virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*) = 0;
117 virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut) = 0;
119 #if USE(ACCELERATED_COMPOSITING)
120 virtual void enterAcceleratedCompositingMode(const LayerTreeContext&) = 0;
121 virtual void exitAcceleratedCompositingMode() = 0;
125 virtual HWND nativeWindow() = 0;
129 virtual void setComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled) = 0;
130 virtual void setAutodisplay(bool) = 0;
131 virtual CGContextRef containingWindowGraphicsContext() = 0;
132 virtual void didPerformDictionaryLookup(const String&, double scaleFactor, const DictionaryPopupInfo&) = 0;
135 virtual void didChangeScrollbarsForMainFrame() const = 0;
137 // Custom representations.
138 virtual void didCommitLoadForMainFrame(bool useCustomRepresentation) = 0;
139 virtual void didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference&) = 0;
140 virtual double customRepresentationZoomFactor() = 0;
141 virtual void setCustomRepresentationZoomFactor(double) = 0;
143 virtual void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects) = 0;
146 } // namespace WebKit
148 #endif // PageClient_h