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.
27 #include "WebPageProxy.h"
29 #include "AuthenticationChallengeProxy.h"
30 #include "AuthenticationDecisionListener.h"
31 #include "DataReference.h"
32 #include "DrawingAreaProxy.h"
33 #include "FindIndicator.h"
34 #include "MessageID.h"
35 #include "NativeWebKeyboardEvent.h"
36 #include "PageClient.h"
37 #include "PrintInfo.h"
38 #include "SessionState.h"
39 #include "StringPairVector.h"
40 #include "TextChecker.h"
41 #include "TextCheckerState.h"
42 #include "WKContextPrivate.h"
43 #include "WebBackForwardList.h"
44 #include "WebBackForwardListItem.h"
45 #include "WebCertificateInfo.h"
46 #include "WebContext.h"
47 #include "WebContextMenuProxy.h"
48 #include "WebContextUserMessageCoders.h"
49 #include "WebCoreArgumentCoders.h"
51 #include "WebEditCommandProxy.h"
53 #include "WebFormSubmissionListenerProxy.h"
54 #include "WebFramePolicyListenerProxy.h"
55 #include "WebOpenPanelResultListenerProxy.h"
56 #include "WebPageCreationParameters.h"
57 #include "WebPageGroup.h"
58 #include "WebPageGroupData.h"
59 #include "WebPageMessages.h"
60 #include "WebPopupItem.h"
61 #include "WebPopupMenuProxy.h"
62 #include "WebPreferences.h"
63 #include "WebProcessMessages.h"
64 #include "WebProcessProxy.h"
65 #include "WebProtectionSpace.h"
66 #include "WebSecurityOrigin.h"
67 #include "WebURLRequest.h"
68 #include <WebCore/DragData.h>
69 #include <WebCore/FloatRect.h>
70 #include <WebCore/MIMETypeRegistry.h>
71 #include <WebCore/WindowFeatures.h>
75 #include "DictionaryPopupInfo.h"
79 #include "WebDragSource.h"
80 #include <WebCore/BitmapInfo.h>
81 #include <WebCore/COMPtr.h>
82 #include <WebCore/WCDataObject.h>
87 #include <wtf/RefCountedLeakCounter.h>
90 // This controls what strategy we use for mouse wheel coalesing.
91 #define MERGE_WHEEL_EVENTS 0
93 #define MESSAGE_CHECK(assertion) MESSAGE_CHECK_BASE(assertion, process()->connection())
95 using namespace WebCore;
99 WKPageDebugPaintFlags WebPageProxy::s_debugPaintFlags = 0;
102 static WTF::RefCountedLeakCounter webPageProxyCounter("WebPageProxy");
105 PassRefPtr<WebPageProxy> WebPageProxy::create(PageClient* pageClient, WebContext* context, WebPageGroup* pageGroup, uint64_t pageID)
107 return adoptRef(new WebPageProxy(pageClient, context, pageGroup, pageID));
110 WebPageProxy::WebPageProxy(PageClient* pageClient, WebContext* context, WebPageGroup* pageGroup, uint64_t pageID)
111 : m_pageClient(pageClient)
113 , m_pageGroup(pageGroup)
115 , m_userAgent(standardUserAgent())
116 , m_geolocationPermissionRequestManager(this)
117 , m_estimatedProgress(0)
118 , m_isInWindow(m_pageClient->isViewInWindow())
119 , m_isVisible(m_pageClient->isViewVisible())
120 , m_backForwardList(WebBackForwardList::create(this))
121 , m_textZoomFactor(1)
122 , m_pageZoomFactor(1)
123 , m_viewScaleFactor(1)
124 , m_drawsBackground(true)
125 , m_drawsTransparentBackground(false)
126 , m_areMemoryCacheClientCallsEnabled(true)
127 , m_useFixedLayout(false)
130 , m_isInPrintingMode(false)
131 , m_isPerformingDOMPrintOperation(false)
132 , m_inDecidePolicyForMIMEType(false)
133 , m_syncMimeTypePolicyActionIsValid(false)
134 , m_syncMimeTypePolicyAction(PolicyUse)
135 , m_syncMimeTypePolicyDownloadID(0)
136 , m_inDecidePolicyForNavigationAction(false)
137 , m_syncNavigationActionPolicyActionIsValid(false)
138 , m_syncNavigationActionPolicyAction(PolicyUse)
139 , m_syncNavigationActionPolicyDownloadID(0)
140 , m_processingWheelEvent(false)
141 , m_processingMouseMoveEvent(false)
144 , m_isSmartInsertDeleteEnabled(TextChecker::isSmartInsertDeleteEnabled())
146 , m_spellDocumentTag(0)
147 , m_hasSpellDocumentTag(false)
148 , m_pendingLearnOrIgnoreWordMessageCount(0)
149 , m_mainFrameHasCustomRepresentation(false)
150 , m_currentDragOperation(DragOperationNone)
151 , m_mainFrameHasHorizontalScrollbar(false)
152 , m_mainFrameHasVerticalScrollbar(false)
153 , m_mainFrameIsPinnedToLeftSide(false)
154 , m_mainFrameIsPinnedToRightSide(false)
157 webPageProxyCounter.increment();
160 WebContext::statistics().wkPageCount++;
162 m_pageGroup->addPage(this);
165 WebPageProxy::~WebPageProxy()
167 WebContext::statistics().wkPageCount--;
169 if (m_hasSpellDocumentTag)
170 TextChecker::closeSpellDocumentWithTag(m_spellDocumentTag);
172 m_pageGroup->removePage(this);
175 webPageProxyCounter.decrement();
179 WebProcessProxy* WebPageProxy::process() const
181 return m_context->process();
184 bool WebPageProxy::isValid()
186 // A page that has been explicitly closed is never valid.
193 void WebPageProxy::setDrawingArea(PassOwnPtr<DrawingAreaProxy> drawingArea)
195 if (drawingArea == m_drawingArea)
198 m_drawingArea = drawingArea;
201 void WebPageProxy::initializeLoaderClient(const WKPageLoaderClient* loadClient)
203 m_loaderClient.initialize(loadClient);
206 void WebPageProxy::initializePolicyClient(const WKPagePolicyClient* policyClient)
208 m_policyClient.initialize(policyClient);
211 void WebPageProxy::initializeFormClient(const WKPageFormClient* formClient)
213 m_formClient.initialize(formClient);
216 void WebPageProxy::initializeResourceLoadClient(const WKPageResourceLoadClient* client)
218 m_resourceLoadClient.initialize(client);
221 void WebPageProxy::initializeUIClient(const WKPageUIClient* client)
223 m_uiClient.initialize(client);
225 process()->send(Messages::WebPage::SetCanRunBeforeUnloadConfirmPanel(m_uiClient.canRunBeforeUnloadConfirmPanel()), m_pageID);
226 process()->send(Messages::WebPage::SetCanRunModal(m_uiClient.canRunModal()), m_pageID);
229 void WebPageProxy::initializeFindClient(const WKPageFindClient* client)
231 m_findClient.initialize(client);
234 void WebPageProxy::initializeContextMenuClient(const WKPageContextMenuClient* client)
236 m_contextMenuClient.initialize(client);
239 void WebPageProxy::reattachToWebProcess()
243 context()->relaunchProcessIfNecessary();
244 process()->addExistingWebPage(this, m_pageID);
248 m_pageClient->didRelaunchProcess();
251 void WebPageProxy::reattachToWebProcessWithItem(WebBackForwardListItem* item)
253 if (item && item != m_backForwardList->currentItem())
254 m_backForwardList->goToItem(item);
256 reattachToWebProcess();
261 SandboxExtension::Handle sandboxExtensionHandle;
262 initializeSandboxExtensionHandle(KURL(KURL(), item->url()), sandboxExtensionHandle);
263 process()->send(Messages::WebPage::GoToBackForwardItem(item->itemID(), sandboxExtensionHandle), m_pageID);
266 void WebPageProxy::initializeWebPage()
270 BackForwardListItemVector items = m_backForwardList->entries();
271 for (size_t i = 0; i < items.size(); ++i)
272 process()->registerNewWebBackForwardListItem(items[i].get());
274 m_drawingArea = m_pageClient->createDrawingAreaProxy();
275 ASSERT(m_drawingArea);
277 process()->send(Messages::WebProcess::CreateWebPage(m_pageID, creationParameters()), 0);
280 void WebPageProxy::close()
287 m_backForwardList->pageClosed();
288 m_pageClient->pageClosed();
290 process()->disconnectFramesFromPage(this);
293 #if ENABLE(INSPECTOR)
295 m_inspector->invalidate();
300 if (m_openPanelResultListener) {
301 m_openPanelResultListener->invalidate();
302 m_openPanelResultListener = 0;
305 m_geolocationPermissionRequestManager.invalidateRequests();
307 m_toolTip = String();
309 m_mainFrameHasHorizontalScrollbar = false;
310 m_mainFrameHasVerticalScrollbar = false;
312 m_mainFrameIsPinnedToLeftSide = false;
313 m_mainFrameIsPinnedToRightSide = false;
315 invalidateCallbackMap(m_voidCallbacks);
316 invalidateCallbackMap(m_dataCallbacks);
317 invalidateCallbackMap(m_stringCallbacks);
318 invalidateCallbackMap(m_scriptValueCallbacks);
319 invalidateCallbackMap(m_computedPagesCallbacks);
321 Vector<WebEditCommandProxy*> editCommandVector;
322 copyToVector(m_editCommandSet, editCommandVector);
323 m_editCommandSet.clear();
324 for (size_t i = 0, size = editCommandVector.size(); i < size; ++i)
325 editCommandVector[i]->invalidate();
327 m_activePopupMenu = 0;
329 m_estimatedProgress = 0.0;
331 m_loaderClient.initialize(0);
332 m_policyClient.initialize(0);
333 m_uiClient.initialize(0);
335 m_drawingArea.clear();
337 process()->send(Messages::WebPage::Close(), m_pageID);
338 process()->removeWebPage(m_pageID);
341 bool WebPageProxy::tryClose()
346 process()->send(Messages::WebPage::TryClose(), m_pageID);
350 void WebPageProxy::initializeSandboxExtensionHandle(const KURL& url, SandboxExtension::Handle& sandboxExtensionHandle)
352 if (!url.isLocalFile())
355 // Don't give the inspector full access to the file system.
356 if (WebInspectorProxy::isInspectorPage(this))
359 SandboxExtension::createHandle("/", SandboxExtension::ReadOnly, sandboxExtensionHandle);
362 void WebPageProxy::loadURL(const String& url)
364 setPendingAPIRequestURL(url);
367 reattachToWebProcess();
369 SandboxExtension::Handle sandboxExtensionHandle;
370 initializeSandboxExtensionHandle(KURL(KURL(), url), sandboxExtensionHandle);
371 process()->send(Messages::WebPage::LoadURL(url, sandboxExtensionHandle), m_pageID);
374 void WebPageProxy::loadURLRequest(WebURLRequest* urlRequest)
376 setPendingAPIRequestURL(urlRequest->resourceRequest().url());
379 reattachToWebProcess();
381 SandboxExtension::Handle sandboxExtensionHandle;
382 initializeSandboxExtensionHandle(urlRequest->resourceRequest().url(), sandboxExtensionHandle);
383 process()->send(Messages::WebPage::LoadURLRequest(urlRequest->resourceRequest(), sandboxExtensionHandle), m_pageID);
386 void WebPageProxy::loadHTMLString(const String& htmlString, const String& baseURL)
390 process()->send(Messages::WebPage::LoadHTMLString(htmlString, baseURL), m_pageID);
393 void WebPageProxy::loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL)
401 m_mainFrame->setUnreachableURL(unreachableURL);
402 process()->send(Messages::WebPage::LoadAlternateHTMLString(htmlString, baseURL, unreachableURL), m_pageID);
405 void WebPageProxy::loadPlainTextString(const String& string)
409 process()->send(Messages::WebPage::LoadPlainTextString(string), m_pageID);
412 void WebPageProxy::stopLoading()
416 process()->send(Messages::WebPage::StopLoading(), m_pageID);
419 void WebPageProxy::reload(bool reloadFromOrigin)
421 if (m_backForwardList->currentItem())
422 setPendingAPIRequestURL(m_backForwardList->currentItem()->url());
425 reattachToWebProcessWithItem(m_backForwardList->currentItem());
429 process()->send(Messages::WebPage::Reload(reloadFromOrigin), m_pageID);
432 void WebPageProxy::goForward()
434 if (isValid() && !canGoForward())
437 WebBackForwardListItem* forwardItem = m_backForwardList->forwardItem();
439 setPendingAPIRequestURL(forwardItem->url());
442 reattachToWebProcessWithItem(forwardItem);
446 SandboxExtension::Handle sandboxExtensionHandle;
447 initializeSandboxExtensionHandle(KURL(KURL(), forwardItem->url()), sandboxExtensionHandle);
448 process()->send(Messages::WebPage::GoForward(forwardItem->itemID(), sandboxExtensionHandle), m_pageID);
451 bool WebPageProxy::canGoForward() const
453 return m_backForwardList->forwardItem();
456 void WebPageProxy::goBack()
458 if (isValid() && !canGoBack())
461 WebBackForwardListItem* backItem = m_backForwardList->backItem();
463 setPendingAPIRequestURL(backItem->url());
466 reattachToWebProcessWithItem(backItem);
470 SandboxExtension::Handle sandboxExtensionHandle;
471 initializeSandboxExtensionHandle(KURL(KURL(), backItem->url()), sandboxExtensionHandle);
472 process()->send(Messages::WebPage::GoBack(backItem->itemID(), sandboxExtensionHandle), m_pageID);
475 bool WebPageProxy::canGoBack() const
477 return m_backForwardList->backItem();
480 void WebPageProxy::goToBackForwardItem(WebBackForwardListItem* item)
483 reattachToWebProcessWithItem(item);
487 setPendingAPIRequestURL(item->url());
489 SandboxExtension::Handle sandboxExtensionHandle;
490 initializeSandboxExtensionHandle(KURL(KURL(), item->url()), sandboxExtensionHandle);
491 process()->send(Messages::WebPage::GoToBackForwardItem(item->itemID(), sandboxExtensionHandle), m_pageID);
494 void WebPageProxy::didChangeBackForwardList(WebBackForwardListItem* added, Vector<RefPtr<APIObject> >* removed)
496 m_loaderClient.didChangeBackForwardList(this, added, removed);
499 void WebPageProxy::shouldGoToBackForwardListItem(uint64_t itemID, bool& shouldGoToBackForwardItem)
501 WebBackForwardListItem* item = process()->webBackForwardItem(itemID);
502 shouldGoToBackForwardItem = item && m_loaderClient.shouldGoToBackForwardListItem(this, item);
505 bool WebPageProxy::canShowMIMEType(const String& mimeType) const
507 if (MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType))
510 if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType))
513 String newMimeType = mimeType;
514 PluginInfoStore::Plugin plugin = context()->pluginInfoStore()->findPlugin(newMimeType, KURL());
515 if (!plugin.path.isNull())
521 void WebPageProxy::setDrawsBackground(bool drawsBackground)
523 if (m_drawsBackground == drawsBackground)
526 m_drawsBackground = drawsBackground;
529 process()->send(Messages::WebPage::SetDrawsBackground(drawsBackground), m_pageID);
532 void WebPageProxy::setDrawsTransparentBackground(bool drawsTransparentBackground)
534 if (m_drawsTransparentBackground == drawsTransparentBackground)
537 m_drawsTransparentBackground = drawsTransparentBackground;
540 process()->send(Messages::WebPage::SetDrawsTransparentBackground(drawsTransparentBackground), m_pageID);
543 void WebPageProxy::viewWillStartLiveResize()
545 process()->send(Messages::WebPage::ViewWillStartLiveResize(), m_pageID);
548 void WebPageProxy::viewWillEndLiveResize()
550 process()->send(Messages::WebPage::ViewWillEndLiveResize(), m_pageID);
553 void WebPageProxy::setViewNeedsDisplay(const IntRect& rect)
555 m_pageClient->setViewNeedsDisplay(rect);
558 void WebPageProxy::displayView()
560 m_pageClient->displayView();
563 void WebPageProxy::scrollView(const IntRect& scrollRect, const IntSize& scrollOffset)
565 m_pageClient->scrollView(scrollRect, scrollOffset);
568 void WebPageProxy::viewStateDidChange(ViewStateFlags flags)
573 if (flags & ViewIsFocused)
574 process()->send(Messages::WebPage::SetFocused(m_pageClient->isViewFocused()), m_pageID);
576 if (flags & ViewWindowIsActive)
577 process()->send(Messages::WebPage::SetActive(m_pageClient->isViewWindowActive()), m_pageID);
579 if (flags & ViewIsVisible) {
580 bool isVisible = m_pageClient->isViewVisible();
581 if (isVisible != m_isVisible) {
582 m_isVisible = isVisible;
583 m_drawingArea->visibilityDidChange();
584 m_drawingArea->setPageIsVisible(isVisible);
588 if (flags & ViewIsInWindow) {
589 bool isInWindow = m_pageClient->isViewInWindow();
590 if (m_isInWindow != isInWindow) {
591 m_isInWindow = isInWindow;
592 process()->send(Messages::WebPage::SetIsInWindow(isInWindow), m_pageID);
597 IntSize WebPageProxy::viewSize() const
599 return m_pageClient->viewSize();
602 void WebPageProxy::setInitialFocus(bool forward)
606 process()->send(Messages::WebPage::SetInitialFocus(forward), m_pageID);
609 void WebPageProxy::setWindowResizerSize(const IntSize& windowResizerSize)
613 process()->send(Messages::WebPage::SetWindowResizerSize(windowResizerSize), m_pageID);
616 void WebPageProxy::validateCommand(const String& commandName, PassRefPtr<ValidateCommandCallback> callback)
619 callback->invalidate();
623 uint64_t callbackID = callback->callbackID();
624 m_validateCommandCallbacks.set(callbackID, callback.get());
625 process()->send(Messages::WebPage::ValidateCommand(commandName, callbackID), m_pageID);
628 void WebPageProxy::executeEditCommand(const String& commandName)
633 process()->send(Messages::WebPage::ExecuteEditCommand(commandName), m_pageID);
637 void WebPageProxy::updateWindowIsVisible(bool windowIsVisible)
641 process()->send(Messages::WebPage::SetWindowIsVisible(windowIsVisible), m_pageID);
644 void WebPageProxy::windowAndViewFramesChanged(const IntRect& windowFrameInScreenCoordinates, const IntRect& viewFrameInWindowCoordinates, const IntPoint& accessibilityViewCoordinates)
649 process()->send(Messages::WebPage::WindowAndViewFramesChanged(windowFrameInScreenCoordinates, viewFrameInWindowCoordinates, accessibilityViewCoordinates), m_pageID);
652 void WebPageProxy::getMarkedRange(uint64_t& location, uint64_t& length)
654 process()->sendSync(Messages::WebPage::GetMarkedRange(), Messages::WebPage::GetMarkedRange::Reply(location, length), m_pageID);
657 uint64_t WebPageProxy::characterIndexForPoint(const IntPoint point)
660 process()->sendSync(Messages::WebPage::CharacterIndexForPoint(point), Messages::WebPage::CharacterIndexForPoint::Reply(result), m_pageID);
664 WebCore::IntRect WebPageProxy::firstRectForCharacterRange(uint64_t location, uint64_t length)
667 process()->sendSync(Messages::WebPage::FirstRectForCharacterRange(location, length), Messages::WebPage::FirstRectForCharacterRange::Reply(resultRect), m_pageID);
671 bool WebPageProxy::writeSelectionToPasteboard(const String& pasteboardName, const Vector<String>& pasteboardTypes)
674 const double MessageTimeout = 20;
675 process()->sendSync(Messages::WebPage::WriteSelectionToPasteboard(pasteboardName, pasteboardTypes), Messages::WebPage::WriteSelectionToPasteboard::Reply(result), m_pageID, MessageTimeout);
679 WebCore::IntRect WebPageProxy::firstRectForCharacterInSelectedRange(int characterPosition)
682 process()->sendSync(Messages::WebPage::FirstRectForCharacterInSelectedRange(characterPosition), Messages::WebPage::FirstRectForCharacterInSelectedRange::Reply(resultRect), m_pageID);
686 String WebPageProxy::getSelectedText()
689 process()->sendSync(Messages::WebPage::GetSelectedText(), Messages::WebPage::GetSelectedText::Reply(text), m_pageID);
694 #if ENABLE(TILED_BACKING_STORE)
695 void WebPageProxy::setActualVisibleContentRect(const IntRect& rect)
700 process()->send(Messages::WebPage::SetActualVisibleContentRect(rect), m_pageID);
704 void WebPageProxy::performDragControllerAction(DragControllerAction action, WebCore::DragData* dragData, const String& dragStorageName)
709 // FIXME: We should pass the drag data map only on DragEnter.
710 process()->send(Messages::WebPage::PerformDragControllerAction(action, dragData->clientPosition(), dragData->globalPosition(),
711 dragData->draggingSourceOperationMask(), dragData->dragDataMap(), dragData->flags()), m_pageID);
713 process()->send(Messages::WebPage::PerformDragControllerAction(action, dragData->clientPosition(), dragData->globalPosition(), dragData->draggingSourceOperationMask(), dragStorageName, dragData->flags()), m_pageID);
717 void WebPageProxy::didPerformDragControllerAction(uint64_t resultOperation)
719 m_currentDragOperation = static_cast<DragOperation>(resultOperation);
723 void WebPageProxy::setDragImage(const WebCore::IntPoint& clientPosition, const IntSize& imageSize, const SharedMemory::Handle& dragImageHandle, bool isLinkDrag)
725 RefPtr<ShareableBitmap> dragImage = ShareableBitmap::create(imageSize, dragImageHandle);
729 m_pageClient->setDragImage(clientPosition, imageSize, dragImage.release(), isLinkDrag);
735 void WebPageProxy::startDragDrop(const IntPoint& imageOrigin, const IntPoint& dragPoint, uint64_t okEffect,
736 const HashMap<UINT, Vector<String> >& dataMap, const IntSize& dragImageSize, const SharedMemory::Handle& dragImageHandle, bool isLinkDrag)
738 COMPtr<WCDataObject> dataObject;
739 WCDataObject::createInstance(&dataObject, dataMap);
741 RefPtr<SharedMemory> memoryBuffer = SharedMemory::create(dragImageHandle, SharedMemory::ReadOnly);
745 RefPtr<WebDragSource> source = WebDragSource::createInstance();
749 COMPtr<IDragSourceHelper> helper;
750 if (FAILED(::CoCreateInstance(CLSID_DragDropHelper, 0, CLSCTX_INPROC_SERVER, IID_IDragSourceHelper, reinterpret_cast<LPVOID*>(&helper))))
753 BitmapInfo bitmapInfo = BitmapInfo::create(dragImageSize);
755 OwnPtr<HBITMAP> hbmp(::CreateDIBSection(0, &bitmapInfo, DIB_RGB_COLORS, &bits, 0, 0));
756 memcpy(bits, memoryBuffer->data(), memoryBuffer->size());
759 sdi.sizeDragImage.cx = bitmapInfo.bmiHeader.biWidth;
760 sdi.sizeDragImage.cy = bitmapInfo.bmiHeader.biHeight;
761 sdi.crColorKey = 0xffffffff;
762 sdi.hbmpDragImage = hbmp.leakPtr();
763 sdi.ptOffset.x = dragPoint.x() - imageOrigin.x();
764 sdi.ptOffset.y = dragPoint.y() - imageOrigin.y();
766 sdi.ptOffset.y = bitmapInfo.bmiHeader.biHeight - sdi.ptOffset.y;
768 helper->InitializeFromBitmap(&sdi, dataObject.get());
770 DWORD effect = DROPEFFECT_NONE;
772 DragOperation operation = DragOperationNone;
773 if (::DoDragDrop(dataObject.get(), source.get(), okEffect, &effect) == DRAGDROP_S_DROP) {
774 if (effect & DROPEFFECT_COPY)
775 operation = DragOperationCopy;
776 else if (effect & DROPEFFECT_LINK)
777 operation = DragOperationLink;
778 else if (effect & DROPEFFECT_MOVE)
779 operation = DragOperationMove;
782 ::GetCursorPos(&globalPoint);
783 POINT localPoint = globalPoint;
784 ::ScreenToClient(m_pageClient->nativeWindow(), &localPoint);
786 dragEnded(localPoint, globalPoint, operation);
790 void WebPageProxy::dragEnded(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition, uint64_t operation)
794 process()->send(Messages::WebPage::DragEnded(clientPosition, globalPosition, operation), m_pageID);
797 void WebPageProxy::handleMouseEvent(const WebMouseEvent& event)
802 // NOTE: This does not start the responsiveness timer because mouse move should not indicate interaction.
803 if (event.type() != WebEvent::MouseMove)
804 process()->responsivenessTimer()->start();
806 if (m_processingMouseMoveEvent) {
807 m_nextMouseMoveEvent = adoptPtr(new WebMouseEvent(event));
811 m_processingMouseMoveEvent = true;
814 process()->send(Messages::WebPage::MouseEvent(event), m_pageID);
817 static PassOwnPtr<WebWheelEvent> coalesceWheelEvents(WebWheelEvent* oldNextWheelEvent, const WebWheelEvent& newWheelEvent)
819 #if MERGE_WHEEL_EVENTS
820 // Merge model: Combine wheel event deltas (and wheel ticks) into a single wheel event.
821 if (!oldNextWheelEvent)
822 return adoptPtr(new WebWheelEvent(newWheelEvent));
824 if (oldNextWheelEvent->position() != newWheelEvent.position() || oldNextWheelEvent->modifiers() != newWheelEvent.modifiers() || oldNextWheelEvent->granularity() != newWheelEvent.granularity())
825 return adoptPtr(new WebWheelEvent(newWheelEvent));
827 FloatSize mergedDelta = oldNextWheelEvent->delta() + newWheelEvent.delta();
828 FloatSize mergedWheelTicks = oldNextWheelEvent->wheelTicks() + newWheelEvent.wheelTicks();
830 return adoptPtr(new WebWheelEvent(WebEvent::Wheel, newWheelEvent.position(), newWheelEvent.globalPosition(), mergedDelta, mergedWheelTicks, newWheelEvent.granularity(), newWheelEvent.modifiers(), newWheelEvent.timestamp()));
832 // Simple model: Just keep the last event, dropping all interim events.
833 return adoptPtr(new WebWheelEvent(newWheelEvent));
837 void WebPageProxy::handleWheelEvent(const WebWheelEvent& event)
842 if (m_processingWheelEvent) {
843 m_nextWheelEvent = coalesceWheelEvents(m_nextWheelEvent.get(), event);
847 process()->responsivenessTimer()->start();
848 process()->send(Messages::WebPage::WheelEvent(event), m_pageID);
849 m_processingWheelEvent = true;
852 void WebPageProxy::handleKeyboardEvent(const NativeWebKeyboardEvent& event)
857 m_keyEventQueue.append(event);
859 process()->responsivenessTimer()->start();
860 process()->send(Messages::WebPage::KeyEvent(event), m_pageID);
863 #if ENABLE(GESTURE_EVENTS)
864 void WebPageProxy::handleGestureEvent(const WebGestureEvent& event)
869 process()->responsivenessTimer()->start();
870 process()->send(Messages::WebPage::GestureEvent(event), m_pageID);
874 #if ENABLE(TOUCH_EVENTS)
875 void WebPageProxy::handleTouchEvent(const WebTouchEvent& event)
879 process()->send(Messages::WebPage::TouchEvent(event), m_pageID);
883 void WebPageProxy::receivedPolicyDecision(PolicyAction action, WebFrameProxy* frame, uint64_t listenerID)
888 uint64_t downloadID = 0;
889 if (action == PolicyDownload) {
890 // Create a download proxy.
891 downloadID = context()->createDownloadProxy();
894 // If we received a policy decision while in decidePolicyForMIMEType the decision will
895 // be sent back to the web process by decidePolicyForMIMEType.
896 if (m_inDecidePolicyForMIMEType) {
897 m_syncMimeTypePolicyActionIsValid = true;
898 m_syncMimeTypePolicyAction = action;
899 m_syncMimeTypePolicyDownloadID = downloadID;
903 // If we received a policy decision while in decidePolicyForNavigationAction the decision will
904 // be sent back to the web process by decidePolicyForNavigationAction.
905 if (m_inDecidePolicyForNavigationAction) {
906 m_syncNavigationActionPolicyActionIsValid = true;
907 m_syncNavigationActionPolicyAction = action;
908 m_syncNavigationActionPolicyDownloadID = downloadID;
912 process()->send(Messages::WebPage::DidReceivePolicyDecision(frame->frameID(), listenerID, action, downloadID), m_pageID);
915 String WebPageProxy::pageTitle() const
917 // Return the null string if there is no main frame (e.g. nothing has been loaded in the page yet, WebProcess has
918 // crashed, page has been closed).
922 return m_mainFrame->title();
925 void WebPageProxy::setUserAgent(const String& userAgent)
927 if (m_userAgent == userAgent)
929 m_userAgent = userAgent;
933 process()->send(Messages::WebPage::SetUserAgent(m_userAgent), m_pageID);
936 void WebPageProxy::setApplicationNameForUserAgent(const String& applicationName)
938 if (m_applicationNameForUserAgent == applicationName)
941 m_applicationNameForUserAgent = applicationName;
942 if (!m_customUserAgent.isEmpty())
945 setUserAgent(standardUserAgent(m_applicationNameForUserAgent));
948 void WebPageProxy::setCustomUserAgent(const String& customUserAgent)
950 if (m_customUserAgent == customUserAgent)
953 m_customUserAgent = customUserAgent;
955 if (m_customUserAgent.isEmpty()) {
956 setUserAgent(standardUserAgent(m_applicationNameForUserAgent));
960 setUserAgent(m_customUserAgent);
963 bool WebPageProxy::supportsTextEncoding() const
965 return !m_mainFrameHasCustomRepresentation && m_mainFrame && !m_mainFrame->isDisplayingStandaloneImageDocument();
968 void WebPageProxy::setCustomTextEncodingName(const String& encodingName)
970 if (m_customTextEncodingName == encodingName)
972 m_customTextEncodingName = encodingName;
976 process()->send(Messages::WebPage::SetCustomTextEncodingName(encodingName), m_pageID);
979 void WebPageProxy::terminateProcess()
984 process()->terminate();
987 #if !USE(CF) || defined(BUILDING_QT__)
988 PassRefPtr<WebData> WebPageProxy::sessionStateData(WebPageProxySessionStateFilterCallback, void* context) const
990 // FIXME: Return session state data for saving Page state.
994 void WebPageProxy::restoreFromSessionStateData(WebData*)
996 // FIXME: Restore the Page from the passed in session state data.
1000 bool WebPageProxy::supportsTextZoom() const
1002 if (m_mainFrameHasCustomRepresentation)
1005 // FIXME: This should also return false for standalone media and plug-in documents.
1006 if (!m_mainFrame || m_mainFrame->isDisplayingStandaloneImageDocument())
1012 void WebPageProxy::setTextZoomFactor(double zoomFactor)
1017 if (m_mainFrameHasCustomRepresentation)
1020 if (m_textZoomFactor == zoomFactor)
1023 m_textZoomFactor = zoomFactor;
1024 process()->send(Messages::WebPage::SetTextZoomFactor(m_textZoomFactor), m_pageID);
1027 double WebPageProxy::pageZoomFactor() const
1029 return m_mainFrameHasCustomRepresentation ? m_pageClient->customRepresentationZoomFactor() : m_pageZoomFactor;
1032 void WebPageProxy::setPageZoomFactor(double zoomFactor)
1037 if (m_mainFrameHasCustomRepresentation) {
1038 m_pageClient->setCustomRepresentationZoomFactor(zoomFactor);
1042 if (m_pageZoomFactor == zoomFactor)
1045 m_pageZoomFactor = zoomFactor;
1046 process()->send(Messages::WebPage::SetPageZoomFactor(m_pageZoomFactor), m_pageID);
1049 void WebPageProxy::setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor)
1054 if (m_mainFrameHasCustomRepresentation) {
1055 m_pageClient->setCustomRepresentationZoomFactor(pageZoomFactor);
1059 if (m_pageZoomFactor == pageZoomFactor && m_textZoomFactor == textZoomFactor)
1062 m_pageZoomFactor = pageZoomFactor;
1063 m_textZoomFactor = textZoomFactor;
1064 process()->send(Messages::WebPage::SetPageAndTextZoomFactors(m_pageZoomFactor, m_textZoomFactor), m_pageID);
1067 void WebPageProxy::scaleWebView(double scale, const IntPoint& origin)
1072 process()->send(Messages::WebPage::ScaleWebView(scale, origin), m_pageID);
1075 void WebPageProxy::setUseFixedLayout(bool fixed)
1080 if (fixed == m_useFixedLayout)
1083 m_useFixedLayout = fixed;
1085 m_fixedLayoutSize = IntSize();
1086 process()->send(Messages::WebPage::SetUseFixedLayout(fixed), m_pageID);
1089 void WebPageProxy::setFixedLayoutSize(const IntSize& size)
1094 if (size == m_fixedLayoutSize)
1097 m_fixedLayoutSize = size;
1098 process()->send(Messages::WebPage::SetFixedLayoutSize(size), m_pageID);
1101 void WebPageProxy::viewScaleFactorDidChange(double scaleFactor)
1103 m_viewScaleFactor = scaleFactor;
1106 void WebPageProxy::setMemoryCacheClientCallsEnabled(bool memoryCacheClientCallsEnabled)
1108 if (m_areMemoryCacheClientCallsEnabled == memoryCacheClientCallsEnabled)
1111 m_areMemoryCacheClientCallsEnabled = memoryCacheClientCallsEnabled;
1112 process()->send(Messages::WebPage::SetMemoryCacheMessagesEnabled(memoryCacheClientCallsEnabled), m_pageID);
1115 void WebPageProxy::findString(const String& string, FindOptions options, unsigned maxMatchCount)
1117 process()->send(Messages::WebPage::FindString(string, options, maxMatchCount), m_pageID);
1120 void WebPageProxy::hideFindUI()
1122 process()->send(Messages::WebPage::HideFindUI(), m_pageID);
1125 void WebPageProxy::countStringMatches(const String& string, FindOptions options, unsigned maxMatchCount)
1127 process()->send(Messages::WebPage::CountStringMatches(string, options, maxMatchCount), m_pageID);
1130 void WebPageProxy::runJavaScriptInMainFrame(const String& script, PassRefPtr<ScriptValueCallback> prpCallback)
1132 RefPtr<ScriptValueCallback> callback = prpCallback;
1133 uint64_t callbackID = callback->callbackID();
1134 m_scriptValueCallbacks.set(callbackID, callback.get());
1135 process()->send(Messages::WebPage::RunJavaScriptInMainFrame(script, callbackID), m_pageID);
1138 void WebPageProxy::getRenderTreeExternalRepresentation(PassRefPtr<StringCallback> prpCallback)
1140 RefPtr<StringCallback> callback = prpCallback;
1141 uint64_t callbackID = callback->callbackID();
1142 m_stringCallbacks.set(callbackID, callback.get());
1143 process()->send(Messages::WebPage::GetRenderTreeExternalRepresentation(callbackID), m_pageID);
1146 void WebPageProxy::getSourceForFrame(WebFrameProxy* frame, PassRefPtr<StringCallback> prpCallback)
1148 RefPtr<StringCallback> callback = prpCallback;
1149 uint64_t callbackID = callback->callbackID();
1150 m_stringCallbacks.set(callbackID, callback.get());
1151 process()->send(Messages::WebPage::GetSourceForFrame(frame->frameID(), callbackID), m_pageID);
1154 void WebPageProxy::getContentsAsString(PassRefPtr<StringCallback> prpCallback)
1156 RefPtr<StringCallback> callback = prpCallback;
1157 uint64_t callbackID = callback->callbackID();
1158 m_stringCallbacks.set(callbackID, callback.get());
1159 process()->send(Messages::WebPage::GetContentsAsString(callbackID), m_pageID);
1162 void WebPageProxy::getSelectionOrContentsAsString(PassRefPtr<StringCallback> prpCallback)
1164 RefPtr<StringCallback> callback = prpCallback;
1165 uint64_t callbackID = callback->callbackID();
1166 m_stringCallbacks.set(callbackID, callback.get());
1167 process()->send(Messages::WebPage::GetSelectionOrContentsAsString(callbackID), m_pageID);
1170 void WebPageProxy::getMainResourceDataOfFrame(WebFrameProxy* frame, PassRefPtr<DataCallback> prpCallback)
1172 RefPtr<DataCallback> callback = prpCallback;
1173 uint64_t callbackID = callback->callbackID();
1174 m_dataCallbacks.set(callbackID, callback.get());
1175 process()->send(Messages::WebPage::GetMainResourceDataOfFrame(frame->frameID(), callbackID), m_pageID);
1178 void WebPageProxy::getResourceDataFromFrame(WebFrameProxy* frame, WebURL* resourceURL, PassRefPtr<DataCallback> prpCallback)
1180 RefPtr<DataCallback> callback = prpCallback;
1181 uint64_t callbackID = callback->callbackID();
1182 m_dataCallbacks.set(callbackID, callback.get());
1183 process()->send(Messages::WebPage::GetResourceDataFromFrame(frame->frameID(), resourceURL->string(), callbackID), m_pageID);
1186 void WebPageProxy::getWebArchiveOfFrame(WebFrameProxy* frame, PassRefPtr<DataCallback> prpCallback)
1188 RefPtr<DataCallback> callback = prpCallback;
1189 uint64_t callbackID = callback->callbackID();
1190 m_dataCallbacks.set(callbackID, callback.get());
1191 process()->send(Messages::WebPage::GetWebArchiveOfFrame(frame->frameID(), callbackID), m_pageID);
1194 void WebPageProxy::forceRepaint(PassRefPtr<VoidCallback> prpCallback)
1196 RefPtr<VoidCallback> callback = prpCallback;
1199 callback->invalidate();
1203 uint64_t callbackID = callback->callbackID();
1204 m_voidCallbacks.set(callbackID, callback.get());
1205 process()->send(Messages::WebPage::ForceRepaint(callbackID), m_pageID);
1209 void WebPageProxy::performDictionaryLookupAtLocation(const WebCore::FloatPoint& point)
1214 process()->send(Messages::WebPage::PerformDictionaryLookupAtLocation(point), m_pageID);
1218 void WebPageProxy::preferencesDidChange()
1223 // FIXME: It probably makes more sense to send individual preference changes.
1224 // However, WebKitTestRunner depends on getting a preference change notification
1225 // even if nothing changed in UI process, so that overrides get removed.
1227 // Preferences need to be updated during synchronous printing to make "print backgrounds" preference work when toggled from a print dialog checkbox.
1228 process()->send(Messages::WebPage::PreferencesDidChange(pageGroup()->preferences()->store()), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
1231 #if ENABLE(TILED_BACKING_STORE)
1232 void WebPageProxy::setResizesToContentsUsingLayoutSize(const WebCore::IntSize& targetLayoutSize)
1234 process()->send(Messages::WebPage::SetResizesToContentsUsingLayoutSize(targetLayoutSize), m_pageID);
1238 void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
1240 #if PLATFORM(MAC) || PLATFORM(WIN)
1241 if (messageID.is<CoreIPC::MessageClassDrawingAreaProxy>()) {
1242 m_drawingArea->didReceiveDrawingAreaProxyMessage(connection, messageID, arguments);
1247 if (messageID.is<CoreIPC::MessageClassDrawingAreaProxyLegacy>()) {
1248 m_drawingArea->didReceiveMessage(connection, messageID, arguments);
1252 #if ENABLE(INSPECTOR)
1253 if (messageID.is<CoreIPC::MessageClassWebInspectorProxy>()) {
1254 if (WebInspectorProxy* inspector = this->inspector())
1255 inspector->didReceiveWebInspectorProxyMessage(connection, messageID, arguments);
1260 didReceiveWebPageProxyMessage(connection, messageID, arguments);
1263 void WebPageProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply)
1265 #if ENABLE(INSPECTOR)
1266 if (messageID.is<CoreIPC::MessageClassWebInspectorProxy>()) {
1267 if (WebInspectorProxy* inspector = this->inspector())
1268 inspector->didReceiveSyncWebInspectorProxyMessage(connection, messageID, arguments, reply);
1273 // FIXME: Do something with reply.
1274 didReceiveSyncWebPageProxyMessage(connection, messageID, arguments, reply);
1278 void WebPageProxy::interpretKeyEvent(uint32_t type, Vector<KeypressCommand>& commandsList, uint32_t selectionStart, uint32_t selectionEnd, Vector<CompositionUnderline>& underlines)
1280 m_pageClient->interceptKeyEvent(m_keyEventQueue.first(), commandsList, selectionStart, selectionEnd, underlines);
1284 void WebPageProxy::didCreateMainFrame(uint64_t frameID)
1286 MESSAGE_CHECK(!m_mainFrame);
1287 MESSAGE_CHECK(process()->canCreateFrame(frameID));
1289 m_mainFrame = WebFrameProxy::create(this, frameID);
1291 // Add the frame to the process wide map.
1292 process()->frameCreated(frameID, m_mainFrame.get());
1295 void WebPageProxy::didCreateSubframe(uint64_t frameID, uint64_t parentFrameID)
1297 MESSAGE_CHECK(m_mainFrame);
1299 WebFrameProxy* parentFrame = process()->webFrame(parentFrameID);
1300 MESSAGE_CHECK(parentFrame);
1301 MESSAGE_CHECK(parentFrame->isDescendantOf(m_mainFrame.get()));
1303 MESSAGE_CHECK(process()->canCreateFrame(frameID));
1305 RefPtr<WebFrameProxy> subFrame = WebFrameProxy::create(this, frameID);
1307 // Add the frame to the process wide map.
1308 process()->frameCreated(frameID, subFrame.get());
1310 // Insert the frame into the frame hierarchy.
1311 parentFrame->appendChild(subFrame.get());
1314 static bool isDisconnectedFrame(WebFrameProxy* frame)
1316 return !frame->page() || !frame->page()->mainFrame() || !frame->isDescendantOf(frame->page()->mainFrame());
1319 void WebPageProxy::didSaveFrameToPageCache(uint64_t frameID)
1321 MESSAGE_CHECK(m_mainFrame);
1323 WebFrameProxy* subframe = process()->webFrame(frameID);
1324 MESSAGE_CHECK(subframe);
1326 if (isDisconnectedFrame(subframe))
1329 MESSAGE_CHECK(subframe->isDescendantOf(m_mainFrame.get()));
1331 subframe->didRemoveFromHierarchy();
1334 void WebPageProxy::didRestoreFrameFromPageCache(uint64_t frameID, uint64_t parentFrameID)
1336 MESSAGE_CHECK(m_mainFrame);
1338 WebFrameProxy* subframe = process()->webFrame(frameID);
1339 MESSAGE_CHECK(subframe);
1340 MESSAGE_CHECK(!subframe->parentFrame());
1341 MESSAGE_CHECK(subframe->page() == m_mainFrame->page());
1343 WebFrameProxy* parentFrame = process()->webFrame(parentFrameID);
1344 MESSAGE_CHECK(parentFrame);
1345 MESSAGE_CHECK(parentFrame->isDescendantOf(m_mainFrame.get()));
1347 // Insert the frame into the frame hierarchy.
1348 parentFrame->appendChild(subframe);
1352 // Always start progress at initialProgressValue. This helps provide feedback as
1353 // soon as a load starts.
1355 static const double initialProgressValue = 0.1;
1357 double WebPageProxy::estimatedProgress() const
1359 if (!pendingAPIRequestURL().isNull())
1360 return initialProgressValue;
1361 return m_estimatedProgress;
1364 void WebPageProxy::didStartProgress()
1366 m_estimatedProgress = initialProgressValue;
1368 m_loaderClient.didStartProgress(this);
1371 void WebPageProxy::didChangeProgress(double value)
1373 m_estimatedProgress = value;
1375 m_loaderClient.didChangeProgress(this);
1378 void WebPageProxy::didFinishProgress()
1380 m_estimatedProgress = 1.0;
1382 m_loaderClient.didFinishProgress(this);
1385 void WebPageProxy::didStartProvisionalLoadForFrame(uint64_t frameID, const String& url, bool loadingSubstituteDataForUnreachableURL, CoreIPC::ArgumentDecoder* arguments)
1387 clearPendingAPIRequestURL();
1389 RefPtr<APIObject> userData;
1390 WebContextUserMessageDecoder messageDecoder(userData, context());
1391 if (!arguments->decode(messageDecoder))
1394 WebFrameProxy* frame = process()->webFrame(frameID);
1395 MESSAGE_CHECK(frame);
1397 if (!loadingSubstituteDataForUnreachableURL)
1398 frame->setUnreachableURL(String());
1400 frame->didStartProvisionalLoad(url);
1401 m_loaderClient.didStartProvisionalLoadForFrame(this, frame, userData.get());
1404 void WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, const String& url, CoreIPC::ArgumentDecoder* arguments)
1406 RefPtr<APIObject> userData;
1407 WebContextUserMessageDecoder messageDecoder(userData, context());
1408 if (!arguments->decode(messageDecoder))
1411 WebFrameProxy* frame = process()->webFrame(frameID);
1412 MESSAGE_CHECK(frame);
1414 frame->didReceiveServerRedirectForProvisionalLoad(url);
1416 m_loaderClient.didReceiveServerRedirectForProvisionalLoadForFrame(this, frame, userData.get());
1419 void WebPageProxy::didFailProvisionalLoadForFrame(uint64_t frameID, const ResourceError& error, CoreIPC::ArgumentDecoder* arguments)
1421 RefPtr<APIObject> userData;
1422 WebContextUserMessageDecoder messageDecoder(userData, context());
1423 if (!arguments->decode(messageDecoder))
1426 WebFrameProxy* frame = process()->webFrame(frameID);
1427 MESSAGE_CHECK(frame);
1429 frame->didFailProvisionalLoad();
1431 m_loaderClient.didFailProvisionalLoadWithErrorForFrame(this, frame, error, userData.get());
1434 void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, const String& mimeType, bool frameHasCustomRepresentation, const PlatformCertificateInfo& certificateInfo, CoreIPC::ArgumentDecoder* arguments)
1436 RefPtr<APIObject> userData;
1437 WebContextUserMessageDecoder messageDecoder(userData, context());
1438 if (!arguments->decode(messageDecoder))
1441 WebFrameProxy* frame = process()->webFrame(frameID);
1442 MESSAGE_CHECK(frame);
1444 frame->didCommitLoad(mimeType, certificateInfo);
1446 if (frame->isMainFrame()) {
1447 m_mainFrameHasCustomRepresentation = frameHasCustomRepresentation;
1448 m_pageClient->didCommitLoadForMainFrame(frameHasCustomRepresentation);
1451 m_loaderClient.didCommitLoadForFrame(this, frame, userData.get());
1454 void WebPageProxy::didFinishDocumentLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
1456 RefPtr<APIObject> userData;
1457 WebContextUserMessageDecoder messageDecoder(userData, context());
1458 if (!arguments->decode(messageDecoder))
1461 WebFrameProxy* frame = process()->webFrame(frameID);
1462 MESSAGE_CHECK(frame);
1464 m_loaderClient.didFinishDocumentLoadForFrame(this, frame, userData.get());
1467 void WebPageProxy::didFinishLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
1469 RefPtr<APIObject> userData;
1470 WebContextUserMessageDecoder messageDecoder(userData, context());
1471 if (!arguments->decode(messageDecoder))
1474 WebFrameProxy* frame = process()->webFrame(frameID);
1475 MESSAGE_CHECK(frame);
1477 frame->didFinishLoad();
1479 m_loaderClient.didFinishLoadForFrame(this, frame, userData.get());
1482 void WebPageProxy::didFailLoadForFrame(uint64_t frameID, const ResourceError& error, CoreIPC::ArgumentDecoder* arguments)
1484 RefPtr<APIObject> userData;
1485 WebContextUserMessageDecoder messageDecoder(userData, context());
1486 if (!arguments->decode(messageDecoder))
1489 WebFrameProxy* frame = process()->webFrame(frameID);
1490 MESSAGE_CHECK(frame);
1492 frame->didFailLoad();
1494 m_loaderClient.didFailLoadWithErrorForFrame(this, frame, error, userData.get());
1497 void WebPageProxy::didSameDocumentNavigationForFrame(uint64_t frameID, uint32_t opaqueSameDocumentNavigationType, const String& url, CoreIPC::ArgumentDecoder* arguments)
1499 RefPtr<APIObject> userData;
1500 WebContextUserMessageDecoder messageDecoder(userData, context());
1501 if (!arguments->decode(messageDecoder))
1504 WebFrameProxy* frame = process()->webFrame(frameID);
1505 MESSAGE_CHECK(frame);
1507 frame->didSameDocumentNavigation(url);
1509 m_loaderClient.didSameDocumentNavigationForFrame(this, frame, static_cast<SameDocumentNavigationType>(opaqueSameDocumentNavigationType), userData.get());
1512 void WebPageProxy::didReceiveTitleForFrame(uint64_t frameID, const String& title, CoreIPC::ArgumentDecoder* arguments)
1514 RefPtr<APIObject> userData;
1515 WebContextUserMessageDecoder messageDecoder(userData, context());
1516 if (!arguments->decode(messageDecoder))
1519 WebFrameProxy* frame = process()->webFrame(frameID);
1520 MESSAGE_CHECK(frame);
1522 frame->didChangeTitle(title);
1524 m_loaderClient.didReceiveTitleForFrame(this, title, frame, userData.get());
1527 void WebPageProxy::didFirstLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
1529 RefPtr<APIObject> userData;
1530 WebContextUserMessageDecoder messageDecoder(userData, context());
1531 if (!arguments->decode(messageDecoder))
1534 WebFrameProxy* frame = process()->webFrame(frameID);
1535 MESSAGE_CHECK(frame);
1537 m_loaderClient.didFirstLayoutForFrame(this, frame, userData.get());
1540 void WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
1542 RefPtr<APIObject> userData;
1543 WebContextUserMessageDecoder messageDecoder(userData, context());
1544 if (!arguments->decode(messageDecoder))
1547 WebFrameProxy* frame = process()->webFrame(frameID);
1548 MESSAGE_CHECK(frame);
1550 m_loaderClient.didFirstVisuallyNonEmptyLayoutForFrame(this, frame, userData.get());
1553 void WebPageProxy::didRemoveFrameFromHierarchy(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
1555 RefPtr<APIObject> userData;
1556 WebContextUserMessageDecoder messageDecoder(userData, context());
1557 if (!arguments->decode(messageDecoder))
1560 WebFrameProxy* frame = process()->webFrame(frameID);
1561 MESSAGE_CHECK(frame);
1563 frame->didRemoveFromHierarchy();
1565 m_loaderClient.didRemoveFrameFromHierarchy(this, frame, userData.get());
1568 void WebPageProxy::didDisplayInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
1570 RefPtr<APIObject> userData;
1571 WebContextUserMessageDecoder messageDecoder(userData, context());
1572 if (!arguments->decode(messageDecoder))
1575 WebFrameProxy* frame = process()->webFrame(frameID);
1576 MESSAGE_CHECK(frame);
1578 m_loaderClient.didDisplayInsecureContentForFrame(this, frame, userData.get());
1581 void WebPageProxy::didRunInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
1583 RefPtr<APIObject> userData;
1584 WebContextUserMessageDecoder messageDecoder(userData, context());
1585 if (!arguments->decode(messageDecoder))
1588 WebFrameProxy* frame = process()->webFrame(frameID);
1589 MESSAGE_CHECK(frame);
1591 m_loaderClient.didRunInsecureContentForFrame(this, frame, userData.get());
1594 void WebPageProxy::frameDidBecomeFrameSet(uint64_t frameID, bool value)
1596 WebFrameProxy* frame = process()->webFrame(frameID);
1597 MESSAGE_CHECK(frame);
1599 frame->setIsFrameSet(value);
1600 if (frame->isMainFrame())
1601 m_frameSetLargestFrame = value ? m_mainFrame : 0;
1605 void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, uint32_t opaqueNavigationType, uint32_t opaqueModifiers, int32_t opaqueMouseButton, const ResourceRequest& request, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID)
1607 RefPtr<APIObject> userData;
1608 WebContextUserMessageDecoder messageDecoder(userData, context());
1609 if (!arguments->decode(messageDecoder))
1612 if (request.url() != pendingAPIRequestURL())
1613 clearPendingAPIRequestURL();
1615 WebFrameProxy* frame = process()->webFrame(frameID);
1616 MESSAGE_CHECK(frame);
1618 NavigationType navigationType = static_cast<NavigationType>(opaqueNavigationType);
1619 WebEvent::Modifiers modifiers = static_cast<WebEvent::Modifiers>(opaqueModifiers);
1620 WebMouseEvent::Button mouseButton = static_cast<WebMouseEvent::Button>(opaqueMouseButton);
1622 RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID);
1624 ASSERT(!m_inDecidePolicyForNavigationAction);
1626 m_inDecidePolicyForNavigationAction = true;
1627 m_syncNavigationActionPolicyActionIsValid = false;
1629 if (!m_policyClient.decidePolicyForNavigationAction(this, frame, navigationType, modifiers, mouseButton, request, listener.get(), userData.get()))
1632 m_inDecidePolicyForNavigationAction = false;
1634 // Check if we received a policy decision already. If we did, we can just pass it back.
1635 receivedPolicyAction = m_syncNavigationActionPolicyActionIsValid;
1636 if (m_syncNavigationActionPolicyActionIsValid) {
1637 policyAction = m_syncNavigationActionPolicyAction;
1638 downloadID = m_syncNavigationActionPolicyDownloadID;
1642 void WebPageProxy::decidePolicyForNewWindowAction(uint64_t frameID, uint32_t opaqueNavigationType, uint32_t opaqueModifiers, int32_t opaqueMouseButton, const ResourceRequest& request, const String& frameName, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments)
1644 RefPtr<APIObject> userData;
1645 WebContextUserMessageDecoder messageDecoder(userData, context());
1646 if (!arguments->decode(messageDecoder))
1649 WebFrameProxy* frame = process()->webFrame(frameID);
1650 MESSAGE_CHECK(frame);
1652 NavigationType navigationType = static_cast<NavigationType>(opaqueNavigationType);
1653 WebEvent::Modifiers modifiers = static_cast<WebEvent::Modifiers>(opaqueModifiers);
1654 WebMouseEvent::Button mouseButton = static_cast<WebMouseEvent::Button>(opaqueMouseButton);
1656 RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID);
1657 if (!m_policyClient.decidePolicyForNewWindowAction(this, frame, navigationType, modifiers, mouseButton, request, frameName, listener.get(), userData.get()))
1661 void WebPageProxy::decidePolicyForResponse(uint64_t frameID, const ResourceResponse& response, const ResourceRequest& request, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID)
1663 RefPtr<APIObject> userData;
1664 WebContextUserMessageDecoder messageDecoder(userData, context());
1665 if (!arguments->decode(messageDecoder))
1668 WebFrameProxy* frame = process()->webFrame(frameID);
1669 MESSAGE_CHECK(frame);
1671 RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID);
1673 ASSERT(!m_inDecidePolicyForMIMEType);
1675 m_inDecidePolicyForMIMEType = true;
1676 m_syncMimeTypePolicyActionIsValid = false;
1678 if (!m_policyClient.decidePolicyForResponse(this, frame, response, request, listener.get(), userData.get()))
1681 m_inDecidePolicyForMIMEType = false;
1683 // Check if we received a policy decision already. If we did, we can just pass it back.
1684 receivedPolicyAction = m_syncMimeTypePolicyActionIsValid;
1685 if (m_syncMimeTypePolicyActionIsValid) {
1686 policyAction = m_syncMimeTypePolicyAction;
1687 downloadID = m_syncMimeTypePolicyDownloadID;
1691 void WebPageProxy::unableToImplementPolicy(uint64_t frameID, const WebCore::ResourceError& error, CoreIPC::ArgumentDecoder* arguments)
1693 RefPtr<APIObject> userData;
1694 WebContextUserMessageDecoder messageDecoder(userData, context());
1695 if (!arguments->decode(messageDecoder))
1698 WebFrameProxy* frame = process()->webFrame(frameID);
1699 MESSAGE_CHECK(frame);
1701 m_policyClient.unableToImplementPolicy(this, frame, error, userData.get());
1706 void WebPageProxy::willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments)
1708 RefPtr<APIObject> userData;
1709 WebContextUserMessageDecoder messageDecoder(userData, context());
1710 if (!arguments->decode(messageDecoder))
1713 WebFrameProxy* frame = process()->webFrame(frameID);
1714 MESSAGE_CHECK(frame);
1716 WebFrameProxy* sourceFrame = process()->webFrame(sourceFrameID);
1717 MESSAGE_CHECK(sourceFrame);
1719 RefPtr<WebFormSubmissionListenerProxy> listener = frame->setUpFormSubmissionListenerProxy(listenerID);
1720 if (!m_formClient.willSubmitForm(this, frame, sourceFrame, textFieldValues.stringPairVector(), userData.get(), listener.get()))
1721 listener->continueSubmission();
1724 // ResourceLoad Client
1726 void WebPageProxy::didInitiateLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceRequest& request, bool pageIsProvisionallyLoading)
1728 WebFrameProxy* frame = process()->webFrame(frameID);
1729 MESSAGE_CHECK(frame);
1731 m_resourceLoadClient.didInitiateLoadForResource(this, frame, resourceIdentifier, request, pageIsProvisionallyLoading);
1734 void WebPageProxy::didSendRequestForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceRequest& request, const ResourceResponse& redirectResponse)
1736 WebFrameProxy* frame = process()->webFrame(frameID);
1737 MESSAGE_CHECK(frame);
1739 m_resourceLoadClient.didSendRequestForResource(this, frame, resourceIdentifier, request, redirectResponse);
1742 void WebPageProxy::didReceiveResponseForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceResponse& response)
1744 WebFrameProxy* frame = process()->webFrame(frameID);
1745 MESSAGE_CHECK(frame);
1747 m_resourceLoadClient.didReceiveResponseForResource(this, frame, resourceIdentifier, response);
1750 void WebPageProxy::didReceiveContentLengthForResource(uint64_t frameID, uint64_t resourceIdentifier, uint64_t contentLength)
1752 WebFrameProxy* frame = process()->webFrame(frameID);
1753 MESSAGE_CHECK(frame);
1755 m_resourceLoadClient.didReceiveContentLengthForResource(this, frame, resourceIdentifier, contentLength);
1758 void WebPageProxy::didFinishLoadForResource(uint64_t frameID, uint64_t resourceIdentifier)
1760 WebFrameProxy* frame = process()->webFrame(frameID);
1761 MESSAGE_CHECK(frame);
1763 m_resourceLoadClient.didFinishLoadForResource(this, frame, resourceIdentifier);
1766 void WebPageProxy::didFailLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceError& error)
1768 WebFrameProxy* frame = process()->webFrame(frameID);
1769 MESSAGE_CHECK(frame);
1771 m_resourceLoadClient.didFailLoadForResource(this, frame, resourceIdentifier, error);
1776 void WebPageProxy::createNewPage(const WindowFeatures& windowFeatures, uint32_t opaqueModifiers, int32_t opaqueMouseButton, uint64_t& newPageID, WebPageCreationParameters& newPageParameters)
1778 RefPtr<WebPageProxy> newPage = m_uiClient.createNewPage(this, windowFeatures, static_cast<WebEvent::Modifiers>(opaqueModifiers), static_cast<WebMouseEvent::Button>(opaqueMouseButton));
1780 newPageID = newPage->pageID();
1781 newPageParameters = newPage->creationParameters();
1786 void WebPageProxy::showPage()
1788 m_uiClient.showPage(this);
1791 void WebPageProxy::closePage()
1793 m_uiClient.close(this);
1796 void WebPageProxy::runJavaScriptAlert(uint64_t frameID, const String& message)
1798 WebFrameProxy* frame = process()->webFrame(frameID);
1799 MESSAGE_CHECK(frame);
1801 m_uiClient.runJavaScriptAlert(this, message, frame);
1804 void WebPageProxy::runJavaScriptConfirm(uint64_t frameID, const String& message, bool& result)
1806 WebFrameProxy* frame = process()->webFrame(frameID);
1807 MESSAGE_CHECK(frame);
1809 result = m_uiClient.runJavaScriptConfirm(this, message, frame);
1812 void WebPageProxy::runJavaScriptPrompt(uint64_t frameID, const String& message, const String& defaultValue, String& result)
1814 WebFrameProxy* frame = process()->webFrame(frameID);
1815 MESSAGE_CHECK(frame);
1817 result = m_uiClient.runJavaScriptPrompt(this, message, defaultValue, frame);
1820 void WebPageProxy::setStatusText(const String& text)
1822 m_uiClient.setStatusText(this, text);
1825 void WebPageProxy::mouseDidMoveOverElement(uint32_t opaqueModifiers, CoreIPC::ArgumentDecoder* arguments)
1827 RefPtr<APIObject> userData;
1828 WebContextUserMessageDecoder messageDecoder(userData, context());
1829 if (!arguments->decode(messageDecoder))
1832 WebEvent::Modifiers modifiers = static_cast<WebEvent::Modifiers>(opaqueModifiers);
1834 m_uiClient.mouseDidMoveOverElement(this, modifiers, userData.get());
1837 void WebPageProxy::missingPluginButtonClicked(const String& mimeType, const String& url, const String& pluginsPageURL)
1839 m_uiClient.missingPluginButtonClicked(this, mimeType, url, pluginsPageURL);
1842 void WebPageProxy::setToolbarsAreVisible(bool toolbarsAreVisible)
1844 m_uiClient.setToolbarsAreVisible(this, toolbarsAreVisible);
1847 void WebPageProxy::getToolbarsAreVisible(bool& toolbarsAreVisible)
1849 toolbarsAreVisible = m_uiClient.toolbarsAreVisible(this);
1852 void WebPageProxy::setMenuBarIsVisible(bool menuBarIsVisible)
1854 m_uiClient.setMenuBarIsVisible(this, menuBarIsVisible);
1857 void WebPageProxy::getMenuBarIsVisible(bool& menuBarIsVisible)
1859 menuBarIsVisible = m_uiClient.menuBarIsVisible(this);
1862 void WebPageProxy::setStatusBarIsVisible(bool statusBarIsVisible)
1864 m_uiClient.setStatusBarIsVisible(this, statusBarIsVisible);
1867 void WebPageProxy::getStatusBarIsVisible(bool& statusBarIsVisible)
1869 statusBarIsVisible = m_uiClient.statusBarIsVisible(this);
1872 void WebPageProxy::setIsResizable(bool isResizable)
1874 m_uiClient.setIsResizable(this, isResizable);
1877 void WebPageProxy::getIsResizable(bool& isResizable)
1879 isResizable = m_uiClient.isResizable(this);
1882 void WebPageProxy::setWindowFrame(const FloatRect& newWindowFrame)
1884 m_uiClient.setWindowFrame(this, m_pageClient->convertToDeviceSpace(newWindowFrame));
1887 void WebPageProxy::getWindowFrame(FloatRect& newWindowFrame)
1889 newWindowFrame = m_pageClient->convertToUserSpace(m_uiClient.windowFrame(this));
1892 void WebPageProxy::windowToScreen(const IntRect& viewRect, IntRect& result)
1894 result = m_pageClient->windowToScreen(viewRect);
1897 void WebPageProxy::runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose)
1899 WebFrameProxy* frame = process()->webFrame(frameID);
1900 MESSAGE_CHECK(frame);
1902 shouldClose = m_uiClient.runBeforeUnloadConfirmPanel(this, message, frame);
1905 #if ENABLE(TILED_BACKING_STORE)
1906 void WebPageProxy::pageDidRequestScroll(const IntSize& delta)
1908 m_pageClient->pageDidRequestScroll(delta);
1912 void WebPageProxy::didChangeViewportData(const ViewportArguments& args)
1914 m_pageClient->setViewportArguments(args);
1917 void WebPageProxy::pageDidScroll()
1919 m_uiClient.pageDidScroll(this);
1922 void WebPageProxy::runOpenPanel(uint64_t frameID, const WebOpenPanelParameters::Data& data)
1924 if (m_openPanelResultListener) {
1925 m_openPanelResultListener->invalidate();
1926 m_openPanelResultListener = 0;
1929 WebFrameProxy* frame = process()->webFrame(frameID);
1930 MESSAGE_CHECK(frame);
1932 m_openPanelResultListener = WebOpenPanelResultListenerProxy::create(this);
1934 if (!m_uiClient.runOpenPanel(this, frame, data, m_openPanelResultListener.get()))
1935 didCancelForOpenPanel();
1938 void WebPageProxy::printFrame(uint64_t frameID)
1940 ASSERT(!m_isPerformingDOMPrintOperation);
1941 m_isPerformingDOMPrintOperation = true;
1943 WebFrameProxy* frame = process()->webFrame(frameID);
1944 MESSAGE_CHECK(frame);
1946 m_uiClient.printFrame(this, frame);
1948 m_isPerformingDOMPrintOperation = false;
1952 void WebPageProxy::didChangeContentsSize(const WebCore::IntSize& size)
1954 m_pageClient->didChangeContentsSize(size);
1957 void WebPageProxy::didFindZoomableArea(const WebCore::IntRect& area)
1959 m_pageClient->didFindZoomableArea(area);
1962 void WebPageProxy::findZoomableAreaForPoint(const WebCore::IntPoint& point)
1967 process()->send(Messages::WebPage::FindZoomableAreaForPoint(point), m_pageID);
1971 void WebPageProxy::didDraw()
1973 m_uiClient.didDraw(this);
1978 #if ENABLE(INSPECTOR)
1980 WebInspectorProxy* WebPageProxy::inspector()
1982 if (isClosed() || !isValid())
1985 m_inspector = WebInspectorProxy::create(this);
1986 return m_inspector.get();
1993 void WebPageProxy::backForwardAddItem(uint64_t itemID)
1995 m_backForwardList->addItem(process()->webBackForwardItem(itemID));
1998 void WebPageProxy::backForwardGoToItem(uint64_t itemID)
2000 m_backForwardList->goToItem(process()->webBackForwardItem(itemID));
2003 void WebPageProxy::backForwardItemAtIndex(int32_t index, uint64_t& itemID)
2005 WebBackForwardListItem* item = m_backForwardList->itemAtIndex(index);
2006 itemID = item ? item->itemID() : 0;
2009 void WebPageProxy::backForwardBackListCount(int32_t& count)
2011 count = m_backForwardList->backListCount();
2014 void WebPageProxy::backForwardForwardListCount(int32_t& count)
2016 count = m_backForwardList->forwardListCount();
2019 void WebPageProxy::selectionStateChanged(const SelectionState& selectionState)
2021 m_selectionState = selectionState;
2025 // Complex text input support for plug-ins.
2026 void WebPageProxy::sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput)
2031 process()->send(Messages::WebPage::SendComplexTextInputToPlugin(pluginComplexTextInputIdentifier, textInput), m_pageID);
2036 void WebPageProxy::didChangeCompositionSelection(bool hasComposition)
2038 m_pageClient->compositionSelectionChanged(hasComposition);
2041 void WebPageProxy::confirmComposition(const String& compositionString)
2043 process()->send(Messages::WebPage::ConfirmComposition(compositionString), m_pageID);
2046 void WebPageProxy::setComposition(const String& compositionString, Vector<WebCore::CompositionUnderline>& underlines, int cursorPosition)
2048 process()->send(Messages::WebPage::SetComposition(compositionString, underlines, cursorPosition), m_pageID);
2054 void WebPageProxy::registerEditCommandForUndo(uint64_t commandID, uint32_t editAction)
2056 registerEditCommand(WebEditCommandProxy::create(commandID, static_cast<EditAction>(editAction), this), Undo);
2059 void WebPageProxy::clearAllEditCommands()
2061 m_pageClient->clearAllEditCommands();
2064 void WebPageProxy::didCountStringMatches(const String& string, uint32_t matchCount)
2066 m_findClient.didCountStringMatches(this, string, matchCount);
2069 void WebPageProxy::setFindIndicator(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, const SharedMemory::Handle& contentImageHandle, bool fadeOut)
2071 RefPtr<FindIndicator> findIndicator = FindIndicator::create(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, contentImageHandle);
2072 m_pageClient->setFindIndicator(findIndicator.release(), fadeOut);
2075 void WebPageProxy::didFindString(const String& string, uint32_t matchCount)
2077 m_findClient.didFindString(this, string, matchCount);
2080 void WebPageProxy::didFailToFindString(const String& string)
2082 m_findClient.didFailToFindString(this, string);
2085 void WebPageProxy::valueChangedForPopupMenu(WebPopupMenuProxy*, int32_t newSelectedIndex)
2087 process()->send(Messages::WebPage::DidChangeSelectedIndexForActivePopupMenu(newSelectedIndex), m_pageID);
2090 void WebPageProxy::setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index)
2092 process()->send(Messages::WebPage::SetTextForActivePopupMenu(index), m_pageID);
2095 void WebPageProxy::showPopupMenu(const IntRect& rect, uint64_t textDirection, const Vector<WebPopupItem>& items, int32_t selectedIndex, const PlatformPopupMenuData& data)
2097 if (m_activePopupMenu) {
2098 m_activePopupMenu->hidePopupMenu();
2099 m_activePopupMenu->invalidate();
2100 m_activePopupMenu = 0;
2103 m_activePopupMenu = m_pageClient->createPopupMenuProxy(this);
2105 // Since showPopupMenu() can spin a nested run loop we need to turn off the responsiveness timer.
2106 process()->responsivenessTimer()->stop();
2108 RefPtr<WebPopupMenuProxy> protectedActivePopupMenu = m_activePopupMenu;
2110 protectedActivePopupMenu->showPopupMenu(rect, static_cast<TextDirection>(textDirection), m_viewScaleFactor, items, data, selectedIndex);
2111 protectedActivePopupMenu->invalidate();
2112 protectedActivePopupMenu = 0;
2115 void WebPageProxy::hidePopupMenu()
2117 if (!m_activePopupMenu)
2120 m_activePopupMenu->hidePopupMenu();
2121 m_activePopupMenu->invalidate();
2122 m_activePopupMenu = 0;
2125 void WebPageProxy::showContextMenu(const IntPoint& menuLocation, const ContextMenuState& contextMenuState, const Vector<WebContextMenuItemData>& proposedItems, CoreIPC::ArgumentDecoder* arguments)
2127 RefPtr<APIObject> userData;
2128 WebContextUserMessageDecoder messageDecoder(userData, context());
2129 if (!arguments->decode(messageDecoder))
2132 m_activeContextMenuState = contextMenuState;
2134 if (m_activeContextMenu)
2135 m_activeContextMenu->hideContextMenu();
2137 m_activeContextMenu = m_pageClient->createContextMenuProxy(this);
2139 // Give the PageContextMenuClient one last swipe at changing the menu.
2140 Vector<WebContextMenuItemData> items;
2142 if (!m_contextMenuClient.getContextMenuFromProposedMenu(this, proposedItems, items, userData.get())) {
2143 m_activeContextMenu->showContextMenu(menuLocation, proposedItems);
2148 m_activeContextMenu->showContextMenu(menuLocation, items);
2151 void WebPageProxy::contextMenuItemSelected(const WebContextMenuItemData& item)
2153 // Application custom items don't need to round-trip through to WebCore in the WebProcess.
2154 if (item.action() >= ContextMenuItemBaseApplicationTag) {
2155 m_contextMenuClient.customContextMenuItemSelected(this, item);
2160 if (item.action() == ContextMenuItemTagSmartCopyPaste) {
2161 setSmartInsertDeleteEnabled(!isSmartInsertDeleteEnabled());
2164 if (item.action() == ContextMenuItemTagSmartQuotes) {
2165 TextChecker::setAutomaticQuoteSubstitutionEnabled(!TextChecker::state().isAutomaticQuoteSubstitutionEnabled);
2166 process()->updateTextCheckerState();
2169 if (item.action() == ContextMenuItemTagSmartDashes) {
2170 TextChecker::setAutomaticDashSubstitutionEnabled(!TextChecker::state().isAutomaticDashSubstitutionEnabled);
2171 process()->updateTextCheckerState();
2174 if (item.action() == ContextMenuItemTagSmartLinks) {
2175 TextChecker::setAutomaticLinkDetectionEnabled(!TextChecker::state().isAutomaticLinkDetectionEnabled);
2176 process()->updateTextCheckerState();
2179 if (item.action() == ContextMenuItemTagTextReplacement) {
2180 TextChecker::setAutomaticTextReplacementEnabled(!TextChecker::state().isAutomaticTextReplacementEnabled);
2181 process()->updateTextCheckerState();
2185 if (item.action() == ContextMenuItemTagDownloadImageToDisk) {
2186 m_context->download(this, KURL(KURL(), m_activeContextMenuState.absoluteImageURLString));
2189 if (item.action() == ContextMenuItemTagDownloadLinkToDisk) {
2190 m_context->download(this, KURL(KURL(), m_activeContextMenuState.absoluteLinkURLString));
2194 if (item.action() == ContextMenuItemTagLearnSpelling || item.action() == ContextMenuItemTagIgnoreSpelling)
2195 ++m_pendingLearnOrIgnoreWordMessageCount;
2197 process()->send(Messages::WebPage::DidSelectItemFromActiveContextMenu(item), m_pageID);
2200 void WebPageProxy::didChooseFilesForOpenPanel(const Vector<String>& fileURLs)
2205 #if ENABLE(WEB_PROCESS_SANDBOX)
2206 // FIXME: The sandbox extensions should be sent with the DidChooseFilesForOpenPanel message. This
2207 // is gated on a way of passing SandboxExtension::Handles in a Vector.
2208 for (size_t i = 0; i < fileURLs.size(); ++i) {
2209 SandboxExtension::Handle sandboxExtensionHandle;
2210 SandboxExtension::createHandle(fileURLs[i], SandboxExtension::ReadOnly, sandboxExtensionHandle);
2211 process()->send(Messages::WebPage::ExtendSandboxForFileFromOpenPanel(sandboxExtensionHandle), m_pageID);
2215 process()->send(Messages::WebPage::DidChooseFilesForOpenPanel(fileURLs), m_pageID);
2217 m_openPanelResultListener->invalidate();
2218 m_openPanelResultListener = 0;
2221 void WebPageProxy::didCancelForOpenPanel()
2226 process()->send(Messages::WebPage::DidCancelForOpenPanel(), m_pageID);
2228 m_openPanelResultListener->invalidate();
2229 m_openPanelResultListener = 0;
2232 void WebPageProxy::advanceToNextMisspelling(bool startBeforeSelection)
2234 process()->send(Messages::WebPage::AdvanceToNextMisspelling(startBeforeSelection), m_pageID);
2237 void WebPageProxy::changeSpellingToWord(const String& word)
2242 process()->send(Messages::WebPage::ChangeSpellingToWord(word), m_pageID);
2245 void WebPageProxy::unmarkAllMisspellings()
2247 process()->send(Messages::WebPage::UnmarkAllMisspellings(), m_pageID);
2250 void WebPageProxy::unmarkAllBadGrammar()
2252 process()->send(Messages::WebPage::UnmarkAllBadGrammar(), m_pageID);
2256 void WebPageProxy::uppercaseWord()
2258 process()->send(Messages::WebPage::UppercaseWord(), m_pageID);
2261 void WebPageProxy::lowercaseWord()
2263 process()->send(Messages::WebPage::LowercaseWord(), m_pageID);
2266 void WebPageProxy::capitalizeWord()
2268 process()->send(Messages::WebPage::CapitalizeWord(), m_pageID);
2271 void WebPageProxy::setSmartInsertDeleteEnabled(bool isSmartInsertDeleteEnabled)
2273 if (m_isSmartInsertDeleteEnabled == isSmartInsertDeleteEnabled)
2276 TextChecker::setSmartInsertDeleteEnabled(isSmartInsertDeleteEnabled);
2277 m_isSmartInsertDeleteEnabled = isSmartInsertDeleteEnabled;
2278 process()->send(Messages::WebPage::SetSmartInsertDeleteEnabled(isSmartInsertDeleteEnabled), m_pageID);
2282 void WebPageProxy::registerEditCommand(PassRefPtr<WebEditCommandProxy> commandProxy, UndoOrRedo undoOrRedo)
2284 m_pageClient->registerEditCommand(commandProxy, undoOrRedo);
2287 void WebPageProxy::addEditCommand(WebEditCommandProxy* command)
2289 m_editCommandSet.add(command);
2292 void WebPageProxy::removeEditCommand(WebEditCommandProxy* command)
2294 m_editCommandSet.remove(command);
2298 process()->send(Messages::WebPage::DidRemoveEditCommand(command->commandID()), m_pageID);
2301 int64_t WebPageProxy::spellDocumentTag()
2303 if (!m_hasSpellDocumentTag) {
2304 m_spellDocumentTag = TextChecker::uniqueSpellDocumentTag();
2305 m_hasSpellDocumentTag = true;
2308 return m_spellDocumentTag;
2311 void WebPageProxy::checkTextOfParagraph(const String& text, uint64_t checkingTypes, Vector<TextCheckingResult>& results)
2313 results = TextChecker::checkTextOfParagraph(spellDocumentTag(), text.characters(), text.length(), checkingTypes);
2316 void WebPageProxy::updateSpellingUIWithMisspelledWord(const String& misspelledWord)
2318 TextChecker::updateSpellingUIWithMisspelledWord(misspelledWord);
2321 void WebPageProxy::updateSpellingUIWithGrammarString(const String& badGrammarPhrase, const GrammarDetail& grammarDetail)
2323 TextChecker::updateSpellingUIWithGrammarString(badGrammarPhrase, grammarDetail);
2326 void WebPageProxy::getGuessesForWord(const String& word, const String& context, Vector<String>& guesses)
2328 TextChecker::getGuessesForWord(spellDocumentTag(), word, context, guesses);
2331 void WebPageProxy::learnWord(const String& word)
2333 MESSAGE_CHECK(m_pendingLearnOrIgnoreWordMessageCount);
2334 --m_pendingLearnOrIgnoreWordMessageCount;
2336 TextChecker::learnWord(word);
2339 void WebPageProxy::ignoreWord(const String& word)
2341 MESSAGE_CHECK(m_pendingLearnOrIgnoreWordMessageCount);
2342 --m_pendingLearnOrIgnoreWordMessageCount;
2344 TextChecker::ignoreWord(spellDocumentTag(), word);
2349 void WebPageProxy::setFocus(bool focused)
2351 m_pageClient->setFocus(focused);
2354 void WebPageProxy::takeFocus(bool direction)
2356 m_pageClient->takeFocus(direction);
2359 void WebPageProxy::setToolTip(const String& toolTip)
2361 String oldToolTip = m_toolTip;
2362 m_toolTip = toolTip;
2363 m_pageClient->toolTipChanged(oldToolTip, m_toolTip);
2366 void WebPageProxy::setCursor(const WebCore::Cursor& cursor)
2368 m_pageClient->setCursor(cursor);
2371 void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
2373 WebEvent::Type type = static_cast<WebEvent::Type>(opaqueType);
2376 case WebEvent::MouseMove:
2379 case WebEvent::MouseDown:
2380 case WebEvent::MouseUp:
2381 case WebEvent::Wheel:
2382 case WebEvent::KeyDown:
2383 case WebEvent::KeyUp:
2384 case WebEvent::RawKeyDown:
2385 case WebEvent::Char:
2386 #if ENABLE(GESTURE_EVENTS)
2387 case WebEvent::GestureScrollBegin:
2388 case WebEvent::GestureScrollEnd:
2390 process()->responsivenessTimer()->stop();
2395 case WebEvent::MouseMove:
2396 m_processingMouseMoveEvent = false;
2397 if (m_nextMouseMoveEvent) {
2398 handleMouseEvent(*m_nextMouseMoveEvent);
2399 m_nextMouseMoveEvent = nullptr;
2402 case WebEvent::MouseDown:
2403 case WebEvent::MouseUp:
2404 #if ENABLE(GESTURE_EVENTS)
2405 case WebEvent::GestureScrollBegin:
2406 case WebEvent::GestureScrollEnd:
2410 case WebEvent::Wheel: {
2411 m_processingWheelEvent = false;
2412 if (m_nextWheelEvent) {
2413 handleWheelEvent(*m_nextWheelEvent);
2414 m_nextWheelEvent = nullptr;
2419 case WebEvent::KeyDown:
2420 case WebEvent::KeyUp:
2421 case WebEvent::RawKeyDown:
2422 case WebEvent::Char: {
2423 NativeWebKeyboardEvent event = m_keyEventQueue.first();
2424 MESSAGE_CHECK(type == event.type());
2426 m_keyEventQueue.removeFirst();
2428 m_pageClient->doneWithKeyEvent(event, handled);
2433 m_uiClient.didNotHandleKeyEvent(this, event);
2439 void WebPageProxy::voidCallback(uint64_t callbackID)
2441 RefPtr<VoidCallback> callback = m_voidCallbacks.take(callbackID);
2443 // FIXME: Log error or assert.
2447 callback->performCallback();
2450 void WebPageProxy::dataCallback(const CoreIPC::DataReference& dataReference, uint64_t callbackID)
2452 RefPtr<DataCallback> callback = m_dataCallbacks.take(callbackID);
2454 // FIXME: Log error or assert.
2458 callback->performCallbackWithReturnValue(WebData::create(dataReference.data(), dataReference.size()).get());
2461 void WebPageProxy::stringCallback(const String& resultString, uint64_t callbackID)
2463 RefPtr<StringCallback> callback = m_stringCallbacks.take(callbackID);
2465 // FIXME: Log error or assert.
2469 callback->performCallbackWithReturnValue(resultString.impl());
2472 void WebPageProxy::scriptValueCallback(const CoreIPC::DataReference& dataReference, uint64_t callbackID)
2474 RefPtr<ScriptValueCallback> callback = m_scriptValueCallbacks.take(callbackID);
2476 // FIXME: Log error or assert.
2480 Vector<uint8_t> data;
2481 data.reserveInitialCapacity(dataReference.size());
2482 data.append(dataReference.data(), dataReference.size());
2484 callback->performCallbackWithReturnValue(data.size() ? WebSerializedScriptValue::adopt(data).get() : 0);
2487 void WebPageProxy::computedPagesCallback(const Vector<WebCore::IntRect>& pageRects, double totalScaleFactorForPrinting, uint64_t callbackID)
2489 RefPtr<ComputedPagesCallback> callback = m_computedPagesCallbacks.take(callbackID);
2491 // FIXME: Log error or assert.
2495 callback->performCallbackWithReturnValue(pageRects, totalScaleFactorForPrinting);
2498 void WebPageProxy::validateCommandCallback(const String& commandName, bool isEnabled, int state, uint64_t callbackID)
2500 RefPtr<ValidateCommandCallback> callback = m_validateCommandCallbacks.take(callbackID);
2502 // FIXME: Log error or assert.
2506 callback->performCallbackWithReturnValue(commandName.impl(), isEnabled, state);
2510 void WebPageProxy::didPerformDictionaryLookup(const String& text, const DictionaryPopupInfo& dictionaryPopupInfo)
2512 m_pageClient->didPerformDictionaryLookup(text, m_viewScaleFactor, dictionaryPopupInfo);
2515 void WebPageProxy::registerWebProcessAccessibilityToken(const CoreIPC::DataReference& data)
2517 m_pageClient->accessibilityWebProcessTokenReceived(data);
2520 void WebPageProxy::registerUIProcessAccessibilityTokens(const CoreIPC::DataReference& elementToken, const CoreIPC::DataReference& windowToken)
2525 process()->send(Messages::WebPage::RegisterUIProcessAccessibilityTokens(elementToken, windowToken), m_pageID);
2529 void WebPageProxy::focusedFrameChanged(uint64_t frameID)
2536 WebFrameProxy* frame = process()->webFrame(frameID);
2537 MESSAGE_CHECK(frame);
2539 m_focusedFrame = frame;
2542 void WebPageProxy::frameSetLargestFrameChanged(uint64_t frameID)
2545 m_frameSetLargestFrame = 0;
2549 WebFrameProxy* frame = process()->webFrame(frameID);
2550 MESSAGE_CHECK(frame);
2552 m_frameSetLargestFrame = frame;
2555 void WebPageProxy::processDidBecomeUnresponsive()
2557 m_loaderClient.processDidBecomeUnresponsive(this);
2560 void WebPageProxy::processDidBecomeResponsive()
2562 m_loaderClient.processDidBecomeResponsive(this);
2565 void WebPageProxy::processDidCrash()
2567 ASSERT(m_pageClient);
2572 m_urlAtProcessExit = m_mainFrame->url();
2576 m_drawingArea = nullptr;
2578 #if ENABLE(INSPECTOR)
2580 m_inspector->invalidate();
2585 if (m_openPanelResultListener) {
2586 m_openPanelResultListener->invalidate();
2587 m_openPanelResultListener = 0;
2590 m_geolocationPermissionRequestManager.invalidateRequests();
2592 m_toolTip = String();
2594 m_mainFrameHasHorizontalScrollbar = false;
2595 m_mainFrameHasVerticalScrollbar = false;
2597 m_mainFrameIsPinnedToLeftSide = false;
2598 m_mainFrameIsPinnedToRightSide = false;
2600 invalidateCallbackMap(m_voidCallbacks);
2601 invalidateCallbackMap(m_dataCallbacks);
2602 invalidateCallbackMap(m_stringCallbacks);
2603 invalidateCallbackMap(m_scriptValueCallbacks);
2604 invalidateCallbackMap(m_computedPagesCallbacks);
2605 invalidateCallbackMap(m_validateCommandCallbacks);
2607 Vector<WebEditCommandProxy*> editCommandVector;
2608 copyToVector(m_editCommandSet, editCommandVector);
2609 m_editCommandSet.clear();
2610 for (size_t i = 0, size = editCommandVector.size(); i < size; ++i)
2611 editCommandVector[i]->invalidate();
2612 m_pageClient->clearAllEditCommands();
2614 m_activePopupMenu = 0;
2616 m_estimatedProgress = 0.0;
2618 m_pendingLearnOrIgnoreWordMessageCount = 0;
2620 m_pageClient->processDidCrash();
2621 m_loaderClient.processDidCrash(this);
2624 WebPageCreationParameters WebPageProxy::creationParameters() const
2626 WebPageCreationParameters parameters;
2628 parameters.viewSize = m_pageClient->viewSize();
2629 parameters.isActive = m_pageClient->isViewWindowActive();
2630 parameters.isFocused = m_pageClient->isViewFocused();
2631 parameters.isVisible = m_pageClient->isViewVisible();
2632 parameters.isInWindow = m_pageClient->isViewInWindow();
2633 parameters.drawingAreaType = m_drawingArea->type();
2634 parameters.store = m_pageGroup->preferences()->store();
2635 parameters.pageGroupData = m_pageGroup->data();
2636 parameters.drawsBackground = m_drawsBackground;
2637 parameters.drawsTransparentBackground = m_drawsTransparentBackground;
2638 parameters.areMemoryCacheClientCallsEnabled = m_areMemoryCacheClientCallsEnabled;
2639 parameters.useFixedLayout = m_useFixedLayout;
2640 parameters.fixedLayoutSize = m_fixedLayoutSize;
2641 parameters.userAgent = userAgent();
2642 parameters.sessionState = SessionState(m_backForwardList->entries(), m_backForwardList->currentIndex());
2643 parameters.highestUsedBackForwardItemID = WebBackForwardListItem::highedUsedItemID();
2644 parameters.canRunBeforeUnloadConfirmPanel = m_uiClient.canRunBeforeUnloadConfirmPanel();
2645 parameters.canRunModal = m_uiClient.canRunModal();
2648 parameters.isSmartInsertDeleteEnabled = m_isSmartInsertDeleteEnabled;
2652 parameters.nativeWindow = m_pageClient->nativeWindow();
2658 #if USE(ACCELERATED_COMPOSITING)
2659 void WebPageProxy::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
2661 m_pageClient->enterAcceleratedCompositingMode(layerTreeContext);
2664 void WebPageProxy::exitAcceleratedCompositingMode()
2666 m_pageClient->exitAcceleratedCompositingMode();
2668 #endif // USE(ACCELERATED_COMPOSITING)
2670 void WebPageProxy::backForwardClear()
2672 m_backForwardList->clear();
2675 void WebPageProxy::canAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, const WebCore::ProtectionSpace& coreProtectionSpace, bool& canAuthenticate)
2677 WebFrameProxy* frame = process()->webFrame(frameID);
2678 MESSAGE_CHECK(frame);
2680 RefPtr<WebProtectionSpace> protectionSpace = WebProtectionSpace::create(coreProtectionSpace);
2682 canAuthenticate = m_loaderClient.canAuthenticateAgainstProtectionSpaceInFrame(this, frame, protectionSpace.get());
2685 void WebPageProxy::didReceiveAuthenticationChallenge(uint64_t frameID, const WebCore::AuthenticationChallenge& coreChallenge, uint64_t challengeID)
2687 WebFrameProxy* frame = process()->webFrame(frameID);
2688 MESSAGE_CHECK(frame);
2690 RefPtr<AuthenticationChallengeProxy> authenticationChallenge = AuthenticationChallengeProxy::create(coreChallenge, challengeID, this);
2692 m_loaderClient.didReceiveAuthenticationChallengeInFrame(this, frame, authenticationChallenge.get());
2695 void WebPageProxy::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)
2697 WebFrameProxy* frame = process()->webFrame(frameID);
2698 MESSAGE_CHECK(frame);
2700 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::create(originIdentifier);
2702 newQuota = m_uiClient.exceededDatabaseQuota(this, frame, origin.get(), databaseName, displayName, currentQuota, currentUsage, expectedUsage);
2705 void WebPageProxy::requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier)
2707 WebFrameProxy* frame = process()->webFrame(frameID);
2708 MESSAGE_CHECK(frame);
2710 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::create(originIdentifier);
2711 RefPtr<GeolocationPermissionRequestProxy> request = m_geolocationPermissionRequestManager.createRequest(geolocationID);
2713 if (!m_uiClient.decidePolicyForGeolocationPermissionRequest(this, frame, origin.get(), request.get()))
2717 float WebPageProxy::headerHeight(WebFrameProxy* frame)
2719 return m_uiClient.headerHeight(this, frame);
2722 float WebPageProxy::footerHeight(WebFrameProxy* frame)
2724 return m_uiClient.footerHeight(this, frame);
2727 void WebPageProxy::drawHeader(WebFrameProxy* frame, const FloatRect& rect)
2729 m_uiClient.drawHeader(this, frame, rect);
2732 void WebPageProxy::drawFooter(WebFrameProxy* frame, const FloatRect& rect)
2734 m_uiClient.drawFooter(this, frame, rect);
2737 void WebPageProxy::didCompleteRubberBandForMainFrame(const IntSize& initialOverhang)
2739 m_uiClient.didCompleteRubberBandForMainFrame(this, initialOverhang);
2742 void WebPageProxy::didChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar)
2744 m_mainFrameHasHorizontalScrollbar = hasHorizontalScrollbar;
2745 m_mainFrameHasVerticalScrollbar = hasVerticalScrollbar;
2747 m_pageClient->didChangeScrollbarsForMainFrame();
2750 void WebPageProxy::didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide)
2752 m_mainFrameIsPinnedToLeftSide = pinnedToLeftSide;
2753 m_mainFrameIsPinnedToRightSide = pinnedToRightSide;
2756 void WebPageProxy::didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference& dataReference)
2758 m_pageClient->didFinishLoadingDataForCustomRepresentation(suggestedFilename, dataReference);
2762 void WebPageProxy::setComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled)
2764 m_pageClient->setComplexTextInputEnabled(pluginComplexTextInputIdentifier, complexTextInputEnabled);
2767 void WebPageProxy::setAutodisplay(bool newState)
2769 m_pageClient->setAutodisplay(newState);
2773 void WebPageProxy::backForwardRemovedItem(uint64_t itemID)
2775 process()->send(Messages::WebPage::DidRemoveBackForwardItem(itemID), m_pageID);
2778 void WebPageProxy::beginPrinting(WebFrameProxy* frame, const PrintInfo& printInfo)
2780 if (m_isInPrintingMode)
2783 m_isInPrintingMode = true;
2784 process()->send(Messages::WebPage::BeginPrinting(frame->frameID(), printInfo), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
2787 void WebPageProxy::endPrinting()
2789 if (!m_isInPrintingMode)
2792 m_isInPrintingMode = false;
2793 process()->send(Messages::WebPage::EndPrinting(), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
2796 void WebPageProxy::computePagesForPrinting(WebFrameProxy* frame, const PrintInfo& printInfo, PassRefPtr<ComputedPagesCallback> callback)
2798 uint64_t callbackID = callback->callbackID();
2799 m_computedPagesCallbacks.set(callbackID, callback.get());
2800 m_isInPrintingMode = true;
2801 process()->send(Messages::WebPage::ComputePagesForPrinting(frame->frameID(), printInfo, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
2804 #if PLATFORM(MAC) || PLATFORM(WIN)
2805 void WebPageProxy::drawRectToPDF(WebFrameProxy* frame, const IntRect& rect, PassRefPtr<DataCallback> callback)
2807 uint64_t callbackID = callback->callbackID();
2808 m_dataCallbacks.set(callbackID, callback.get());
2809 process()->send(Messages::WebPage::DrawRectToPDF(frame->frameID(), rect, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
2812 void WebPageProxy::drawPagesToPDF(WebFrameProxy* frame, uint32_t first, uint32_t count, PassRefPtr<DataCallback> callback)
2814 uint64_t callbackID = callback->callbackID();
2815 m_dataCallbacks.set(callbackID, callback.get());
2816 process()->send(Messages::WebPage::DrawPagesToPDF(frame->frameID(), first, count, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
2820 void WebPageProxy::flashBackingStoreUpdates(const Vector<IntRect>& updateRects)
2822 m_pageClient->flashBackingStoreUpdates(updateRects);
2825 Color WebPageProxy::viewUpdatesFlashColor()
2827 return Color(0, 200, 255);
2830 Color WebPageProxy::backingStoreUpdatesFlashColor()
2832 return Color(200, 0, 255);
2835 } // namespace WebKit