2 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Corporation. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
18 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
24 * THE POSSIBILITY OF SUCH DAMAGE.
28 #include "WebPageProxy.h"
30 #include "AuthenticationChallengeProxy.h"
31 #include "AuthenticationDecisionListener.h"
32 #include "DataReference.h"
33 #include "DownloadProxy.h"
34 #include "DrawingAreaProxy.h"
35 #include "EventDispatcherMessages.h"
36 #include "FindIndicator.h"
38 #include "MessageID.h"
39 #include "NativeWebKeyboardEvent.h"
40 #include "NativeWebMouseEvent.h"
41 #include "NativeWebWheelEvent.h"
42 #include "NotificationPermissionRequest.h"
43 #include "NotificationPermissionRequestManager.h"
44 #include "PageClient.h"
45 #include "PrintInfo.h"
46 #include "SessionState.h"
47 #include "StringPairVector.h"
48 #include "TextChecker.h"
49 #include "TextCheckerState.h"
50 #include "WKContextPrivate.h"
51 #include "WebBackForwardList.h"
52 #include "WebBackForwardListItem.h"
53 #include "WebCertificateInfo.h"
54 #include "WebContext.h"
55 #include "WebContextMenuProxy.h"
56 #include "WebContextUserMessageCoders.h"
57 #include "WebCoreArgumentCoders.h"
59 #include "WebEditCommandProxy.h"
61 #include "WebFormSubmissionListenerProxy.h"
62 #include "WebFramePolicyListenerProxy.h"
63 #include "WebFullScreenManagerProxy.h"
64 #include "WebInspectorProxy.h"
65 #include "WebNotificationManagerProxy.h"
66 #include "WebOpenPanelResultListenerProxy.h"
67 #include "WebPageCreationParameters.h"
68 #include "WebPageGroup.h"
69 #include "WebPageGroupData.h"
70 #include "WebPageMessages.h"
71 #include "WebPopupItem.h"
72 #include "WebPopupMenuProxy.h"
73 #include "WebPreferences.h"
74 #include "WebProcessMessages.h"
75 #include "WebProcessProxy.h"
76 #include "WebProtectionSpace.h"
77 #include "WebSecurityOrigin.h"
78 #include "WebURLRequest.h"
79 #include <WebCore/DragController.h>
80 #include <WebCore/DragData.h>
81 #include <WebCore/DragSession.h>
82 #include <WebCore/FloatRect.h>
83 #include <WebCore/FocusDirection.h>
84 #include <WebCore/MIMETypeRegistry.h>
85 #include <WebCore/TextCheckerClient.h>
86 #include <WebCore/WindowFeatures.h>
89 #if USE(UI_SIDE_COMPOSITING)
90 #include "LayerTreeHostProxyMessages.h"
94 #include "ArgumentCodersQt.h"
98 #include "ArgumentCodersGtk.h"
102 #include <wtf/RefCountedLeakCounter.h>
105 #if ENABLE(TIZEN_ISF_PORT)
106 #include <WebCore/Logging.h>
109 // This controls what strategy we use for mouse wheel coalescing.
110 #define MERGE_WHEEL_EVENTS 1
112 #define MESSAGE_CHECK(assertion) MESSAGE_CHECK_BASE(assertion, m_process->connection())
113 #define MESSAGE_CHECK_URL(url) MESSAGE_CHECK_BASE(m_process->checkURLReceivedFromWebProcess(url), m_process->connection())
115 using namespace WebCore;
117 // Represents the number of wheel events we can hold in the queue before we start pushing them preemptively.
118 static const unsigned wheelEventQueueSizeThreshold = 10;
122 WKPageDebugPaintFlags WebPageProxy::s_debugPaintFlags = 0;
124 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, webPageProxyCounter, ("WebPageProxy"));
127 static const char* webKeyboardEventTypeString(WebEvent::Type type)
130 case WebEvent::KeyDown:
133 case WebEvent::KeyUp:
136 case WebEvent::RawKeyDown:
143 ASSERT_NOT_REACHED();
147 #endif // !LOG_DISABLED
149 PassRefPtr<WebPageProxy> WebPageProxy::create(PageClient* pageClient, PassRefPtr<WebProcessProxy> process, WebPageGroup* pageGroup, uint64_t pageID)
151 return adoptRef(new WebPageProxy(pageClient, process, pageGroup, pageID));
154 WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> process, WebPageGroup* pageGroup, uint64_t pageID)
155 : m_pageClient(pageClient)
157 , m_pageGroup(pageGroup)
159 , m_userAgent(standardUserAgent())
160 , m_geolocationPermissionRequestManager(this)
161 , m_notificationPermissionRequestManager(this)
162 #if ENABLE(TIZEN_MEDIA_STREAM)
163 , m_userMediaPermissionRequestManager(this)
165 , m_estimatedProgress(0)
166 , m_isInWindow(m_pageClient->isViewInWindow())
167 , m_isVisible(m_pageClient->isViewVisible())
168 , m_backForwardList(WebBackForwardList::create(this))
169 , m_loadStateAtProcessExit(WebFrameProxy::LoadStateFinished)
170 , m_textZoomFactor(1)
171 , m_pageZoomFactor(1)
172 , m_pageScaleFactor(1)
173 , m_intrinsicDeviceScaleFactor(1)
174 , m_customDeviceScaleFactor(0)
175 #if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
176 , m_layerHostingMode(LayerHostingModeInWindowServer)
178 , m_layerHostingMode(LayerHostingModeDefault)
180 , m_drawsBackground(true)
181 , m_drawsTransparentBackground(false)
182 , m_areMemoryCacheClientCallsEnabled(true)
183 , m_useFixedLayout(false)
184 , m_paginationMode(Page::Pagination::Unpaginated)
185 , m_paginationBehavesLikeColumns(false)
187 , m_gapBetweenPages(0)
190 , m_isInPrintingMode(false)
191 , m_isPerformingDOMPrintOperation(false)
192 , m_inDecidePolicyForResponse(false)
193 , m_syncMimeTypePolicyActionIsValid(false)
194 , m_syncMimeTypePolicyAction(PolicyUse)
195 , m_syncMimeTypePolicyDownloadID(0)
196 , m_inDecidePolicyForNavigationAction(false)
197 , m_syncNavigationActionPolicyActionIsValid(false)
198 , m_syncNavigationActionPolicyAction(PolicyUse)
199 , m_syncNavigationActionPolicyDownloadID(0)
200 , m_processingMouseMoveEvent(false)
201 #if ENABLE(TOUCH_EVENTS)
202 , m_needTouchEvents(false)
205 , m_isPageSuspended(false)
207 , m_isSmartInsertDeleteEnabled(TextChecker::isSmartInsertDeleteEnabled())
209 , m_spellDocumentTag(0)
210 , m_hasSpellDocumentTag(false)
211 , m_pendingLearnOrIgnoreWordMessageCount(0)
212 , m_mainFrameHasCustomRepresentation(false)
213 , m_mainFrameHasHorizontalScrollbar(false)
214 , m_mainFrameHasVerticalScrollbar(false)
215 , m_canShortCircuitHorizontalWheelEvents(true)
216 , m_mainFrameIsPinnedToLeftSide(false)
217 , m_mainFrameIsPinnedToRightSide(false)
219 , m_renderTreeSize(0)
220 , m_shouldSendEventsSynchronously(false)
222 #if ENABLE(PAGE_VISIBILITY_API)
223 , m_visibilityState(PageVisibilityStateVisible)
227 webPageProxyCounter.increment();
230 WebContext::statistics().wkPageCount++;
232 m_pageGroup->addPage(this);
235 WebPageProxy::~WebPageProxy()
240 WebContext::statistics().wkPageCount--;
242 if (m_hasSpellDocumentTag)
243 TextChecker::closeSpellDocumentWithTag(m_spellDocumentTag);
245 m_pageGroup->removePage(this);
248 webPageProxyCounter.decrement();
252 WebProcessProxy* WebPageProxy::process() const
254 return m_process.get();
257 PlatformProcessIdentifier WebPageProxy::processIdentifier() const
262 return m_process->processIdentifier();
265 bool WebPageProxy::isValid()
267 // A page that has been explicitly closed is never valid.
274 void WebPageProxy::initializeLoaderClient(const WKPageLoaderClient* loadClient)
276 m_loaderClient.initialize(loadClient);
281 process()->send(Messages::WebPage::SetWillGoToBackForwardItemCallbackEnabled(loadClient->version > 0), m_pageID);
284 void WebPageProxy::initializePolicyClient(const WKPagePolicyClient* policyClient)
286 m_policyClient.initialize(policyClient);
289 void WebPageProxy::initializeFormClient(const WKPageFormClient* formClient)
291 m_formClient.initialize(formClient);
294 void WebPageProxy::initializeResourceLoadClient(const WKPageResourceLoadClient* client)
296 m_resourceLoadClient.initialize(client);
299 void WebPageProxy::initializeUIClient(const WKPageUIClient* client)
304 m_uiClient.initialize(client);
306 process()->send(Messages::WebPage::SetCanRunBeforeUnloadConfirmPanel(m_uiClient.canRunBeforeUnloadConfirmPanel()), m_pageID);
307 process()->send(Messages::WebPage::SetCanRunModal(m_uiClient.canRunModal()), m_pageID);
310 void WebPageProxy::initializeFindClient(const WKPageFindClient* client)
312 m_findClient.initialize(client);
315 #if ENABLE(CONTEXT_MENUS)
316 void WebPageProxy::initializeContextMenuClient(const WKPageContextMenuClient* client)
318 m_contextMenuClient.initialize(client);
322 void WebPageProxy::reattachToWebProcess()
328 m_process = m_process->context()->relaunchProcessIfNecessary();
329 process()->addExistingWebPage(this, m_pageID);
333 m_pageClient->didRelaunchProcess();
334 m_drawingArea->waitForBackingStoreUpdateOnNextPaint();
337 void WebPageProxy::reattachToWebProcessWithItem(WebBackForwardListItem* item)
339 if (item && item != m_backForwardList->currentItem())
340 m_backForwardList->goToItem(item);
342 reattachToWebProcess();
347 process()->send(Messages::WebPage::GoToBackForwardItem(item->itemID()), m_pageID);
348 process()->responsivenessTimer()->start();
351 void WebPageProxy::initializeWebPage()
355 BackForwardListItemVector items = m_backForwardList->entries();
356 for (size_t i = 0; i < items.size(); ++i)
357 process()->registerNewWebBackForwardListItem(items[i].get());
359 m_drawingArea = m_pageClient->createDrawingAreaProxy();
360 ASSERT(m_drawingArea);
362 #if ENABLE(INSPECTOR_SERVER)
363 if (m_pageGroup->preferences()->developerExtrasEnabled())
364 inspector()->enableRemoteInspection();
367 process()->send(Messages::WebProcess::CreateWebPage(m_pageID, creationParameters()), 0);
369 #if ENABLE(PAGE_VISIBILITY_API)
370 process()->send(Messages::WebPage::SetVisibilityState(m_visibilityState, /* isInitialState */ true), m_pageID);
374 void WebPageProxy::close()
381 m_backForwardList->pageClosed();
382 m_pageClient->pageClosed();
384 process()->disconnectFramesFromPage(this);
387 #if ENABLE(INSPECTOR)
389 m_inspector->invalidate();
394 #if ENABLE(FULLSCREEN_API)
395 if (m_fullScreenManager) {
396 m_fullScreenManager->invalidate();
397 m_fullScreenManager = 0;
401 if (m_openPanelResultListener) {
402 m_openPanelResultListener->invalidate();
403 m_openPanelResultListener = 0;
406 #if ENABLE(INPUT_TYPE_COLOR)
407 if (m_colorChooser) {
408 m_colorChooser->invalidate();
409 m_colorChooser = nullptr;
413 #if ENABLE(GEOLOCATION)
414 m_geolocationPermissionRequestManager.invalidateRequests();
417 m_notificationPermissionRequestManager.invalidateRequests();
418 #if ENABLE(TIZEN_MEDIA_STREAM)
419 m_userMediaPermissionRequestManager.invalidateRequests();
422 m_toolTip = String();
424 m_mainFrameHasHorizontalScrollbar = false;
425 m_mainFrameHasVerticalScrollbar = false;
427 m_mainFrameIsPinnedToLeftSide = false;
428 m_mainFrameIsPinnedToRightSide = false;
430 m_visibleScrollerThumbRect = IntRect();
432 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
433 invalidateCallbackMap(m_booleanCallbacks);
435 invalidateCallbackMap(m_voidCallbacks);
436 invalidateCallbackMap(m_dataCallbacks);
437 invalidateCallbackMap(m_stringCallbacks);
438 m_loadDependentStringCallbackIDs.clear();
439 invalidateCallbackMap(m_scriptValueCallbacks);
440 invalidateCallbackMap(m_computedPagesCallbacks);
442 invalidateCallbackMap(m_printFinishedCallbacks);
445 Vector<WebEditCommandProxy*> editCommandVector;
446 copyToVector(m_editCommandSet, editCommandVector);
447 m_editCommandSet.clear();
448 for (size_t i = 0, size = editCommandVector.size(); i < size; ++i)
449 editCommandVector[i]->invalidate();
451 m_activePopupMenu = 0;
453 m_estimatedProgress = 0.0;
455 m_loaderClient.initialize(0);
456 m_policyClient.initialize(0);
457 m_uiClient.initialize(0);
459 m_drawingArea = nullptr;
461 process()->send(Messages::WebPage::Close(), m_pageID);
462 process()->removeWebPage(m_pageID);
465 bool WebPageProxy::tryClose()
470 process()->send(Messages::WebPage::TryClose(), m_pageID);
471 process()->responsivenessTimer()->start();
475 bool WebPageProxy::maybeInitializeSandboxExtensionHandle(const KURL& url, SandboxExtension::Handle& sandboxExtensionHandle)
477 if (!url.isLocalFile())
480 #if ENABLE(INSPECTOR)
481 // Don't give the inspector full access to the file system.
482 if (WebInspectorProxy::isInspectorPage(this))
486 SandboxExtension::createHandle("/", SandboxExtension::ReadOnly, sandboxExtensionHandle);
490 void WebPageProxy::loadURL(const String& url)
492 setPendingAPIRequestURL(url);
495 reattachToWebProcess();
497 SandboxExtension::Handle sandboxExtensionHandle;
498 bool createdExtension = maybeInitializeSandboxExtensionHandle(KURL(KURL(), url), sandboxExtensionHandle);
499 if (createdExtension)
500 process()->willAcquireUniversalFileReadSandboxExtension();
501 process()->send(Messages::WebPage::LoadURL(url, sandboxExtensionHandle), m_pageID);
502 process()->responsivenessTimer()->start();
505 void WebPageProxy::loadURLRequest(WebURLRequest* urlRequest)
507 setPendingAPIRequestURL(urlRequest->resourceRequest().url());
510 reattachToWebProcess();
512 SandboxExtension::Handle sandboxExtensionHandle;
513 bool createdExtension = maybeInitializeSandboxExtensionHandle(urlRequest->resourceRequest().url(), sandboxExtensionHandle);
514 if (createdExtension)
515 process()->willAcquireUniversalFileReadSandboxExtension();
516 process()->send(Messages::WebPage::LoadURLRequest(urlRequest->resourceRequest(), sandboxExtensionHandle), m_pageID);
517 process()->responsivenessTimer()->start();
520 void WebPageProxy::loadHTMLString(const String& htmlString, const String& baseURL)
523 reattachToWebProcess();
525 process()->assumeReadAccessToBaseURL(baseURL);
526 process()->send(Messages::WebPage::LoadHTMLString(htmlString, baseURL), m_pageID);
527 process()->responsivenessTimer()->start();
530 void WebPageProxy::loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL)
533 reattachToWebProcess();
536 m_mainFrame->setUnreachableURL(unreachableURL);
538 process()->assumeReadAccessToBaseURL(baseURL);
539 process()->send(Messages::WebPage::LoadAlternateHTMLString(htmlString, baseURL, unreachableURL), m_pageID);
540 process()->responsivenessTimer()->start();
543 void WebPageProxy::loadPlainTextString(const String& string)
546 reattachToWebProcess();
548 process()->send(Messages::WebPage::LoadPlainTextString(string), m_pageID);
549 process()->responsivenessTimer()->start();
552 void WebPageProxy::loadWebArchiveData(const WebData* webArchiveData)
555 reattachToWebProcess();
557 process()->send(Messages::WebPage::LoadWebArchiveData(webArchiveData->dataReference()), m_pageID);
558 process()->responsivenessTimer()->start();
562 void WebPageProxy::loadContentsbyMimeType(const WebData* contents, const String& mimeType, const String& encoding, const String& baseURL)
565 reattachToWebProcess();
567 process()->assumeReadAccessToBaseURL(baseURL);
568 process()->send(Messages::WebPage::LoadContentsbyMimeType(contents->dataReference(), mimeType, encoding, baseURL), m_pageID);
569 process()->responsivenessTimer()->start();
573 void WebPageProxy::stopLoading()
578 process()->send(Messages::WebPage::StopLoading(), m_pageID);
579 process()->responsivenessTimer()->start();
582 void WebPageProxy::reload(bool reloadFromOrigin)
584 SandboxExtension::Handle sandboxExtensionHandle;
586 if (m_backForwardList->currentItem()) {
587 String url = m_backForwardList->currentItem()->url();
588 setPendingAPIRequestURL(url);
590 // We may not have an extension yet if back/forward list was reinstated after a WebProcess crash or a browser relaunch
591 bool createdExtension = maybeInitializeSandboxExtensionHandle(KURL(KURL(), url), sandboxExtensionHandle);
592 if (createdExtension)
593 process()->willAcquireUniversalFileReadSandboxExtension();
597 reattachToWebProcessWithItem(m_backForwardList->currentItem());
601 process()->send(Messages::WebPage::Reload(reloadFromOrigin, sandboxExtensionHandle), m_pageID);
602 process()->responsivenessTimer()->start();
605 void WebPageProxy::goForward()
607 if (isValid() && !canGoForward())
610 WebBackForwardListItem* forwardItem = m_backForwardList->forwardItem();
614 setPendingAPIRequestURL(forwardItem->url());
617 reattachToWebProcessWithItem(forwardItem);
621 process()->send(Messages::WebPage::GoForward(forwardItem->itemID()), m_pageID);
622 process()->responsivenessTimer()->start();
625 bool WebPageProxy::canGoForward() const
627 return m_backForwardList->forwardItem();
630 void WebPageProxy::goBack()
632 if (isValid() && !canGoBack())
635 WebBackForwardListItem* backItem = m_backForwardList->backItem();
639 setPendingAPIRequestURL(backItem->url());
642 reattachToWebProcessWithItem(backItem);
646 process()->send(Messages::WebPage::GoBack(backItem->itemID()), m_pageID);
647 process()->responsivenessTimer()->start();
650 bool WebPageProxy::canGoBack() const
652 return m_backForwardList->backItem();
655 void WebPageProxy::goToBackForwardItem(WebBackForwardListItem* item)
658 reattachToWebProcessWithItem(item);
662 setPendingAPIRequestURL(item->url());
664 process()->send(Messages::WebPage::GoToBackForwardItem(item->itemID()), m_pageID);
665 process()->responsivenessTimer()->start();
668 void WebPageProxy::tryRestoreScrollPosition()
673 process()->send(Messages::WebPage::TryRestoreScrollPosition(), m_pageID);
676 void WebPageProxy::didChangeBackForwardList(WebBackForwardListItem* added, Vector<RefPtr<APIObject> >* removed)
678 m_loaderClient.didChangeBackForwardList(this, added, removed);
681 void WebPageProxy::shouldGoToBackForwardListItem(uint64_t itemID, bool& shouldGoToBackForwardItem)
683 WebBackForwardListItem* item = process()->webBackForwardItem(itemID);
684 shouldGoToBackForwardItem = item && m_loaderClient.shouldGoToBackForwardListItem(this, item);
687 void WebPageProxy::willGoToBackForwardListItem(uint64_t itemID, CoreIPC::ArgumentDecoder* arguments)
689 RefPtr<APIObject> userData;
690 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
691 if (!arguments->decode(messageDecoder))
694 if (WebBackForwardListItem* item = process()->webBackForwardItem(itemID))
695 m_loaderClient.willGoToBackForwardListItem(this, item, userData.get());
698 String WebPageProxy::activeURL() const
700 // If there is a currently pending url, it is the active URL,
701 // even when there's no main frame yet, as it might be the
702 // first API request.
703 if (!m_pendingAPIRequestURL.isNull())
704 return m_pendingAPIRequestURL;
709 if (!m_mainFrame->unreachableURL().isEmpty())
710 return m_mainFrame->unreachableURL();
712 switch (m_mainFrame->loadState()) {
713 case WebFrameProxy::LoadStateProvisional:
714 return m_mainFrame->provisionalURL();
715 case WebFrameProxy::LoadStateCommitted:
716 case WebFrameProxy::LoadStateFinished:
717 return m_mainFrame->url();
720 ASSERT_NOT_REACHED();
724 String WebPageProxy::provisionalURL() const
728 return m_mainFrame->provisionalURL();
731 String WebPageProxy::committedURL() const
736 return m_mainFrame->url();
739 bool WebPageProxy::canShowMIMEType(const String& mimeType) const
741 if (MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType))
744 if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType))
747 if (mimeType.startsWith("text/", false))
748 return !MIMETypeRegistry::isUnsupportedTextMIMEType(mimeType);
750 #if ENABLE(TIZEN_FIX_PLUGIN_DOWNLOAD)
751 // check plugin mime types if the plugin option is enabled
752 if (arePluginsEnabled()) {
753 String newMimeType = mimeType;
754 PluginModuleInfo plugin = m_process->context()->pluginInfoStore().findPlugin(newMimeType, KURL());
755 if (!plugin.path.isNull())
758 #else // ENABLE(TIZEN_FIX_PLUGIN_DOWNLOAD)
759 String newMimeType = mimeType;
760 PluginModuleInfo plugin = m_process->context()->pluginInfoStore().findPlugin(newMimeType, KURL());
761 if (!plugin.path.isNull())
763 #endif // ENABLE(TIZEN_FIX_PLUGIN_DOWNLOAD)
768 void WebPageProxy::setDrawsBackground(bool drawsBackground)
770 if (m_drawsBackground == drawsBackground)
773 m_drawsBackground = drawsBackground;
776 process()->send(Messages::WebPage::SetDrawsBackground(drawsBackground), m_pageID);
779 void WebPageProxy::setDrawsTransparentBackground(bool drawsTransparentBackground)
781 if (m_drawsTransparentBackground == drawsTransparentBackground)
784 m_drawsTransparentBackground = drawsTransparentBackground;
787 process()->send(Messages::WebPage::SetDrawsTransparentBackground(drawsTransparentBackground), m_pageID);
790 void WebPageProxy::viewWillStartLiveResize()
794 process()->send(Messages::WebPage::ViewWillStartLiveResize(), m_pageID);
797 void WebPageProxy::viewWillEndLiveResize()
801 process()->send(Messages::WebPage::ViewWillEndLiveResize(), m_pageID);
804 void WebPageProxy::setViewNeedsDisplay(const IntRect& rect)
806 m_pageClient->setViewNeedsDisplay(rect);
809 void WebPageProxy::displayView()
811 m_pageClient->displayView();
814 void WebPageProxy::scrollView(const IntRect& scrollRect, const IntSize& scrollOffset)
816 m_pageClient->scrollView(scrollRect, scrollOffset);
819 void WebPageProxy::viewStateDidChange(ViewStateFlags flags)
824 if (flags & ViewIsFocused)
825 process()->send(Messages::WebPage::SetFocused(m_pageClient->isViewFocused()), m_pageID);
827 if (flags & ViewWindowIsActive)
828 process()->send(Messages::WebPage::SetActive(m_pageClient->isViewWindowActive()), m_pageID);
830 if (flags & ViewIsVisible) {
831 bool isVisible = m_pageClient->isViewVisible();
832 if (isVisible != m_isVisible) {
833 m_isVisible = isVisible;
834 m_drawingArea->visibilityDidChange();
837 // If we've started the responsiveness timer as part of telling the web process to update the backing store
838 // state, it might not send back a reply (since it won't paint anything if the web page is hidden) so we
839 // stop the unresponsiveness timer here.
840 process()->responsivenessTimer()->stop();
845 if (flags & ViewIsInWindow) {
846 bool isInWindow = m_pageClient->isViewInWindow();
847 if (m_isInWindow != isInWindow) {
848 m_isInWindow = isInWindow;
849 process()->send(Messages::WebPage::SetIsInWindow(isInWindow), m_pageID);
853 LayerHostingMode layerHostingMode = m_pageClient->viewLayerHostingMode();
854 if (m_layerHostingMode != layerHostingMode) {
855 m_layerHostingMode = layerHostingMode;
856 m_drawingArea->layerHostingModeDidChange();
861 #if ENABLE(PAGE_VISIBILITY_API)
862 PageVisibilityState visibilityState = PageVisibilityStateHidden;
864 if (m_pageClient->isViewVisible())
865 visibilityState = PageVisibilityStateVisible;
867 if (visibilityState != m_visibilityState) {
868 m_visibilityState = visibilityState;
869 process()->send(Messages::WebPage::SetVisibilityState(visibilityState, false), m_pageID);
873 updateBackingStoreDiscardableState();
876 IntSize WebPageProxy::viewSize() const
878 return m_pageClient->viewSize();
881 void WebPageProxy::setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent& keyboardEvent)
885 process()->send(Messages::WebPage::SetInitialFocus(forward, isKeyboardEventValid, keyboardEvent), m_pageID);
888 void WebPageProxy::setWindowResizerSize(const IntSize& windowResizerSize)
892 process()->send(Messages::WebPage::SetWindowResizerSize(windowResizerSize), m_pageID);
895 void WebPageProxy::clearSelection()
899 process()->send(Messages::WebPage::ClearSelection(), m_pageID);
902 void WebPageProxy::validateCommand(const String& commandName, PassRefPtr<ValidateCommandCallback> callback)
905 callback->invalidate();
909 uint64_t callbackID = callback->callbackID();
910 m_validateCommandCallbacks.set(callbackID, callback.get());
911 process()->send(Messages::WebPage::ValidateCommand(commandName, callbackID), m_pageID);
914 void WebPageProxy::setMaintainsInactiveSelection(bool newValue)
916 m_maintainsInactiveSelection = newValue;
919 void WebPageProxy::executeEditCommand(const String& commandName)
924 DEFINE_STATIC_LOCAL(String, ignoreSpellingCommandName, ("ignoreSpelling"));
925 if (commandName == ignoreSpellingCommandName)
926 ++m_pendingLearnOrIgnoreWordMessageCount;
928 process()->send(Messages::WebPage::ExecuteEditCommand(commandName), m_pageID);
931 #if USE(TILED_BACKING_STORE)
932 void WebPageProxy::setViewportSize(const IntSize& size)
937 process()->send(Messages::WebPage::SetViewportSize(size), m_pageID);
941 #if ENABLE(DRAG_SUPPORT)
942 void WebPageProxy::dragEntered(DragData* dragData, const String& dragStorageName)
944 SandboxExtension::Handle sandboxExtensionHandle;
945 SandboxExtension::HandleArray sandboxExtensionHandleEmptyArray;
946 performDragControllerAction(DragControllerActionEntered, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionHandleEmptyArray);
949 void WebPageProxy::dragUpdated(DragData* dragData, const String& dragStorageName)
951 SandboxExtension::Handle sandboxExtensionHandle;
952 SandboxExtension::HandleArray sandboxExtensionHandleEmptyArray;
953 performDragControllerAction(DragControllerActionUpdated, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionHandleEmptyArray);
956 void WebPageProxy::dragExited(DragData* dragData, const String& dragStorageName)
958 SandboxExtension::Handle sandboxExtensionHandle;
959 SandboxExtension::HandleArray sandboxExtensionHandleEmptyArray;
960 performDragControllerAction(DragControllerActionExited, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionHandleEmptyArray);
963 void WebPageProxy::performDrag(DragData* dragData, const String& dragStorageName, const SandboxExtension::Handle& sandboxExtensionHandle, const SandboxExtension::HandleArray& sandboxExtensionsForUpload)
965 performDragControllerAction(DragControllerActionPerformDrag, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionsForUpload);
968 void WebPageProxy::performDragControllerAction(DragControllerAction action, DragData* dragData, const String& dragStorageName, const SandboxExtension::Handle& sandboxExtensionHandle, const SandboxExtension::HandleArray& sandboxExtensionsForUpload)
973 // FIXME: We should pass the drag data map only on DragEnter.
974 process()->send(Messages::WebPage::PerformDragControllerAction(action, dragData->clientPosition(), dragData->globalPosition(),
975 dragData->draggingSourceOperationMask(), dragData->dragDataMap(), dragData->flags()), m_pageID);
976 #elif PLATFORM(QT) || PLATFORM(GTK)
977 process()->send(Messages::WebPage::PerformDragControllerAction(action, *dragData), m_pageID);
979 process()->send(Messages::WebPage::PerformDragControllerAction(action, dragData->clientPosition(), dragData->globalPosition(), dragData->draggingSourceOperationMask(), dragStorageName, dragData->flags(), sandboxExtensionHandle, sandboxExtensionsForUpload), m_pageID);
983 void WebPageProxy::didPerformDragControllerAction(WebCore::DragSession dragSession)
985 m_currentDragSession = dragSession;
988 #if PLATFORM(QT) || PLATFORM(GTK)
989 void WebPageProxy::startDrag(const DragData& dragData, const ShareableBitmap::Handle& dragImageHandle)
991 RefPtr<ShareableBitmap> dragImage = 0;
992 if (!dragImageHandle.isNull()) {
993 dragImage = ShareableBitmap::create(dragImageHandle);
998 m_pageClient->startDrag(dragData, dragImage.release());
1002 void WebPageProxy::dragEnded(const IntPoint& clientPosition, const IntPoint& globalPosition, uint64_t operation)
1006 process()->send(Messages::WebPage::DragEnded(clientPosition, globalPosition, operation), m_pageID);
1008 #endif // ENABLE(DRAG_SUPPORT)
1010 void WebPageProxy::handleMouseEvent(const NativeWebMouseEvent& event)
1015 // NOTE: This does not start the responsiveness timer because mouse move should not indicate interaction.
1016 if (event.type() != WebEvent::MouseMove)
1017 process()->responsivenessTimer()->start();
1019 if (m_processingMouseMoveEvent) {
1020 m_nextMouseMoveEvent = adoptPtr(new NativeWebMouseEvent(event));
1024 m_processingMouseMoveEvent = true;
1027 // <https://bugs.webkit.org/show_bug.cgi?id=57904> We need to keep track of the mouse down event in the case where we
1028 // display a popup menu for select elements. When the user changes the selected item,
1029 // we fake a mouse up event by using this stored down event. This event gets cleared
1030 // when the mouse up message is received from WebProcess.
1031 if (event.type() == WebEvent::MouseDown)
1032 m_currentlyProcessedMouseDownEvent = adoptPtr(new NativeWebMouseEvent(event));
1034 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
1035 // We have to hide text-selection's context menu when other area is clicked.
1036 // In case of normal context menu, it is hided by elm_ctxpopup's logic.
1037 if (event.type() == WebEvent::MouseDown)
1041 #if ENABLE(TIZEN_ISF_PORT)
1042 if (event.type() == WebEvent::MouseDown)
1043 m_pageClient->handleInputMethodMousePress();
1046 if (m_shouldSendEventsSynchronously) {
1047 bool handled = false;
1048 process()->sendSync(Messages::WebPage::MouseEventSyncForTesting(event), Messages::WebPage::MouseEventSyncForTesting::Reply(handled), m_pageID);
1049 didReceiveEvent(event.type(), handled);
1051 process()->send(Messages::WebPage::MouseEvent(event), m_pageID);
1054 #if MERGE_WHEEL_EVENTS
1055 static bool canCoalesce(const WebWheelEvent& a, const WebWheelEvent& b)
1057 if (a.position() != b.position())
1059 if (a.globalPosition() != b.globalPosition())
1061 if (a.modifiers() != b.modifiers())
1063 if (a.granularity() != b.granularity())
1066 if (a.phase() != b.phase())
1068 if (a.momentumPhase() != b.momentumPhase())
1070 if (a.hasPreciseScrollingDeltas() != b.hasPreciseScrollingDeltas())
1077 static WebWheelEvent coalesce(const WebWheelEvent& a, const WebWheelEvent& b)
1079 ASSERT(canCoalesce(a, b));
1081 FloatSize mergedDelta = a.delta() + b.delta();
1082 FloatSize mergedWheelTicks = a.wheelTicks() + b.wheelTicks();
1085 FloatSize mergedUnacceleratedScrollingDelta = a.unacceleratedScrollingDelta() + b.unacceleratedScrollingDelta();
1087 return WebWheelEvent(WebEvent::Wheel, b.position(), b.globalPosition(), mergedDelta, mergedWheelTicks, b.granularity(), b.directionInvertedFromDevice(), b.phase(), b.momentumPhase(), b.hasPreciseScrollingDeltas(), b.scrollCount(), mergedUnacceleratedScrollingDelta, b.modifiers(), b.timestamp());
1089 return WebWheelEvent(WebEvent::Wheel, b.position(), b.globalPosition(), mergedDelta, mergedWheelTicks, b.granularity(), b.modifiers(), b.timestamp());
1092 #endif // MERGE_WHEEL_EVENTS
1094 static WebWheelEvent coalescedWheelEvent(Deque<NativeWebWheelEvent>& queue, Vector<NativeWebWheelEvent>& coalescedEvents)
1096 ASSERT(!queue.isEmpty());
1097 ASSERT(coalescedEvents.isEmpty());
1099 #if MERGE_WHEEL_EVENTS
1100 NativeWebWheelEvent firstEvent = queue.takeFirst();
1101 coalescedEvents.append(firstEvent);
1103 WebWheelEvent event = firstEvent;
1104 while (!queue.isEmpty() && canCoalesce(event, queue.first())) {
1105 NativeWebWheelEvent firstEvent = queue.takeFirst();
1106 coalescedEvents.append(firstEvent);
1107 event = coalesce(event, firstEvent);
1112 while (!queue.isEmpty())
1113 coalescedEvents.append(queue.takeFirst());
1114 return coalescedEvents.last();
1118 void WebPageProxy::handleWheelEvent(const NativeWebWheelEvent& event)
1123 if (!m_currentlyProcessedWheelEvents.isEmpty()) {
1124 m_wheelEventQueue.append(event);
1125 if (m_wheelEventQueue.size() < wheelEventQueueSizeThreshold)
1127 // The queue has too many wheel events, so push a new event.
1130 if (!m_wheelEventQueue.isEmpty()) {
1131 processNextQueuedWheelEvent();
1135 OwnPtr<Vector<NativeWebWheelEvent> > coalescedWheelEvent = adoptPtr(new Vector<NativeWebWheelEvent>);
1136 coalescedWheelEvent->append(event);
1137 m_currentlyProcessedWheelEvents.append(coalescedWheelEvent.release());
1138 sendWheelEvent(event);
1141 void WebPageProxy::processNextQueuedWheelEvent()
1143 OwnPtr<Vector<NativeWebWheelEvent> > nextCoalescedEvent = adoptPtr(new Vector<NativeWebWheelEvent>);
1144 WebWheelEvent nextWheelEvent = coalescedWheelEvent(m_wheelEventQueue, *nextCoalescedEvent.get());
1145 m_currentlyProcessedWheelEvents.append(nextCoalescedEvent.release());
1146 sendWheelEvent(nextWheelEvent);
1149 void WebPageProxy::sendWheelEvent(const WebWheelEvent& event)
1151 process()->responsivenessTimer()->start();
1153 if (m_shouldSendEventsSynchronously) {
1154 bool handled = false;
1155 process()->sendSync(Messages::WebPage::WheelEventSyncForTesting(event), Messages::WebPage::WheelEventSyncForTesting::Reply(handled), m_pageID);
1156 didReceiveEvent(event.type(), handled);
1160 process()->send(Messages::EventDispatcher::WheelEvent(m_pageID, event, canGoBack(), canGoForward()), 0);
1163 void WebPageProxy::handleKeyboardEvent(const NativeWebKeyboardEvent& event)
1168 LOG(KeyHandling, "WebPageProxy::handleKeyboardEvent: %s", webKeyboardEventTypeString(event.type()));
1170 m_keyEventQueue.append(event);
1172 process()->responsivenessTimer()->start();
1173 if (m_shouldSendEventsSynchronously) {
1174 bool handled = false;
1175 process()->sendSync(Messages::WebPage::KeyEventSyncForTesting(event), Messages::WebPage::KeyEventSyncForTesting::Reply(handled), m_pageID);
1176 didReceiveEvent(event.type(), handled);
1178 process()->send(Messages::WebPage::KeyEvent(event), m_pageID);
1181 #if ENABLE(GESTURE_EVENTS)
1182 void WebPageProxy::handleGestureEvent(const WebGestureEvent& event)
1187 m_gestureEventQueue.append(event);
1189 process()->responsivenessTimer()->start();
1190 process()->send(Messages::EventDispatcher::GestureEvent(m_pageID, event), 0);
1194 #if ENABLE(TOUCH_EVENTS)
1196 void WebPageProxy::handlePotentialActivation(const IntPoint& touchPoint, const IntSize& touchArea)
1198 process()->send(Messages::WebPage::HighlightPotentialActivation(touchPoint, touchArea), m_pageID);
1202 void WebPageProxy::handleTouchEvent(const NativeWebTouchEvent& event)
1207 // If the page is suspended, which should be the case during panning, pinching
1208 // and animation on the page itself (kinetic scrolling, tap to zoom) etc, then
1209 // we do not send any of the events to the page even if is has listeners.
1210 if (m_needTouchEvents && !m_isPageSuspended) {
1212 // Do not send the TouchMove event if last TouchMove is not processed yet.
1213 // TouchMove event will be sent too many times without below codes,
1214 // and it will affect Web Applications' performance.
1215 if (event.type() == WebEvent::TouchMove
1216 && !m_touchEventQueue.isEmpty()
1217 && m_touchEventQueue.last().forwardedEvent.type() == event.type())
1220 m_touchEventQueue.append(event);
1221 process()->responsivenessTimer()->start();
1222 if (m_shouldSendEventsSynchronously) {
1223 bool handled = false;
1224 process()->sendSync(Messages::WebPage::TouchEventSyncForTesting(event), Messages::WebPage::TouchEventSyncForTesting::Reply(handled), m_pageID);
1225 didReceiveEvent(event.type(), handled);
1227 process()->send(Messages::WebPage::TouchEvent(event), m_pageID);
1229 if (m_touchEventQueue.isEmpty()) {
1230 bool isEventHandled = false;
1231 m_pageClient->doneWithTouchEvent(event, isEventHandled);
1233 // We attach the incoming events to the newest queued event so that all
1234 // the events are delivered in the correct order when the event is dequed.
1235 QueuedTouchEvents& lastEvent = m_touchEventQueue.last();
1236 lastEvent.deferredTouchEvents.append(event);
1242 #if ENABLE(TIZEN_VIBRATION)
1243 void WebPageProxy::vibrate(uint64_t time)
1245 m_pageClient->vibrate(time);
1248 void WebPageProxy::cancelVibration()
1250 m_pageClient->cancelVibration();
1254 #if ENABLE(SCREEN_ORIENTATION_SUPPORT) && ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT)
1255 void WebPageProxy::lockOrientation(int willLockOrientation, bool& result)
1257 result = m_pageClient->lockOrientation(willLockOrientation);
1259 void WebPageProxy::unlockOrientation()
1261 m_pageClient->unlockOrientation();
1265 void WebPageProxy::scrollBy(ScrollDirection direction, ScrollGranularity granularity)
1270 process()->send(Messages::WebPage::ScrollBy(direction, granularity), m_pageID);
1273 void WebPageProxy::centerSelectionInVisibleArea()
1278 process()->send(Messages::WebPage::CenterSelectionInVisibleArea(), m_pageID);
1281 void WebPageProxy::receivedPolicyDecision(PolicyAction action, WebFrameProxy* frame, uint64_t listenerID)
1286 if (action == PolicyIgnore)
1287 clearPendingAPIRequestURL();
1289 uint64_t downloadID = 0;
1290 if (action == PolicyDownload) {
1291 // Create a download proxy.
1292 DownloadProxy* download = m_process->context()->createDownloadProxy();
1293 downloadID = download->downloadID();
1295 // Our design does not suppport downloads without a WebPage.
1296 handleDownloadRequest(download);
1300 // If we received a policy decision while in decidePolicyForResponse the decision will
1301 // be sent back to the web process by decidePolicyForResponse.
1302 if (m_inDecidePolicyForResponse) {
1303 m_syncMimeTypePolicyActionIsValid = true;
1304 m_syncMimeTypePolicyAction = action;
1305 m_syncMimeTypePolicyDownloadID = downloadID;
1309 // If we received a policy decision while in decidePolicyForNavigationAction the decision will
1310 // be sent back to the web process by decidePolicyForNavigationAction.
1311 if (m_inDecidePolicyForNavigationAction) {
1312 m_syncNavigationActionPolicyActionIsValid = true;
1313 m_syncNavigationActionPolicyAction = action;
1314 m_syncNavigationActionPolicyDownloadID = downloadID;
1318 process()->send(Messages::WebPage::DidReceivePolicyDecision(frame->frameID(), listenerID, action, downloadID), m_pageID);
1321 String WebPageProxy::pageTitle() const
1323 // Return the null string if there is no main frame (e.g. nothing has been loaded in the page yet, WebProcess has
1324 // crashed, page has been closed).
1328 return m_mainFrame->title();
1331 void WebPageProxy::setUserAgent(const String& userAgent)
1333 if (m_userAgent == userAgent)
1335 m_userAgent = userAgent;
1339 process()->send(Messages::WebPage::SetUserAgent(m_userAgent), m_pageID);
1342 void WebPageProxy::setApplicationNameForUserAgent(const String& applicationName)
1344 if (m_applicationNameForUserAgent == applicationName)
1347 m_applicationNameForUserAgent = applicationName;
1348 if (!m_customUserAgent.isEmpty())
1351 setUserAgent(standardUserAgent(m_applicationNameForUserAgent));
1354 void WebPageProxy::setCustomUserAgent(const String& customUserAgent)
1356 if (m_customUserAgent == customUserAgent)
1359 m_customUserAgent = customUserAgent;
1361 if (m_customUserAgent.isEmpty()) {
1362 setUserAgent(standardUserAgent(m_applicationNameForUserAgent));
1366 setUserAgent(m_customUserAgent);
1369 void WebPageProxy::resumeActiveDOMObjectsAndAnimations()
1371 if (!isValid() || !m_isPageSuspended)
1374 m_isPageSuspended = false;
1376 process()->send(Messages::WebPage::ResumeActiveDOMObjectsAndAnimations(), m_pageID);
1379 void WebPageProxy::suspendActiveDOMObjectsAndAnimations()
1381 if (!isValid() || m_isPageSuspended)
1384 m_isPageSuspended = true;
1386 process()->send(Messages::WebPage::SuspendActiveDOMObjectsAndAnimations(), m_pageID);
1389 bool WebPageProxy::supportsTextEncoding() const
1391 return !m_mainFrameHasCustomRepresentation && m_mainFrame && !m_mainFrame->isDisplayingStandaloneImageDocument();
1394 void WebPageProxy::setCustomTextEncodingName(const String& encodingName)
1396 if (m_customTextEncodingName == encodingName)
1398 m_customTextEncodingName = encodingName;
1402 process()->send(Messages::WebPage::SetCustomTextEncodingName(encodingName), m_pageID);
1405 void WebPageProxy::terminateProcess()
1407 // NOTE: This uses a check of m_isValid rather than calling isValid() since
1408 // we want this to run even for pages being closed or that already closed.
1412 process()->terminate();
1415 #if !USE(CF) || defined(BUILDING_QT__)
1416 PassRefPtr<WebData> WebPageProxy::sessionStateData(WebPageProxySessionStateFilterCallback, void* context) const
1418 // FIXME: Return session state data for saving Page state.
1422 void WebPageProxy::restoreFromSessionStateData(WebData*)
1424 // FIXME: Restore the Page from the passed in session state data.
1428 bool WebPageProxy::supportsTextZoom() const
1430 if (m_mainFrameHasCustomRepresentation)
1433 // FIXME: This should also return false for standalone media and plug-in documents.
1434 if (!m_mainFrame || m_mainFrame->isDisplayingStandaloneImageDocument())
1440 void WebPageProxy::setTextZoomFactor(double zoomFactor)
1445 if (m_mainFrameHasCustomRepresentation)
1448 if (m_textZoomFactor == zoomFactor)
1451 m_textZoomFactor = zoomFactor;
1452 process()->send(Messages::WebPage::SetTextZoomFactor(m_textZoomFactor), m_pageID);
1455 double WebPageProxy::pageZoomFactor() const
1457 return m_mainFrameHasCustomRepresentation ? m_pageClient->customRepresentationZoomFactor() : m_pageZoomFactor;
1460 void WebPageProxy::setPageZoomFactor(double zoomFactor)
1465 if (m_mainFrameHasCustomRepresentation) {
1466 m_pageClient->setCustomRepresentationZoomFactor(zoomFactor);
1470 if (m_pageZoomFactor == zoomFactor)
1473 m_pageZoomFactor = zoomFactor;
1474 process()->send(Messages::WebPage::SetPageZoomFactor(m_pageZoomFactor), m_pageID);
1477 void WebPageProxy::setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor)
1482 if (m_mainFrameHasCustomRepresentation) {
1483 m_pageClient->setCustomRepresentationZoomFactor(pageZoomFactor);
1487 if (m_pageZoomFactor == pageZoomFactor && m_textZoomFactor == textZoomFactor)
1490 m_pageZoomFactor = pageZoomFactor;
1491 m_textZoomFactor = textZoomFactor;
1492 process()->send(Messages::WebPage::SetPageAndTextZoomFactors(m_pageZoomFactor, m_textZoomFactor), m_pageID);
1495 void WebPageProxy::scalePage(double scale, const IntPoint& origin)
1500 process()->send(Messages::WebPage::ScalePage(scale, origin), m_pageID);
1502 m_pageClient->setRequestedScaleFactor(scale);
1506 void WebPageProxy::setIntrinsicDeviceScaleFactor(float scaleFactor)
1508 if (m_intrinsicDeviceScaleFactor == scaleFactor)
1511 m_intrinsicDeviceScaleFactor = scaleFactor;
1514 m_drawingArea->deviceScaleFactorDidChange();
1517 void WebPageProxy::windowScreenDidChange(PlatformDisplayID displayID)
1522 process()->send(Messages::WebPage::WindowScreenDidChange(displayID), m_pageID);
1525 float WebPageProxy::deviceScaleFactor() const
1527 if (m_customDeviceScaleFactor)
1528 return m_customDeviceScaleFactor;
1529 return m_intrinsicDeviceScaleFactor;
1532 void WebPageProxy::setCustomDeviceScaleFactor(float customScaleFactor)
1537 if (m_customDeviceScaleFactor == customScaleFactor)
1540 float oldScaleFactor = deviceScaleFactor();
1542 m_customDeviceScaleFactor = customScaleFactor;
1544 if (deviceScaleFactor() != oldScaleFactor)
1545 m_drawingArea->deviceScaleFactorDidChange();
1548 void WebPageProxy::setUseFixedLayout(bool fixed)
1553 // This check is fine as the value is initialized in the web
1554 // process as part of the creation parameters.
1555 if (fixed == m_useFixedLayout)
1558 m_useFixedLayout = fixed;
1560 m_fixedLayoutSize = IntSize();
1561 process()->send(Messages::WebPage::SetUseFixedLayout(fixed), m_pageID);
1564 void WebPageProxy::setFixedLayoutSize(const IntSize& size)
1569 if (size == m_fixedLayoutSize)
1572 m_fixedLayoutSize = size;
1573 process()->send(Messages::WebPage::SetFixedLayoutSize(size), m_pageID);
1576 void WebPageProxy::setPaginationMode(WebCore::Page::Pagination::Mode mode)
1578 if (mode == m_paginationMode)
1581 m_paginationMode = mode;
1585 process()->send(Messages::WebPage::SetPaginationMode(mode), m_pageID);
1588 void WebPageProxy::setPaginationBehavesLikeColumns(bool behavesLikeColumns)
1590 if (behavesLikeColumns == m_paginationBehavesLikeColumns)
1593 m_paginationBehavesLikeColumns = behavesLikeColumns;
1597 process()->send(Messages::WebPage::SetPaginationBehavesLikeColumns(behavesLikeColumns), m_pageID);
1600 void WebPageProxy::setPageLength(double pageLength)
1602 if (pageLength == m_pageLength)
1605 m_pageLength = pageLength;
1609 process()->send(Messages::WebPage::SetPageLength(pageLength), m_pageID);
1612 void WebPageProxy::setGapBetweenPages(double gap)
1614 if (gap == m_gapBetweenPages)
1617 m_gapBetweenPages = gap;
1621 process()->send(Messages::WebPage::SetGapBetweenPages(gap), m_pageID);
1624 void WebPageProxy::pageScaleFactorDidChange(double scaleFactor)
1626 m_pageScaleFactor = scaleFactor;
1627 m_pageClient->pageScaleFactorDidChange();
1630 void WebPageProxy::setMemoryCacheClientCallsEnabled(bool memoryCacheClientCallsEnabled)
1635 if (m_areMemoryCacheClientCallsEnabled == memoryCacheClientCallsEnabled)
1638 m_areMemoryCacheClientCallsEnabled = memoryCacheClientCallsEnabled;
1639 process()->send(Messages::WebPage::SetMemoryCacheMessagesEnabled(memoryCacheClientCallsEnabled), m_pageID);
1642 void WebPageProxy::findString(const String& string, FindOptions options, unsigned maxMatchCount)
1644 if (m_mainFrameHasCustomRepresentation)
1645 m_pageClient->findStringInCustomRepresentation(string, options, maxMatchCount);
1647 process()->send(Messages::WebPage::FindString(string, options, maxMatchCount), m_pageID);
1650 void WebPageProxy::hideFindUI()
1652 process()->send(Messages::WebPage::HideFindUI(), m_pageID);
1655 void WebPageProxy::countStringMatches(const String& string, FindOptions options, unsigned maxMatchCount)
1657 if (m_mainFrameHasCustomRepresentation) {
1658 m_pageClient->countStringMatchesInCustomRepresentation(string, options, maxMatchCount);
1665 process()->send(Messages::WebPage::CountStringMatches(string, options, maxMatchCount), m_pageID);
1668 void WebPageProxy::runJavaScriptInMainFrame(const String& script, PassRefPtr<ScriptValueCallback> prpCallback)
1670 RefPtr<ScriptValueCallback> callback = prpCallback;
1672 callback->invalidate();
1676 uint64_t callbackID = callback->callbackID();
1677 m_scriptValueCallbacks.set(callbackID, callback.get());
1678 process()->send(Messages::WebPage::RunJavaScriptInMainFrame(script, callbackID), m_pageID);
1681 void WebPageProxy::getRenderTreeExternalRepresentation(PassRefPtr<StringCallback> prpCallback)
1683 RefPtr<StringCallback> callback = prpCallback;
1685 callback->invalidate();
1689 uint64_t callbackID = callback->callbackID();
1690 m_stringCallbacks.set(callbackID, callback.get());
1691 process()->send(Messages::WebPage::GetRenderTreeExternalRepresentation(callbackID), m_pageID);
1694 void WebPageProxy::getSourceForFrame(WebFrameProxy* frame, PassRefPtr<StringCallback> prpCallback)
1696 RefPtr<StringCallback> callback = prpCallback;
1698 callback->invalidate();
1702 uint64_t callbackID = callback->callbackID();
1703 m_loadDependentStringCallbackIDs.add(callbackID);
1704 m_stringCallbacks.set(callbackID, callback.get());
1705 process()->send(Messages::WebPage::GetSourceForFrame(frame->frameID(), callbackID), m_pageID);
1708 void WebPageProxy::getContentsAsString(PassRefPtr<StringCallback> prpCallback)
1710 RefPtr<StringCallback> callback = prpCallback;
1712 callback->invalidate();
1716 uint64_t callbackID = callback->callbackID();
1717 m_loadDependentStringCallbackIDs.add(callbackID);
1718 m_stringCallbacks.set(callbackID, callback.get());
1719 process()->send(Messages::WebPage::GetContentsAsString(callbackID), m_pageID);
1722 void WebPageProxy::getSelectionOrContentsAsString(PassRefPtr<StringCallback> prpCallback)
1724 RefPtr<StringCallback> callback = prpCallback;
1726 callback->invalidate();
1730 uint64_t callbackID = callback->callbackID();
1731 m_stringCallbacks.set(callbackID, callback.get());
1732 process()->send(Messages::WebPage::GetSelectionOrContentsAsString(callbackID), m_pageID);
1735 void WebPageProxy::getMainResourceDataOfFrame(WebFrameProxy* frame, PassRefPtr<DataCallback> prpCallback)
1737 RefPtr<DataCallback> callback = prpCallback;
1739 callback->invalidate();
1743 uint64_t callbackID = callback->callbackID();
1744 m_dataCallbacks.set(callbackID, callback.get());
1745 process()->send(Messages::WebPage::GetMainResourceDataOfFrame(frame->frameID(), callbackID), m_pageID);
1748 void WebPageProxy::getResourceDataFromFrame(WebFrameProxy* frame, WebURL* resourceURL, PassRefPtr<DataCallback> prpCallback)
1750 RefPtr<DataCallback> callback = prpCallback;
1752 callback->invalidate();
1756 uint64_t callbackID = callback->callbackID();
1757 m_dataCallbacks.set(callbackID, callback.get());
1758 process()->send(Messages::WebPage::GetResourceDataFromFrame(frame->frameID(), resourceURL->string(), callbackID), m_pageID);
1761 void WebPageProxy::getWebArchiveOfFrame(WebFrameProxy* frame, PassRefPtr<DataCallback> prpCallback)
1763 RefPtr<DataCallback> callback = prpCallback;
1765 callback->invalidate();
1769 uint64_t callbackID = callback->callbackID();
1770 m_dataCallbacks.set(callbackID, callback.get());
1771 process()->send(Messages::WebPage::GetWebArchiveOfFrame(frame->frameID(), callbackID), m_pageID);
1774 void WebPageProxy::forceRepaint(PassRefPtr<VoidCallback> prpCallback)
1776 RefPtr<VoidCallback> callback = prpCallback;
1778 callback->invalidate();
1782 uint64_t callbackID = callback->callbackID();
1783 m_voidCallbacks.set(callbackID, callback.get());
1784 m_drawingArea->waitForBackingStoreUpdateOnNextPaint();
1785 process()->send(Messages::WebPage::ForceRepaint(callbackID), m_pageID);
1788 void WebPageProxy::preferencesDidChange()
1793 #if ENABLE(INSPECTOR_SERVER)
1794 if (m_pageGroup->preferences()->developerExtrasEnabled())
1795 inspector()->enableRemoteInspection();
1798 // FIXME: It probably makes more sense to send individual preference changes.
1799 // However, WebKitTestRunner depends on getting a preference change notification
1800 // even if nothing changed in UI process, so that overrides get removed.
1802 // Preferences need to be updated during synchronous printing to make "print backgrounds" preference work when toggled from a print dialog checkbox.
1803 process()->send(Messages::WebPage::PreferencesDidChange(pageGroup()->preferences()->store()), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
1806 void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
1808 if (messageID.is<CoreIPC::MessageClassDrawingAreaProxy>()) {
1809 m_drawingArea->didReceiveDrawingAreaProxyMessage(connection, messageID, arguments);
1813 #if USE(UI_SIDE_COMPOSITING)
1814 if (messageID.is<CoreIPC::MessageClassLayerTreeHostProxy>()) {
1815 m_drawingArea->didReceiveLayerTreeHostProxyMessage(connection, messageID, arguments);
1820 #if ENABLE(INSPECTOR)
1821 if (messageID.is<CoreIPC::MessageClassWebInspectorProxy>()) {
1822 if (WebInspectorProxy* inspector = this->inspector())
1823 inspector->didReceiveWebInspectorProxyMessage(connection, messageID, arguments);
1828 #if ENABLE(FULLSCREEN_API)
1829 if (messageID.is<CoreIPC::MessageClassWebFullScreenManagerProxy>()) {
1830 fullScreenManager()->didReceiveMessage(connection, messageID, arguments);
1835 didReceiveWebPageProxyMessage(connection, messageID, arguments);
1838 void WebPageProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, OwnPtr<CoreIPC::ArgumentEncoder>& reply)
1840 #if ENABLE(INSPECTOR)
1841 if (messageID.is<CoreIPC::MessageClassWebInspectorProxy>()) {
1842 if (WebInspectorProxy* inspector = this->inspector())
1843 inspector->didReceiveSyncWebInspectorProxyMessage(connection, messageID, arguments, reply);
1848 #if ENABLE(FULLSCREEN_API)
1849 if (messageID.is<CoreIPC::MessageClassWebFullScreenManagerProxy>()) {
1850 fullScreenManager()->didReceiveSyncMessage(connection, messageID, arguments, reply);
1855 // FIXME: Do something with reply.
1856 didReceiveSyncWebPageProxyMessage(connection, messageID, arguments, reply);
1859 void WebPageProxy::didCreateMainFrame(uint64_t frameID)
1861 MESSAGE_CHECK(!m_mainFrame);
1862 MESSAGE_CHECK(process()->canCreateFrame(frameID));
1864 m_mainFrame = WebFrameProxy::create(this, frameID);
1866 // Add the frame to the process wide map.
1867 process()->frameCreated(frameID, m_mainFrame.get());
1870 void WebPageProxy::didCreateSubframe(uint64_t frameID, uint64_t parentFrameID)
1872 MESSAGE_CHECK(m_mainFrame);
1874 WebFrameProxy* parentFrame = process()->webFrame(parentFrameID);
1875 MESSAGE_CHECK(parentFrame);
1876 MESSAGE_CHECK(parentFrame->isDescendantOf(m_mainFrame.get()));
1878 MESSAGE_CHECK(process()->canCreateFrame(frameID));
1880 RefPtr<WebFrameProxy> subFrame = WebFrameProxy::create(this, frameID);
1882 // Add the frame to the process wide map.
1883 process()->frameCreated(frameID, subFrame.get());
1885 // Insert the frame into the frame hierarchy.
1886 parentFrame->appendChild(subFrame.get());
1889 static bool isDisconnectedFrame(WebFrameProxy* frame)
1891 return !frame->page() || !frame->page()->mainFrame() || !frame->isDescendantOf(frame->page()->mainFrame());
1894 void WebPageProxy::didSaveFrameToPageCache(uint64_t frameID)
1896 MESSAGE_CHECK(m_mainFrame);
1898 WebFrameProxy* subframe = process()->webFrame(frameID);
1899 MESSAGE_CHECK(subframe);
1901 if (isDisconnectedFrame(subframe))
1904 MESSAGE_CHECK(subframe->isDescendantOf(m_mainFrame.get()));
1906 subframe->didRemoveFromHierarchy();
1909 void WebPageProxy::didRestoreFrameFromPageCache(uint64_t frameID, uint64_t parentFrameID)
1911 MESSAGE_CHECK(m_mainFrame);
1913 WebFrameProxy* subframe = process()->webFrame(frameID);
1914 MESSAGE_CHECK(subframe);
1915 MESSAGE_CHECK(!subframe->parentFrame());
1916 MESSAGE_CHECK(subframe->page() == m_mainFrame->page());
1918 WebFrameProxy* parentFrame = process()->webFrame(parentFrameID);
1919 MESSAGE_CHECK(parentFrame);
1920 MESSAGE_CHECK(parentFrame->isDescendantOf(m_mainFrame.get()));
1922 // Insert the frame into the frame hierarchy.
1923 parentFrame->appendChild(subframe);
1927 // Always start progress at initialProgressValue. This helps provide feedback as
1928 // soon as a load starts.
1930 static const double initialProgressValue = 0.1;
1932 double WebPageProxy::estimatedProgress() const
1934 if (!pendingAPIRequestURL().isNull())
1935 return initialProgressValue;
1936 return m_estimatedProgress;
1939 void WebPageProxy::didStartProgress()
1941 m_estimatedProgress = initialProgressValue;
1944 //FIXME: After ewk_view_loader_client is implemented,
1945 // consider this line to move to loaderClient.
1946 m_pageClient->didStartProgress();
1949 m_loaderClient.didStartProgress(this);
1952 void WebPageProxy::didChangeProgress(double value)
1954 m_estimatedProgress = value;
1956 m_loaderClient.didChangeProgress(this);
1959 void WebPageProxy::didFinishProgress()
1961 m_estimatedProgress = 1.0;
1964 //FIXME: consider to move this to loaderClient.
1965 m_pageClient->didFinishProgress();
1968 m_loaderClient.didFinishProgress(this);
1971 void WebPageProxy::didStartProvisionalLoadForFrame(uint64_t frameID, const String& url, const String& unreachableURL, CoreIPC::ArgumentDecoder* arguments)
1973 clearPendingAPIRequestURL();
1975 RefPtr<APIObject> userData;
1976 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
1977 if (!arguments->decode(messageDecoder))
1980 WebFrameProxy* frame = process()->webFrame(frameID);
1981 MESSAGE_CHECK(frame);
1982 MESSAGE_CHECK_URL(url);
1984 frame->setUnreachableURL(unreachableURL);
1986 frame->didStartProvisionalLoad(url);
1987 m_loaderClient.didStartProvisionalLoadForFrame(this, frame, userData.get());
1990 void WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, const String& url, CoreIPC::ArgumentDecoder* arguments)
1992 RefPtr<APIObject> userData;
1993 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
1994 if (!arguments->decode(messageDecoder))
1997 WebFrameProxy* frame = process()->webFrame(frameID);
1998 MESSAGE_CHECK(frame);
1999 MESSAGE_CHECK_URL(url);
2001 frame->didReceiveServerRedirectForProvisionalLoad(url);
2003 m_loaderClient.didReceiveServerRedirectForProvisionalLoadForFrame(this, frame, userData.get());
2006 void WebPageProxy::didFailProvisionalLoadForFrame(uint64_t frameID, const ResourceError& error, CoreIPC::ArgumentDecoder* arguments)
2008 RefPtr<APIObject> userData;
2009 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2010 if (!arguments->decode(messageDecoder))
2013 WebFrameProxy* frame = process()->webFrame(frameID);
2014 MESSAGE_CHECK(frame);
2016 frame->didFailProvisionalLoad();
2018 m_loaderClient.didFailProvisionalLoadWithErrorForFrame(this, frame, error, userData.get());
2021 void WebPageProxy::clearLoadDependentCallbacks()
2023 Vector<uint64_t> callbackIDsCopy;
2024 copyToVector(m_loadDependentStringCallbackIDs, callbackIDsCopy);
2025 m_loadDependentStringCallbackIDs.clear();
2027 for (size_t i = 0; i < callbackIDsCopy.size(); ++i) {
2028 RefPtr<StringCallback> callback = m_stringCallbacks.take(callbackIDsCopy[i]);
2030 callback->invalidate();
2034 void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, const String& mimeType, bool frameHasCustomRepresentation, const PlatformCertificateInfo& certificateInfo, CoreIPC::ArgumentDecoder* arguments)
2036 RefPtr<APIObject> userData;
2037 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2038 if (!arguments->decode(messageDecoder))
2041 WebFrameProxy* frame = process()->webFrame(frameID);
2042 MESSAGE_CHECK(frame);
2045 // FIXME (bug 59111): didCommitLoadForFrame comes too late when restoring a page from b/f cache, making us disable secure event mode in password fields.
2046 // FIXME (bug 59121): A load going on in one frame shouldn't affect typing in sibling frames.
2047 m_pageClient->resetTextInputState();
2048 #if !defined(BUILDING_ON_SNOW_LEOPARD)
2049 // FIXME: Should this be moved inside resetTextInputState()?
2050 dismissCorrectionPanel(ReasonForDismissingAlternativeTextIgnored);
2051 m_pageClient->dismissDictionaryLookupPanel();
2055 clearLoadDependentCallbacks();
2057 frame->didCommitLoad(mimeType, certificateInfo);
2059 if (frame->isMainFrame()) {
2060 m_mainFrameHasCustomRepresentation = frameHasCustomRepresentation;
2062 if (m_mainFrameHasCustomRepresentation) {
2063 // Always assume that the main frame is pinned here, since the custom representation view will handle
2064 // any wheel events and dispatch them to the WKView when necessary.
2065 m_mainFrameIsPinnedToLeftSide = true;
2066 m_mainFrameIsPinnedToRightSide = true;
2068 m_pageClient->didCommitLoadForMainFrame(frameHasCustomRepresentation);
2071 m_loaderClient.didCommitLoadForFrame(this, frame, userData.get());
2074 void WebPageProxy::didFinishDocumentLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2076 RefPtr<APIObject> userData;
2077 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2078 if (!arguments->decode(messageDecoder))
2081 WebFrameProxy* frame = process()->webFrame(frameID);
2082 MESSAGE_CHECK(frame);
2084 m_loaderClient.didFinishDocumentLoadForFrame(this, frame, userData.get());
2087 void WebPageProxy::didFinishLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2089 RefPtr<APIObject> userData;
2090 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2091 if (!arguments->decode(messageDecoder))
2094 WebFrameProxy* frame = process()->webFrame(frameID);
2095 MESSAGE_CHECK(frame);
2097 frame->didFinishLoad();
2100 if (frame->isMainFrame())
2101 m_pageClient->didFinishLoadForMainFrame();
2104 m_loaderClient.didFinishLoadForFrame(this, frame, userData.get());
2107 void WebPageProxy::didFailLoadForFrame(uint64_t frameID, const ResourceError& error, CoreIPC::ArgumentDecoder* arguments)
2109 RefPtr<APIObject> userData;
2110 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2111 if (!arguments->decode(messageDecoder))
2114 WebFrameProxy* frame = process()->webFrame(frameID);
2115 MESSAGE_CHECK(frame);
2117 clearLoadDependentCallbacks();
2119 frame->didFailLoad();
2121 m_loaderClient.didFailLoadWithErrorForFrame(this, frame, error, userData.get());
2124 void WebPageProxy::didSameDocumentNavigationForFrame(uint64_t frameID, uint32_t opaqueSameDocumentNavigationType, const String& url, CoreIPC::ArgumentDecoder* arguments)
2126 RefPtr<APIObject> userData;
2127 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2128 if (!arguments->decode(messageDecoder))
2131 WebFrameProxy* frame = process()->webFrame(frameID);
2132 MESSAGE_CHECK(frame);
2133 MESSAGE_CHECK_URL(url);
2135 clearPendingAPIRequestURL();
2136 frame->didSameDocumentNavigation(url);
2138 #if ENABLE(TIZEN_ISF_PORT)
2139 if (m_pageClient->getInputMethodState()) {
2140 LOG(ISF, "%s\n", __func__);
2141 setInputMethodState(false, String(), String());
2145 m_loaderClient.didSameDocumentNavigationForFrame(this, frame, static_cast<SameDocumentNavigationType>(opaqueSameDocumentNavigationType), userData.get());
2148 void WebPageProxy::didReceiveTitleForFrame(uint64_t frameID, const String& title, CoreIPC::ArgumentDecoder* arguments)
2150 RefPtr<APIObject> userData;
2151 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2152 if (!arguments->decode(messageDecoder))
2155 WebFrameProxy* frame = process()->webFrame(frameID);
2156 MESSAGE_CHECK(frame);
2158 frame->didChangeTitle(title);
2160 m_loaderClient.didReceiveTitleForFrame(this, title, frame, userData.get());
2163 void WebPageProxy::didFirstLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2165 RefPtr<APIObject> userData;
2166 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2167 if (!arguments->decode(messageDecoder))
2170 WebFrameProxy* frame = process()->webFrame(frameID);
2171 MESSAGE_CHECK(frame);
2173 m_loaderClient.didFirstLayoutForFrame(this, frame, userData.get());
2176 void WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2178 RefPtr<APIObject> userData;
2179 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2180 if (!arguments->decode(messageDecoder))
2183 WebFrameProxy* frame = process()->webFrame(frameID);
2184 MESSAGE_CHECK(frame);
2187 if (frame->isMainFrame())
2188 m_pageClient->didFirstVisuallyNonEmptyLayoutForMainFrame();
2191 m_loaderClient.didFirstVisuallyNonEmptyLayoutForFrame(this, frame, userData.get());
2194 void WebPageProxy::didNewFirstVisuallyNonEmptyLayout(CoreIPC::ArgumentDecoder* arguments)
2196 RefPtr<APIObject> userData;
2197 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2198 if (!arguments->decode(messageDecoder))
2201 m_loaderClient.didNewFirstVisuallyNonEmptyLayout(this, userData.get());
2204 void WebPageProxy::didRemoveFrameFromHierarchy(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2206 RefPtr<APIObject> userData;
2207 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2208 if (!arguments->decode(messageDecoder))
2211 WebFrameProxy* frame = process()->webFrame(frameID);
2212 MESSAGE_CHECK(frame);
2214 frame->didRemoveFromHierarchy();
2216 m_loaderClient.didRemoveFrameFromHierarchy(this, frame, userData.get());
2219 void WebPageProxy::didDisplayInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2221 RefPtr<APIObject> userData;
2222 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2223 if (!arguments->decode(messageDecoder))
2226 WebFrameProxy* frame = process()->webFrame(frameID);
2227 MESSAGE_CHECK(frame);
2229 m_loaderClient.didDisplayInsecureContentForFrame(this, frame, userData.get());
2232 void WebPageProxy::didRunInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2234 RefPtr<APIObject> userData;
2235 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2236 if (!arguments->decode(messageDecoder))
2239 WebFrameProxy* frame = process()->webFrame(frameID);
2240 MESSAGE_CHECK(frame);
2242 m_loaderClient.didRunInsecureContentForFrame(this, frame, userData.get());
2245 void WebPageProxy::didDetectXSSForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2247 RefPtr<APIObject> userData;
2248 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2249 if (!arguments->decode(messageDecoder))
2252 WebFrameProxy* frame = process()->webFrame(frameID);
2253 MESSAGE_CHECK(frame);
2255 m_loaderClient.didDetectXSSForFrame(this, frame, userData.get());
2258 void WebPageProxy::frameDidBecomeFrameSet(uint64_t frameID, bool value)
2260 WebFrameProxy* frame = process()->webFrame(frameID);
2261 MESSAGE_CHECK(frame);
2263 frame->setIsFrameSet(value);
2264 if (frame->isMainFrame())
2265 m_frameSetLargestFrame = value ? m_mainFrame : 0;
2269 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)
2271 RefPtr<APIObject> userData;
2272 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2273 if (!arguments->decode(messageDecoder))
2276 if (request.url() != pendingAPIRequestURL())
2277 clearPendingAPIRequestURL();
2279 WebFrameProxy* frame = process()->webFrame(frameID);
2280 MESSAGE_CHECK(frame);
2281 MESSAGE_CHECK_URL(request.url());
2283 NavigationType navigationType = static_cast<NavigationType>(opaqueNavigationType);
2284 WebEvent::Modifiers modifiers = static_cast<WebEvent::Modifiers>(opaqueModifiers);
2285 WebMouseEvent::Button mouseButton = static_cast<WebMouseEvent::Button>(opaqueMouseButton);
2287 RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID);
2289 ASSERT(!m_inDecidePolicyForNavigationAction);
2291 m_inDecidePolicyForNavigationAction = true;
2292 m_syncNavigationActionPolicyActionIsValid = false;
2294 if (!m_policyClient.decidePolicyForNavigationAction(this, frame, navigationType, modifiers, mouseButton, request, listener.get(), userData.get()))
2297 m_inDecidePolicyForNavigationAction = false;
2299 // Check if we received a policy decision already. If we did, we can just pass it back.
2300 receivedPolicyAction = m_syncNavigationActionPolicyActionIsValid;
2301 if (m_syncNavigationActionPolicyActionIsValid) {
2302 policyAction = m_syncNavigationActionPolicyAction;
2303 downloadID = m_syncNavigationActionPolicyDownloadID;
2307 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)
2309 RefPtr<APIObject> userData;
2310 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2311 if (!arguments->decode(messageDecoder))
2314 WebFrameProxy* frame = process()->webFrame(frameID);
2315 MESSAGE_CHECK(frame);
2316 MESSAGE_CHECK_URL(request.url());
2318 NavigationType navigationType = static_cast<NavigationType>(opaqueNavigationType);
2319 WebEvent::Modifiers modifiers = static_cast<WebEvent::Modifiers>(opaqueModifiers);
2320 WebMouseEvent::Button mouseButton = static_cast<WebMouseEvent::Button>(opaqueMouseButton);
2322 RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID);
2323 if (!m_policyClient.decidePolicyForNewWindowAction(this, frame, navigationType, modifiers, mouseButton, request, frameName, listener.get(), userData.get()))
2327 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)
2329 RefPtr<APIObject> userData;
2330 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2331 if (!arguments->decode(messageDecoder))
2334 WebFrameProxy* frame = process()->webFrame(frameID);
2335 MESSAGE_CHECK(frame);
2336 MESSAGE_CHECK_URL(request.url());
2337 MESSAGE_CHECK_URL(response.url());
2339 RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID);
2341 ASSERT(!m_inDecidePolicyForResponse);
2343 m_inDecidePolicyForResponse = true;
2344 m_syncMimeTypePolicyActionIsValid = false;
2346 if (!m_policyClient.decidePolicyForResponse(this, frame, response, request, listener.get(), userData.get()))
2349 m_inDecidePolicyForResponse = false;
2351 // Check if we received a policy decision already. If we did, we can just pass it back.
2352 receivedPolicyAction = m_syncMimeTypePolicyActionIsValid;
2353 if (m_syncMimeTypePolicyActionIsValid) {
2354 policyAction = m_syncMimeTypePolicyAction;
2355 downloadID = m_syncMimeTypePolicyDownloadID;
2359 void WebPageProxy::unableToImplementPolicy(uint64_t frameID, const ResourceError& error, CoreIPC::ArgumentDecoder* arguments)
2361 RefPtr<APIObject> userData;
2362 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2363 if (!arguments->decode(messageDecoder))
2366 WebFrameProxy* frame = process()->webFrame(frameID);
2367 MESSAGE_CHECK(frame);
2369 m_policyClient.unableToImplementPolicy(this, frame, error, userData.get());
2374 void WebPageProxy::willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments)
2376 RefPtr<APIObject> userData;
2377 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2378 if (!arguments->decode(messageDecoder))
2381 WebFrameProxy* frame = process()->webFrame(frameID);
2382 MESSAGE_CHECK(frame);
2384 WebFrameProxy* sourceFrame = process()->webFrame(sourceFrameID);
2385 MESSAGE_CHECK(sourceFrame);
2387 RefPtr<WebFormSubmissionListenerProxy> listener = frame->setUpFormSubmissionListenerProxy(listenerID);
2388 if (!m_formClient.willSubmitForm(this, frame, sourceFrame, textFieldValues.stringPairVector(), userData.get(), listener.get()))
2389 listener->continueSubmission();
2392 // ResourceLoad Client
2394 void WebPageProxy::didInitiateLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceRequest& request, bool pageIsProvisionallyLoading)
2396 WebFrameProxy* frame = process()->webFrame(frameID);
2397 MESSAGE_CHECK(frame);
2398 MESSAGE_CHECK_URL(request.url());
2400 m_resourceLoadClient.didInitiateLoadForResource(this, frame, resourceIdentifier, request, pageIsProvisionallyLoading);
2403 void WebPageProxy::didSendRequestForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceRequest& request, const ResourceResponse& redirectResponse)
2405 WebFrameProxy* frame = process()->webFrame(frameID);
2406 MESSAGE_CHECK(frame);
2407 MESSAGE_CHECK_URL(request.url());
2409 m_resourceLoadClient.didSendRequestForResource(this, frame, resourceIdentifier, request, redirectResponse);
2412 void WebPageProxy::didReceiveResponseForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceResponse& response)
2414 WebFrameProxy* frame = process()->webFrame(frameID);
2415 MESSAGE_CHECK(frame);
2416 MESSAGE_CHECK_URL(response.url());
2418 m_resourceLoadClient.didReceiveResponseForResource(this, frame, resourceIdentifier, response);
2421 void WebPageProxy::didReceiveContentLengthForResource(uint64_t frameID, uint64_t resourceIdentifier, uint64_t contentLength)
2423 WebFrameProxy* frame = process()->webFrame(frameID);
2424 MESSAGE_CHECK(frame);
2426 m_resourceLoadClient.didReceiveContentLengthForResource(this, frame, resourceIdentifier, contentLength);
2429 void WebPageProxy::didFinishLoadForResource(uint64_t frameID, uint64_t resourceIdentifier)
2431 WebFrameProxy* frame = process()->webFrame(frameID);
2432 MESSAGE_CHECK(frame);
2434 m_resourceLoadClient.didFinishLoadForResource(this, frame, resourceIdentifier);
2437 void WebPageProxy::didFailLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceError& error)
2439 WebFrameProxy* frame = process()->webFrame(frameID);
2440 MESSAGE_CHECK(frame);
2442 m_resourceLoadClient.didFailLoadForResource(this, frame, resourceIdentifier, error);
2447 void WebPageProxy::createNewPage(const ResourceRequest& request, const WindowFeatures& windowFeatures, uint32_t opaqueModifiers, int32_t opaqueMouseButton, uint64_t& newPageID, WebPageCreationParameters& newPageParameters)
2449 RefPtr<WebPageProxy> newPage = m_uiClient.createNewPage(this, request, windowFeatures, static_cast<WebEvent::Modifiers>(opaqueModifiers), static_cast<WebMouseEvent::Button>(opaqueMouseButton));
2451 newPageID = newPage->pageID();
2452 newPageParameters = newPage->creationParameters();
2457 void WebPageProxy::showPage()
2459 m_uiClient.showPage(this);
2462 void WebPageProxy::closePage(bool stopResponsivenessTimer)
2464 if (stopResponsivenessTimer)
2465 process()->responsivenessTimer()->stop();
2467 m_pageClient->clearAllEditCommands();
2468 m_uiClient.close(this);
2472 void WebPageProxy::runJavaScriptAlert(uint64_t frameID, const String& message, PassRefPtr<Messages::WebPageProxy::RunJavaScriptAlert::DelayedReply> reply)
2474 WebFrameProxy* frame = process()->webFrame(frameID);
2475 MESSAGE_CHECK(frame);
2477 // Since runJavaScriptAlert() can spin a nested run loop we need to turn off the responsiveness timer.
2478 process()->responsivenessTimer()->stop();
2480 m_alertReply = reply;
2481 if (!m_uiClient.runJavaScriptAlert(this, message, frame))
2482 replyJavaScriptAlert();
2485 void WebPageProxy::runJavaScriptConfirm(uint64_t frameID, const String& message, PassRefPtr<Messages::WebPageProxy::RunJavaScriptConfirm::DelayedReply> reply)
2487 WebFrameProxy* frame = process()->webFrame(frameID);
2488 MESSAGE_CHECK(frame);
2490 // Since runJavaScriptConfirm() can spin a nested run loop we need to turn off the responsiveness timer.
2491 process()->responsivenessTimer()->stop();
2493 m_confirmReply = reply;
2494 if (!m_uiClient.runJavaScriptConfirm(this, message, frame))
2495 replyJavaScriptConfirm(false);
2498 void WebPageProxy::runJavaScriptPrompt(uint64_t frameID, const String& message, const String& defaultValue, PassRefPtr<Messages::WebPageProxy::RunJavaScriptPrompt::DelayedReply> reply)
2500 WebFrameProxy* frame = process()->webFrame(frameID);
2501 MESSAGE_CHECK(frame);
2503 // Since runJavaScriptPrompt() can spin a nested run loop we need to turn off the responsiveness timer.
2504 process()->responsivenessTimer()->stop();
2506 m_promptReply = reply;
2507 if (!m_uiClient.runJavaScriptPrompt(this, message, defaultValue, frame))
2508 replyJavaScriptPrompt(String());
2511 void WebPageProxy::runJavaScriptAlert(uint64_t frameID, const String& message)
2513 WebFrameProxy* frame = process()->webFrame(frameID);
2514 MESSAGE_CHECK(frame);
2516 // Since runJavaScriptAlert() can spin a nested run loop we need to turn off the responsiveness timer.
2517 process()->responsivenessTimer()->stop();
2519 m_uiClient.runJavaScriptAlert(this, message, frame);
2522 void WebPageProxy::runJavaScriptConfirm(uint64_t frameID, const String& message, bool& result)
2524 WebFrameProxy* frame = process()->webFrame(frameID);
2525 MESSAGE_CHECK(frame);
2527 // Since runJavaScriptConfirm() can spin a nested run loop we need to turn off the responsiveness timer.
2528 process()->responsivenessTimer()->stop();
2530 result = m_uiClient.runJavaScriptConfirm(this, message, frame);
2533 void WebPageProxy::runJavaScriptPrompt(uint64_t frameID, const String& message, const String& defaultValue, String& result)
2535 WebFrameProxy* frame = process()->webFrame(frameID);
2536 MESSAGE_CHECK(frame);
2538 // Since runJavaScriptPrompt() can spin a nested run loop we need to turn off the responsiveness timer.
2539 process()->responsivenessTimer()->stop();
2541 result = m_uiClient.runJavaScriptPrompt(this, message, defaultValue, frame);
2545 void WebPageProxy::shouldInterruptJavaScript(bool& result)
2547 // Since shouldInterruptJavaScript() can spin a nested run loop we need to turn off the responsiveness timer.
2548 process()->responsivenessTimer()->stop();
2550 result = m_uiClient.shouldInterruptJavaScript(this);
2553 void WebPageProxy::setStatusText(const String& text)
2555 m_uiClient.setStatusText(this, text);
2558 void WebPageProxy::mouseDidMoveOverElement(const WebHitTestResult::Data& hitTestResultData, uint32_t opaqueModifiers, CoreIPC::ArgumentDecoder* arguments)
2560 RefPtr<APIObject> userData;
2561 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2562 if (!arguments->decode(messageDecoder))
2565 WebEvent::Modifiers modifiers = static_cast<WebEvent::Modifiers>(opaqueModifiers);
2567 m_uiClient.mouseDidMoveOverElement(this, hitTestResultData, modifiers, userData.get());
2570 void WebPageProxy::unavailablePluginButtonClicked(uint32_t opaquePluginUnavailabilityReason, const String& mimeType, const String& url, const String& pluginsPageURL)
2572 MESSAGE_CHECK_URL(url);
2573 MESSAGE_CHECK_URL(pluginsPageURL);
2575 WKPluginUnavailabilityReason pluginUnavailabilityReason = static_cast<WKPluginUnavailabilityReason>(opaquePluginUnavailabilityReason);
2576 m_uiClient.unavailablePluginButtonClicked(this, pluginUnavailabilityReason, mimeType, url, pluginsPageURL);
2579 void WebPageProxy::setToolbarsAreVisible(bool toolbarsAreVisible)
2581 m_uiClient.setToolbarsAreVisible(this, toolbarsAreVisible);
2584 void WebPageProxy::getToolbarsAreVisible(bool& toolbarsAreVisible)
2586 toolbarsAreVisible = m_uiClient.toolbarsAreVisible(this);
2589 void WebPageProxy::setMenuBarIsVisible(bool menuBarIsVisible)
2591 m_uiClient.setMenuBarIsVisible(this, menuBarIsVisible);
2594 void WebPageProxy::getMenuBarIsVisible(bool& menuBarIsVisible)
2596 menuBarIsVisible = m_uiClient.menuBarIsVisible(this);
2599 void WebPageProxy::setStatusBarIsVisible(bool statusBarIsVisible)
2601 m_uiClient.setStatusBarIsVisible(this, statusBarIsVisible);
2604 void WebPageProxy::getStatusBarIsVisible(bool& statusBarIsVisible)
2606 statusBarIsVisible = m_uiClient.statusBarIsVisible(this);
2609 void WebPageProxy::setIsResizable(bool isResizable)
2611 m_uiClient.setIsResizable(this, isResizable);
2614 void WebPageProxy::getIsResizable(bool& isResizable)
2616 isResizable = m_uiClient.isResizable(this);
2619 void WebPageProxy::setWindowFrame(const FloatRect& newWindowFrame)
2621 m_uiClient.setWindowFrame(this, m_pageClient->convertToDeviceSpace(newWindowFrame));
2624 void WebPageProxy::getWindowFrame(FloatRect& newWindowFrame)
2626 newWindowFrame = m_pageClient->convertToUserSpace(m_uiClient.windowFrame(this));
2629 void WebPageProxy::screenToWindow(const IntPoint& screenPoint, IntPoint& windowPoint)
2631 windowPoint = m_pageClient->screenToWindow(screenPoint);
2634 void WebPageProxy::windowToScreen(const IntRect& viewRect, IntRect& result)
2636 result = m_pageClient->windowToScreen(viewRect);
2639 void WebPageProxy::runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose)
2641 WebFrameProxy* frame = process()->webFrame(frameID);
2642 MESSAGE_CHECK(frame);
2644 // Since runBeforeUnloadConfirmPanel() can spin a nested run loop we need to turn off the responsiveness timer.
2645 process()->responsivenessTimer()->stop();
2647 shouldClose = m_uiClient.runBeforeUnloadConfirmPanel(this, message, frame);
2650 #if USE(TILED_BACKING_STORE)
2651 void WebPageProxy::pageDidRequestScroll(const IntPoint& point)
2653 m_pageClient->pageDidRequestScroll(point);
2657 void WebPageProxy::didChangeViewportProperties(const ViewportAttributes& attr)
2659 m_pageClient->didChangeViewportProperties(attr);
2662 void WebPageProxy::pageDidScroll()
2664 m_uiClient.pageDidScroll(this);
2665 #if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD)
2666 dismissCorrectionPanel(ReasonForDismissingAlternativeTextIgnored);
2670 void WebPageProxy::runOpenPanel(uint64_t frameID, const FileChooserSettings& settings)
2672 if (m_openPanelResultListener) {
2673 m_openPanelResultListener->invalidate();
2674 m_openPanelResultListener = 0;
2677 WebFrameProxy* frame = process()->webFrame(frameID);
2678 MESSAGE_CHECK(frame);
2680 RefPtr<WebOpenPanelParameters> parameters = WebOpenPanelParameters::create(settings);
2681 m_openPanelResultListener = WebOpenPanelResultListenerProxy::create(this);
2683 // Since runOpenPanel() can spin a nested run loop we need to turn off the responsiveness timer.
2684 process()->responsivenessTimer()->stop();
2686 if (!m_uiClient.runOpenPanel(this, frame, parameters.get(), m_openPanelResultListener.get()))
2687 didCancelForOpenPanel();
2690 void WebPageProxy::printFrame(uint64_t frameID)
2692 ASSERT(!m_isPerformingDOMPrintOperation);
2693 m_isPerformingDOMPrintOperation = true;
2695 WebFrameProxy* frame = process()->webFrame(frameID);
2696 MESSAGE_CHECK(frame);
2698 m_uiClient.printFrame(this, frame);
2700 endPrinting(); // Send a message synchronously while m_isPerformingDOMPrintOperation is still true.
2701 m_isPerformingDOMPrintOperation = false;
2704 void WebPageProxy::printMainFrame()
2706 printFrame(m_mainFrame->frameID());
2709 #if ENABLE(TIZEN_REGISTER_PROTOCOL_HANDLER)
2710 void WebPageProxy::registerProtocolHandler(const String& scheme, const String& baseURL, const String& url, const String& title)
2712 m_pageClient->registerProtocolHandler(scheme, baseURL, url, title);
2716 #if ENABLE(TIZEN_REGISTER_CONTENT_HANDLER)
2717 void WebPageProxy::registerContentHandler(const String& mimeType, const String& baseURL, const String& url, const String& title)
2719 m_pageClient->registerContentHandler(mimeType, baseURL, url, title);
2723 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
2724 void WebPageProxy::getStandaloneStatus(bool& standalone)
2726 standalone = m_pageClient->getStandaloneStatus();
2729 void WebPageProxy::getWebAppCapable(PassRefPtr<BooleanCallback> prpCallback)
2731 RefPtr<BooleanCallback> callback = prpCallback;
2733 callback->invalidate();
2737 uint64_t callbackID = callback->callbackID();
2738 m_booleanCallbacks.set(callbackID, callback.get());
2739 process()->send(Messages::WebPage::GetWebAppCapable(callbackID), m_pageID);
2742 void WebPageProxy::didGetWebAppCapable(const bool capable, uint64_t callbackID)
2744 RefPtr<BooleanCallback> callback = m_booleanCallbacks.take(callbackID);
2746 // FIXME: Log error or assert.
2747 // this can validly happen if a load invalidated the callback, though
2751 m_booleanCallbacks.remove(callbackID);
2752 callback->performCallbackWithReturnValue(WebBoolean::create(capable).leakRef());
2755 void WebPageProxy::getWebAppIconURL(PassRefPtr<StringCallback> prpCallback)
2757 RefPtr<StringCallback> callback = prpCallback;
2759 callback->invalidate();
2763 uint64_t callbackID = callback->callbackID();
2764 m_stringCallbacks.set(callbackID, callback.get());
2765 process()->send(Messages::WebPage::GetWebAppIconURL(callbackID), m_pageID);
2768 void WebPageProxy::didGetWebAppIconURL(const String& iconURL, uint64_t callbackID)
2770 RefPtr<StringCallback> callback = m_stringCallbacks.take(callbackID);
2772 // FIXME: Log error or assert.
2773 // this can validly happen if a load invalidated the callback, though
2777 m_stringCallbacks.remove(callbackID);
2778 callback->performCallbackWithReturnValue(iconURL.impl());
2782 void WebPageProxy::setMediaVolume(float volume)
2784 if (volume == m_mediaVolume)
2787 m_mediaVolume = volume;
2792 process()->send(Messages::WebPage::SetMediaVolume(volume), m_pageID);
2796 void WebPageProxy::didChangeContentsSize(const IntSize& size)
2798 m_pageClient->didChangeContentsSize(size);
2801 void WebPageProxy::didFindZoomableArea(const IntPoint& target, const IntRect& area)
2803 m_pageClient->didFindZoomableArea(target, area);
2806 void WebPageProxy::findZoomableAreaForPoint(const IntPoint& point, const IntSize& area)
2811 process()->send(Messages::WebPage::FindZoomableAreaForPoint(point, area), m_pageID);
2814 void WebPageProxy::didReceiveMessageFromNavigatorQtObject(const String& contents)
2816 m_pageClient->didReceiveMessageFromNavigatorQtObject(contents);
2819 void WebPageProxy::handleDownloadRequest(DownloadProxy* download)
2821 m_pageClient->handleDownloadRequest(download);
2824 void WebPageProxy::authenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password)
2826 m_pageClient->handleAuthenticationRequiredRequest(hostname, realm, prefilledUsername, username, password);
2829 void WebPageProxy::proxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password)
2831 m_pageClient->handleProxyAuthenticationRequiredRequest(hostname, port, prefilledUsername, username, password);
2834 void WebPageProxy::certificateVerificationRequest(const String& hostname, bool& ignoreErrors)
2836 m_pageClient->handleCertificateVerificationRequest(hostname, ignoreErrors);
2838 #endif // PLATFORM(QT).
2840 #if ENABLE(TOUCH_EVENTS)
2841 void WebPageProxy::needTouchEvents(bool needTouchEvents)
2843 m_needTouchEvents = needTouchEvents;
2847 #if ENABLE(INPUT_TYPE_COLOR)
2848 void WebPageProxy::showColorChooser(const WebCore::Color& initialColor)
2850 ASSERT(!m_colorChooser);
2852 m_colorChooser = m_pageClient->createColorChooserProxy(this, initialColor);
2855 void WebPageProxy::setColorChooserColor(const WebCore::Color& color)
2857 ASSERT(m_colorChooser);
2859 m_colorChooser->setSelectedColor(color);
2862 void WebPageProxy::endColorChooser()
2864 ASSERT(m_colorChooser);
2866 m_colorChooser->endChooser();
2869 void WebPageProxy::didChooseColor(const WebCore::Color& color)
2874 process()->send(Messages::WebPage::DidChooseColor(color), m_pageID);
2877 void WebPageProxy::didEndColorChooser()
2882 ASSERT(m_colorChooser);
2884 #if !ENABLE(TIZEN_INPUT_COLOR_PICKER) // prevent crash when the color chooser closed
2885 m_colorChooser->invalidate();
2887 m_colorChooser = nullptr;
2889 process()->send(Messages::WebPage::DidEndColorChooser(), m_pageID);
2893 void WebPageProxy::didDraw()
2895 m_uiClient.didDraw(this);
2900 #if ENABLE(INSPECTOR)
2902 WebInspectorProxy* WebPageProxy::inspector()
2904 if (isClosed() || !isValid())
2907 m_inspector = WebInspectorProxy::create(this);
2908 return m_inspector.get();
2913 #if ENABLE(FULLSCREEN_API)
2914 WebFullScreenManagerProxy* WebPageProxy::fullScreenManager()
2916 if (!m_fullScreenManager)
2917 m_fullScreenManager = WebFullScreenManagerProxy::create(this);
2918 return m_fullScreenManager.get();
2924 void WebPageProxy::backForwardAddItem(uint64_t itemID)
2926 m_backForwardList->addItem(process()->webBackForwardItem(itemID));
2929 void WebPageProxy::backForwardGoToItem(uint64_t itemID, SandboxExtension::Handle& sandboxExtensionHandle)
2931 WebBackForwardListItem* item = process()->webBackForwardItem(itemID);
2935 bool createdExtension = maybeInitializeSandboxExtensionHandle(KURL(KURL(), item->url()), sandboxExtensionHandle);
2936 if (createdExtension)
2937 process()->willAcquireUniversalFileReadSandboxExtension();
2938 m_backForwardList->goToItem(item);
2941 void WebPageProxy::backForwardItemAtIndex(int32_t index, uint64_t& itemID)
2943 WebBackForwardListItem* item = m_backForwardList->itemAtIndex(index);
2944 itemID = item ? item->itemID() : 0;
2947 void WebPageProxy::backForwardBackListCount(int32_t& count)
2949 count = m_backForwardList->backListCount();
2952 void WebPageProxy::backForwardForwardListCount(int32_t& count)
2954 count = m_backForwardList->forwardListCount();
2957 void WebPageProxy::editorStateChanged(const EditorState& editorState)
2960 bool couldChangeSecureInputState = m_editorState.isInPasswordField != editorState.isInPasswordField || m_editorState.selectionIsNone;
2963 m_editorState = editorState;
2966 m_pageClient->updateTextInputState(couldChangeSecureInputState);
2968 m_pageClient->updateTextInputState();
2971 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
2972 m_pageClient->updateTextSelection();
2978 void WebPageProxy::registerEditCommandForUndo(uint64_t commandID, uint32_t editAction)
2980 registerEditCommand(WebEditCommandProxy::create(commandID, static_cast<EditAction>(editAction), this), Undo);
2983 void WebPageProxy::canUndoRedo(uint32_t action, bool& result)
2985 result = m_pageClient->canUndoRedo(static_cast<UndoOrRedo>(action));
2988 void WebPageProxy::executeUndoRedo(uint32_t action, bool& result)
2990 m_pageClient->executeUndoRedo(static_cast<UndoOrRedo>(action));
2994 void WebPageProxy::clearAllEditCommands()
2996 m_pageClient->clearAllEditCommands();
2999 void WebPageProxy::didCountStringMatches(const String& string, uint32_t matchCount)
3001 m_findClient.didCountStringMatches(this, string, matchCount);
3004 void WebPageProxy::setFindIndicator(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, const ShareableBitmap::Handle& contentImageHandle, bool fadeOut, bool animate)
3006 RefPtr<FindIndicator> findIndicator = FindIndicator::create(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, contentImageScaleFactor, contentImageHandle);
3007 m_pageClient->setFindIndicator(findIndicator.release(), fadeOut, animate);
3010 void WebPageProxy::didFindString(const String& string, uint32_t matchCount)
3012 m_findClient.didFindString(this, string, matchCount);
3015 void WebPageProxy::didFailToFindString(const String& string)
3017 m_findClient.didFailToFindString(this, string);
3020 void WebPageProxy::valueChangedForPopupMenu(WebPopupMenuProxy*, int32_t newSelectedIndex)
3022 process()->send(Messages::WebPage::DidChangeSelectedIndexForActivePopupMenu(newSelectedIndex), m_pageID);
3025 void WebPageProxy::setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index)
3027 process()->send(Messages::WebPage::SetTextForActivePopupMenu(index), m_pageID);
3030 NativeWebMouseEvent* WebPageProxy::currentlyProcessedMouseDownEvent()
3032 return m_currentlyProcessedMouseDownEvent.get();
3036 void WebPageProxy::failedToShowPopupMenu()
3038 process()->send(Messages::WebPage::FailedToShowPopupMenu(), m_pageID);
3042 void WebPageProxy::showPopupMenu(const IntRect& rect, uint64_t textDirection, const Vector<WebPopupItem>& items, int32_t selectedIndex, const PlatformPopupMenuData& data)
3044 if (m_activePopupMenu) {
3045 m_activePopupMenu->hidePopupMenu();
3046 m_activePopupMenu->invalidate();
3047 m_activePopupMenu = 0;
3050 m_activePopupMenu = m_pageClient->createPopupMenuProxy(this);
3052 // Since showPopupMenu() can spin a nested run loop we need to turn off the responsiveness timer.
3053 process()->responsivenessTimer()->stop();
3055 RefPtr<WebPopupMenuProxy> protectedActivePopupMenu = m_activePopupMenu;
3057 protectedActivePopupMenu->showPopupMenu(rect, static_cast<TextDirection>(textDirection), m_pageScaleFactor, items, data, selectedIndex);
3059 protectedActivePopupMenu->invalidate();
3061 protectedActivePopupMenu = 0;
3064 void WebPageProxy::hidePopupMenu()
3066 if (!m_activePopupMenu)
3069 m_activePopupMenu->hidePopupMenu();
3070 m_activePopupMenu->invalidate();
3071 m_activePopupMenu = 0;
3074 #if ENABLE(CONTEXT_MENUS)
3075 void WebPageProxy::showContextMenu(const IntPoint& menuLocation, const WebHitTestResult::Data& hitTestResultData, const Vector<WebContextMenuItemData>& proposedItems, CoreIPC::ArgumentDecoder* arguments)
3077 internalShowContextMenu(menuLocation, hitTestResultData, proposedItems, arguments);
3079 // No matter the result of internalShowContextMenu, always notify the WebProcess that the menu is hidden so it starts handling mouse events again.
3080 process()->send(Messages::WebPage::ContextMenuHidden(), m_pageID);
3081 #if ENABLE(TOUCH_EVENTS) && ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
3082 // Cancel touch event when ContextMenu is shown.
3083 m_pageClient->cancelTouchEvent();
3087 void WebPageProxy::internalShowContextMenu(const IntPoint& menuLocation, const WebHitTestResult::Data& hitTestResultData, const Vector<WebContextMenuItemData>& proposedItems, CoreIPC::ArgumentDecoder* arguments)
3089 RefPtr<APIObject> userData;
3090 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
3091 if (!arguments->decode(messageDecoder))
3094 m_activeContextMenuHitTestResultData = hitTestResultData;
3096 if (m_activeContextMenu) {
3097 m_activeContextMenu->hideContextMenu();
3098 m_activeContextMenu = 0;
3101 m_activeContextMenu = m_pageClient->createContextMenuProxy(this);
3103 // Since showContextMenu() can spin a nested run loop we need to turn off the responsiveness timer.
3104 process()->responsivenessTimer()->stop();
3106 // Give the PageContextMenuClient one last swipe at changing the menu.
3107 Vector<WebContextMenuItemData> items;
3108 if (!m_contextMenuClient.getContextMenuFromProposedMenu(this, proposedItems, items, hitTestResultData, userData.get()))
3109 m_activeContextMenu->showContextMenu(menuLocation, proposedItems);
3111 m_activeContextMenu->showContextMenu(menuLocation, items);
3113 m_contextMenuClient.contextMenuDismissed(this);
3116 void WebPageProxy::contextMenuItemSelected(const WebContextMenuItemData& item)
3118 // Application custom items don't need to round-trip through to WebCore in the WebProcess.
3119 if (item.action() >= ContextMenuItemBaseApplicationTag) {
3120 m_contextMenuClient.customContextMenuItemSelected(this, item);
3121 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
3122 m_pageClient->setIsTextSelectionMode(false);
3127 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
3128 if (item.action() == ContextMenuItemTagPaste)
3129 m_pageClient->setIsTextSelectionMode(false);
3133 if (item.action() == ContextMenuItemTagSmartCopyPaste) {
3134 setSmartInsertDeleteEnabled(!isSmartInsertDeleteEnabled());
3137 if (item.action() == ContextMenuItemTagSmartQuotes) {
3138 TextChecker::setAutomaticQuoteSubstitutionEnabled(!TextChecker::state().isAutomaticQuoteSubstitutionEnabled);
3139 process()->updateTextCheckerState();
3142 if (item.action() == ContextMenuItemTagSmartDashes) {
3143 TextChecker::setAutomaticDashSubstitutionEnabled(!TextChecker::state().isAutomaticDashSubstitutionEnabled);
3144 process()->updateTextCheckerState();
3147 if (item.action() == ContextMenuItemTagSmartLinks) {
3148 TextChecker::setAutomaticLinkDetectionEnabled(!TextChecker::state().isAutomaticLinkDetectionEnabled);
3149 process()->updateTextCheckerState();
3152 if (item.action() == ContextMenuItemTagTextReplacement) {
3153 TextChecker::setAutomaticTextReplacementEnabled(!TextChecker::state().isAutomaticTextReplacementEnabled);
3154 process()->updateTextCheckerState();
3157 if (item.action() == ContextMenuItemTagCorrectSpellingAutomatically) {
3158 TextChecker::setAutomaticSpellingCorrectionEnabled(!TextChecker::state().isAutomaticSpellingCorrectionEnabled);
3159 process()->updateTextCheckerState();
3162 if (item.action() == ContextMenuItemTagShowSubstitutions) {
3163 TextChecker::toggleSubstitutionsPanelIsShowing();
3167 if (item.action() == ContextMenuItemTagDownloadImageToDisk) {
3168 m_process->context()->download(this, KURL(KURL(), m_activeContextMenuHitTestResultData.absoluteImageURL));
3171 if (item.action() == ContextMenuItemTagDownloadLinkToDisk) {
3172 m_process->context()->download(this, KURL(KURL(), m_activeContextMenuHitTestResultData.absoluteLinkURL));
3175 if (item.action() == ContextMenuItemTagCheckSpellingWhileTyping) {
3176 TextChecker::setContinuousSpellCheckingEnabled(!TextChecker::state().isContinuousSpellCheckingEnabled);
3177 process()->updateTextCheckerState();
3180 if (item.action() == ContextMenuItemTagCheckGrammarWithSpelling) {
3181 TextChecker::setGrammarCheckingEnabled(!TextChecker::state().isGrammarCheckingEnabled);
3182 process()->updateTextCheckerState();
3185 if (item.action() == ContextMenuItemTagShowSpellingPanel) {
3186 if (!TextChecker::spellingUIIsShowing())
3187 advanceToNextMisspelling(true);
3188 TextChecker::toggleSpellingUIIsShowing();
3191 if (item.action() == ContextMenuItemTagLearnSpelling || item.action() == ContextMenuItemTagIgnoreSpelling)
3192 ++m_pendingLearnOrIgnoreWordMessageCount;
3194 #if ENABLE(TIZEN_WEBKIT_PASTEBOARD)
3195 if (item.action() == ContextMenuItemTagPaste) {
3196 // process paste after getting data from clipboard.
3197 pasteWithClipboard();
3202 #if ENABLE(CONTEXT_MENUS)
3203 process()->send(Messages::WebPage::DidSelectItemFromActiveContextMenu(item), m_pageID);
3206 #endif // ENABLE(CONTEXT_MENUS)
3208 void WebPageProxy::didChooseFilesForOpenPanel(const Vector<String>& fileURLs)
3213 #if ENABLE(WEB_PROCESS_SANDBOX)
3214 // FIXME: The sandbox extensions should be sent with the DidChooseFilesForOpenPanel message. This
3215 // is gated on a way of passing SandboxExtension::Handles in a Vector.
3216 for (size_t i = 0; i < fileURLs.size(); ++i) {
3217 SandboxExtension::Handle sandboxExtensionHandle;
3218 SandboxExtension::createHandle(fileURLs[i], SandboxExtension::ReadOnly, sandboxExtensionHandle);
3219 process()->send(Messages::WebPage::ExtendSandboxForFileFromOpenPanel(sandboxExtensionHandle), m_pageID);
3223 process()->send(Messages::WebPage::DidChooseFilesForOpenPanel(fileURLs), m_pageID);
3225 m_openPanelResultListener->invalidate();
3226 m_openPanelResultListener = 0;
3229 void WebPageProxy::didCancelForOpenPanel()
3234 process()->send(Messages::WebPage::DidCancelForOpenPanel(), m_pageID);
3236 m_openPanelResultListener->invalidate();
3237 m_openPanelResultListener = 0;
3240 void WebPageProxy::advanceToNextMisspelling(bool startBeforeSelection) const
3242 process()->send(Messages::WebPage::AdvanceToNextMisspelling(startBeforeSelection), m_pageID);
3245 void WebPageProxy::changeSpellingToWord(const String& word) const
3250 process()->send(Messages::WebPage::ChangeSpellingToWord(word), m_pageID);
3253 void WebPageProxy::registerEditCommand(PassRefPtr<WebEditCommandProxy> commandProxy, UndoOrRedo undoOrRedo)
3255 m_pageClient->registerEditCommand(commandProxy, undoOrRedo);
3258 void WebPageProxy::addEditCommand(WebEditCommandProxy* command)
3260 m_editCommandSet.add(command);
3263 void WebPageProxy::removeEditCommand(WebEditCommandProxy* command)
3265 m_editCommandSet.remove(command);
3269 process()->send(Messages::WebPage::DidRemoveEditCommand(command->commandID()), m_pageID);
3272 bool WebPageProxy::isValidEditCommand(WebEditCommandProxy* command)
3274 return m_editCommandSet.find(command) != m_editCommandSet.end();
3277 int64_t WebPageProxy::spellDocumentTag()
3279 if (!m_hasSpellDocumentTag) {
3280 m_spellDocumentTag = TextChecker::uniqueSpellDocumentTag(this);
3281 m_hasSpellDocumentTag = true;
3284 return m_spellDocumentTag;
3287 #if USE(UNIFIED_TEXT_CHECKING)
3288 void WebPageProxy::checkTextOfParagraph(const String& text, uint64_t checkingTypes, Vector<TextCheckingResult>& results)
3290 results = TextChecker::checkTextOfParagraph(spellDocumentTag(), text.characters(), text.length(), checkingTypes);
3294 void WebPageProxy::checkSpellingOfString(const String& text, int32_t& misspellingLocation, int32_t& misspellingLength)
3296 TextChecker::checkSpellingOfString(spellDocumentTag(), text.characters(), text.length(), misspellingLocation, misspellingLength);
3299 void WebPageProxy::checkGrammarOfString(const String& text, Vector<GrammarDetail>& grammarDetails, int32_t& badGrammarLocation, int32_t& badGrammarLength)
3301 TextChecker::checkGrammarOfString(spellDocumentTag(), text.characters(), text.length(), grammarDetails, badGrammarLocation, badGrammarLength);
3304 void WebPageProxy::spellingUIIsShowing(bool& isShowing)
3306 isShowing = TextChecker::spellingUIIsShowing();
3309 void WebPageProxy::updateSpellingUIWithMisspelledWord(const String& misspelledWord)
3311 TextChecker::updateSpellingUIWithMisspelledWord(spellDocumentTag(), misspelledWord);
3314 void WebPageProxy::updateSpellingUIWithGrammarString(const String& badGrammarPhrase, const GrammarDetail& grammarDetail)
3316 TextChecker::updateSpellingUIWithGrammarString(spellDocumentTag(), badGrammarPhrase, grammarDetail);
3319 void WebPageProxy::getGuessesForWord(const String& word, const String& context, Vector<String>& guesses)
3321 TextChecker::getGuessesForWord(spellDocumentTag(), word, context, guesses);
3324 void WebPageProxy::learnWord(const String& word)
3326 MESSAGE_CHECK(m_pendingLearnOrIgnoreWordMessageCount);
3327 --m_pendingLearnOrIgnoreWordMessageCount;
3329 TextChecker::learnWord(spellDocumentTag(), word);
3332 void WebPageProxy::ignoreWord(const String& word)
3334 MESSAGE_CHECK(m_pendingLearnOrIgnoreWordMessageCount);
3335 --m_pendingLearnOrIgnoreWordMessageCount;
3337 TextChecker::ignoreWord(spellDocumentTag(), word);
3342 void WebPageProxy::setFocus(bool focused)
3345 m_uiClient.focus(this);
3347 m_uiClient.unfocus(this);
3350 void WebPageProxy::takeFocus(uint32_t direction)
3352 m_uiClient.takeFocus(this, (static_cast<FocusDirection>(direction) == FocusDirectionForward) ? kWKFocusDirectionForward : kWKFocusDirectionBackward);
3355 void WebPageProxy::setToolTip(const String& toolTip)
3357 String oldToolTip = m_toolTip;
3358 m_toolTip = toolTip;
3359 m_pageClient->toolTipChanged(oldToolTip, m_toolTip);
3362 void WebPageProxy::setCursor(const WebCore::Cursor& cursor)
3364 m_pageClient->setCursor(cursor);
3367 void WebPageProxy::setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves)
3369 m_pageClient->setCursorHiddenUntilMouseMoves(hiddenUntilMouseMoves);
3372 void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
3374 WebEvent::Type type = static_cast<WebEvent::Type>(opaqueType);
3377 case WebEvent::NoType:
3378 case WebEvent::MouseMove:
3381 case WebEvent::MouseDown:
3382 case WebEvent::MouseUp:
3383 case WebEvent::Wheel:
3384 case WebEvent::KeyDown:
3385 case WebEvent::KeyUp:
3386 case WebEvent::RawKeyDown:
3387 case WebEvent::Char:
3388 #if ENABLE(GESTURE_EVENTS)
3389 case WebEvent::GestureScrollBegin:
3390 case WebEvent::GestureScrollEnd:
3391 case WebEvent::GestureSingleTap:
3393 #if ENABLE(TOUCH_EVENTS)
3394 case WebEvent::TouchStart:
3395 case WebEvent::TouchMove:
3396 case WebEvent::TouchEnd:
3397 case WebEvent::TouchCancel:
3399 process()->responsivenessTimer()->stop();
3404 case WebEvent::NoType:
3406 case WebEvent::MouseMove:
3407 m_processingMouseMoveEvent = false;
3408 if (m_nextMouseMoveEvent) {
3409 handleMouseEvent(*m_nextMouseMoveEvent);
3410 m_nextMouseMoveEvent = nullptr;
3413 case WebEvent::MouseDown:
3415 #if ENABLE(GESTURE_EVENTS)
3416 case WebEvent::GestureScrollBegin:
3417 case WebEvent::GestureScrollEnd:
3418 case WebEvent::GestureSingleTap: {
3419 WebGestureEvent event = m_gestureEventQueue.first();
3420 MESSAGE_CHECK(type == event.type());
3422 m_gestureEventQueue.removeFirst();
3423 m_pageClient->doneWithGestureEvent(event, handled);
3427 case WebEvent::MouseUp:
3428 m_currentlyProcessedMouseDownEvent = nullptr;
3431 case WebEvent::Wheel: {
3432 ASSERT(!m_currentlyProcessedWheelEvents.isEmpty());
3434 OwnPtr<Vector<NativeWebWheelEvent> > oldestCoalescedEvent = m_currentlyProcessedWheelEvents.takeFirst();
3436 // FIXME: Dispatch additional events to the didNotHandleWheelEvent client function.
3437 if (!handled && m_uiClient.implementsDidNotHandleWheelEvent())
3438 m_uiClient.didNotHandleWheelEvent(this, oldestCoalescedEvent->last());
3440 if (!m_wheelEventQueue.isEmpty())
3441 processNextQueuedWheelEvent();
3445 case WebEvent::KeyDown:
3446 case WebEvent::KeyUp:
3447 case WebEvent::RawKeyDown:
3448 case WebEvent::Char: {
3449 LOG(KeyHandling, "WebPageProxy::didReceiveEvent: %s", webKeyboardEventTypeString(type));
3451 NativeWebKeyboardEvent event = m_keyEventQueue.first();
3452 MESSAGE_CHECK(type == event.type());
3454 m_keyEventQueue.removeFirst();
3456 m_pageClient->doneWithKeyEvent(event, handled);
3461 if (m_uiClient.implementsDidNotHandleKeyEvent())
3462 m_uiClient.didNotHandleKeyEvent(this, event);
3465 ::TranslateMessage(event.nativeEvent());
3469 #if ENABLE(TOUCH_EVENTS)
3470 case WebEvent::TouchStart:
3471 case WebEvent::TouchMove:
3472 case WebEvent::TouchEnd:
3473 case WebEvent::TouchCancel: {
3474 QueuedTouchEvents queuedEvents = m_touchEventQueue.first();
3475 MESSAGE_CHECK(type == queuedEvents.forwardedEvent.type());
3476 m_touchEventQueue.removeFirst();
3478 m_pageClient->doneWithTouchEvent(queuedEvents.forwardedEvent, handled);
3479 for (size_t i = 0; i < queuedEvents.deferredTouchEvents.size(); ++i) {
3480 bool isEventHandled = false;
3481 m_pageClient->doneWithTouchEvent(queuedEvents.deferredTouchEvents.at(i), isEventHandled);
3489 void WebPageProxy::stopResponsivenessTimer()
3491 process()->responsivenessTimer()->stop();
3494 void WebPageProxy::voidCallback(uint64_t callbackID)
3496 RefPtr<VoidCallback> callback = m_voidCallbacks.take(callbackID);
3498 // FIXME: Log error or assert.
3502 callback->performCallback();
3505 void WebPageProxy::dataCallback(const CoreIPC::DataReference& dataReference, uint64_t callbackID)
3507 RefPtr<DataCallback> callback = m_dataCallbacks.take(callbackID);
3509 // FIXME: Log error or assert.
3513 callback->performCallbackWithReturnValue(WebData::create(dataReference.data(), dataReference.size()).get());
3516 void WebPageProxy::stringCallback(const String& resultString, uint64_t callbackID)
3518 RefPtr<StringCallback> callback = m_stringCallbacks.take(callbackID);
3520 // FIXME: Log error or assert.
3521 // this can validly happen if a load invalidated the callback, though
3525 m_loadDependentStringCallbackIDs.remove(callbackID);
3527 callback->performCallbackWithReturnValue(resultString.impl());
3530 void WebPageProxy::scriptValueCallback(const CoreIPC::DataReference& dataReference, uint64_t callbackID)
3532 RefPtr<ScriptValueCallback> callback = m_scriptValueCallbacks.take(callbackID);
3534 // FIXME: Log error or assert.
3538 Vector<uint8_t> data;
3539 data.reserveInitialCapacity(dataReference.size());
3540 data.append(dataReference.data(), dataReference.size());
3542 callback->performCallbackWithReturnValue(data.size() ? WebSerializedScriptValue::adopt(data).get() : 0);
3545 void WebPageProxy::computedPagesCallback(const Vector<IntRect>& pageRects, double totalScaleFactorForPrinting, uint64_t callbackID)
3547 RefPtr<ComputedPagesCallback> callback = m_computedPagesCallbacks.take(callbackID);
3549 // FIXME: Log error or assert.
3553 callback->performCallbackWithReturnValue(pageRects, totalScaleFactorForPrinting);
3556 void WebPageProxy::validateCommandCallback(const String& commandName, bool isEnabled, int state, uint64_t callbackID)
3558 RefPtr<ValidateCommandCallback> callback = m_validateCommandCallbacks.take(callbackID);
3560 // FIXME: Log error or assert.
3564 callback->performCallbackWithReturnValue(commandName.impl(), isEnabled, state);
3568 void WebPageProxy::printFinishedCallback(const ResourceError& printError, uint64_t callbackID)
3570 RefPtr<PrintFinishedCallback> callback = m_printFinishedCallbacks.take(callbackID);
3572 // FIXME: Log error or assert.
3576 RefPtr<WebError> error = WebError::create(printError);
3577 callback->performCallbackWithReturnValue(error.get());
3581 void WebPageProxy::focusedFrameChanged(uint64_t frameID)
3588 WebFrameProxy* frame = process()->webFrame(frameID);
3589 MESSAGE_CHECK(frame);
3591 m_focusedFrame = frame;
3594 void WebPageProxy::frameSetLargestFrameChanged(uint64_t frameID)
3597 m_frameSetLargestFrame = 0;
3601 WebFrameProxy* frame = process()->webFrame(frameID);
3602 MESSAGE_CHECK(frame);
3604 m_frameSetLargestFrame = frame;
3607 void WebPageProxy::processDidBecomeUnresponsive()
3612 updateBackingStoreDiscardableState();
3614 m_loaderClient.processDidBecomeUnresponsive(this);
3617 void WebPageProxy::interactionOccurredWhileProcessUnresponsive()
3622 m_loaderClient.interactionOccurredWhileProcessUnresponsive(this);
3625 void WebPageProxy::processDidBecomeResponsive()
3630 updateBackingStoreDiscardableState();
3632 m_loaderClient.processDidBecomeResponsive(this);
3635 void WebPageProxy::processDidCrash()
3637 ASSERT(m_pageClient);
3640 m_isPageSuspended = false;
3643 m_urlAtProcessExit = m_mainFrame->url();
3644 m_loadStateAtProcessExit = m_mainFrame->loadState();
3647 m_mainFrame = nullptr;
3648 m_drawingArea = nullptr;
3650 #if ENABLE(INSPECTOR)
3652 m_inspector->invalidate();
3653 m_inspector = nullptr;
3657 #if ENABLE(FULLSCREEN_API)
3658 if (m_fullScreenManager) {
3659 m_fullScreenManager->invalidate();
3660 m_fullScreenManager = nullptr;
3664 if (m_openPanelResultListener) {
3665 m_openPanelResultListener->invalidate();
3666 m_openPanelResultListener = nullptr;
3669 #if ENABLE(INPUT_TYPE_COLOR)
3670 if (m_colorChooser) {
3671 m_colorChooser->invalidate();
3672 m_colorChooser = nullptr;
3676 #if ENABLE(GEOLOCATION)
3677 m_geolocationPermissionRequestManager.invalidateRequests();
3680 m_notificationPermissionRequestManager.invalidateRequests();
3682 m_toolTip = String();
3684 m_mainFrameHasHorizontalScrollbar = false;
3685 m_mainFrameHasVerticalScrollbar = false;
3687 m_mainFrameIsPinnedToLeftSide = false;
3688 m_mainFrameIsPinnedToRightSide = false;
3690 m_visibleScrollerThumbRect = IntRect();
3692 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
3693 invalidateCallbackMap(m_booleanCallbacks);
3695 invalidateCallbackMap(m_voidCallbacks);
3696 invalidateCallbackMap(m_dataCallbacks);
3697 invalidateCallbackMap(m_stringCallbacks);
3698 m_loadDependentStringCallbackIDs.clear();
3699 invalidateCallbackMap(m_scriptValueCallbacks);
3700 invalidateCallbackMap(m_computedPagesCallbacks);
3701 invalidateCallbackMap(m_validateCommandCallbacks);
3703 invalidateCallbackMap(m_printFinishedCallbacks);
3706 Vector<WebEditCommandProxy*> editCommandVector;
3707 copyToVector(m_editCommandSet, editCommandVector);
3708 m_editCommandSet.clear();
3709 for (size_t i = 0, size = editCommandVector.size(); i < size; ++i)
3710 editCommandVector[i]->invalidate();
3711 m_pageClient->clearAllEditCommands();
3713 m_activePopupMenu = 0;
3715 m_estimatedProgress = 0.0;
3717 m_pendingLearnOrIgnoreWordMessageCount = 0;
3719 m_pageClient->processDidCrash();
3720 m_loaderClient.processDidCrash(this);
3723 // If the call out to the loader client didn't cause the web process to be relaunched,
3724 // we'll call setNeedsDisplay on the view so that we won't have the old contents showing.
3725 // If the call did cause the web process to be relaunched, we'll keep the old page contents showing
3726 // until the new web process has painted its contents.
3727 setViewNeedsDisplay(IntRect(IntPoint(), viewSize()));
3730 // Can't expect DidReceiveEvent notifications from a crashed web process.
3731 m_keyEventQueue.clear();
3733 m_wheelEventQueue.clear();
3734 m_currentlyProcessedWheelEvents.clear();
3736 m_nextMouseMoveEvent = nullptr;
3737 m_currentlyProcessedMouseDownEvent = nullptr;
3739 m_processingMouseMoveEvent = false;
3741 #if ENABLE(TOUCH_EVENTS)
3742 m_needTouchEvents = false;
3743 m_touchEventQueue.clear();
3746 #if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD)
3747 dismissCorrectionPanel(ReasonForDismissingAlternativeTextIgnored);
3748 m_pageClient->dismissDictionaryLookupPanel();
3752 WebPageCreationParameters WebPageProxy::creationParameters() const
3754 WebPageCreationParameters parameters;
3756 parameters.viewSize = m_pageClient->viewSize();
3757 parameters.isActive = m_pageClient->isViewWindowActive();
3758 parameters.isFocused = m_pageClient->isViewFocused();
3759 parameters.isVisible = m_pageClient->isViewVisible();
3760 parameters.isInWindow = m_pageClient->isViewInWindow();
3761 parameters.drawingAreaType = m_drawingArea->type();
3762 parameters.store = m_pageGroup->preferences()->store();
3763 parameters.pageGroupData = m_pageGroup->data();
3764 parameters.drawsBackground = m_drawsBackground;
3765 parameters.drawsTransparentBackground = m_drawsTransparentBackground;
3766 parameters.areMemoryCacheClientCallsEnabled = m_areMemoryCacheClientCallsEnabled;
3767 parameters.useFixedLayout = m_useFixedLayout;
3768 parameters.fixedLayoutSize = m_fixedLayoutSize;
3769 parameters.paginationMode = m_paginationMode;
3770 parameters.paginationBehavesLikeColumns = m_paginationBehavesLikeColumns;
3771 parameters.pageLength = m_pageLength;
3772 parameters.gapBetweenPages = m_gapBetweenPages;
3773 parameters.userAgent = userAgent();
3774 parameters.sessionState = SessionState(m_backForwardList->entries(), m_backForwardList->currentIndex());
3775 parameters.highestUsedBackForwardItemID = WebBackForwardListItem::highedUsedItemID();
3776 parameters.canRunBeforeUnloadConfirmPanel = m_uiClient.canRunBeforeUnloadConfirmPanel();
3777 parameters.canRunModal = m_uiClient.canRunModal();
3778 parameters.deviceScaleFactor = m_intrinsicDeviceScaleFactor;
3779 parameters.mediaVolume = m_mediaVolume;
3782 parameters.isSmartInsertDeleteEnabled = m_isSmartInsertDeleteEnabled;
3783 parameters.layerHostingMode = m_layerHostingMode;
3787 parameters.nativeWindow = m_pageClient->nativeWindow();
3792 #if USE(ACCELERATED_COMPOSITING)
3793 void WebPageProxy::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
3795 m_pageClient->enterAcceleratedCompositingMode(layerTreeContext);
3798 void WebPageProxy::exitAcceleratedCompositingMode()
3800 m_pageClient->exitAcceleratedCompositingMode();
3803 void WebPageProxy::updateAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
3805 m_pageClient->updateAcceleratedCompositingMode(layerTreeContext);
3807 #endif // USE(ACCELERATED_COMPOSITING)
3809 void WebPageProxy::backForwardClear()
3811 m_backForwardList->clear();
3814 void WebPageProxy::canAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, const ProtectionSpace& coreProtectionSpace, bool& canAuthenticate)
3816 WebFrameProxy* frame = process()->webFrame(frameID);
3817 MESSAGE_CHECK(frame);
3819 RefPtr<WebProtectionSpace> protectionSpace = WebProtectionSpace::create(coreProtectionSpace);
3821 canAuthenticate = m_loaderClient.canAuthenticateAgainstProtectionSpaceInFrame(this, frame, protectionSpace.get());
3824 void WebPageProxy::didReceiveAuthenticationChallenge(uint64_t frameID, const AuthenticationChallenge& coreChallenge, uint64_t challengeID)
3826 WebFrameProxy* frame = process()->webFrame(frameID);
3827 MESSAGE_CHECK(frame);
3829 RefPtr<AuthenticationChallengeProxy> authenticationChallenge = AuthenticationChallengeProxy::create(coreChallenge, challengeID, process());
3831 m_loaderClient.didReceiveAuthenticationChallengeInFrame(this, frame, authenticationChallenge.get());
3834 void WebPageProxy::exceededDatabaseQuota(uint64_t frameID, const String& originIdentifier, const String& databaseName, const String& displayName, uint64_t currentQuota, uint64_t currentOriginUsage, uint64_t currentDatabaseUsage, uint64_t expectedUsage, uint64_t& newQuota)
3836 WebFrameProxy* frame = process()->webFrame(frameID);
3837 MESSAGE_CHECK(frame);
3839 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
3841 newQuota = m_uiClient.exceededDatabaseQuota(this, frame, origin.get(), databaseName, displayName, currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage);
3844 void WebPageProxy::requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier)
3846 WebFrameProxy* frame = process()->webFrame(frameID);
3847 MESSAGE_CHECK(frame);
3849 // FIXME: Geolocation should probably be using toString() as its string representation instead of databaseIdentifier().
3850 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
3851 RefPtr<GeolocationPermissionRequestProxy> request = m_geolocationPermissionRequestManager.createRequest(geolocationID);
3853 if (!m_uiClient.decidePolicyForGeolocationPermissionRequest(this, frame, origin.get(), request.get()))
3857 void WebPageProxy::requestNotificationPermission(uint64_t requestID, const String& originString)
3859 if (!isRequestIDValid(requestID))
3862 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromString(originString);
3863 RefPtr<NotificationPermissionRequest> request = m_notificationPermissionRequestManager.createRequest(requestID);
3865 if (!m_uiClient.decidePolicyForNotificationPermissionRequest(this, origin.get(), request.get()))
3869 void WebPageProxy::showNotification(const String& title, const String& body, const String& iconURL, const String& tag, const String& originString, uint64_t notificationID)
3871 m_process->context()->notificationManagerProxy()->show(this, title, body, iconURL, tag, originString, notificationID);
3874 #if ENABLE(TIZEN_MEDIA_STREAM)
3875 void WebPageProxy::requestUserMediaPermission(uint64_t requestID)
3877 if (!isRequestIDValid(requestID))
3880 RefPtr<UserMediaPermissionRequest> request = m_userMediaPermissionRequestManager.createRequest(requestID);
3882 if (!m_tizenClient.decidePolicyForUserMediaPermissionRequest(this, request.get()))
3887 float WebPageProxy::headerHeight(WebFrameProxy* frame)
3889 if (frame->isDisplayingPDFDocument())
3891 return m_uiClient.headerHeight(this, frame);
3894 float WebPageProxy::footerHeight(WebFrameProxy* frame)
3896 if (frame->isDisplayingPDFDocument())
3898 return m_uiClient.footerHeight(this, frame);
3901 void WebPageProxy::drawHeader(WebFrameProxy* frame, const FloatRect& rect)
3903 if (frame->isDisplayingPDFDocument())
3905 m_uiClient.drawHeader(this, frame, rect);
3908 void WebPageProxy::drawFooter(WebFrameProxy* frame, const FloatRect& rect)
3910 if (frame->isDisplayingPDFDocument())
3912 m_uiClient.drawFooter(this, frame, rect);
3915 void WebPageProxy::runModal()
3917 // Since runModal() can (and probably will) spin a nested run loop we need to turn off the responsiveness timer.
3918 process()->responsivenessTimer()->stop();
3920 m_uiClient.runModal(this);
3923 void WebPageProxy::notifyScrollerThumbIsVisibleInRect(const IntRect& scrollerThumb)
3925 m_visibleScrollerThumbRect = scrollerThumb;
3928 void WebPageProxy::recommendedScrollbarStyleDidChange(int32_t newStyle)
3931 m_pageClient->recommendedScrollbarStyleDidChange(newStyle);
3935 void WebPageProxy::didChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar)
3937 m_mainFrameHasHorizontalScrollbar = hasHorizontalScrollbar;
3938 m_mainFrameHasVerticalScrollbar = hasVerticalScrollbar;
3940 m_pageClient->didChangeScrollbarsForMainFrame();
3943 void WebPageProxy::didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide)
3945 m_mainFrameIsPinnedToLeftSide = pinnedToLeftSide;
3946 m_mainFrameIsPinnedToRightSide = pinnedToRightSide;
3949 void WebPageProxy::didChangePageCount(unsigned pageCount)
3951 m_pageCount = pageCount;
3954 void WebPageProxy::didFailToInitializePlugin(const String& mimeType)
3956 m_loaderClient.didFailToInitializePlugin(this, mimeType);
3959 void WebPageProxy::didBlockInsecurePluginVersion(const String& mimeType, const String& urlString)
3961 String pluginIdentifier;
3962 String pluginVersion;
3963 String newMimeType = mimeType;
3966 PluginModuleInfo plugin = m_process->context()->pluginInfoStore().findPlugin(newMimeType, KURL(KURL(), urlString));
3968 pluginIdentifier = plugin.bundleIdentifier;
3969 pluginVersion = plugin.versionString;
3972 m_loaderClient.didBlockInsecurePluginVersion(this, newMimeType, pluginIdentifier, pluginVersion);
3975 bool WebPageProxy::willHandleHorizontalScrollEvents() const
3977 return !m_canShortCircuitHorizontalWheelEvents;
3980 void WebPageProxy::didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference& dataReference)
3982 m_pageClient->didFinishLoadingDataForCustomRepresentation(suggestedFilename, dataReference);
3985 void WebPageProxy::backForwardRemovedItem(uint64_t itemID)
3987 process()->send(Messages::WebPage::DidRemoveBackForwardItem(itemID), m_pageID);
3990 void WebPageProxy::beginPrinting(WebFrameProxy* frame, const PrintInfo& printInfo)
3992 if (m_isInPrintingMode)
3995 m_isInPrintingMode = true;
3996 process()->send(Messages::WebPage::BeginPrinting(frame->frameID(), printInfo), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
3999 void WebPageProxy::endPrinting()
4001 if (!m_isInPrintingMode)
4004 m_isInPrintingMode = false;
4005 process()->send(Messages::WebPage::EndPrinting(), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
4008 void WebPageProxy::computePagesForPrinting(WebFrameProxy* frame, const PrintInfo& printInfo, PassRefPtr<ComputedPagesCallback> prpCallback)
4010 RefPtr<ComputedPagesCallback> callback = prpCallback;
4012 callback->invalidate();
4016 uint64_t callbackID = callback->callbackID();
4017 m_computedPagesCallbacks.set(callbackID, callback.get());
4018 m_isInPrintingMode = true;
4019 process()->send(Messages::WebPage::ComputePagesForPrinting(frame->frameID(), printInfo, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
4022 #if PLATFORM(MAC) || PLATFORM(WIN)
4023 void WebPageProxy::drawRectToPDF(WebFrameProxy* frame, const PrintInfo& printInfo, const IntRect& rect, PassRefPtr<DataCallback> prpCallback)
4025 RefPtr<DataCallback> callback = prpCallback;
4027 callback->invalidate();
4031 uint64_t callbackID = callback->callbackID();
4032 m_dataCallbacks.set(callbackID, callback.get());
4033 process()->send(Messages::WebPage::DrawRectToPDF(frame->frameID(), printInfo, rect, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
4036 void WebPageProxy::drawPagesToPDF(WebFrameProxy* frame, const PrintInfo& printInfo, uint32_t first, uint32_t count, PassRefPtr<DataCallback> prpCallback)
4038 RefPtr<DataCallback> callback = prpCallback;
4040 callback->invalidate();
4044 uint64_t callbackID = callback->callbackID();
4045 m_dataCallbacks.set(callbackID, callback.get());
4046 process()->send(Messages::WebPage::DrawPagesToPDF(frame->frameID(), printInfo, first, count, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
4049 void WebPageProxy::drawPagesForPrinting(WebFrameProxy* frame, const PrintInfo& printInfo, PassRefPtr<PrintFinishedCallback> didPrintCallback)
4051 RefPtr<PrintFinishedCallback> callback = didPrintCallback;
4053 callback->invalidate();
4057 uint64_t callbackID = callback->callbackID();
4058 m_printFinishedCallbacks.set(callbackID, callback.get());
4059 m_isInPrintingMode = true;
4060 process()->send(Messages::WebPage::DrawPagesForPrinting(frame->frameID(), printInfo, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
4064 void WebPageProxy::flashBackingStoreUpdates(const Vector<IntRect>& updateRects)
4066 m_pageClient->flashBackingStoreUpdates(updateRects);
4069 void WebPageProxy::updateBackingStoreDiscardableState()
4075 if (!process()->responsivenessTimer()->isResponsive())
4076 isDiscardable = false;
4078 isDiscardable = !m_pageClient->isViewWindowActive() || !isViewVisible();
4080 m_drawingArea->setBackingStoreIsDiscardable(isDiscardable);
4083 Color WebPageProxy::viewUpdatesFlashColor()
4085 return Color(0, 200, 255);
4088 Color WebPageProxy::backingStoreUpdatesFlashColor()
4090 return Color(200, 0, 255);
4093 void WebPageProxy::saveDataToFileInDownloadsFolder(const String& suggestedFilename, const String& mimeType, const String& originatingURLString, WebData* data)
4095 m_uiClient.saveDataToFileInDownloadsFolder(this, suggestedFilename, mimeType, originatingURLString, data);
4098 void WebPageProxy::linkClicked(const String& url, const WebMouseEvent& event)
4100 process()->send(Messages::WebPage::LinkClicked(url, event), m_pageID, 0);
4105 void WebPageProxy::substitutionsPanelIsShowing(bool& isShowing)
4107 isShowing = TextChecker::substitutionsPanelIsShowing();
4110 #if !defined(BUILDING_ON_SNOW_LEOPARD)
4111 void WebPageProxy::showCorrectionPanel(int32_t panelType, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings)
4113 m_pageClient->showCorrectionPanel((AlternativeTextType)panelType, boundingBoxOfReplacedString, replacedString, replacementString, alternativeReplacementStrings);
4116 void WebPageProxy::dismissCorrectionPanel(int32_t reason)
4118 m_pageClient->dismissCorrectionPanel((ReasonForDismissingAlternativeText)reason);
4121 void WebPageProxy::dismissCorrectionPanelSoon(int32_t reason, String& result)
4123 result = m_pageClient->dismissCorrectionPanelSoon((ReasonForDismissingAlternativeText)reason);
4126 void WebPageProxy::recordAutocorrectionResponse(int32_t responseType, const String& replacedString, const String& replacementString)
4128 m_pageClient->recordAutocorrectionResponse((AutocorrectionResponseType)responseType, replacedString, replacementString);
4130 #endif // !defined(BUILDING_ON_SNOW_LEOPARD)
4132 void WebPageProxy::handleAlternativeTextUIResult(const String& result)
4134 #if !defined(BUILDING_ON_SNOW_LEOPARD)
4136 process()->send(Messages::WebPage::HandleAlternativeTextUIResult(result), m_pageID, 0);
4139 #endif // PLATFORM(MAC)
4141 #if ENABLE(TIZEN_PAGE_VISIBILITY_API)
4142 void WebPageProxy::setPageVisibility(WebCore::PageVisibilityState pageVisibilityState, bool isInitialState)
4144 process()->send(Messages::WebPage::SetVisibilityState(static_cast<uint32_t>(pageVisibilityState), isInitialState), m_pageID);
4148 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
4149 void WebPageProxy::updateLayoutAndScaleIfNeeded()
4151 m_pageClient->updateLayoutAndScaleIfNeeded();
4155 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
4156 void WebPageProxy::decidePolicyForCertificateError(bool isTrusted, const String& url, const String& certificate, int error, bool& canContinue)
4158 canContinue = m_tizenClient.decidePolicyForCertificateError(this, isTrusted, url, certificate, error);
4162 } // namespace WebKit