2 * Copyright (C) 2012, 2013 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 PageClientImplIOS_h
27 #define PageClientImplIOS_h
31 #import "PageClient.h"
32 #import "WebFullScreenManagerProxy.h"
33 #import <wtf/RetainPtr.h>
35 OBJC_CLASS WKContentView;
37 OBJC_CLASS WKEditorUndoTargetObjC;
41 class PageClientImpl : public PageClient
42 #if ENABLE(FULLSCREEN_API)
43 , public WebFullScreenManagerProxyClient
47 PageClientImpl(WKContentView *, WKWebView *);
48 virtual ~PageClientImpl();
52 virtual std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy() override;
53 virtual void setViewNeedsDisplay(const WebCore::IntRect&) override;
54 virtual void displayView() override;
55 virtual bool canScrollView() override;
56 virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset) override;
57 virtual void requestScroll(const WebCore::FloatPoint& scrollPosition, bool isProgrammaticScroll) override;
58 virtual WebCore::IntSize viewSize() override;
59 virtual bool isViewWindowActive() override;
60 virtual bool isViewFocused() override;
61 virtual bool isViewVisible() override;
62 virtual bool isViewInWindow() override;
63 virtual bool isViewVisibleOrOccluded() override;
64 virtual bool isVisuallyIdle() override;
65 virtual void processDidExit() override;
66 virtual void didRelaunchProcess() override;
67 virtual void pageClosed() override;
68 virtual void preferencesDidChange() override;
69 virtual void toolTipChanged(const String&, const String&) override;
70 virtual bool decidePolicyForGeolocationPermissionRequest(WebFrameProxy&, WebSecurityOrigin&, GeolocationPermissionRequestProxy&) override;
71 virtual void didCommitLoadForMainFrame(const String& mimeType, bool useCustomContentProvider) override;
72 virtual void handleDownloadRequest(DownloadProxy*) override;
73 virtual void setCursor(const WebCore::Cursor&) override;
74 virtual void setCursorHiddenUntilMouseMoves(bool) override;
75 virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&) override;
76 virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo) override;
77 virtual void clearAllEditCommands() override;
78 virtual bool canUndoRedo(WebPageProxy::UndoOrRedo) override;
79 virtual void executeUndoRedo(WebPageProxy::UndoOrRedo) override;
80 virtual void accessibilityWebProcessTokenReceived(const IPC::DataReference&) override;
81 virtual bool executeSavedCommandBySelector(const String& selector) override;
82 virtual void setDragImage(const WebCore::IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag) override;
83 virtual void updateSecureInputState() override;
84 virtual void resetSecureInputState() override;
85 virtual void notifyInputContextAboutDiscardedComposition() override;
86 virtual void makeFirstResponder() override;
87 virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&) override;
88 virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&) override;
89 virtual WebCore::IntPoint screenToRootView(const WebCore::IntPoint&) override;
90 virtual WebCore::IntRect rootViewToScreen(const WebCore::IntRect&) override;
91 virtual WebCore::IntPoint accessibilityScreenToRootView(const WebCore::IntPoint&) override;
92 virtual WebCore::IntRect rootViewToAccessibilityScreen(const WebCore::IntRect&) override;
93 virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled) override;
94 #if ENABLE(TOUCH_EVENTS)
95 virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled) override;
97 virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*) override;
98 virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*) override;
99 virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate) override;
101 virtual void enterAcceleratedCompositingMode(const LayerTreeContext&) override;
102 virtual void exitAcceleratedCompositingMode() override;
103 virtual void updateAcceleratedCompositingMode(const LayerTreeContext&) override;
104 virtual void setAcceleratedCompositingRootLayer(LayerOrView *) override;
105 virtual LayerOrView *acceleratedCompositingRootLayer() const override;
106 virtual LayerHostingMode viewLayerHostingMode() override { return LayerHostingMode::OutOfProcess; }
108 virtual PassRefPtr<ViewSnapshot> takeViewSnapshot() override;
109 virtual void wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent&) override;
110 virtual void clearCustomSwipeViews() override;
112 virtual void commitPotentialTapFailed() override;
113 virtual void didGetTapHighlightGeometries(uint64_t requestID, const WebCore::Color&, const Vector<WebCore::FloatQuad>& highlightedQuads, const WebCore::IntSize& topLeftRadius, const WebCore::IntSize& topRightRadius, const WebCore::IntSize& bottomLeftRadius, const WebCore::IntSize& bottomRightRadius) override;
115 virtual void didCommitLayerTree(const RemoteLayerTreeTransaction&) override;
116 virtual void dynamicViewportUpdateChangedTarget(double newScale, const WebCore::FloatPoint& newScrollPosition, uint64_t transactionID) override;
117 virtual void restorePageState(const WebCore::FloatRect&, double) override;
118 virtual void restorePageCenterAndScale(const WebCore::FloatPoint&, double) override;
120 virtual void startAssistingNode(const AssistedNodeInformation&, bool userIsInteracting, bool blurPreviousNode, API::Object* userData) override;
121 virtual void stopAssistingNode() override;
122 virtual bool isAssistingNode() override;
123 virtual void selectionDidChange() override;
124 virtual bool interpretKeyEvent(const NativeWebKeyboardEvent&, bool isCharEvent) override;
125 virtual void positionInformationDidChange(const InteractionInformationAtPosition&) override;
126 virtual void saveImageToLibrary(PassRefPtr<WebCore::SharedBuffer>) override;
127 virtual void didUpdateBlockSelectionWithTouch(uint32_t touch, uint32_t flags, float growThreshold, float shrinkThreshold) override;
128 virtual void showPlaybackTargetPicker(bool hasVideo, const WebCore::IntRect& elementRect) override;
130 virtual bool handleRunOpenPanel(WebPageProxy*, WebFrameProxy*, WebOpenPanelParameters*, WebOpenPanelResultListenerProxy*) override;
131 virtual void didChangeViewportMetaTagWidth(float) override;
132 virtual void setUsesMinimalUI(bool) override;
133 virtual double minimumZoomScale() const override;
134 virtual WebCore::FloatSize contentsSize() const override;
136 #if ENABLE(INSPECTOR)
137 virtual void showInspectorHighlight(const WebCore::Highlight&) override;
138 virtual void hideInspectorHighlight() override;
140 virtual void showInspectorIndication() override;
141 virtual void hideInspectorIndication() override;
143 virtual void enableInspectorNodeSearch() override;
144 virtual void disableInspectorNodeSearch() override;
147 virtual void zoomToRect(WebCore::FloatRect, double minimumScale, double maximumScale) override;
148 virtual void overflowScrollViewWillStartPanGesture() override;
149 virtual void overflowScrollViewDidScroll() override;
150 virtual void overflowScrollWillStartScroll() override;
151 virtual void overflowScrollDidEndScroll() override;
153 virtual void didFinishDrawingPagesToPDF(const IPC::DataReference&) override;
155 // Auxiliary Client Creation
156 #if ENABLE(FULLSCREEN_API)
157 virual WebFullScreenManagerProxyClient& fullScreenManagerProxyClient() override;
160 #if ENABLE(FULLSCREEN_API)
161 // WebFullScreenManagerProxyClient
162 virtual void closeFullScreenManager() override;
163 virtual bool isFullScreen() override;
164 virtual void enterFullScreen() override;
165 virtual void exitFullScreen() override;
166 virtual void beganEnterFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame) override;
167 virtual void beganExitFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame) override;
170 virtual void didFinishLoadingDataForCustomContentProvider(const String& suggestedFilename, const IPC::DataReference&) override;
172 virtual Vector<String> mimeTypesWithCustomContentProviders() override;
174 virtual void navigationGestureDidBegin() override;
175 virtual void navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem&) override;
176 virtual void navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&) override;
177 virtual void willRecordNavigationSnapshot(WebBackForwardListItem&) override;
179 WKContentView *m_contentView;
180 WKWebView *m_webView;
181 RetainPtr<WKEditorUndoTargetObjC> m_undoTarget;
183 } // namespace WebKit
185 #endif // PLATFORM(IOS)
187 #endif // PageClientImplIOS_h