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.
26 #ifndef WebPageProxy_h
27 #define WebPageProxy_h
29 #include "APIObject.h"
30 #include "ContextMenuState.h"
31 #include "DragControllerAction.h"
32 #include "DrawingAreaProxy.h"
33 #include "GeolocationPermissionRequestManagerProxy.h"
34 #include "SandboxExtension.h"
35 #include "SelectionState.h"
36 #include "SharedMemory.h"
38 #include "WKPagePrivate.h"
39 #include "WebContextMenuItemData.h"
41 #include "WebFindClient.h"
42 #include "WebFindOptions.h"
43 #include "WebFormClient.h"
44 #include "WebFrameProxy.h"
45 #include "WebHistoryClient.h"
46 #include "WebInspectorProxy.h"
47 #include "WebLoaderClient.h"
48 #include "WebPageContextMenuClient.h"
49 #include "WebPolicyClient.h"
50 #include "WebPopupMenuProxy.h"
51 #include "WebResourceLoadClient.h"
52 #include "WebUIClient.h"
53 #include <WebCore/DragActions.h>
54 #include <WebCore/EditAction.h>
55 #include <WebCore/Editor.h>
56 #include <WebCore/FrameLoaderTypes.h>
57 #include <WebCore/KeyboardEvent.h>
58 #include <wtf/HashMap.h>
59 #include <wtf/HashSet.h>
60 #include <wtf/OwnPtr.h>
61 #include <wtf/PassOwnPtr.h>
62 #include <wtf/PassRefPtr.h>
63 #include <wtf/RefPtr.h>
64 #include <wtf/text/WTFString.h>
67 class ArgumentDecoder;
73 class AuthenticationChallenge;
78 class ProtectionSpace;
79 struct TextCheckingResult;
80 struct ViewportArguments;
81 struct WindowFeatures;
86 class DrawingAreaProxy;
87 class NativeWebKeyboardEvent;
89 class PlatformCertificateInfo;
90 class StringPairVector;
91 class WebBackForwardList;
92 class WebBackForwardListItem;
93 class WebContextMenuProxy;
95 class WebEditCommandProxy;
96 class WebKeyboardEvent;
98 class WebOpenPanelResultListenerProxy;
100 class WebPopupMenuProxy;
101 class WebProcessProxy;
104 struct ContextMenuState;
105 struct DictionaryPopupInfo;
106 struct PlatformPopupMenuData;
108 struct WebPageCreationParameters;
111 #if ENABLE(GESTURE_EVENTS)
112 class WebGestureEvent;
115 typedef GenericCallback<WKStringRef, StringImpl*> StringCallback;
116 typedef GenericCallback<WKSerializedScriptValueRef, WebSerializedScriptValue*> ScriptValueCallback;
118 // FIXME: Make a version of CallbackBase with three arguments, and define ValidateCommandCallback as a specialization.
119 class ValidateCommandCallback : public CallbackBase {
121 typedef void (*CallbackFunction)(WKStringRef, bool, int32_t, WKErrorRef, void*);
123 static PassRefPtr<ValidateCommandCallback> create(void* context, CallbackFunction callback)
125 return adoptRef(new ValidateCommandCallback(context, callback));
128 virtual ~ValidateCommandCallback()
133 void performCallbackWithReturnValue(StringImpl* returnValue1, bool returnValue2, int returnValue3)
137 m_callback(toAPI(returnValue1), returnValue2, returnValue3, 0, context());
146 RefPtr<WebError> error = WebError::create();
147 m_callback(0, 0, 0, toAPI(error.get()), context());
154 ValidateCommandCallback(void* context, CallbackFunction callback)
155 : CallbackBase(context)
156 , m_callback(callback)
160 CallbackFunction m_callback;
163 class WebPageProxy : public APIObject, public WebPopupMenuProxy::Client {
165 static const Type APIType = TypePage;
167 static PassRefPtr<WebPageProxy> create(PageClient*, WebContext*, WebPageGroup*, uint64_t pageID);
168 virtual ~WebPageProxy();
170 uint64_t pageID() const { return m_pageID; }
172 WebFrameProxy* mainFrame() const { return m_mainFrame.get(); }
173 WebFrameProxy* focusedFrame() const { return m_focusedFrame.get(); }
174 WebFrameProxy* frameSetLargestFrame() const { return m_frameSetLargestFrame.get(); }
176 DrawingAreaProxy* drawingArea() { return m_drawingArea.get(); }
177 void setDrawingArea(PassOwnPtr<DrawingAreaProxy>);
179 WebBackForwardList* backForwardList() { return m_backForwardList.get(); }
181 #if ENABLE(INSPECTOR)
182 WebInspectorProxy* inspector();
185 void initializeContextMenuClient(const WKPageContextMenuClient*);
186 void initializeFindClient(const WKPageFindClient*);
187 void initializeFormClient(const WKPageFormClient*);
188 void initializeLoaderClient(const WKPageLoaderClient*);
189 void initializePolicyClient(const WKPagePolicyClient*);
190 void initializeResourceLoadClient(const WKPageResourceLoadClient*);
191 void initializeUIClient(const WKPageUIClient*);
193 void initializeWebPage();
197 bool isClosed() const { return m_isClosed; }
199 void loadURL(const String&);
200 void loadURLRequest(WebURLRequest*);
201 void loadHTMLString(const String& htmlString, const String& baseURL);
202 void loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL);
203 void loadPlainTextString(const String& string);
206 void reload(bool reloadFromOrigin);
209 bool canGoForward() const;
211 bool canGoBack() const;
213 void goToBackForwardItem(WebBackForwardListItem*);
214 void didChangeBackForwardList(WebBackForwardListItem* addedItem, Vector<RefPtr<APIObject> >* removedItems);
215 void shouldGoToBackForwardListItem(uint64_t itemID, bool& shouldGoToBackForwardListItem);
217 bool canShowMIMEType(const String& mimeType) const;
219 bool drawsBackground() const { return m_drawsBackground; }
220 void setDrawsBackground(bool);
222 bool drawsTransparentBackground() const { return m_drawsTransparentBackground; }
223 void setDrawsTransparentBackground(bool);
225 void viewWillStartLiveResize();
226 void viewWillEndLiveResize();
228 void setInitialFocus(bool);
229 void setWindowResizerSize(const WebCore::IntSize&);
231 void setViewNeedsDisplay(const WebCore::IntRect&);
233 void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
236 ViewWindowIsActive = 1 << 0,
237 ViewIsFocused = 1 << 1,
238 ViewIsVisible = 1 << 2,
239 ViewIsInWindow = 1 << 3
241 typedef unsigned ViewStateFlags;
242 void viewStateDidChange(ViewStateFlags flags);
244 WebCore::IntSize viewSize() const;
245 bool isViewVisible() const { return m_isVisible; }
247 void executeEditCommand(const String& commandName);
248 void validateCommand(const String& commandName, PassRefPtr<ValidateCommandCallback>);
250 const SelectionState& selectionState() const { return m_selectionState; }
251 bool canDelete() const { return hasSelectedRange() && isContentEditable(); }
252 bool hasSelectedRange() const { return m_selectionState.selectedRangeLength; }
253 bool isContentEditable() const { return m_selectionState.isContentEditable; }
256 void updateWindowIsVisible(bool windowIsVisible);
257 void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates, const WebCore::IntPoint& accessibilityViewCoordinates);
258 void getMarkedRange(uint64_t& location, uint64_t& length);
259 uint64_t characterIndexForPoint(const WebCore::IntPoint);
260 WebCore::IntRect firstRectForCharacterRange(uint64_t, uint64_t);
261 void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput);
262 CGContextRef containingWindowGraphicsContext();
265 void didChangeCompositionSelection(bool);
266 void confirmComposition(const String&);
267 void setComposition(const String&, Vector<WebCore::CompositionUnderline>&, int);
268 WebCore::IntRect firstRectForCharacterInSelectedRange(int);
269 String getSelectedText();
271 #if ENABLE(TILED_BACKING_STORE)
272 void setActualVisibleContentRect(const WebCore::IntRect& rect);
275 void handleMouseEvent(const WebMouseEvent&);
276 void handleWheelEvent(const WebWheelEvent&);
277 void handleKeyboardEvent(const NativeWebKeyboardEvent&);
278 #if ENABLE(GESTURE_EVENTS)
279 void handleGestureEvent(const WebGestureEvent&);
281 #if ENABLE(TOUCH_EVENTS)
282 void handleTouchEvent(const WebTouchEvent&);
285 String pageTitle() const;
286 const String& toolTip() const { return m_toolTip; }
288 void setUserAgent(const String&);
289 const String& userAgent() const { return m_userAgent; }
290 void setApplicationNameForUserAgent(const String&);
291 const String& applicationNameForUserAgent() const { return m_applicationNameForUserAgent; }
292 void setCustomUserAgent(const String&);
293 const String& customUserAgent() const { return m_customUserAgent; }
295 bool supportsTextEncoding() const;
296 void setCustomTextEncodingName(const String&);
297 String customTextEncodingName() const { return m_customTextEncodingName; }
299 double estimatedProgress() const;
301 void terminateProcess();
303 typedef bool (*WebPageProxySessionStateFilterCallback)(WKPageRef, WKStringRef type, WKTypeRef object, void* context);
304 PassRefPtr<WebData> sessionStateData(WebPageProxySessionStateFilterCallback, void* context) const;
305 void restoreFromSessionStateData(WebData*);
307 bool supportsTextZoom() const;
308 double textZoomFactor() const { return m_mainFrameHasCustomRepresentation ? 1 : m_textZoomFactor; }
309 void setTextZoomFactor(double);
310 double pageZoomFactor() const;
311 void setPageZoomFactor(double);
312 void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor);
314 void scaleWebView(double scale, const WebCore::IntPoint& origin);
315 double viewScaleFactor() const { return m_viewScaleFactor; }
317 void setUseFixedLayout(bool);
318 void setFixedLayoutSize(const WebCore::IntSize&);
319 bool useFixedLayout() const { return m_useFixedLayout; };
320 const WebCore::IntSize& fixedLayoutSize() const { return m_fixedLayoutSize; };
322 bool hasHorizontalScrollbar() const { return m_mainFrameHasHorizontalScrollbar; }
323 bool hasVerticalScrollbar() const { return m_mainFrameHasVerticalScrollbar; }
325 bool isPinnedToLeftSide() const { return m_mainFrameIsPinnedToLeftSide; }
326 bool isPinnedToRightSide() const { return m_mainFrameIsPinnedToRightSide; }
329 // Called by the web process through a message.
330 void registerWebProcessAccessibilityToken(const CoreIPC::DataReference&);
331 // Called by the UI process when it is ready to send its tokens to the web process.
332 void registerUIProcessAccessibilityTokens(const CoreIPC::DataReference& elemenToken, const CoreIPC::DataReference& windowToken);
333 bool writeSelectionToPasteboard(const String& pasteboardName, const Vector<String>& pasteboardTypes);
336 void viewScaleFactorDidChange(double);
338 void setMemoryCacheClientCallsEnabled(bool);
341 void findString(const String&, FindOptions, unsigned maxMatchCount);
343 void countStringMatches(const String&, FindOptions, unsigned maxMatchCount);
345 void getContentsAsString(PassRefPtr<StringCallback>);
346 void getMainResourceDataOfFrame(WebFrameProxy*, PassRefPtr<DataCallback>);
347 void getResourceDataFromFrame(WebFrameProxy*, WebURL*, PassRefPtr<DataCallback>);
348 void getRenderTreeExternalRepresentation(PassRefPtr<StringCallback>);
349 void getSelectionOrContentsAsString(PassRefPtr<StringCallback>);
350 void getSourceForFrame(WebFrameProxy*, PassRefPtr<StringCallback>);
351 void getWebArchiveOfFrame(WebFrameProxy*, PassRefPtr<DataCallback>);
352 void runJavaScriptInMainFrame(const String&, PassRefPtr<ScriptValueCallback>);
353 void forceRepaint(PassRefPtr<VoidCallback>);
355 float headerHeight(WebFrameProxy*);
356 float footerHeight(WebFrameProxy*);
357 void drawHeader(WebFrameProxy*, const WebCore::FloatRect&);
358 void drawFooter(WebFrameProxy*, const WebCore::FloatRect&);
361 void setAutodisplay(bool);
364 void performDictionaryLookupAtLocation(const WebCore::FloatPoint&);
367 void receivedPolicyDecision(WebCore::PolicyAction, WebFrameProxy*, uint64_t listenerID);
369 void backForwardRemovedItem(uint64_t itemID);
371 // Drag and drop support.
372 void performDragControllerAction(DragControllerAction, WebCore::DragData*, const String& = String());
373 void didPerformDragControllerAction(uint64_t resultOperation);
374 void dragEnded(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition, uint64_t operation);
376 void setDragImage(const WebCore::IntPoint& clientPosition, const WebCore::IntSize& imageSize, const SharedMemory::Handle& dragImageHandle, bool isLinkDrag);
379 void startDragDrop(const WebCore::IntPoint& imagePoint, const WebCore::IntPoint& dragPoint, uint64_t okEffect, const HashMap<UINT, Vector<String> >& dataMap, const WebCore::IntSize& dragImageSize, const SharedMemory::Handle& dragImageHandle, bool isLinkDrag);
381 void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
382 void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*);
384 void processDidBecomeUnresponsive();
385 void processDidBecomeResponsive();
386 void processDidCrash();
388 #if USE(ACCELERATED_COMPOSITING)
389 virtual void enterAcceleratedCompositingMode(const LayerTreeContext&);
390 virtual void exitAcceleratedCompositingMode();
395 enum UndoOrRedo { Undo, Redo };
396 void addEditCommand(WebEditCommandProxy*);
397 void removeEditCommand(WebEditCommandProxy*);
398 void registerEditCommand(PassRefPtr<WebEditCommandProxy>, UndoOrRedo);
400 WebProcessProxy* process() const;
401 WebContext* context() const { return m_context.get(); }
403 WebPageGroup* pageGroup() const { return m_pageGroup.get(); }
407 WebCore::DragOperation dragOperation() { return m_currentDragOperation; }
408 void resetDragOperation() { m_currentDragOperation = WebCore::DragOperationNone; }
410 // REMOVE: For demo purposes only.
411 const String& urlAtProcessExit() const { return m_urlAtProcessExit; }
413 void preferencesDidChange();
415 #if ENABLE(TILED_BACKING_STORE)
416 void setResizesToContentsUsingLayoutSize(const WebCore::IntSize&);
419 // Called by the WebContextMenuProxy.
420 void contextMenuItemSelected(const WebContextMenuItemData&);
422 // Called by the WebOpenPanelResultListenerProxy.
423 void didChooseFilesForOpenPanel(const Vector<String>&);
424 void didCancelForOpenPanel();
426 WebPageCreationParameters creationParameters() const;
429 void findZoomableAreaForPoint(const WebCore::IntPoint&);
432 void advanceToNextMisspelling(bool startBeforeSelection);
433 void changeSpellingToWord(const String& word);
434 void unmarkAllMisspellings();
435 void unmarkAllBadGrammar();
437 void uppercaseWord();
438 void lowercaseWord();
439 void capitalizeWord();
441 bool isSmartInsertDeleteEnabled() const { return m_isSmartInsertDeleteEnabled; }
442 void setSmartInsertDeleteEnabled(bool);
445 void beginPrinting(WebFrameProxy*, const PrintInfo&);
447 void computePagesForPrinting(WebFrameProxy*, const PrintInfo&, PassRefPtr<ComputedPagesCallback>);
448 #if PLATFORM(MAC) || PLATFORM(WIN)
449 void drawRectToPDF(WebFrameProxy*, const WebCore::IntRect&, PassRefPtr<DataCallback>);
450 void drawPagesToPDF(WebFrameProxy*, uint32_t first, uint32_t count, PassRefPtr<DataCallback>);
453 const String& pendingAPIRequestURL() const { return m_pendingAPIRequestURL; }
455 void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects);
457 static void setDebugPaintFlags(WKPageDebugPaintFlags flags) { s_debugPaintFlags = flags; }
458 static WKPageDebugPaintFlags debugPaintFlags() { return s_debugPaintFlags; }
460 // Color to be used with kWKDebugFlashViewUpdates.
461 static WebCore::Color viewUpdatesFlashColor();
462 // Color to be used with kWKDebugFlashBackingStoreUpdates.
463 static WebCore::Color backingStoreUpdatesFlashColor();
466 WebPageProxy(PageClient*, WebContext*, WebPageGroup*, uint64_t pageID);
468 virtual Type type() const { return APIType; }
470 // WebPopupMenuProxy::Client
471 virtual void valueChangedForPopupMenu(WebPopupMenuProxy*, int32_t newSelectedIndex);
472 virtual void setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index);
474 // Implemented in generated WebPageProxyMessageReceiver.cpp
475 void didReceiveWebPageProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
476 CoreIPC::SyncReplyMode didReceiveSyncWebPageProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*);
478 void didCreateMainFrame(uint64_t frameID);
479 void didCreateSubframe(uint64_t frameID, uint64_t parentFrameID);
480 void didSaveFrameToPageCache(uint64_t frameID);
481 void didRestoreFrameFromPageCache(uint64_t frameID, uint64_t parentFrameID);
483 void didStartProvisionalLoadForFrame(uint64_t frameID, const String&, bool loadingSubstituteDataForUnreachableURL, CoreIPC::ArgumentDecoder*);
484 void didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, const String&, CoreIPC::ArgumentDecoder*);
485 void didFailProvisionalLoadForFrame(uint64_t frameID, const WebCore::ResourceError&, CoreIPC::ArgumentDecoder*);
486 void didCommitLoadForFrame(uint64_t frameID, const String& mimeType, bool frameHasCustomRepresentation, const PlatformCertificateInfo&, CoreIPC::ArgumentDecoder*);
487 void didFinishDocumentLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*);
488 void didFinishLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*);
489 void didFailLoadForFrame(uint64_t frameID, const WebCore::ResourceError&, CoreIPC::ArgumentDecoder*);
490 void didSameDocumentNavigationForFrame(uint64_t frameID, uint32_t sameDocumentNavigationType, const String&, CoreIPC::ArgumentDecoder*);
491 void didReceiveTitleForFrame(uint64_t frameID, const String&, CoreIPC::ArgumentDecoder*);
492 void didFirstLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*);
493 void didFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*);
494 void didRemoveFrameFromHierarchy(uint64_t frameID, CoreIPC::ArgumentDecoder*);
495 void didDisplayInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*);
496 void didRunInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*);
497 void frameDidBecomeFrameSet(uint64_t frameID, bool);
498 void didStartProgress();
499 void didChangeProgress(double);
500 void didFinishProgress();
502 void decidePolicyForNavigationAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, const WebCore::ResourceRequest&, uint64_t listenerID, CoreIPC::ArgumentDecoder*, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID);
503 void decidePolicyForNewWindowAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, const WebCore::ResourceRequest&, const String& frameName, uint64_t listenerID, CoreIPC::ArgumentDecoder*);
504 void decidePolicyForResponse(uint64_t frameID, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID);
505 void unableToImplementPolicy(uint64_t frameID, const WebCore::ResourceError&, CoreIPC::ArgumentDecoder* arguments);
507 void willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, uint64_t listenerID, CoreIPC::ArgumentDecoder*);
509 // Resource load client
510 void didInitiateLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const WebCore::ResourceRequest&, bool pageIsProvisionallyLoading);
511 void didSendRequestForResource(uint64_t frameID, uint64_t resourceIdentifier, const WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse);
512 void didReceiveResponseForResource(uint64_t frameID, uint64_t resourceIdentifier, const WebCore::ResourceResponse&);
513 void didReceiveContentLengthForResource(uint64_t frameID, uint64_t resourceIdentifier, uint64_t contentLength);
514 void didFinishLoadForResource(uint64_t frameID, uint64_t resourceIdentifier);
515 void didFailLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const WebCore::ResourceError&);
518 void createNewPage(const WebCore::WindowFeatures&, uint32_t modifiers, int32_t mouseButton, uint64_t& newPageID, WebPageCreationParameters&);
521 void runJavaScriptAlert(uint64_t frameID, const String&);
522 void runJavaScriptConfirm(uint64_t frameID, const String&, bool& result);
523 void runJavaScriptPrompt(uint64_t frameID, const String&, const String&, String& result);
524 void setStatusText(const String&);
525 void mouseDidMoveOverElement(uint32_t modifiers, CoreIPC::ArgumentDecoder*);
526 void missingPluginButtonClicked(const String& mimeType, const String& url, const String& pluginsPageURL);
527 void setToolbarsAreVisible(bool toolbarsAreVisible);
528 void getToolbarsAreVisible(bool& toolbarsAreVisible);
529 void setMenuBarIsVisible(bool menuBarIsVisible);
530 void getMenuBarIsVisible(bool& menuBarIsVisible);
531 void setStatusBarIsVisible(bool statusBarIsVisible);
532 void getStatusBarIsVisible(bool& statusBarIsVisible);
533 void setIsResizable(bool isResizable);
534 void getIsResizable(bool& isResizable);
535 void setWindowFrame(const WebCore::FloatRect&);
536 void getWindowFrame(WebCore::FloatRect&);
537 void windowToScreen(const WebCore::IntRect& viewRect, WebCore::IntRect& result);
538 void runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose);
539 void didChangeViewportData(const WebCore::ViewportArguments&);
540 void pageDidScroll();
541 void runOpenPanel(uint64_t frameID, const WebOpenPanelParameters::Data&);
542 void printFrame(uint64_t frameID);
543 void exceededDatabaseQuota(uint64_t frameID, const String& originIdentifier, const String& databaseName, const String& displayName, uint64_t currentQuota, uint64_t currentUsage, uint64_t expectedUsage, uint64_t& newQuota);
544 void requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier);
545 void runModal() { m_uiClient.runModal(this); }
546 void didCompleteRubberBandForMainFrame(const WebCore::IntSize&);
547 void didChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar);
548 void didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide);
550 void reattachToWebProcess();
551 void reattachToWebProcessWithItem(WebBackForwardListItem*);
553 #if ENABLE(TILED_BACKING_STORE)
554 void pageDidRequestScroll(const WebCore::IntSize&);
558 void didChangeContentsSize(const WebCore::IntSize&);
559 void didFindZoomableArea(const WebCore::IntRect&);
563 void selectionStateChanged(const SelectionState&);
565 // Back/Forward list management
566 void backForwardAddItem(uint64_t itemID);
567 void backForwardGoToItem(uint64_t itemID);
568 void backForwardItemAtIndex(int32_t index, uint64_t& itemID);
569 void backForwardBackListCount(int32_t& count);
570 void backForwardForwardListCount(int32_t& count);
571 void backForwardClear();
574 void registerEditCommandForUndo(uint64_t commandID, uint32_t editAction);
575 void clearAllEditCommands();
579 void interpretKeyEvent(uint32_t eventType, Vector<WebCore::KeypressCommand>&, uint32_t selectionStart, uint32_t selectionEnd, Vector<WebCore::CompositionUnderline>& underlines);
583 void didCountStringMatches(const String&, uint32_t matchCount);
584 void setFindIndicator(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, const SharedMemory::Handle& contentImageHandle, bool fadeOut);
585 void didFindString(const String&, uint32_t matchCount);
586 void didFailToFindString(const String&);
589 void showPopupMenu(const WebCore::IntRect& rect, uint64_t textDirection, const Vector<WebPopupItem>& items, int32_t selectedIndex, const PlatformPopupMenuData&);
590 void hidePopupMenu();
593 void showContextMenu(const WebCore::IntPoint& menuLocation, const ContextMenuState&, const Vector<WebContextMenuItemData>&, CoreIPC::ArgumentDecoder*);
597 void getIsSpeaking(bool&);
598 void speak(const String&);
602 void didPerformDictionaryLookup(const String&, const DictionaryPopupInfo&);
605 // Spelling and grammar.
606 int64_t spellDocumentTag();
607 void checkTextOfParagraph(const String& text, uint64_t checkingTypes, Vector<WebCore::TextCheckingResult>& results);
608 void updateSpellingUIWithMisspelledWord(const String& misspelledWord);
609 void updateSpellingUIWithGrammarString(const String& badGrammarPhrase, const WebCore::GrammarDetail&);
610 void getGuessesForWord(const String& word, const String& context, Vector<String>& guesses);
611 void learnWord(const String& word);
612 void ignoreWord(const String& word);
614 void takeFocus(bool direction);
615 void setToolTip(const String&);
616 void setCursor(const WebCore::Cursor&);
618 void didReceiveEvent(uint32_t opaqueType, bool handled);
620 void voidCallback(uint64_t);
621 void dataCallback(const CoreIPC::DataReference&, uint64_t);
622 void stringCallback(const String&, uint64_t);
623 void scriptValueCallback(const CoreIPC::DataReference&, uint64_t);
624 void computedPagesCallback(const Vector<WebCore::IntRect>&, double totalScaleFactorForPrinting, uint64_t);
625 void validateCommandCallback(const String&, bool, int, uint64_t);
627 void focusedFrameChanged(uint64_t frameID);
628 void frameSetLargestFrameChanged(uint64_t frameID);
630 void canAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, const WebCore::ProtectionSpace&, bool& canAuthenticate);
631 void didReceiveAuthenticationChallenge(uint64_t frameID, const WebCore::AuthenticationChallenge&, uint64_t challengeID);
633 void didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference&);
636 void setComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled);
639 static String standardUserAgent(const String& applicationName = String());
641 void clearPendingAPIRequestURL() { m_pendingAPIRequestURL = String(); }
642 void setPendingAPIRequestURL(const String& pendingAPIRequestURL) { m_pendingAPIRequestURL = pendingAPIRequestURL; }
644 void initializeSandboxExtensionHandle(const WebCore::KURL&, SandboxExtension::Handle&);
646 PageClient* m_pageClient;
647 WebLoaderClient m_loaderClient;
648 WebPolicyClient m_policyClient;
649 WebFormClient m_formClient;
650 WebResourceLoadClient m_resourceLoadClient;
651 WebUIClient m_uiClient;
652 WebFindClient m_findClient;
653 WebPageContextMenuClient m_contextMenuClient;
655 OwnPtr<DrawingAreaProxy> m_drawingArea;
656 RefPtr<WebContext> m_context;
657 RefPtr<WebPageGroup> m_pageGroup;
658 RefPtr<WebFrameProxy> m_mainFrame;
659 RefPtr<WebFrameProxy> m_focusedFrame;
660 RefPtr<WebFrameProxy> m_frameSetLargestFrame;
663 String m_applicationNameForUserAgent;
664 String m_customUserAgent;
665 String m_customTextEncodingName;
667 #if ENABLE(INSPECTOR)
668 RefPtr<WebInspectorProxy> m_inspector;
671 HashMap<uint64_t, RefPtr<VoidCallback> > m_voidCallbacks;
672 HashMap<uint64_t, RefPtr<DataCallback> > m_dataCallbacks;
673 HashMap<uint64_t, RefPtr<StringCallback> > m_stringCallbacks;
674 HashMap<uint64_t, RefPtr<ScriptValueCallback> > m_scriptValueCallbacks;
675 HashMap<uint64_t, RefPtr<ComputedPagesCallback> > m_computedPagesCallbacks;
676 HashMap<uint64_t, RefPtr<ValidateCommandCallback> > m_validateCommandCallbacks;
678 HashSet<WebEditCommandProxy*> m_editCommandSet;
680 RefPtr<WebPopupMenuProxy> m_activePopupMenu;
681 RefPtr<WebContextMenuProxy> m_activeContextMenu;
682 ContextMenuState m_activeContextMenuState;
683 RefPtr<WebOpenPanelResultListenerProxy> m_openPanelResultListener;
684 GeolocationPermissionRequestManagerProxy m_geolocationPermissionRequestManager;
686 double m_estimatedProgress;
688 // Whether the web page is contained in a top-level window.
691 // Whether the page is visible; if the backing view is visible and inserted into a window.
696 RefPtr<WebBackForwardList> m_backForwardList;
700 SelectionState m_selectionState;
702 // REMOVE: For demo purposes only.
703 String m_urlAtProcessExit;
705 double m_textZoomFactor;
706 double m_pageZoomFactor;
707 double m_viewScaleFactor;
709 bool m_drawsBackground;
710 bool m_drawsTransparentBackground;
712 bool m_areMemoryCacheClientCallsEnabled;
714 bool m_useFixedLayout;
715 WebCore::IntSize m_fixedLayoutSize;
717 // If the process backing the web page is alive and kicking.
720 // Whether WebPageProxy::close() has been called on this page.
723 bool m_isInPrintingMode;
724 bool m_isPerformingDOMPrintOperation;
726 bool m_inDecidePolicyForMIMEType;
727 bool m_syncMimeTypePolicyActionIsValid;
728 WebCore::PolicyAction m_syncMimeTypePolicyAction;
729 uint64_t m_syncMimeTypePolicyDownloadID;
731 bool m_inDecidePolicyForNavigationAction;
732 bool m_syncNavigationActionPolicyActionIsValid;
733 WebCore::PolicyAction m_syncNavigationActionPolicyAction;
734 uint64_t m_syncNavigationActionPolicyDownloadID;
736 Deque<NativeWebKeyboardEvent> m_keyEventQueue;
737 bool m_processingWheelEvent;
738 OwnPtr<WebWheelEvent> m_nextWheelEvent;
740 bool m_processingMouseMoveEvent;
741 OwnPtr<WebMouseEvent> m_nextMouseMoveEvent;
746 bool m_isSmartInsertDeleteEnabled;
749 int64_t m_spellDocumentTag;
750 bool m_hasSpellDocumentTag;
751 unsigned m_pendingLearnOrIgnoreWordMessageCount;
753 bool m_mainFrameHasCustomRepresentation;
754 WebCore::DragOperation m_currentDragOperation;
756 String m_pendingAPIRequestURL;
758 bool m_mainFrameHasHorizontalScrollbar;
759 bool m_mainFrameHasVerticalScrollbar;
761 bool m_mainFrameIsPinnedToLeftSide;
762 bool m_mainFrameIsPinnedToRightSide;
764 static WKPageDebugPaintFlags s_debugPaintFlags;
767 } // namespace WebKit
769 #endif // WebPageProxy_h