2 * Copyright (C) 2010, 2011 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 "APIObject.h"
30 #include "DrawingArea.h"
31 #include "FindController.h"
32 #include "GeolocationPermissionRequestManager.h"
33 #include "ImageOptions.h"
34 #include "ImmutableArray.h"
35 #if ENABLE(CONTEXT_MENUS)
36 #include "InjectedBundlePageContextMenuClient.h"
38 #include "InjectedBundlePageDiagnosticLoggingClient.h"
39 #include "InjectedBundlePageEditorClient.h"
40 #include "InjectedBundlePageFormClient.h"
41 #include "InjectedBundlePageFullScreenClient.h"
42 #include "InjectedBundlePageLoaderClient.h"
43 #include "InjectedBundlePagePolicyClient.h"
44 #include "InjectedBundlePageResourceLoadClient.h"
45 #include "InjectedBundlePageUIClient.h"
46 #include "MessageSender.h"
47 #include "TapHighlightController.h"
49 #include "SandboxExtension.h"
50 #include "ShareableBitmap.h"
51 #include "WebHitTestResult.h"
52 #include "WebUndoStep.h"
53 #include <WebCore/DictationAlternative.h>
54 #include <WebCore/DragData.h>
55 #include <WebCore/Editor.h>
56 #include <WebCore/FrameLoaderTypes.h>
57 #include <WebCore/IntRect.h>
58 #include <WebCore/Page.h>
59 #if ENABLE(PAGE_VISIBILITY_API)
60 #include <WebCore/PageVisibilityState.h>
62 #include <WebCore/PlatformScreen.h>
63 #include <WebCore/ScrollTypes.h>
64 #include <WebCore/WebCoreKeyboardUIMode.h>
65 #include <wtf/HashMap.h>
66 #include <wtf/OwnPtr.h>
67 #include <wtf/PassRefPtr.h>
68 #include <wtf/RefPtr.h>
69 #include <wtf/text/WTFString.h>
72 #include "ArgumentCodersQt.h"
73 #include "QtNetworkAccessManager.h"
74 #include "QtNetworkReply.h"
75 #include "QtNetworkReplyData.h"
76 #include "QtNetworkRequestData.h"
77 #include <QNetworkReply>
78 #include <QNetworkRequest>
82 #include "ArgumentCodersGtk.h"
83 #include "WebPageAccessibilityObject.h"
84 #include "WebPrintOperationGtk.h"
87 #if ENABLE(TOUCH_EVENTS)
88 #include <WebCore/PlatformTouchEvent.h>
92 #include "DictionaryPopupInfo.h"
93 #include "LayerHostingContext.h"
94 #include <wtf/RetainPtr.h>
95 OBJC_CLASS NSDictionary;
97 OBJC_CLASS WKAccessibilityWebPageObject;
100 #if ENABLE(TIZEN_PAGE_VISIBILITY_API)
101 #include <WebCore/PageVisibilityState.h>
104 #if ENABLE(TIZEN_CUSTOM_HEADERS)
105 #include <WebCore/HTTPHeaderMap.h>
108 #if ENABLE(TIZEN_DATALIST_ELEMENT)
109 #include "HTMLDataListElement.h"
112 #if ENABLE(TIZEN_DRAG_SUPPORT)
113 #include "ArgumentCodersTizen.h"
116 #if ENABLE(TIZEN_SCREEN_READER)
117 #include "ScreenReader.h"
120 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
121 #include "EditorState.h"
125 class ArgumentDecoder;
131 class GraphicsContext;
134 class HTMLPlugInElement;
139 class ResourceRequest;
141 class VisibleSelection;
142 struct KeypressCommand;
144 #if ENABLE(TIZEN_DATALIST_ELEMENT)
145 class HTMLDataListElement;
152 class InjectedBundleBackForwardList;
153 class NotificationPermissionRequestManager;
157 class WebColorChooser;
158 class WebContextMenu;
159 class WebContextMenuItemData;
162 class WebFullScreenManager;
165 class WebInspectorClient;
166 class WebKeyboardEvent;
168 class WebNotificationClient;
169 class WebOpenPanelResultListener;
170 class WebPageGroupProxy;
173 struct AttributedString;
176 struct WebPageCreationParameters;
177 struct WebPreferencesStore;
179 #if ENABLE(WEB_INTENTS)
183 #if ENABLE(GESTURE_EVENTS)
184 class WebGestureEvent;
187 #if ENABLE(TOUCH_EVENTS)
191 #if ENABLE(TIZEN_MEDIA_STREAM)
192 class UserMediaPermissionRequestManager;
193 class WebUserMediaClient;
196 #if ENABLE(TIZEN_ISF_PORT)
197 class NativeWebKeyboardEvent;
200 class WebPage : public APIObject, public CoreIPC::MessageSender<WebPage> {
202 static const Type APIType = TypeBundlePage;
204 static PassRefPtr<WebPage> create(uint64_t pageID, const WebPageCreationParameters&);
207 // Used by MessageSender.
208 CoreIPC::Connection* connection() const;
209 uint64_t destinationID() const { return pageID(); }
213 WebCore::Page* corePage() const { return m_page.get(); }
214 uint64_t pageID() const { return m_pageID; }
216 void setSize(const WebCore::IntSize&);
217 const WebCore::IntSize& size() const { return m_viewSize; }
218 WebCore::IntRect bounds() const { return WebCore::IntRect(WebCore::IntPoint(), size()); }
220 InjectedBundleBackForwardList* backForwardList();
221 DrawingArea* drawingArea() const { return m_drawingArea.get(); }
223 WebPageGroupProxy* pageGroup() const { return m_pageGroup.get(); }
225 void scrollMainFrameIfNotAtMaxScrollPosition(const WebCore::IntSize& scrollOffset);
227 void scrollBy(uint32_t scrollDirection, uint32_t scrollGranularity);
229 void centerSelectionInVisibleArea();
232 void confirmComposition(const String& compositionString);
233 void setComposition(const WTF::String& compositionString, const WTF::Vector<WebCore::CompositionUnderline>& underlines, uint64_t cursorPosition);
234 #if ENABLE(TIZEN_TEXT_CARET_HANDLING_WK2)
235 bool setCaretPosition(const WebCore::IntPoint&);
236 void getCaretPosition(WebCore::IntRect&);
238 #if ENABLE(TIZEN_ISF_PORT)
239 void updateCursorOffset();
240 void didCancelComposition(WebCore::Node*);
242 void getCursorOffset(int&);
243 void getSurroundingTextAndCursorOffset(String&, int&);
244 void getSelectionRect(bool, WebCore::IntRect&);
245 void deleteSurroundingText(int, int);
247 void scrollMainFrameBy(const WebCore::IntSize&);
248 void scrollMainFrameTo(const WebCore::IntPoint&);
249 void createSnapshot(const WebCore::IntRect, float, ShareableBitmap::Handle&);
250 void requestUpdateFormNavigation();
251 void moveFocus(int newIndex);
252 #if ENABLE(TIZEN_MOBILE_WEB_PRINT)
253 void createPagesToPDF(const WebCore::IntSize&, const WebCore::IntSize&, const String&);
255 #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
256 void hitTestResultAtPoint(const WebCore::IntPoint&, int hitTestMode, WebHitTestResult::Data&);
259 #if ENABLE(TIZEN_WEB_STORAGE)
260 void getStorageQuotaBytes(uint64_t callbackID);
261 void setStorageQuotaBytes(uint32_t quota);
264 #if ENABLE(TIZEN_CLIPBOARD) || ENABLE(TIZEN_PASTEBOARD)
265 void setClipboardDataForPaste(const String& data, const String& type);
268 void suspendJavaScriptAndResources();
269 void resumeJavaScriptAndResources();
270 #if ENABLE(TIZEN_SYNC_REQUEST_ANIMATION_FRAME)
271 void suspendAnimationController();
272 void resumeAnimationController();
274 #if ENABLE(TIZEN_PLUGIN_SUSPEND_RESUME)
275 void suspendPlugin();
279 #if ENABLE(TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR)
280 void startInspectorServer(uint32_t port, uint32_t& assignedPort);
281 void stopInspectorServer(bool& result);
283 #if ENABLE(TIZEN_ORIENTATION_EVENTS)
284 void sendOrientationChangeEvent(int orientation);
287 #if ENABLE(INSPECTOR)
288 WebInspector* inspector();
291 #if ENABLE(FULLSCREEN_API)
292 WebFullScreenManager* fullScreenManager();
295 // -- Called by the DrawingArea.
296 // FIXME: We could genericize these into a DrawingArea client interface. Would that be beneficial?
297 void drawRect(WebCore::GraphicsContext&, const WebCore::IntRect&);
298 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
299 void selectClosestWord(const WebCore::IntPoint&, bool isStartedTextSelectionFromOutside, bool& result);
300 void setLeftSelection(const WebCore::IntPoint&, bool& result);
301 void setRightSelection(const WebCore::IntPoint&, bool& result);
302 void getSelectionHandlers(WebCore::IntRect& leftRect, WebCore::IntRect& rightRect);
303 void getSelectionText(String& result);
304 void selectionRangeClear(bool& result);
305 void selectionClearAllSelection(WebCore::Frame* frame);
308 #if ENABLE(TIZEN_OFFLINE_PAGE_SAVE)
309 void startOfflinePageSave(String subresourceFolderName);
312 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_TEXT_SELECTION_MODE)
313 void selectLink(WebCore::IntPoint positionForSelection, bool& result);
316 void drawPageOverlay(WebCore::GraphicsContext&, const WebCore::IntRect&);
317 void layoutIfNeeded();
318 #if ENABLE(TIZEN_RECORDING_SURFACE_SET)
319 void recordingSurfaceSetEnableSet(bool enable);
320 void recordingSurfaceSetEnableURL(const String&);
322 bool recordingSurfaceEnabled() { return m_recordingSurfaceSetEnable; }
324 void setRecordingSurfaceLoadStart(bool enable) { m_recordingSurfaceSetLoadStart = enable; }
325 bool recordingSurfaceLoadStart() { return m_recordingSurfaceSetLoadStart; }
327 void setRecordingSurfaceLoadFinish(bool enable) { m_recordingSurfaceSetLoadFinished = enable; }
328 bool recordingSurfaceLoadFinish() { return m_recordingSurfaceSetLoadFinished; }
331 // -- Called from WebCore clients.
333 bool handleEditingKeyboardEvent(WebCore::KeyboardEvent*, bool saveCommands);
335 bool handleEditingKeyboardEvent(WebCore::KeyboardEvent*);
339 String userAgent() const { return m_userAgent; }
340 WebCore::IntRect windowResizerRect() const;
341 WebCore::KeyboardUIMode keyboardUIMode();
343 WebUndoStep* webUndoStep(uint64_t);
344 void addWebUndoStep(uint64_t, WebUndoStep*);
345 void removeWebEditCommand(uint64_t);
346 bool isInRedo() const { return m_isInRedo; }
348 void setActivePopupMenu(WebPopupMenu*);
350 #if ENABLE(INPUT_TYPE_COLOR)
351 WebColorChooser* activeColorChooser() const { return m_activeColorChooser; }
352 void setActiveColorChooser(WebColorChooser*);
353 void didChooseColor(const WebCore::Color&);
354 void didEndColorChooser();
357 WebOpenPanelResultListener* activeOpenPanelResultListener() const { return m_activeOpenPanelResultListener.get(); }
358 void setActiveOpenPanelResultListener(PassRefPtr<WebOpenPanelResultListener>);
360 // -- Called from WebProcess.
361 void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
362 void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&);
364 // -- InjectedBundle methods
365 #if ENABLE(CONTEXT_MENUS)
366 void initializeInjectedBundleContextMenuClient(WKBundlePageContextMenuClient*);
368 void initializeInjectedBundleEditorClient(WKBundlePageEditorClient*);
369 void initializeInjectedBundleFormClient(WKBundlePageFormClient*);
370 void initializeInjectedBundleLoaderClient(WKBundlePageLoaderClient*);
371 void initializeInjectedBundlePolicyClient(WKBundlePagePolicyClient*);
372 void initializeInjectedBundleResourceLoadClient(WKBundlePageResourceLoadClient*);
373 void initializeInjectedBundleUIClient(WKBundlePageUIClient*);
374 #if ENABLE(FULLSCREEN_API)
375 void initializeInjectedBundleFullScreenClient(WKBundlePageFullScreenClient*);
377 void initializeInjectedBundleDiagnosticLoggingClient(WKBundlePageDiagnosticLoggingClient*);
379 #if ENABLE(CONTEXT_MENUS)
380 InjectedBundlePageContextMenuClient& injectedBundleContextMenuClient() { return m_contextMenuClient; }
382 InjectedBundlePageEditorClient& injectedBundleEditorClient() { return m_editorClient; }
383 InjectedBundlePageFormClient& injectedBundleFormClient() { return m_formClient; }
384 InjectedBundlePageLoaderClient& injectedBundleLoaderClient() { return m_loaderClient; }
385 InjectedBundlePagePolicyClient& injectedBundlePolicyClient() { return m_policyClient; }
386 InjectedBundlePageResourceLoadClient& injectedBundleResourceLoadClient() { return m_resourceLoadClient; }
387 InjectedBundlePageUIClient& injectedBundleUIClient() { return m_uiClient; }
388 InjectedBundlePageDiagnosticLoggingClient& injectedBundleDiagnosticLoggingClient() { return m_logDiagnosticMessageClient; }
389 #if ENABLE(FULLSCREEN_API)
390 InjectedBundlePageFullScreenClient& injectedBundleFullScreenClient() { return m_fullScreenClient; }
393 void setUnderlayPage(PassRefPtr<WebPage> underlayPage) { m_underlayPage = underlayPage; }
395 bool findStringFromInjectedBundle(const String&, FindOptions);
397 WebFrame* mainWebFrame() const { return m_mainFrame.get(); }
399 WebCore::Frame* mainFrame() const; // May return 0.
400 WebCore::FrameView* mainFrameView() const; // May return 0.
402 PassRefPtr<Plugin> createPlugin(WebFrame*, WebCore::HTMLPlugInElement*, const Plugin::Parameters&);
404 EditorState editorState() const;
405 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
406 void setEditorState(const EditorState& editorState) { m_editorState = editorState;}
409 String renderTreeExternalRepresentation() const;
410 uint64_t renderTreeSize() const;
411 void setPaintedObjectsCounterThreshold(uint64_t);
413 void setTracksRepaints(bool);
414 bool isTrackingRepaints() const;
415 void resetTrackedRepaints();
416 PassRefPtr<ImmutableArray> trackedRepaintRects();
418 void executeEditingCommand(const String& commandName, const String& argument);
419 bool isEditingCommandEnabled(const String& commandName);
420 void clearMainFrameName();
423 double textZoomFactor() const;
424 void setTextZoomFactor(double);
425 double pageZoomFactor() const;
426 void setPageZoomFactor(double);
427 void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor);
428 void windowScreenDidChange(uint64_t);
429 void setViewMode(WebCore::Page::ViewMode);
431 void scalePage(double scale, const WebCore::IntPoint& origin);
432 double pageScaleFactor() const;
434 void setUseFixedLayout(bool);
435 bool useFixedLayout() const { return m_useFixedLayout; }
436 void setFixedLayoutSize(const WebCore::IntSize&);
438 void setPaginationMode(uint32_t /* WebCore::Page::Pagination::Mode */);
439 void setPaginationBehavesLikeColumns(bool);
440 void setPageLength(double);
441 void setGapBetweenPages(double);
443 bool drawsBackground() const { return m_drawsBackground; }
444 bool drawsTransparentBackground() const { return m_drawsTransparentBackground; }
447 void stopLoadingFrame(uint64_t frameID);
448 void setDefersLoading(bool deferLoading);
450 #if USE(ACCELERATED_COMPOSITING)
451 void enterAcceleratedCompositingMode(WebCore::GraphicsLayer*);
452 void exitAcceleratedCompositingMode();
455 void addPluginView(PluginView*);
456 void removePluginView(PluginView*);
459 LayerHostingMode layerHostingMode() const { return m_layerHostingMode; }
460 void setLayerHostingMode(LayerHostingMode);
462 bool windowIsVisible() const { return m_windowIsVisible; }
463 void updatePluginsActiveAndFocusedState();
464 const WebCore::IntRect& windowFrameInScreenCoordinates() const { return m_windowFrameInScreenCoordinates; }
465 const WebCore::IntRect& viewFrameInWindowCoordinates() const { return m_viewFrameInWindowCoordinates; }
467 HWND nativeWindow() const { return m_nativeWindow; }
470 bool windowIsFocused() const;
471 bool windowAndWebPageAreFocused() const;
472 void installPageOverlay(PassRefPtr<PageOverlay>);
473 void uninstallPageOverlay(PageOverlay*, bool fadeOut);
474 bool hasPageOverlay() const { return m_pageOverlay; }
475 WebCore::IntPoint screenToWindow(const WebCore::IntPoint&);
476 WebCore::IntRect windowToScreen(const WebCore::IntRect&);
478 PassRefPtr<WebImage> snapshotInViewCoordinates(const WebCore::IntRect&, ImageOptions);
479 PassRefPtr<WebImage> scaledSnapshotInViewCoordinates(const WebCore::IntRect&, double scaleFactor, ImageOptions);
480 PassRefPtr<WebImage> snapshotInDocumentCoordinates(const WebCore::IntRect&, ImageOptions);
481 PassRefPtr<WebImage> scaledSnapshotInDocumentCoordinates(const WebCore::IntRect&, double scaleFactor, ImageOptions);
483 static const WebEvent* currentEvent();
485 FindController& findController() { return m_findController; }
486 #if ENABLE(TOUCH_EVENTS) && PLATFORM(QT)
487 TapHighlightController& tapHighlightController() { return m_tapHighlightController; }
490 #if ENABLE(GEOLOCATION)
491 GeolocationPermissionRequestManager& geolocationPermissionRequestManager() { return m_geolocationPermissionRequestManager; }
494 NotificationPermissionRequestManager* notificationPermissionRequestManager();
495 #if ENABLE(TIZEN_MEDIA_STREAM)
496 UserMediaPermissionRequestManager* userMediaPermissionRequestManager();
498 void pageDidScroll();
499 #if USE(TILED_BACKING_STORE)
500 void pageDidRequestScroll(const WebCore::IntPoint&);
502 #if ENABLE(TIZEN_WEBKIT2_HISTORICAL_RESTORE_VISIBLE_CONTENT_RECT)
503 void pageDidRequestRestoreVisibleContentRect(const WebCore::IntPoint&, float);
506 void setFixedVisibleContentRect(const WebCore::IntRect&);
507 void setResizesToContentsUsingLayoutSize(const WebCore::IntSize&);
508 void resizeToContentsIfNeeded();
509 void sendViewportAttributesChanged();
510 void setViewportSize(const WebCore::IntSize&);
511 WebCore::IntSize viewportSize() const { return m_viewportSize; }
513 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
514 WebCore::IntSize contentsSize() const;
519 #if ENABLE(CONTEXT_MENUS)
520 WebContextMenu* contextMenu();
523 bool hasLocalDataForURL(const WebCore::KURL&);
524 String cachedResponseMIMETypeForURL(const WebCore::KURL&);
525 String cachedSuggestedFilenameForURL(const WebCore::KURL&);
526 PassRefPtr<WebCore::SharedBuffer> cachedResponseDataForURL(const WebCore::KURL&);
528 static bool canHandleRequest(const WebCore::ResourceRequest&);
530 class SandboxExtensionTracker {
532 ~SandboxExtensionTracker();
536 void beginLoad(WebFrame*, const SandboxExtension::Handle& handle);
537 void willPerformLoadDragDestinationAction(PassRefPtr<SandboxExtension> pendingDropSandboxExtension);
538 void didStartProvisionalLoad(WebFrame*);
539 void didCommitProvisionalLoad(WebFrame*);
540 void didFailProvisionalLoad(WebFrame*);
543 void setPendingProvisionalSandboxExtension(PassRefPtr<SandboxExtension>);
545 RefPtr<SandboxExtension> m_pendingProvisionalSandboxExtension;
546 RefPtr<SandboxExtension> m_provisionalSandboxExtension;
547 RefPtr<SandboxExtension> m_committedSandboxExtension;
550 SandboxExtensionTracker& sandboxExtensionTracker() { return m_sandboxExtensionTracker; }
553 void setThemePath(const String&);
557 void setComposition(const String& text, Vector<WebCore::CompositionUnderline> underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd);
558 void confirmComposition(const String& text, int64_t selectionStart, int64_t selectionLength);
559 void cancelComposition();
563 void registerUIProcessAccessibilityTokens(const CoreIPC::DataReference& elemenToken, const CoreIPC::DataReference& windowToken);
564 WKAccessibilityWebPageObject* accessibilityRemoteObject();
565 WebCore::IntPoint accessibilityPosition() const { return m_accessibilityPosition; }
567 void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput);
569 void setComposition(const String& text, Vector<WebCore::CompositionUnderline> underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd, EditorState& newState);
570 void confirmComposition(EditorState& newState);
571 void cancelComposition(EditorState& newState);
572 void insertText(const String& text, uint64_t replacementRangeStart, uint64_t replacementRangeEnd, bool& handled, EditorState& newState);
573 void getMarkedRange(uint64_t& location, uint64_t& length);
574 void getSelectedRange(uint64_t& location, uint64_t& length);
575 void getAttributedSubstringFromRange(uint64_t location, uint64_t length, AttributedString&);
576 void characterIndexForPoint(const WebCore::IntPoint point, uint64_t& result);
577 void firstRectForCharacterRange(uint64_t location, uint64_t length, WebCore::IntRect& resultRect);
578 void executeKeypressCommands(const Vector<WebCore::KeypressCommand>&, bool& handled, EditorState& newState);
579 void readSelectionFromPasteboard(const WTF::String& pasteboardName, bool& result);
580 void getStringSelectionForPasteboard(WTF::String& stringValue);
581 void getDataSelectionForPasteboard(const WTF::String pasteboardType, SharedMemory::Handle& handle, uint64_t& size);
582 void shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent&, bool& result);
583 void acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent&, bool& result);
584 bool performNonEditingBehaviorForSelector(const String&);
585 void insertDictatedText(const String& text, uint64_t replacementRangeStart, uint64_t replacementRangeEnd, const Vector<WebCore::DictationAlternative>& dictationAlternativeLocations, bool& handled, EditorState& newState);
587 void confirmComposition(const String& compositionString);
588 void setComposition(const WTF::String& compositionString, const WTF::Vector<WebCore::CompositionUnderline>& underlines, uint64_t cursorPosition);
589 void firstRectForCharacterInSelectedRange(const uint64_t characterPosition, WebCore::IntRect& resultRect);
590 void getSelectedText(WTF::String&);
592 void gestureWillBegin(const WebCore::IntPoint&, bool& canBeginPanning);
593 void gestureDidScroll(const WebCore::IntSize&);
594 void gestureDidEnd();
597 void updateAccessibilityTree();
598 bool handleMousePressedEvent(const WebCore::PlatformMouseEvent&);
599 #if USE(TEXTURE_MAPPER_GL)
600 void widgetMapped(int64_t nativeWindowHandle);
604 void setCompositionForTesting(const String& compositionString, uint64_t from, uint64_t length);
605 bool hasCompositionForTesting();
606 void confirmCompositionForTesting(const String& compositionString);
608 // FIXME: This a dummy message, to avoid breaking the build for platforms that don't require
609 // any synchronous messages, and should be removed when <rdar://problem/8775115> is fixed.
613 void performDictionaryLookupForSelection(DictionaryPopupInfo::Type, WebCore::Frame*, const WebCore::VisibleSelection&);
616 void speak(const String&);
619 bool isSmartInsertDeleteEnabled() const { return m_isSmartInsertDeleteEnabled; }
622 #if ENABLE(WEB_INTENTS)
623 void deliverIntentToFrame(uint64_t frameID, const IntentData&);
626 void replaceSelectionWithText(WebCore::Frame*, const String&);
627 void clearSelection();
629 #if ENABLE(DRAG_SUPPORT)
631 void performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const WebCore::DragDataMap&, uint32_t flags);
632 #elif PLATFORM(QT) || PLATFORM(GTK)
633 void performDragControllerAction(uint64_t action, WebCore::DragData);
635 #if ENABLE(TIZEN_DRAG_SUPPORT)
636 void performDragControllerAction(uint64_t action, WebCore::DragData);
638 void performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const WTF::String& dragStorageName, uint32_t flags, const SandboxExtension::Handle&, const SandboxExtension::HandleArray&);
641 void dragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation);
643 void willPerformLoadDragDestinationAction();
644 void mayPerformUploadDragDestinationAction();
645 #endif // ENABLE(DRAG_SUPPORT)
647 void beginPrinting(uint64_t frameID, const PrintInfo&);
649 void computePagesForPrinting(uint64_t frameID, const PrintInfo&, uint64_t callbackID);
650 #if PLATFORM(MAC) || PLATFORM(WIN)
651 void drawRectToPDF(uint64_t frameID, const PrintInfo&, const WebCore::IntRect&, uint64_t callbackID);
652 void drawPagesToPDF(uint64_t frameID, const PrintInfo&, uint32_t first, uint32_t count, uint64_t callbackID);
654 void drawPagesForPrinting(uint64_t frameID, const PrintInfo&, uint64_t callbackID);
657 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
658 void getWebAppCapable(uint64_t callbackID);
659 void getWebAppIconURL(uint64_t callbackID);
660 void getWebAppIconURLs(uint64_t callbackID);
663 void setMediaVolume(float);
665 bool mainFrameHasCustomRepresentation() const;
667 void didChangeScrollOffsetForMainFrame();
669 void mainFrameDidLayout();
671 bool canRunBeforeUnloadConfirmPanel() const { return m_canRunBeforeUnloadConfirmPanel; }
672 void setCanRunBeforeUnloadConfirmPanel(bool canRunBeforeUnloadConfirmPanel) { m_canRunBeforeUnloadConfirmPanel = canRunBeforeUnloadConfirmPanel; }
674 bool canRunModal() const { return m_canRunModal; }
675 void setCanRunModal(bool canRunModal) { m_canRunModal = canRunModal; }
679 void setDeviceScaleFactor(float);
680 float deviceScaleFactor() const;
682 void setMemoryCacheMessagesEnabled(bool);
684 void forceRepaintWithoutCallback();
686 void unmarkAllMisspellings();
687 void unmarkAllBadGrammar();
688 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
689 void handleAlternativeTextUIResult(const String&);
692 // For testing purpose.
693 void simulateMouseDown(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, double time);
694 void simulateMouseUp(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, double time);
695 void simulateMouseMotion(WebCore::IntPoint, double time);
697 #if ENABLE(CONTEXT_MENUS)
698 void contextMenuShowing() { m_isShowingContextMenu = true; }
702 void registerApplicationScheme(const String& scheme);
703 void applicationSchemeReply(const QtNetworkReplyData&);
704 void receivedApplicationSchemeRequest(const QNetworkRequest&, QtNetworkReply*);
705 void setUserScripts(const Vector<String>&);
707 void wheelEvent(const WebWheelEvent&);
708 #if ENABLE(GESTURE_EVENTS)
709 void gestureEvent(const WebGestureEvent&);
712 void numWheelEventHandlersChanged(unsigned);
713 void recomputeShortCircuitHorizontalWheelEventsState();
715 bool willGoToBackForwardItemCallbackEnabled() const { return m_willGoToBackForwardItemCallbackEnabled; }
717 #if ENABLE(PAGE_VISIBILITY_API)
718 void setVisibilityState(int visibilityState, bool isInitialState);
721 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION) || ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
722 void setFocusedInputElementValue(const String& inputValue);
723 void getFocusedInputElementValue(String& inputValue);
726 #if ENABLE(TIZEN_DATALIST_ELEMENT)
727 void getFocusedInputElementDataList(Vector<String>&);
730 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
731 void scrollOverflow(const WebCore::FloatPoint&, bool& scrolled);
732 void setPressedNodeAtPoint(const WebCore::IntPoint&, bool checkOverflowLayer, bool& pressed, uint32_t& id);
735 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION_ON_UI_SIDE)
736 void scrollOverflowWithTrajectoryVector(const WebCore::FloatPoint&);
739 #if ENABLE(TIZEN_CUSTOM_HEADERS)
740 void addCustomHeader(const String& name, const String& value);
741 void removeCustomHeader(const String& name);
742 void clearCustomHeaders();
743 WebCore::HTTPHeaderMap customHeaders();
746 #if ENABLE(TIZEN_WEBKIT2_GET_TEXT_STYLE_FOR_SELECTION)
747 void getTextStyleStateForSelection();
750 #if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
751 uint64_t nativeWindowHandle() { return m_nativeWindowHandle; }
754 #if ENABLE(TIZEN_MULTIPLE_SELECT)
755 void didChangeSelectedIndexForActivePopupMenuMultiple(Vector<int32_t>);
758 #if ENABLE(TIZEN_LINK_MAGNIFIER)
759 void getLinkMagnifierRect(const WebCore::IntPoint&, const WebCore::IntSize&);
762 #if ENABLE(TIZEN_SCREEN_READER)
763 void raiseTapEvent(const WebCore::IntPoint&, const WebCore::IntPoint&);
764 void moveScreenReaderFocus(bool, bool&);
765 void moveScreenReaderFocusByPoint(const WebCore::IntPoint&);
766 void recalcScreenReaderFocusRect();
767 void updateScreenReaderFocus(WebCore::RenderObject*);
768 void clearScreenReader();
771 #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
772 void notifyTransitionToCommitted(bool);
775 #if ENABLE(TIZEN_CSP)
776 void setContentSecurityPolicy(const String& policy, uint32_t headerType);
779 #if ENABLE(TIZEN_INDEXED_DATABASE)
780 void setIndexedDatabaseDirectory(const String& path);
783 #if ENABLE(TIZEN_WEB_STORAGE)
784 void setLocalStorageDirectory(const String& path);
788 WebPage(uint64_t pageID, const WebPageCreationParameters&);
790 virtual Type type() const { return APIType; }
792 void platformInitialize();
794 void didReceiveWebPageMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
795 void didReceiveSyncWebPageMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&);
798 static const char* interpretKeyEvent(const WebCore::KeyboardEvent*);
800 bool performDefaultBehaviorForKeyEvent(const WebKeyboardEvent&);
803 bool executeKeypressCommandsInternal(const Vector<WebCore::KeypressCommand>&, WebCore::KeyboardEvent*);
806 String sourceForFrame(WebFrame*);
808 void loadData(PassRefPtr<WebCore::SharedBuffer>, const String& MIMEType, const String& encodingName, const WebCore::KURL& baseURL, const WebCore::KURL& failingURL);
810 bool platformHasLocalDataForURL(const WebCore::KURL&);
814 void loadURL(const String&, const SandboxExtension::Handle&);
815 void loadURLRequest(const WebCore::ResourceRequest&, const SandboxExtension::Handle&);
816 void loadHTMLString(const String& htmlString, const String& baseURL);
817 void loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL);
818 void loadPlainTextString(const String&);
819 void loadWebArchiveData(const CoreIPC::DataReference&);
821 void loadContentsbyMimeType(const CoreIPC::DataReference&, const String& mimeType, const String& encoding, const String& baseURL);
823 void linkClicked(const String& url, const WebMouseEvent&);
824 void reload(bool reloadFromOrigin, const SandboxExtension::Handle&);
825 void goForward(uint64_t);
826 void goBack(uint64_t);
827 void goToBackForwardItem(uint64_t);
828 void tryRestoreScrollPosition();
829 void setActive(bool);
830 void setFocused(bool);
831 void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&);
832 void setWindowResizerSize(const WebCore::IntSize&);
833 void setIsInWindow(bool);
834 void validateCommand(const String&, uint64_t);
835 void executeEditCommand(const String&);
837 void executeEditCommandWithArgument(const String& command, const String& argument);
840 void mouseEvent(const WebMouseEvent&);
841 void mouseEventSyncForTesting(const WebMouseEvent&, bool&);
842 void wheelEventSyncForTesting(const WebWheelEvent&, bool&);
843 #if ENABLE(TIZEN_ISF_PORT)
844 void keyEvent(const NativeWebKeyboardEvent&);
846 void keyEvent(const WebKeyboardEvent&);
848 void keyEventSyncForTesting(const WebKeyboardEvent&, bool&);
849 #if ENABLE(TOUCH_EVENTS)
850 void touchEvent(const WebTouchEvent&);
851 void touchEventSyncForTesting(const WebTouchEvent&, bool& handled);
853 void highlightPotentialActivation(const WebCore::IntPoint&, const WebCore::IntSize& area);
856 #if ENABLE(CONTEXT_MENUS)
857 void contextMenuHidden() { m_isShowingContextMenu = false; }
860 static void scroll(WebCore::Page*, WebCore::ScrollDirection, WebCore::ScrollGranularity);
861 static void logicalScroll(WebCore::Page*, WebCore::ScrollLogicalDirection, WebCore::ScrollGranularity);
863 uint64_t restoreSession(const SessionState&);
864 void restoreSessionAndNavigateToCurrentItem(const SessionState&);
866 void didRemoveBackForwardItem(uint64_t);
868 void setWillGoToBackForwardItemCallbackEnabled(bool enabled) { m_willGoToBackForwardItemCallbackEnabled = enabled; }
870 void setDrawsBackground(bool);
871 void setDrawsTransparentBackground(bool);
873 void viewWillStartLiveResize();
874 void viewWillEndLiveResize();
876 void getContentsAsString(uint64_t callbackID);
878 void getContentsAsMHTMLData(uint64_t callbackID, bool useBinaryEncoding);
880 void getMainResourceDataOfFrame(uint64_t frameID, uint64_t callbackID);
881 void getResourceDataFromFrame(uint64_t frameID, const String& resourceURL, uint64_t callbackID);
882 void getRenderTreeExternalRepresentation(uint64_t callbackID);
883 void getSelectionOrContentsAsString(uint64_t callbackID);
884 void getSourceForFrame(uint64_t frameID, uint64_t callbackID);
885 void getWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID);
886 void runJavaScriptInMainFrame(const String&, uint64_t callbackID);
887 void forceRepaint(uint64_t callbackID);
889 void preferencesDidChange(const WebPreferencesStore&);
890 void platformPreferencesDidChange(const WebPreferencesStore&);
891 void updatePreferences(const WebPreferencesStore&);
893 void didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t downloadID);
894 void setUserAgent(const String&);
895 void setCustomTextEncodingName(const String&);
896 void suspendActiveDOMObjectsAndAnimations();
897 void resumeActiveDOMObjectsAndAnimations();
900 void performDictionaryLookupAtLocation(const WebCore::FloatPoint&);
901 void performDictionaryLookupForRange(DictionaryPopupInfo::Type, WebCore::Frame*, WebCore::Range*, NSDictionary *options);
903 void setWindowIsVisible(bool windowIsVisible);
904 void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates, const WebCore::IntPoint& accessibilityViewCoordinates);
906 RetainPtr<PDFDocument> pdfDocumentForPrintingFrame(WebCore::Frame*);
907 void computePagesForPrintingPDFDocument(uint64_t frameID, const PrintInfo&, Vector<WebCore::IntRect>& resultPageRects);
908 void drawRectToPDFFromPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, const WebCore::IntRect&);
909 void drawPagesToPDFFromPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, uint32_t first, uint32_t count);
912 void unapplyEditCommand(uint64_t commandID);
913 void reapplyEditCommand(uint64_t commandID);
914 void didRemoveEditCommand(uint64_t commandID);
916 void findString(const String&, uint32_t findOptions, uint32_t maxMatchCount);
917 void findStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
918 void getImageForFindMatch(uint32_t matchIndex);
919 void selectFindMatch(uint32_t matchIndex);
921 void countStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
923 #if PLATFORM(QT) || OS(TIZEN)
924 void findZoomableAreaForPoint(const WebCore::IntPoint&, const WebCore::IntSize& area);
927 void didChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
928 void setTextForActivePopupMenu(int32_t index);
931 void failedToShowPopupMenu();
934 void hidePopupMenu();
935 void selectedIndex(int32_t newIndex);
938 void didChooseFilesForOpenPanel(const Vector<String>&);
939 void didCancelForOpenPanel();
940 #if ENABLE(WEB_PROCESS_SANDBOX)
941 void extendSandboxForFileFromOpenPanel(const SandboxExtension::Handle&);
944 void didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed);
946 void didReceiveNotificationPermissionDecision(uint64_t notificationID, bool allowed);
947 #if ENABLE(TIZEN_MEDIA_STREAM)
948 void didReceiveUserMediaPermissionDecision(uint64_t userMediaID, bool allowed);
951 void advanceToNextMisspelling(bool startBeforeSelection);
952 void changeSpellingToWord(const String& word);
954 void uppercaseWord();
955 void lowercaseWord();
956 void capitalizeWord();
960 void setSmartInsertDeleteEnabled(bool isSmartInsertDeleteEnabled) { m_isSmartInsertDeleteEnabled = isSmartInsertDeleteEnabled; }
963 #if ENABLE(CONTEXT_MENUS)
964 void didSelectItemFromActiveContextMenu(const WebContextMenuItemData&);
967 void changeSelectedIndex(int32_t index);
968 void setCanStartMediaTimerFired();
970 static bool platformCanHandleRequest(const WebCore::ResourceRequest&);
971 #if ENABLE(TIZEN_NATIVE_MEMORY_SNAPSHOT)
972 void dumpMemorySnapshot();
974 OwnPtr<WebCore::Page> m_page;
975 RefPtr<WebFrame> m_mainFrame;
976 RefPtr<InjectedBundleBackForwardList> m_backForwardList;
978 RefPtr<WebPageGroupProxy> m_pageGroup;
982 WebCore::IntSize m_viewSize;
983 OwnPtr<DrawingArea> m_drawingArea;
985 HashSet<PluginView*> m_pluginViews;
987 bool m_useFixedLayout;
989 bool m_drawsBackground;
990 bool m_drawsTransparentBackground;
996 #if ENABLE(TIZEN_CUSTOM_HEADERS)
997 WebCore::HTTPHeaderMap m_customHeaders;
1001 // Whether the containing window is visible or not.
1002 bool m_windowIsVisible;
1004 // Whether smart insert/delete is enabled or not.
1005 bool m_isSmartInsertDeleteEnabled;
1007 // The frame of the containing window in screen coordinates.
1008 WebCore::IntRect m_windowFrameInScreenCoordinates;
1010 // The frame of the view in window coordinates.
1011 WebCore::IntRect m_viewFrameInWindowCoordinates;
1013 // The accessibility position of the view.
1014 WebCore::IntPoint m_accessibilityPosition;
1016 // The layer hosting mode.
1017 LayerHostingMode m_layerHostingMode;
1019 RetainPtr<WKAccessibilityWebPageObject> m_mockAccessibilityElement;
1021 WebCore::KeyboardEvent* m_keyboardEventBeingInterpreted;
1024 // Our view's window (in the UI process).
1025 HWND m_nativeWindow;
1027 RefPtr<WebCore::Node> m_gestureTargetNode;
1029 WebPageAccessibilityObject* m_accessibilityObject;
1031 #if USE(TEXTURE_MAPPER_GL)
1032 // Our view's window in the UI process.
1033 uint64_t m_nativeWindowHandle;
1037 WebCore::RunLoop::Timer<WebPage> m_setCanStartMediaTimer;
1039 HashMap<uint64_t, RefPtr<WebUndoStep> > m_undoStepMap;
1041 WebCore::IntSize m_windowResizerSize;
1043 #if ENABLE(CONTEXT_MENUS)
1044 InjectedBundlePageContextMenuClient m_contextMenuClient;
1046 InjectedBundlePageEditorClient m_editorClient;
1047 InjectedBundlePageFormClient m_formClient;
1048 InjectedBundlePageLoaderClient m_loaderClient;
1049 InjectedBundlePagePolicyClient m_policyClient;
1050 InjectedBundlePageResourceLoadClient m_resourceLoadClient;
1051 InjectedBundlePageUIClient m_uiClient;
1052 #if ENABLE(FULLSCREEN_API)
1053 InjectedBundlePageFullScreenClient m_fullScreenClient;
1055 InjectedBundlePageDiagnosticLoggingClient m_logDiagnosticMessageClient;
1057 #if USE(TILED_BACKING_STORE)
1058 WebCore::IntSize m_viewportSize;
1061 FindController m_findController;
1062 #if ENABLE(TOUCH_EVENTS) && PLATFORM(QT)
1063 TapHighlightController m_tapHighlightController;
1065 RefPtr<PageOverlay> m_pageOverlay;
1067 RefPtr<WebPage> m_underlayPage;
1069 #if ENABLE(INSPECTOR)
1070 RefPtr<WebInspector> m_inspector;
1072 #if ENABLE(FULLSCREEN_API)
1073 RefPtr<WebFullScreenManager> m_fullScreenManager;
1075 RefPtr<WebPopupMenu> m_activePopupMenu;
1076 #if ENABLE(CONTEXT_MENUS)
1077 RefPtr<WebContextMenu> m_contextMenu;
1079 #if ENABLE(INPUT_TYPE_COLOR)
1080 WebColorChooser* m_activeColorChooser;
1082 RefPtr<WebOpenPanelResultListener> m_activeOpenPanelResultListener;
1083 RefPtr<NotificationPermissionRequestManager> m_notificationPermissionRequestManager;
1084 #if ENABLE(TIZEN_MEDIA_STREAM)
1085 RefPtr<UserMediaPermissionRequestManager> m_userMediaPermissionRequestManager;
1088 #if ENABLE(GEOLOCATION)
1089 GeolocationPermissionRequestManager m_geolocationPermissionRequestManager;
1092 OwnPtr<WebCore::PrintContext> m_printContext;
1094 RefPtr<WebPrintOperationGtk> m_printOperation;
1097 SandboxExtensionTracker m_sandboxExtensionTracker;
1100 RefPtr<SandboxExtension> m_pendingDropSandboxExtension;
1101 Vector<RefPtr<SandboxExtension> > m_pendingDropExtensionsForFileUpload;
1103 bool m_canRunBeforeUnloadConfirmPanel;
1106 bool m_isRunningModal;
1108 bool m_cachedMainFrameIsPinnedToLeftSide;
1109 bool m_cachedMainFrameIsPinnedToRightSide;
1110 bool m_canShortCircuitHorizontalWheelEvents;
1111 unsigned m_numWheelEventHandlers;
1113 unsigned m_cachedPageCount;
1115 #if ENABLE(CONTEXT_MENUS)
1116 bool m_isShowingContextMenu;
1119 bool m_willGoToBackForwardItemCallbackEnabled;
1122 bool m_gestureReachedScrollingLimit;
1126 HashMap<String, QtNetworkReply*> m_applicationSchemeReplies;
1128 #if ENABLE(PAGE_VISIBILITY_API)
1129 WebCore::PageVisibilityState m_visibilityState;
1131 #if ENABLE(TIZEN_RECORDING_SURFACE_SET)
1132 bool m_recordingSurfaceSetEnable;
1133 bool m_recordingSurfaceSetLoadStart;
1134 bool m_recordingSurfaceSetLoadFinished;
1135 bool m_recordingSurfaceSetSettings;
1137 #if ENABLE(TIZEN_SYNC_REQUEST_ANIMATION_FRAME)
1138 bool m_suspendedAnimationController;
1141 WebInspectorClient* m_inspectorClient;
1143 #if ENABLE(TIZEN_SCREEN_READER)
1144 OwnPtr<ScreenReader> m_screenReader;
1147 #if ENABLE(TIZEN_ISF_PORT)
1148 bool m_isSettingComposition;
1151 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
1152 EditorState m_editorState;
1156 #if ENABLE(TIZEN_NATIVE_MEMORY_SNAPSHOT)
1157 void dumpMemorySnapshot();
1160 } // namespace WebKit