webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
PageClientImpl.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010, 2011, 2016 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
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.
12  *
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.
24  */
25 
26 #ifndef PageClientImpl_h
27 #define PageClientImpl_h
28 
29 #if PLATFORM(MAC)
30 
31 #include "CorrectionPanel.h"
32 #include "PageClient.h"
34 #include <wtf/RetainPtr.h>
35 
36 @class WKEditorUndoTargetObjC;
37 @class WKView;
38 @class WKWebView;
39 
40 namespace WebCore {
41 class AlternativeTextUIController;
42 }
43 
44 namespace WebKit {
45 
46 class WebViewImpl;
47 
48 class PageClientImpl final : public PageClient
49 #if ENABLE(FULLSCREEN_API)
50  , public WebFullScreenManagerProxyClient
51 #endif
52  {
53 public:
54  PageClientImpl(NSView *, WKWebView *);
55  virtual ~PageClientImpl();
56 
57  // FIXME: Eventually WebViewImpl should become the PageClient.
58  void setImpl(WebViewImpl& impl) { m_impl = &impl; }
59 
60  void viewWillMoveToAnotherWindow();
61 
62 private:
63  // PageClient
64  std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy() override;
65  void setViewNeedsDisplay(const WebCore::Region&) override;
66  void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, bool isProgrammaticScroll) override;
67 
68  WebCore::IntSize viewSize() override;
69  bool isViewWindowActive() override;
70  bool isViewFocused() override;
71  bool isViewVisible() override;
72  bool isViewVisibleOrOccluded() override;
73  bool isViewInWindow() override;
74  bool isVisuallyIdle() override;
75  LayerHostingMode viewLayerHostingMode() override;
76  ColorSpaceData colorSpace() override;
77  void setAcceleratedCompositingRootLayer(LayerOrView *) override;
78  LayerOrView *acceleratedCompositingRootLayer() const override;
79 
80  void processDidExit() override;
81  void pageClosed() override;
82  void didRelaunchProcess() override;
83  void preferencesDidChange() override;
84  void toolTipChanged(const String& oldToolTip, const String& newToolTip) override;
85  void didCommitLoadForMainFrame(const String& mimeType, bool useCustomContentProvider) override;
86  void didFinishLoadingDataForCustomContentProvider(const String& suggestedFilename, const IPC::DataReference&) override;
87  void handleDownloadRequest(DownloadProxy*) override;
88  void didChangeContentSize(const WebCore::IntSize&) override;
89  void setCursor(const WebCore::Cursor&) override;
90  void setCursorHiddenUntilMouseMoves(bool) override;
91  void didChangeViewportProperties(const WebCore::ViewportAttributes&) override;
92 
93  void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo) override;
94  void clearAllEditCommands() override;
95  bool canUndoRedo(WebPageProxy::UndoOrRedo) override;
96  void executeUndoRedo(WebPageProxy::UndoOrRedo) override;
97  bool executeSavedCommandBySelector(const String& selector) override;
98  void setDragImage(const WebCore::IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, WebCore::DragSourceAction) override;
99  void setPromisedDataForImage(const String& pasteboardName, PassRefPtr<WebCore::SharedBuffer> imageBuffer, const String& filename, const String& extension, const String& title,
100  const String& url, const String& visibleUrl, PassRefPtr<WebCore::SharedBuffer> archiveBuffer) override;
101 #if ENABLE(ATTACHMENT_ELEMENT)
102  void setPromisedDataForAttachment(const String& pasteboardName, const String& filename, const String& extension, const String& title, const String& url, const String& visibleUrl) override;
103 #endif
104  void updateSecureInputState() override;
105  void resetSecureInputState() override;
106  void notifyInputContextAboutDiscardedComposition() override;
107  void selectionDidChange() override;
108 
109  WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&) override;
110  WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&) override;
111  WebCore::IntPoint screenToRootView(const WebCore::IntPoint&) override;
112  WebCore::IntRect rootViewToScreen(const WebCore::IntRect&) override;
113 #if PLATFORM(MAC)
114  WebCore::IntRect rootViewToWindow(const WebCore::IntRect&) override;
115 #endif
116 #if PLATFORM(IOS)
117  virtual WebCore::IntPoint accessibilityScreenToRootView(const WebCore::IntPoint&) = 0;
118  virtual WebCore::IntRect rootViewToAccessibilityScreen(const WebCore::IntRect&) = 0;
119 #endif
120 
121  CGRect boundsOfLayerInLayerBackedWindowCoordinates(CALayer *layer) const override;
122 
123  void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled) override;
124 
125  RefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy&) override;
126 #if ENABLE(CONTEXT_MENUS)
127  std::unique_ptr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy&, const ContextMenuContextData&, const UserData&) override;
128 #endif
129 
130 #if ENABLE(INPUT_TYPE_COLOR)
131  RefPtr<WebColorPicker> createColorPicker(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&) override;
132 #endif
133 
134  Ref<WebCore::ValidationBubble> createValidationBubble(const String& message, const WebCore::ValidationBubble::Settings&) final;
135 
136  void setTextIndicator(Ref<WebCore::TextIndicator>, WebCore::TextIndicatorWindowLifetime) override;
137  void clearTextIndicator(WebCore::TextIndicatorWindowDismissalAnimation) override;
138  void setTextIndicatorAnimationProgress(float) override;
139 
140  void enterAcceleratedCompositingMode(const LayerTreeContext&) override;
141  void exitAcceleratedCompositingMode() override;
142  void updateAcceleratedCompositingMode(const LayerTreeContext&) override;
143 
144  PassRefPtr<ViewSnapshot> takeViewSnapshot() override;
145  void wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent&) override;
146 #if ENABLE(MAC_GESTURE_EVENTS)
147  void gestureEventWasNotHandledByWebCore(const NativeWebGestureEvent&) override;
148 #endif
149 
150  void accessibilityWebProcessTokenReceived(const IPC::DataReference&) override;
151 
152  void pluginFocusOrWindowFocusChanged(uint64_t pluginComplexTextInputIdentifier, bool pluginHasFocusAndWindowHasFocus) override;
153  void setPluginComplexTextInputState(uint64_t pluginComplexTextInputIdentifier, PluginComplexTextInputState) override;
154 
155  void makeFirstResponder() override;
156 
157  void didPerformDictionaryLookup(const WebCore::DictionaryPopupInfo&) override;
158  void dismissContentRelativeChildWindows(bool withAnimation = true) override;
159 
160  void showCorrectionPanel(WebCore::AlternativeTextType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings) override;
161  void dismissCorrectionPanel(WebCore::ReasonForDismissingAlternativeText) override;
162  String dismissCorrectionPanelSoon(WebCore::ReasonForDismissingAlternativeText) override;
163  void recordAutocorrectionResponse(WebCore::AutocorrectionResponse, const String& replacedString, const String& replacementString) override;
164 
165  void recommendedScrollbarStyleDidChange(WebCore::ScrollbarStyle) override;
166 
167  void intrinsicContentSizeDidChange(const WebCore::IntSize& intrinsicContentSize) override;
168 
169 #if USE(DICTATION_ALTERNATIVES)
170  uint64_t addDictationAlternatives(const RetainPtr<NSTextAlternatives>&) override;
171  void removeDictationAlternatives(uint64_t dictationContext) override;
172  void showDictationAlternativeUI(const WebCore::FloatRect& boundingBoxOfDictatedText, uint64_t dictationContext) override;
173  Vector<String> dictationAlternatives(uint64_t dictationContext) override;
174 #endif
175  void setEditableElementIsFocused(bool) override;
176 
177 #if USE(INSERTION_UNDO_GROUPING)
178  void registerInsertionUndoGrouping() override;
179 #endif
180 
181  // Auxiliary Client Creation
182 #if ENABLE(FULLSCREEN_API)
183  WebFullScreenManagerProxyClient& fullScreenManagerProxyClient() override;
184 #endif
185 
186 #if ENABLE(FULLSCREEN_API)
187  // WebFullScreenManagerProxyClient
188  void closeFullScreenManager() override;
189  bool isFullScreen() override;
190  void enterFullScreen() override;
191  void exitFullScreen() override;
192  void beganEnterFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame) override;
193  void beganExitFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame) override;
194 #endif
195 
196  void navigationGestureDidBegin() override;
197  void navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem&) override;
198  void navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&) override;
199  void navigationGestureDidEnd() override;
200  void willRecordNavigationSnapshot(WebBackForwardListItem&) override;
201  void didRemoveNavigationGestureSnapshot() override;
202 
203  NSView *activeView() const;
204  NSWindow *activeWindow() const;
205 
206  void didFirstVisuallyNonEmptyLayoutForMainFrame() override;
207  void didFinishLoadForMainFrame() override;
208  void didFailLoadForMainFrame() override;
209  void didSameDocumentNavigationForMainFrame(SameDocumentNavigationType) override;
210  void removeNavigationGestureSnapshot() override;
211  void handleControlledElementIDResponse(const String&) override;
212  void handleActiveNowPlayingSessionInfoResponse(bool hasActiveSession, const String& title, double duration, double elapsedTime) override;
213 
214  void didPerformImmediateActionHitTest(const WebHitTestResultData&, bool contentPreventsDefault, API::Object*) override;
215  void* immediateActionAnimationControllerForHitTestResult(RefPtr<API::HitTestResult>, uint64_t, RefPtr<API::Object>) override;
216 
217  void didHandleAcceptedCandidate() override;
218 
219  void videoControlsManagerDidChange() override;
220 
221  void showPlatformContextMenu(NSMenu *, WebCore::IntPoint) override;
222 
223  void didChangeBackgroundColor() override;
224 
225  void startWindowDrag() override;
226  NSWindow *platformWindow() override;
227 
228  WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override;
229 
230 #if WK_API_ENABLED
231  NSView *inspectorAttachmentView() override;
232  _WKRemoteObjectRegistry *remoteObjectRegistry() override;
233 #endif
234 
235  NSView *m_view;
236  WKWebView *m_webView;
237  WebViewImpl* m_impl { nullptr };
238 #if USE(AUTOCORRECTION_PANEL)
239  CorrectionPanel m_correctionPanel;
240 #endif
241 #if USE(DICTATION_ALTERNATIVES)
242  std::unique_ptr<WebCore::AlternativeTextUIController> m_alternativeTextUIController;
243 #endif
244 
245 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
246  WebCore::WebMediaSessionManager& mediaSessionManager() override;
247 #endif
248 
249  void refView() override;
250  void derefView() override;
251 
252  void didRestoreScrollPosition() override;
253  bool windowIsFrontWindowUnderMouse(const NativeWebMouseEvent&) override;
254 };
255 
256 } // namespace WebKit
257 
258 #endif // PLATFORM(MAC)
259 
260 #endif // PageClientImpl_h
Definition: MemoryMeasure.h:29
Definition: Color.h:108
unsigned long long uint64_t
Definition: ptypes.h:120
OBJC_CLASS NSView
Definition: TextIndicatorWindow.h:34
Definition: IntPoint.h:67
LayerHostingMode
Definition: LayerTreeContext.h:38
OBJC_CLASS NSWindow
Definition: WebCoreSystemInterface.h:113
Definition: Cursor.h:79
OBJC_CLASS _WKRemoteObjectRegistry
Definition: RemoteObjectRegistry.h:31
EGLOutputLayerEXT layer
Definition: eglext.h:695
Definition: FloatPoint.h:63
Definition: IntRect.h:70
Definition: FloatRect.h:59
DragSourceAction
Definition: DragActions.h:42
USVString filename
Definition: ErrorEvent.idl:46
Definition: ViewportArguments.h:44
Definition: DictionaryPopupInfo.h:37
title('Estimate ms')
ScrollbarStyle
Definition: ScrollTypes.h:159
UserInterfaceLayoutDirection
Definition: UserInterfaceLayoutDirection.h:31
Definition: WKView.h:39
PluginComplexTextInputState
Definition: PluginComplexTextInputState.h:31
AutocorrectionResponse
Definition: AlternativeTextClient.h:53
JNIEnv jlong jstring jint duration
Definition: peerconnection_jni.cc:2704
TextIndicatorWindowDismissalAnimation
Definition: TextIndicatorWindow.h:47
TextIndicatorWindowLifetime
Definition: TextIndicatorWindow.h:39
Definition: ApplePayLineItem.idl:30
Definition: APIObject.h:49
struct CGRect CGRect
Definition: WebCoreSystemInterface.h:36
ReasonForDismissingAlternativeText
Definition: AlternativeTextClient.h:40
Definition: DataReference.h:37
OBJC_CLASS NSMenu
Definition: WebCoreSystemInterface.h:104
url
Definition: setup.py:223
Definition: ValidationBubble.h:58
Definition: Region.h:34
CALayer LayerOrView
Definition: LayerRepresentation.h:40
AlternativeTextType
Definition: AlternativeTextClient.h:46
SameDocumentNavigationType
Definition: SameDocumentNavigationType.h:31
OBJC_CLASS CALayer
Definition: WebCoreSystemInterface.h:90
double elapsedTime
Definition: AnimationEvent.idl:38
const char * extension
Definition: MIMETypeRegistry.cpp:58
GLuint GLsizei const GLchar * message
Definition: gl2ext.h:137
This file is generated by create-http-header-name-table, do not edit.
Definition: CharsetData.cpp:6
Definition: IntSize.h:69