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"
37 #include "ImmutableArray.h"
39 #include "MessageID.h"
40 #include "NativeWebKeyboardEvent.h"
41 #include "NativeWebMouseEvent.h"
42 #include "NativeWebWheelEvent.h"
43 #include "NotificationPermissionRequest.h"
44 #include "NotificationPermissionRequestManager.h"
45 #include "PageClient.h"
46 #include "PrintInfo.h"
47 #include "SessionState.h"
48 #include "StringPairVector.h"
49 #include "TextChecker.h"
50 #include "TextCheckerState.h"
51 #include "WKContextPrivate.h"
52 #include "WebBackForwardList.h"
53 #include "WebBackForwardListItem.h"
54 #include "WebCertificateInfo.h"
55 #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
56 #include "WebColorPickerResultListenerProxy.h"
58 #include "WebContext.h"
59 #include "WebContextMenuProxy.h"
60 #include "WebContextUserMessageCoders.h"
61 #include "WebCoreArgumentCoders.h"
63 #include "WebEditCommandProxy.h"
65 #include "WebFormSubmissionListenerProxy.h"
66 #include "WebFramePolicyListenerProxy.h"
67 #include "WebFullScreenManagerProxy.h"
68 #include "WebInspectorProxy.h"
69 #include "WebNotificationManagerProxy.h"
70 #include "WebOpenPanelResultListenerProxy.h"
71 #include "WebPageCreationParameters.h"
72 #include "WebPageGroup.h"
73 #include "WebPageGroupData.h"
74 #include "WebPageMessages.h"
75 #include "WebPopupItem.h"
76 #include "WebPopupMenuProxy.h"
77 #include "WebPreferences.h"
78 #include "WebProcessMessages.h"
79 #include "WebProcessProxy.h"
80 #include "WebProtectionSpace.h"
81 #include "WebSecurityOrigin.h"
82 #include "WebURLRequest.h"
83 #include <WebCore/DragController.h>
84 #include <WebCore/DragData.h>
85 #include <WebCore/DragSession.h>
86 #include <WebCore/FloatRect.h>
87 #include <WebCore/FocusDirection.h>
88 #include <WebCore/MIMETypeRegistry.h>
89 #include <WebCore/TextCheckerClient.h>
90 #include <WebCore/WindowFeatures.h>
93 #if ENABLE(WEB_INTENTS)
94 #include "IntentData.h"
95 #include "IntentServiceInfo.h"
96 #include "WebIntentData.h"
97 #include "WebIntentServiceInfo.h"
100 #if USE(UI_SIDE_COMPOSITING)
101 #include "LayerTreeCoordinatorProxyMessages.h"
105 #include "ArgumentCodersQt.h"
109 #include "ArgumentCodersGtk.h"
112 #if ENABLE(TIZEN_DRAG_SUPPORT)
113 #include "ArgumentCodersTizen.h"
117 #include <wtf/RefCountedLeakCounter.h>
120 #if ENABLE(TIZEN_ISF_PORT) || ENABLE(TIZEN_GESTURE)
121 #include "ewk_view_private.h"
124 // This controls what strategy we use for mouse wheel coalescing.
125 #define MERGE_WHEEL_EVENTS 1
127 #define MESSAGE_CHECK(assertion) MESSAGE_CHECK_BASE(assertion, m_process->connection())
128 #define MESSAGE_CHECK_URL(url) MESSAGE_CHECK_BASE(m_process->checkURLReceivedFromWebProcess(url), m_process->connection())
130 using namespace WebCore;
132 // Represents the number of wheel events we can hold in the queue before we start pushing them preemptively.
133 static const unsigned wheelEventQueueSizeThreshold = 10;
137 WKPageDebugPaintFlags WebPageProxy::s_debugPaintFlags = 0;
139 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, webPageProxyCounter, ("WebPageProxy"));
142 static const char* webKeyboardEventTypeString(WebEvent::Type type)
145 case WebEvent::KeyDown:
148 case WebEvent::KeyUp:
151 case WebEvent::RawKeyDown:
158 ASSERT_NOT_REACHED();
162 #endif // !LOG_DISABLED
164 PassRefPtr<WebPageProxy> WebPageProxy::create(PageClient* pageClient, PassRefPtr<WebProcessProxy> process, WebPageGroup* pageGroup, uint64_t pageID)
166 return adoptRef(new WebPageProxy(pageClient, process, pageGroup, pageID));
169 WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> process, WebPageGroup* pageGroup, uint64_t pageID)
170 : m_pageClient(pageClient)
172 , m_pageGroup(pageGroup)
174 , m_userAgent(standardUserAgent())
175 , m_geolocationPermissionRequestManager(this)
176 , m_notificationPermissionRequestManager(this)
177 #if ENABLE(TIZEN_MEDIA_STREAM)
178 , m_userMediaPermissionRequestManager(this)
180 , m_estimatedProgress(0)
181 , m_isInWindow(m_pageClient->isViewInWindow())
182 , m_isVisible(m_pageClient->isViewVisible())
183 , m_backForwardList(WebBackForwardList::create(this))
184 , m_loadStateAtProcessExit(WebFrameProxy::LoadStateFinished)
185 , m_textZoomFactor(1)
186 , m_pageZoomFactor(1)
187 , m_pageScaleFactor(1)
188 , m_intrinsicDeviceScaleFactor(1)
189 , m_customDeviceScaleFactor(0)
190 #if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
191 , m_layerHostingMode(LayerHostingModeInWindowServer)
193 , m_layerHostingMode(LayerHostingModeDefault)
195 , m_drawsBackground(true)
196 , m_drawsTransparentBackground(false)
197 , m_areMemoryCacheClientCallsEnabled(true)
198 , m_useFixedLayout(false)
199 , m_paginationMode(Page::Pagination::Unpaginated)
200 , m_paginationBehavesLikeColumns(false)
202 , m_gapBetweenPages(0)
205 , m_canRunModal(false)
206 , m_isInPrintingMode(false)
207 , m_isPerformingDOMPrintOperation(false)
208 , m_inDecidePolicyForResponse(false)
209 , m_syncMimeTypePolicyActionIsValid(false)
210 , m_syncMimeTypePolicyAction(PolicyUse)
211 , m_syncMimeTypePolicyDownloadID(0)
212 , m_inDecidePolicyForNavigationAction(false)
213 , m_syncNavigationActionPolicyActionIsValid(false)
214 , m_syncNavigationActionPolicyAction(PolicyUse)
215 , m_syncNavigationActionPolicyDownloadID(0)
216 , m_processingMouseMoveEvent(false)
217 #if ENABLE(TOUCH_EVENTS)
218 , m_needTouchEvents(false)
220 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
221 , m_askOverflow(true)
224 , m_isPageSuspended(false)
226 , m_isSmartInsertDeleteEnabled(TextChecker::isSmartInsertDeleteEnabled())
228 , m_spellDocumentTag(0)
229 , m_hasSpellDocumentTag(false)
230 , m_pendingLearnOrIgnoreWordMessageCount(0)
231 , m_mainFrameHasCustomRepresentation(false)
232 , m_mainFrameHasHorizontalScrollbar(false)
233 , m_mainFrameHasVerticalScrollbar(false)
234 , m_canShortCircuitHorizontalWheelEvents(true)
235 , m_mainFrameIsPinnedToLeftSide(false)
236 , m_mainFrameIsPinnedToRightSide(false)
238 , m_renderTreeSize(0)
239 , m_shouldSendEventsSynchronously(false)
240 , m_suppressVisibilityUpdates(false)
242 #if ENABLE(PAGE_VISIBILITY_API)
243 , m_visibilityState(PageVisibilityStateVisible)
245 #if ENABLE(TIZEN_REDUCE_KEY_LAGGING)
246 , m_pageContentResumeTimer(0)
248 #if ENABLE(TIZEN_ISF_PORT)
249 , m_didCancelCompositionFromWebProcess(false)
253 webPageProxyCounter.increment();
256 WebContext::statistics().wkPageCount++;
258 m_pageGroup->addPage(this);
261 WebPageProxy::~WebPageProxy()
266 WebContext::statistics().wkPageCount--;
268 if (m_hasSpellDocumentTag)
269 TextChecker::closeSpellDocumentWithTag(m_spellDocumentTag);
271 m_pageGroup->removePage(this);
274 webPageProxyCounter.decrement();
276 #if ENABLE(TIZEN_REDUCE_KEY_LAGGING)
277 if (m_pageContentResumeTimer)
278 ecore_timer_del(m_pageContentResumeTimer);
282 WebProcessProxy* WebPageProxy::process() const
284 return m_process.get();
287 PlatformProcessIdentifier WebPageProxy::processIdentifier() const
292 return m_process->processIdentifier();
295 bool WebPageProxy::isValid()
297 // A page that has been explicitly closed is never valid.
304 void WebPageProxy::initializeLoaderClient(const WKPageLoaderClient* loadClient)
306 m_loaderClient.initialize(loadClient);
311 process()->send(Messages::WebPage::SetWillGoToBackForwardItemCallbackEnabled(loadClient->version > 0), m_pageID);
314 void WebPageProxy::initializePolicyClient(const WKPagePolicyClient* policyClient)
316 m_policyClient.initialize(policyClient);
319 void WebPageProxy::initializeFormClient(const WKPageFormClient* formClient)
321 m_formClient.initialize(formClient);
324 void WebPageProxy::initializeResourceLoadClient(const WKPageResourceLoadClient* client)
326 m_resourceLoadClient.initialize(client);
329 void WebPageProxy::initializeUIClient(const WKPageUIClient* client)
334 m_uiClient.initialize(client);
336 process()->send(Messages::WebPage::SetCanRunBeforeUnloadConfirmPanel(m_uiClient.canRunBeforeUnloadConfirmPanel()), m_pageID);
337 setCanRunModal(m_uiClient.canRunModal());
340 void WebPageProxy::initializeFindClient(const WKPageFindClient* client)
342 m_findClient.initialize(client);
345 void WebPageProxy::initializeFindMatchesClient(const WKPageFindMatchesClient* client)
347 m_findMatchesClient.initialize(client);
350 #if ENABLE(CONTEXT_MENUS)
351 void WebPageProxy::initializeContextMenuClient(const WKPageContextMenuClient* client)
353 m_contextMenuClient.initialize(client);
357 void WebPageProxy::reattachToWebProcess()
363 m_process = m_process->context()->relaunchProcessIfNecessary();
364 process()->addExistingWebPage(this, m_pageID);
368 m_pageClient->didRelaunchProcess();
369 m_drawingArea->waitForBackingStoreUpdateOnNextPaint();
372 void WebPageProxy::reattachToWebProcessWithItem(WebBackForwardListItem* item)
374 if (item && item != m_backForwardList->currentItem())
375 m_backForwardList->goToItem(item);
377 reattachToWebProcess();
382 process()->send(Messages::WebPage::GoToBackForwardItem(item->itemID()), m_pageID);
383 process()->responsivenessTimer()->start();
386 void WebPageProxy::initializeWebPage()
390 BackForwardListItemVector items = m_backForwardList->entries();
391 for (size_t i = 0; i < items.size(); ++i)
392 process()->registerNewWebBackForwardListItem(items[i].get());
394 m_drawingArea = m_pageClient->createDrawingAreaProxy();
395 ASSERT(m_drawingArea);
397 #if ENABLE(INSPECTOR_SERVER)
398 if (m_pageGroup->preferences()->developerExtrasEnabled())
399 inspector()->enableRemoteInspection();
402 process()->send(Messages::WebProcess::CreateWebPage(m_pageID, creationParameters()), 0);
404 #if ENABLE(PAGE_VISIBILITY_API)
405 process()->send(Messages::WebPage::SetVisibilityState(m_visibilityState, /* isInitialState */ true), m_pageID);
409 void WebPageProxy::close()
416 m_backForwardList->pageClosed();
417 m_pageClient->pageClosed();
419 process()->disconnectFramesFromPage(this);
422 #if ENABLE(INSPECTOR)
424 m_inspector->invalidate();
429 #if ENABLE(FULLSCREEN_API)
430 if (m_fullScreenManager) {
431 m_fullScreenManager->invalidate();
432 m_fullScreenManager = 0;
436 if (m_openPanelResultListener) {
437 m_openPanelResultListener->invalidate();
438 m_openPanelResultListener = 0;
441 #if ENABLE(INPUT_TYPE_COLOR)
442 if (m_colorChooser) {
443 m_colorChooser->invalidate();
444 m_colorChooser = nullptr;
447 #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
448 if (m_colorPickerResultListener) {
449 m_colorPickerResultListener->invalidate();
450 m_colorPickerResultListener = nullptr;
455 #if ENABLE(GEOLOCATION)
456 m_geolocationPermissionRequestManager.invalidateRequests();
459 m_notificationPermissionRequestManager.invalidateRequests();
460 #if ENABLE(TIZEN_MEDIA_STREAM)
461 m_userMediaPermissionRequestManager.invalidateRequests();
464 m_toolTip = String();
466 m_mainFrameHasHorizontalScrollbar = false;
467 m_mainFrameHasVerticalScrollbar = false;
469 m_mainFrameIsPinnedToLeftSide = false;
470 m_mainFrameIsPinnedToRightSide = false;
472 m_visibleScrollerThumbRect = IntRect();
474 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
475 invalidateCallbackMap(m_booleanCallbacks);
477 invalidateCallbackMap(m_voidCallbacks);
478 invalidateCallbackMap(m_dataCallbacks);
479 invalidateCallbackMap(m_stringCallbacks);
480 m_loadDependentStringCallbackIDs.clear();
481 invalidateCallbackMap(m_scriptValueCallbacks);
482 invalidateCallbackMap(m_computedPagesCallbacks);
484 invalidateCallbackMap(m_printFinishedCallbacks);
487 Vector<WebEditCommandProxy*> editCommandVector;
488 copyToVector(m_editCommandSet, editCommandVector);
489 m_editCommandSet.clear();
490 for (size_t i = 0, size = editCommandVector.size(); i < size; ++i)
491 editCommandVector[i]->invalidate();
493 m_activePopupMenu = 0;
495 m_estimatedProgress = 0.0;
497 m_loaderClient.initialize(0);
498 m_policyClient.initialize(0);
499 m_uiClient.initialize(0);
501 m_drawingArea = nullptr;
503 process()->send(Messages::WebPage::Close(), m_pageID);
504 process()->removeWebPage(m_pageID);
507 bool WebPageProxy::tryClose()
512 process()->send(Messages::WebPage::TryClose(), m_pageID);
513 process()->responsivenessTimer()->start();
517 bool WebPageProxy::maybeInitializeSandboxExtensionHandle(const KURL& url, SandboxExtension::Handle& sandboxExtensionHandle)
519 if (!url.isLocalFile())
522 #if ENABLE(INSPECTOR)
523 // Don't give the inspector full access to the file system.
524 if (WebInspectorProxy::isInspectorPage(this))
528 SandboxExtension::createHandle("/", SandboxExtension::ReadOnly, sandboxExtensionHandle);
532 void WebPageProxy::loadURL(const String& url)
534 setPendingAPIRequestURL(url);
537 reattachToWebProcess();
539 SandboxExtension::Handle sandboxExtensionHandle;
540 bool createdExtension = maybeInitializeSandboxExtensionHandle(KURL(KURL(), url), sandboxExtensionHandle);
541 if (createdExtension)
542 process()->willAcquireUniversalFileReadSandboxExtension();
543 process()->send(Messages::WebPage::LoadURL(url, sandboxExtensionHandle), m_pageID);
544 process()->responsivenessTimer()->start();
547 void WebPageProxy::loadURLRequest(WebURLRequest* urlRequest)
549 setPendingAPIRequestURL(urlRequest->resourceRequest().url());
552 reattachToWebProcess();
554 SandboxExtension::Handle sandboxExtensionHandle;
555 bool createdExtension = maybeInitializeSandboxExtensionHandle(urlRequest->resourceRequest().url(), sandboxExtensionHandle);
556 if (createdExtension)
557 process()->willAcquireUniversalFileReadSandboxExtension();
558 process()->send(Messages::WebPage::LoadURLRequest(urlRequest->resourceRequest(), sandboxExtensionHandle), m_pageID);
559 process()->responsivenessTimer()->start();
562 void WebPageProxy::loadHTMLString(const String& htmlString, const String& baseURL)
565 reattachToWebProcess();
567 process()->assumeReadAccessToBaseURL(baseURL);
568 process()->send(Messages::WebPage::LoadHTMLString(htmlString, baseURL), m_pageID);
569 process()->responsivenessTimer()->start();
572 void WebPageProxy::loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL)
575 reattachToWebProcess();
578 m_mainFrame->setUnreachableURL(unreachableURL);
580 process()->assumeReadAccessToBaseURL(baseURL);
581 process()->send(Messages::WebPage::LoadAlternateHTMLString(htmlString, baseURL, unreachableURL), m_pageID);
582 process()->responsivenessTimer()->start();
585 void WebPageProxy::loadPlainTextString(const String& string)
588 reattachToWebProcess();
590 process()->send(Messages::WebPage::LoadPlainTextString(string), m_pageID);
591 process()->responsivenessTimer()->start();
594 void WebPageProxy::loadWebArchiveData(const WebData* webArchiveData)
597 reattachToWebProcess();
599 process()->send(Messages::WebPage::LoadWebArchiveData(webArchiveData->dataReference()), m_pageID);
600 process()->responsivenessTimer()->start();
604 void WebPageProxy::loadContentsbyMimeType(const WebData* contents, const String& mimeType, const String& encoding, const String& baseURL)
607 reattachToWebProcess();
609 process()->assumeReadAccessToBaseURL(baseURL);
610 process()->send(Messages::WebPage::LoadContentsbyMimeType(contents->dataReference(), mimeType, encoding, baseURL), m_pageID);
611 process()->responsivenessTimer()->start();
615 void WebPageProxy::stopLoading()
620 process()->send(Messages::WebPage::StopLoading(), m_pageID);
621 process()->responsivenessTimer()->start();
624 void WebPageProxy::reload(bool reloadFromOrigin)
626 SandboxExtension::Handle sandboxExtensionHandle;
628 if (m_backForwardList->currentItem()) {
629 String url = m_backForwardList->currentItem()->url();
630 setPendingAPIRequestURL(url);
632 // We may not have an extension yet if back/forward list was reinstated after a WebProcess crash or a browser relaunch
633 bool createdExtension = maybeInitializeSandboxExtensionHandle(KURL(KURL(), url), sandboxExtensionHandle);
634 if (createdExtension)
635 process()->willAcquireUniversalFileReadSandboxExtension();
639 reattachToWebProcessWithItem(m_backForwardList->currentItem());
643 process()->send(Messages::WebPage::Reload(reloadFromOrigin, sandboxExtensionHandle), m_pageID);
644 process()->responsivenessTimer()->start();
647 void WebPageProxy::goForward()
649 if (isValid() && !canGoForward())
652 WebBackForwardListItem* forwardItem = m_backForwardList->forwardItem();
656 setPendingAPIRequestURL(forwardItem->url());
659 reattachToWebProcessWithItem(forwardItem);
663 process()->send(Messages::WebPage::GoForward(forwardItem->itemID()), m_pageID);
664 process()->responsivenessTimer()->start();
667 bool WebPageProxy::canGoForward() const
669 return m_backForwardList->forwardItem();
672 void WebPageProxy::goBack()
674 if (isValid() && !canGoBack())
677 WebBackForwardListItem* backItem = m_backForwardList->backItem();
681 setPendingAPIRequestURL(backItem->url());
684 reattachToWebProcessWithItem(backItem);
688 process()->send(Messages::WebPage::GoBack(backItem->itemID()), m_pageID);
689 process()->responsivenessTimer()->start();
692 bool WebPageProxy::canGoBack() const
694 return m_backForwardList->backItem();
697 void WebPageProxy::goToBackForwardItem(WebBackForwardListItem* item)
700 reattachToWebProcessWithItem(item);
704 setPendingAPIRequestURL(item->url());
706 process()->send(Messages::WebPage::GoToBackForwardItem(item->itemID()), m_pageID);
707 process()->responsivenessTimer()->start();
710 void WebPageProxy::tryRestoreScrollPosition()
715 process()->send(Messages::WebPage::TryRestoreScrollPosition(), m_pageID);
718 void WebPageProxy::didChangeBackForwardList(WebBackForwardListItem* added, Vector<RefPtr<APIObject> >* removed)
720 m_loaderClient.didChangeBackForwardList(this, added, removed);
723 void WebPageProxy::shouldGoToBackForwardListItem(uint64_t itemID, bool& shouldGoToBackForwardItem)
725 WebBackForwardListItem* item = process()->webBackForwardItem(itemID);
726 shouldGoToBackForwardItem = item && m_loaderClient.shouldGoToBackForwardListItem(this, item);
729 void WebPageProxy::willGoToBackForwardListItem(uint64_t itemID, CoreIPC::ArgumentDecoder* arguments)
731 RefPtr<APIObject> userData;
732 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
733 if (!arguments->decode(messageDecoder))
736 if (WebBackForwardListItem* item = process()->webBackForwardItem(itemID))
737 m_loaderClient.willGoToBackForwardListItem(this, item, userData.get());
740 String WebPageProxy::activeURL() const
742 // If there is a currently pending url, it is the active URL,
743 // even when there's no main frame yet, as it might be the
744 // first API request.
745 if (!m_pendingAPIRequestURL.isNull())
746 return m_pendingAPIRequestURL;
751 if (!m_mainFrame->unreachableURL().isEmpty())
752 return m_mainFrame->unreachableURL();
754 switch (m_mainFrame->loadState()) {
755 case WebFrameProxy::LoadStateProvisional:
756 return m_mainFrame->provisionalURL();
757 case WebFrameProxy::LoadStateCommitted:
758 case WebFrameProxy::LoadStateFinished:
759 return m_mainFrame->url();
762 ASSERT_NOT_REACHED();
766 String WebPageProxy::provisionalURL() const
770 return m_mainFrame->provisionalURL();
773 String WebPageProxy::committedURL() const
778 return m_mainFrame->url();
781 bool WebPageProxy::canShowMIMEType(const String& mimeType) const
783 if (MIMETypeRegistry::canShowMIMEType(mimeType))
786 String newMimeType = mimeType;
787 PluginModuleInfo plugin = m_process->context()->pluginInfoStore().findPlugin(newMimeType, KURL());
788 if (!plugin.path.isNull() && m_pageGroup->preferences()->pluginsEnabled())
794 void WebPageProxy::setDrawsBackground(bool drawsBackground)
796 if (m_drawsBackground == drawsBackground)
799 m_drawsBackground = drawsBackground;
802 process()->send(Messages::WebPage::SetDrawsBackground(drawsBackground), m_pageID);
805 void WebPageProxy::setDrawsTransparentBackground(bool drawsTransparentBackground)
807 if (m_drawsTransparentBackground == drawsTransparentBackground)
810 m_drawsTransparentBackground = drawsTransparentBackground;
813 process()->send(Messages::WebPage::SetDrawsTransparentBackground(drawsTransparentBackground), m_pageID);
816 void WebPageProxy::viewWillStartLiveResize()
820 process()->send(Messages::WebPage::ViewWillStartLiveResize(), m_pageID);
823 void WebPageProxy::viewWillEndLiveResize()
827 process()->send(Messages::WebPage::ViewWillEndLiveResize(), m_pageID);
830 void WebPageProxy::setViewNeedsDisplay(const IntRect& rect)
832 m_pageClient->setViewNeedsDisplay(rect);
835 void WebPageProxy::displayView()
837 m_pageClient->displayView();
840 void WebPageProxy::scrollView(const IntRect& scrollRect, const IntSize& scrollOffset)
842 m_pageClient->scrollView(scrollRect, scrollOffset);
845 void WebPageProxy::viewStateDidChange(ViewStateFlags flags)
850 if (flags & ViewIsFocused)
851 process()->send(Messages::WebPage::SetFocused(m_pageClient->isViewFocused()), m_pageID);
853 if (flags & ViewWindowIsActive)
854 process()->send(Messages::WebPage::SetActive(m_pageClient->isViewWindowActive()), m_pageID);
856 if (flags & ViewIsVisible) {
857 bool isVisible = m_pageClient->isViewVisible();
858 if (isVisible != m_isVisible) {
859 m_isVisible = isVisible;
860 m_drawingArea->visibilityDidChange();
863 // If we've started the responsiveness timer as part of telling the web process to update the backing store
864 // state, it might not send back a reply (since it won't paint anything if the web page is hidden) so we
865 // stop the unresponsiveness timer here.
866 process()->responsivenessTimer()->stop();
871 if (flags & ViewIsInWindow) {
872 bool isInWindow = m_pageClient->isViewInWindow();
873 if (m_isInWindow != isInWindow) {
874 m_isInWindow = isInWindow;
875 process()->send(Messages::WebPage::SetIsInWindow(isInWindow), m_pageID);
879 LayerHostingMode layerHostingMode = m_pageClient->viewLayerHostingMode();
880 if (m_layerHostingMode != layerHostingMode) {
881 m_layerHostingMode = layerHostingMode;
882 m_drawingArea->layerHostingModeDidChange();
887 #if ENABLE(PAGE_VISIBILITY_API)
888 PageVisibilityState visibilityState = PageVisibilityStateHidden;
890 if (m_pageClient->isViewVisible())
891 visibilityState = PageVisibilityStateVisible;
893 if (visibilityState != m_visibilityState) {
894 m_visibilityState = visibilityState;
895 process()->send(Messages::WebPage::SetVisibilityState(visibilityState, false), m_pageID);
899 updateBackingStoreDiscardableState();
902 IntSize WebPageProxy::viewSize() const
904 return m_pageClient->viewSize();
907 void WebPageProxy::setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent& keyboardEvent)
911 process()->send(Messages::WebPage::SetInitialFocus(forward, isKeyboardEventValid, keyboardEvent), m_pageID);
914 void WebPageProxy::setWindowResizerSize(const IntSize& windowResizerSize)
918 process()->send(Messages::WebPage::SetWindowResizerSize(windowResizerSize), m_pageID);
921 void WebPageProxy::clearSelection()
925 process()->send(Messages::WebPage::ClearSelection(), m_pageID);
928 void WebPageProxy::validateCommand(const String& commandName, PassRefPtr<ValidateCommandCallback> callback)
931 callback->invalidate();
935 uint64_t callbackID = callback->callbackID();
936 m_validateCommandCallbacks.set(callbackID, callback.get());
937 process()->send(Messages::WebPage::ValidateCommand(commandName, callbackID), m_pageID);
940 void WebPageProxy::setMaintainsInactiveSelection(bool newValue)
942 m_maintainsInactiveSelection = newValue;
945 void WebPageProxy::executeEditCommand(const String& commandName)
950 DEFINE_STATIC_LOCAL(String, ignoreSpellingCommandName, ("ignoreSpelling"));
951 if (commandName == ignoreSpellingCommandName)
952 ++m_pendingLearnOrIgnoreWordMessageCount;
954 process()->send(Messages::WebPage::ExecuteEditCommand(commandName), m_pageID);
957 #if USE(TILED_BACKING_STORE)
958 void WebPageProxy::setViewportSize(const IntSize& size)
963 process()->send(Messages::WebPage::SetViewportSize(size), m_pageID);
967 #if ENABLE(DRAG_SUPPORT)
968 void WebPageProxy::dragEntered(DragData* dragData, const String& dragStorageName)
970 SandboxExtension::Handle sandboxExtensionHandle;
971 SandboxExtension::HandleArray sandboxExtensionHandleEmptyArray;
972 performDragControllerAction(DragControllerActionEntered, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionHandleEmptyArray);
975 void WebPageProxy::dragUpdated(DragData* dragData, const String& dragStorageName)
977 SandboxExtension::Handle sandboxExtensionHandle;
978 SandboxExtension::HandleArray sandboxExtensionHandleEmptyArray;
979 performDragControllerAction(DragControllerActionUpdated, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionHandleEmptyArray);
982 void WebPageProxy::dragExited(DragData* dragData, const String& dragStorageName)
984 SandboxExtension::Handle sandboxExtensionHandle;
985 SandboxExtension::HandleArray sandboxExtensionHandleEmptyArray;
986 performDragControllerAction(DragControllerActionExited, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionHandleEmptyArray);
989 #if ENABLE(TIZEN_DRAG_SUPPORT)
990 void WebPageProxy::performDrag(DragData* dragData, const String& dragStorageName)
992 void WebPageProxy::performDrag(DragData* dragData, const String& dragStorageName, const SandboxExtension::Handle& sandboxExtensionHandle, const SandboxExtension::HandleArray& sandboxExtensionsForUpload)
995 #if ENABLE(TIZEN_DRAG_SUPPORT)
996 TIZEN_LOGI("dragData (%p)", dragData);
997 SandboxExtension::Handle sandboxExtensionHandle;
998 SandboxExtension::HandleArray sandboxExtensionHandleEmptyArray;
999 performDragControllerAction(DragControllerActionPerformDrag, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionHandleEmptyArray);
1001 performDragControllerAction(DragControllerActionPerformDrag, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionsForUpload);
1005 void WebPageProxy::performDragControllerAction(DragControllerAction action, DragData* dragData, const String& dragStorageName, const SandboxExtension::Handle& sandboxExtensionHandle, const SandboxExtension::HandleArray& sandboxExtensionsForUpload)
1010 // FIXME: We should pass the drag data map only on DragEnter.
1011 process()->send(Messages::WebPage::PerformDragControllerAction(action, dragData->clientPosition(), dragData->globalPosition(),
1012 dragData->draggingSourceOperationMask(), dragData->dragDataMap(), dragData->flags()), m_pageID);
1013 #elif PLATFORM(QT) || PLATFORM(GTK) || ENABLE(TIZEN_DRAG_SUPPORT)
1014 process()->send(Messages::WebPage::PerformDragControllerAction(action, *dragData), m_pageID);
1016 process()->send(Messages::WebPage::PerformDragControllerAction(action, dragData->clientPosition(), dragData->globalPosition(), dragData->draggingSourceOperationMask(), dragStorageName, dragData->flags(), sandboxExtensionHandle, sandboxExtensionsForUpload), m_pageID);
1020 void WebPageProxy::didPerformDragControllerAction(WebCore::DragSession dragSession)
1022 m_currentDragSession = dragSession;
1025 #if PLATFORM(QT) || PLATFORM(GTK) || ENABLE(TIZEN_DRAG_SUPPORT)
1026 void WebPageProxy::startDrag(const DragData& dragData, const ShareableBitmap::Handle& dragImageHandle)
1028 TIZEN_LOGI("dragData (%p)", dragData);
1029 RefPtr<ShareableBitmap> dragImage = 0;
1030 if (!dragImageHandle.isNull()) {
1031 dragImage = ShareableBitmap::create(dragImageHandle);
1036 m_pageClient->startDrag(dragData, dragImage.release());
1040 void WebPageProxy::dragEnded(const IntPoint& clientPosition, const IntPoint& globalPosition, uint64_t operation)
1042 TIZEN_LOGI("clientPosition (%p)", clientPosition);
1045 process()->send(Messages::WebPage::DragEnded(clientPosition, globalPosition, operation), m_pageID);
1047 #endif // ENABLE(DRAG_SUPPORT)
1049 void WebPageProxy::handleMouseEvent(const NativeWebMouseEvent& event)
1054 // NOTE: This does not start the responsiveness timer because mouse move should not indicate interaction.
1055 if (event.type() != WebEvent::MouseMove)
1056 process()->responsivenessTimer()->start();
1058 if (m_processingMouseMoveEvent) {
1059 m_nextMouseMoveEvent = adoptPtr(new NativeWebMouseEvent(event));
1063 m_processingMouseMoveEvent = true;
1066 // <https://bugs.webkit.org/show_bug.cgi?id=57904> We need to keep track of the mouse down event in the case where we
1067 // display a popup menu for select elements. When the user changes the selected item,
1068 // we fake a mouse up event by using this stored down event. This event gets cleared
1069 // when the mouse up message is received from WebProcess.
1070 if (event.type() == WebEvent::MouseDown)
1071 m_currentlyProcessedMouseDownEvent = adoptPtr(new NativeWebMouseEvent(event));
1073 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
1074 // We have to hide text-selection's context menu when other area is clicked.
1075 // In case of normal context menu, it is hided by elm_ctxpopup's logic.
1076 if (event.type() == WebEvent::MouseDown)
1080 if (m_shouldSendEventsSynchronously) {
1081 bool handled = false;
1082 process()->sendSync(Messages::WebPage::MouseEventSyncForTesting(event), Messages::WebPage::MouseEventSyncForTesting::Reply(handled), m_pageID);
1083 didReceiveEvent(event.type(), handled);
1085 process()->send(Messages::WebPage::MouseEvent(event), m_pageID);
1088 #if MERGE_WHEEL_EVENTS
1089 static bool canCoalesce(const WebWheelEvent& a, const WebWheelEvent& b)
1091 if (a.position() != b.position())
1093 if (a.globalPosition() != b.globalPosition())
1095 if (a.modifiers() != b.modifiers())
1097 if (a.granularity() != b.granularity())
1100 if (a.phase() != b.phase())
1102 if (a.momentumPhase() != b.momentumPhase())
1104 if (a.hasPreciseScrollingDeltas() != b.hasPreciseScrollingDeltas())
1111 static WebWheelEvent coalesce(const WebWheelEvent& a, const WebWheelEvent& b)
1113 ASSERT(canCoalesce(a, b));
1115 FloatSize mergedDelta = a.delta() + b.delta();
1116 FloatSize mergedWheelTicks = a.wheelTicks() + b.wheelTicks();
1119 FloatSize mergedUnacceleratedScrollingDelta = a.unacceleratedScrollingDelta() + b.unacceleratedScrollingDelta();
1121 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());
1123 return WebWheelEvent(WebEvent::Wheel, b.position(), b.globalPosition(), mergedDelta, mergedWheelTicks, b.granularity(), b.modifiers(), b.timestamp());
1126 #endif // MERGE_WHEEL_EVENTS
1128 static WebWheelEvent coalescedWheelEvent(Deque<NativeWebWheelEvent>& queue, Vector<NativeWebWheelEvent>& coalescedEvents)
1130 ASSERT(!queue.isEmpty());
1131 ASSERT(coalescedEvents.isEmpty());
1133 #if MERGE_WHEEL_EVENTS
1134 NativeWebWheelEvent firstEvent = queue.takeFirst();
1135 coalescedEvents.append(firstEvent);
1137 WebWheelEvent event = firstEvent;
1138 while (!queue.isEmpty() && canCoalesce(event, queue.first())) {
1139 NativeWebWheelEvent firstEvent = queue.takeFirst();
1140 coalescedEvents.append(firstEvent);
1141 event = coalesce(event, firstEvent);
1146 while (!queue.isEmpty())
1147 coalescedEvents.append(queue.takeFirst());
1148 return coalescedEvents.last();
1152 void WebPageProxy::handleWheelEvent(const NativeWebWheelEvent& event)
1157 if (!m_currentlyProcessedWheelEvents.isEmpty()) {
1158 m_wheelEventQueue.append(event);
1159 if (m_wheelEventQueue.size() < wheelEventQueueSizeThreshold)
1161 // The queue has too many wheel events, so push a new event.
1164 if (!m_wheelEventQueue.isEmpty()) {
1165 processNextQueuedWheelEvent();
1169 OwnPtr<Vector<NativeWebWheelEvent> > coalescedWheelEvent = adoptPtr(new Vector<NativeWebWheelEvent>);
1170 coalescedWheelEvent->append(event);
1171 m_currentlyProcessedWheelEvents.append(coalescedWheelEvent.release());
1172 sendWheelEvent(event);
1175 void WebPageProxy::processNextQueuedWheelEvent()
1177 OwnPtr<Vector<NativeWebWheelEvent> > nextCoalescedEvent = adoptPtr(new Vector<NativeWebWheelEvent>);
1178 WebWheelEvent nextWheelEvent = coalescedWheelEvent(m_wheelEventQueue, *nextCoalescedEvent.get());
1179 m_currentlyProcessedWheelEvents.append(nextCoalescedEvent.release());
1180 sendWheelEvent(nextWheelEvent);
1183 void WebPageProxy::sendWheelEvent(const WebWheelEvent& event)
1185 process()->responsivenessTimer()->start();
1187 if (m_shouldSendEventsSynchronously) {
1188 bool handled = false;
1189 process()->sendSync(Messages::WebPage::WheelEventSyncForTesting(event), Messages::WebPage::WheelEventSyncForTesting::Reply(handled), m_pageID);
1190 didReceiveEvent(event.type(), handled);
1194 process()->send(Messages::EventDispatcher::WheelEvent(m_pageID, event, canGoBack(), canGoForward()), 0);
1197 void WebPageProxy::handleKeyboardEvent(const NativeWebKeyboardEvent& event)
1202 LOG(KeyHandling, "WebPageProxy::handleKeyboardEvent: %s", webKeyboardEventTypeString(event.type()));
1204 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1205 if (!isWaitingForJavaScriptPopupReply()) {
1206 m_keyEventQueue.append(event);
1208 process()->responsivenessTimer()->start();
1209 if (m_shouldSendEventsSynchronously) {
1210 bool handled = false;
1211 process()->sendSync(Messages::WebPage::KeyEventSyncForTesting(event), Messages::WebPage::KeyEventSyncForTesting::Reply(handled), m_pageID);
1212 didReceiveEvent(event.type(), handled);
1214 process()->send(Messages::WebPage::KeyEvent(event), m_pageID);
1216 if (m_keyEventQueue.isEmpty()) {
1217 bool handled = false;
1218 m_pageClient->doneWithKeyEvent(event, handled);
1220 QueuedUIEvents<NativeWebKeyboardEvent>& lastEvent = m_keyEventQueue.last();
1221 lastEvent.deferredEvents.append(event);
1225 m_keyEventQueue.append(event);
1227 process()->responsivenessTimer()->start();
1228 if (m_shouldSendEventsSynchronously) {
1229 bool handled = false;
1230 process()->sendSync(Messages::WebPage::KeyEventSyncForTesting(event), Messages::WebPage::KeyEventSyncForTesting::Reply(handled), m_pageID);
1231 didReceiveEvent(event.type(), handled);
1232 } else if (m_keyEventQueue.size() == 1) // Otherwise, sent from DidReceiveEvent message handler.
1233 process()->send(Messages::WebPage::KeyEvent(event), m_pageID);
1237 #if ENABLE(GESTURE_EVENTS)
1238 void WebPageProxy::handleGestureEvent(const WebGestureEvent& event)
1243 #if ENABLE(TIZEN_ISF_PORT)
1244 if (event.type() == WebEvent::GestureSingleTap)
1245 ewk_view_imf_context_reset(viewWidget());
1248 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1249 if (!isWaitingForJavaScriptPopupReply()) {
1250 m_gestureEventQueue.append(event);
1252 process()->responsivenessTimer()->start();
1253 process()->send(Messages::EventDispatcher::GestureEvent(m_pageID, event), 0);
1255 if (m_gestureEventQueue.isEmpty()) {
1256 bool isEventHandled = false;
1257 m_pageClient->doneWithGestureEvent(event, isEventHandled);
1259 QueuedUIEvents<WebGestureEvent>& lastEvent = m_gestureEventQueue.last();
1260 lastEvent.deferredEvents.append(event);
1264 m_gestureEventQueue.append(event);
1266 process()->responsivenessTimer()->start();
1267 process()->send(Messages::EventDispatcher::GestureEvent(m_pageID, event), 0);
1272 #if ENABLE(TOUCH_EVENTS)
1274 void WebPageProxy::handlePotentialActivation(const IntPoint& touchPoint, const IntSize& touchArea)
1276 process()->send(Messages::WebPage::HighlightPotentialActivation(touchPoint, touchArea), m_pageID);
1280 void WebPageProxy::handleTouchEvent(const NativeWebTouchEvent& event)
1285 // If the page is suspended, which should be the case during panning, pinching
1286 // and animation on the page itself (kinetic scrolling, tap to zoom) etc, then
1287 // we do not send any of the events to the page even if is has listeners.
1288 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1289 if (m_needTouchEvents && !m_isPageSuspended && !isWaitingForJavaScriptPopupReply()) {
1291 if (m_needTouchEvents && !m_isPageSuspended) {
1294 // Do not send the TouchMove event if last TouchMove is not processed yet.
1295 // TouchMove event will be sent too many times without below codes,
1296 // and it will affect Web Applications' performance.
1297 if (event.type() == WebEvent::TouchMove
1298 && !m_touchEventQueue.isEmpty()
1299 && m_touchEventQueue.last().forwardedEvent.type() == event.type())
1302 m_touchEventQueue.append(event);
1303 process()->responsivenessTimer()->start();
1304 if (m_shouldSendEventsSynchronously) {
1305 bool handled = false;
1306 process()->sendSync(Messages::WebPage::TouchEventSyncForTesting(event), Messages::WebPage::TouchEventSyncForTesting::Reply(handled), m_pageID);
1307 didReceiveEvent(event.type(), handled);
1309 process()->send(Messages::WebPage::TouchEvent(event), m_pageID);
1311 if (m_touchEventQueue.isEmpty()) {
1312 bool isEventHandled = false;
1313 m_pageClient->doneWithTouchEvent(event, isEventHandled);
1315 // We attach the incoming events to the newest queued event so that all
1316 // the events are delivered in the correct order when the event is dequed.
1317 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1318 QueuedUIEvents<NativeWebTouchEvent>& lastEvent = m_touchEventQueue.last();
1319 lastEvent.deferredEvents.append(event);
1321 QueuedTouchEvents& lastEvent = m_touchEventQueue.last();
1322 lastEvent.deferredTouchEvents.append(event);
1329 #if ENABLE(SCREEN_ORIENTATION_SUPPORT) && ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT)
1330 void WebPageProxy::lockOrientation(int willLockOrientation, bool& result)
1332 result = m_pageClient->lockOrientation(willLockOrientation);
1334 void WebPageProxy::unlockOrientation()
1336 m_pageClient->unlockOrientation();
1340 void WebPageProxy::scrollBy(ScrollDirection direction, ScrollGranularity granularity)
1345 process()->send(Messages::WebPage::ScrollBy(direction, granularity), m_pageID);
1348 void WebPageProxy::centerSelectionInVisibleArea()
1353 process()->send(Messages::WebPage::CenterSelectionInVisibleArea(), m_pageID);
1356 #if ENABLE(TIZEN_DOWNLOAD_ATTRIBUTE)
1357 void WebPageProxy::startDownload(const ResourceRequest& request, const String& /*suggestedName*/)
1359 // FIXME: suggestedName need to be passed to provide a suggested destination file name
1360 m_process->context()->download(this, request);
1364 void WebPageProxy::receivedPolicyDecision(PolicyAction action, WebFrameProxy* frame, uint64_t listenerID)
1369 if (action == PolicyIgnore)
1370 clearPendingAPIRequestURL();
1372 uint64_t downloadID = 0;
1373 if (action == PolicyDownload) {
1374 // Create a download proxy.
1375 DownloadProxy* download = m_process->context()->createDownloadProxy();
1376 downloadID = download->downloadID();
1377 #if PLATFORM(QT) || PLATFORM(EFL)
1378 // Our design does not suppport downloads without a WebPage.
1379 handleDownloadRequest(download);
1383 // If we received a policy decision while in decidePolicyForResponse the decision will
1384 // be sent back to the web process by decidePolicyForResponse.
1385 if (m_inDecidePolicyForResponse) {
1386 m_syncMimeTypePolicyActionIsValid = true;
1387 m_syncMimeTypePolicyAction = action;
1388 m_syncMimeTypePolicyDownloadID = downloadID;
1392 // If we received a policy decision while in decidePolicyForNavigationAction the decision will
1393 // be sent back to the web process by decidePolicyForNavigationAction.
1394 if (m_inDecidePolicyForNavigationAction) {
1395 m_syncNavigationActionPolicyActionIsValid = true;
1396 m_syncNavigationActionPolicyAction = action;
1397 m_syncNavigationActionPolicyDownloadID = downloadID;
1401 process()->send(Messages::WebPage::DidReceivePolicyDecision(frame->frameID(), listenerID, action, downloadID), m_pageID);
1404 String WebPageProxy::pageTitle() const
1406 // Return the null string if there is no main frame (e.g. nothing has been loaded in the page yet, WebProcess has
1407 // crashed, page has been closed).
1411 return m_mainFrame->title();
1414 void WebPageProxy::setUserAgent(const String& userAgent)
1416 if (m_userAgent == userAgent)
1418 m_userAgent = userAgent;
1422 process()->send(Messages::WebPage::SetUserAgent(m_userAgent), m_pageID);
1425 void WebPageProxy::setApplicationNameForUserAgent(const String& applicationName)
1427 if (m_applicationNameForUserAgent == applicationName)
1430 m_applicationNameForUserAgent = applicationName;
1431 if (!m_customUserAgent.isEmpty())
1434 setUserAgent(standardUserAgent(m_applicationNameForUserAgent));
1437 void WebPageProxy::setCustomUserAgent(const String& customUserAgent)
1439 if (m_customUserAgent == customUserAgent)
1442 m_customUserAgent = customUserAgent;
1444 if (m_customUserAgent.isEmpty()) {
1445 setUserAgent(standardUserAgent(m_applicationNameForUserAgent));
1449 setUserAgent(m_customUserAgent);
1452 void WebPageProxy::resumeActiveDOMObjectsAndAnimations()
1454 if (!isValid() || !m_isPageSuspended)
1457 m_isPageSuspended = false;
1459 process()->send(Messages::WebPage::ResumeActiveDOMObjectsAndAnimations(), m_pageID);
1462 void WebPageProxy::suspendActiveDOMObjectsAndAnimations()
1464 if (!isValid() || m_isPageSuspended)
1467 m_isPageSuspended = true;
1469 process()->send(Messages::WebPage::SuspendActiveDOMObjectsAndAnimations(), m_pageID);
1472 bool WebPageProxy::supportsTextEncoding() const
1474 return !m_mainFrameHasCustomRepresentation && m_mainFrame && !m_mainFrame->isDisplayingStandaloneImageDocument();
1477 void WebPageProxy::setCustomTextEncodingName(const String& encodingName)
1479 if (m_customTextEncodingName == encodingName)
1481 m_customTextEncodingName = encodingName;
1485 process()->send(Messages::WebPage::SetCustomTextEncodingName(encodingName), m_pageID);
1488 void WebPageProxy::terminateProcess()
1490 // NOTE: This uses a check of m_isValid rather than calling isValid() since
1491 // we want this to run even for pages being closed or that already closed.
1495 process()->terminate();
1498 #if !USE(CF) || defined(BUILDING_QT__)
1499 PassRefPtr<WebData> WebPageProxy::sessionStateData(WebPageProxySessionStateFilterCallback, void* context) const
1501 // FIXME: Return session state data for saving Page state.
1505 void WebPageProxy::restoreFromSessionStateData(WebData*)
1507 // FIXME: Restore the Page from the passed in session state data.
1511 bool WebPageProxy::supportsTextZoom() const
1513 if (m_mainFrameHasCustomRepresentation)
1516 // FIXME: This should also return false for standalone media and plug-in documents.
1517 if (!m_mainFrame || m_mainFrame->isDisplayingStandaloneImageDocument())
1523 void WebPageProxy::setTextZoomFactor(double zoomFactor)
1528 if (m_mainFrameHasCustomRepresentation)
1531 if (m_textZoomFactor == zoomFactor)
1534 m_textZoomFactor = zoomFactor;
1535 process()->send(Messages::WebPage::SetTextZoomFactor(m_textZoomFactor), m_pageID);
1538 double WebPageProxy::pageZoomFactor() const
1540 return m_mainFrameHasCustomRepresentation ? m_pageClient->customRepresentationZoomFactor() : m_pageZoomFactor;
1543 void WebPageProxy::setPageZoomFactor(double zoomFactor)
1548 if (m_mainFrameHasCustomRepresentation) {
1549 m_pageClient->setCustomRepresentationZoomFactor(zoomFactor);
1553 if (m_pageZoomFactor == zoomFactor)
1556 m_pageZoomFactor = zoomFactor;
1557 process()->send(Messages::WebPage::SetPageZoomFactor(m_pageZoomFactor), m_pageID);
1560 void WebPageProxy::setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor)
1565 if (m_mainFrameHasCustomRepresentation) {
1566 m_pageClient->setCustomRepresentationZoomFactor(pageZoomFactor);
1570 if (m_pageZoomFactor == pageZoomFactor && m_textZoomFactor == textZoomFactor)
1573 m_pageZoomFactor = pageZoomFactor;
1574 m_textZoomFactor = textZoomFactor;
1575 process()->send(Messages::WebPage::SetPageAndTextZoomFactors(m_pageZoomFactor, m_textZoomFactor), m_pageID);
1578 void WebPageProxy::scalePage(double scale, const IntPoint& origin)
1583 process()->send(Messages::WebPage::ScalePage(scale, origin), m_pageID);
1586 void WebPageProxy::setIntrinsicDeviceScaleFactor(float scaleFactor)
1588 if (m_intrinsicDeviceScaleFactor == scaleFactor)
1591 m_intrinsicDeviceScaleFactor = scaleFactor;
1594 m_drawingArea->deviceScaleFactorDidChange();
1597 void WebPageProxy::windowScreenDidChange(PlatformDisplayID displayID)
1602 process()->send(Messages::WebPage::WindowScreenDidChange(displayID), m_pageID);
1605 float WebPageProxy::deviceScaleFactor() const
1607 if (m_customDeviceScaleFactor)
1608 return m_customDeviceScaleFactor;
1609 return m_intrinsicDeviceScaleFactor;
1612 void WebPageProxy::setCustomDeviceScaleFactor(float customScaleFactor)
1617 if (m_customDeviceScaleFactor == customScaleFactor)
1620 float oldScaleFactor = deviceScaleFactor();
1622 m_customDeviceScaleFactor = customScaleFactor;
1624 if (deviceScaleFactor() != oldScaleFactor)
1625 m_drawingArea->deviceScaleFactorDidChange();
1628 void WebPageProxy::setUseFixedLayout(bool fixed)
1633 // This check is fine as the value is initialized in the web
1634 // process as part of the creation parameters.
1635 if (fixed == m_useFixedLayout)
1638 m_useFixedLayout = fixed;
1640 m_fixedLayoutSize = IntSize();
1641 process()->send(Messages::WebPage::SetUseFixedLayout(fixed), m_pageID);
1644 void WebPageProxy::setFixedLayoutSize(const IntSize& size)
1649 if (size == m_fixedLayoutSize)
1652 m_fixedLayoutSize = size;
1653 process()->send(Messages::WebPage::SetFixedLayoutSize(size), m_pageID);
1656 void WebPageProxy::setPaginationMode(WebCore::Page::Pagination::Mode mode)
1658 if (mode == m_paginationMode)
1661 m_paginationMode = mode;
1665 process()->send(Messages::WebPage::SetPaginationMode(mode), m_pageID);
1668 void WebPageProxy::setPaginationBehavesLikeColumns(bool behavesLikeColumns)
1670 if (behavesLikeColumns == m_paginationBehavesLikeColumns)
1673 m_paginationBehavesLikeColumns = behavesLikeColumns;
1677 process()->send(Messages::WebPage::SetPaginationBehavesLikeColumns(behavesLikeColumns), m_pageID);
1680 void WebPageProxy::setPageLength(double pageLength)
1682 if (pageLength == m_pageLength)
1685 m_pageLength = pageLength;
1689 process()->send(Messages::WebPage::SetPageLength(pageLength), m_pageID);
1692 void WebPageProxy::setGapBetweenPages(double gap)
1694 if (gap == m_gapBetweenPages)
1697 m_gapBetweenPages = gap;
1701 process()->send(Messages::WebPage::SetGapBetweenPages(gap), m_pageID);
1704 void WebPageProxy::pageScaleFactorDidChange(double scaleFactor)
1706 m_pageScaleFactor = scaleFactor;
1707 m_pageClient->pageScaleFactorDidChange();
1710 void WebPageProxy::setMemoryCacheClientCallsEnabled(bool memoryCacheClientCallsEnabled)
1715 if (m_areMemoryCacheClientCallsEnabled == memoryCacheClientCallsEnabled)
1718 m_areMemoryCacheClientCallsEnabled = memoryCacheClientCallsEnabled;
1719 process()->send(Messages::WebPage::SetMemoryCacheMessagesEnabled(memoryCacheClientCallsEnabled), m_pageID);
1722 void WebPageProxy::findStringMatches(const String& string, FindOptions options, unsigned maxMatchCount)
1724 if (string.isEmpty()) {
1725 didFindStringMatches(string, Vector<Vector<WebCore::IntRect> > (), 0);
1729 m_process->send(Messages::WebPage::FindStringMatches(string, options, maxMatchCount), m_pageID);
1732 void WebPageProxy::findString(const String& string, FindOptions options, unsigned maxMatchCount)
1734 if (m_mainFrameHasCustomRepresentation)
1735 m_pageClient->findStringInCustomRepresentation(string, options, maxMatchCount);
1737 process()->send(Messages::WebPage::FindString(string, options, maxMatchCount), m_pageID);
1740 void WebPageProxy::getImageForFindMatch(int32_t matchIndex)
1742 m_process->send(Messages::WebPage::GetImageForFindMatch(matchIndex), m_pageID);
1745 void WebPageProxy::selectFindMatch(int32_t matchIndex)
1747 m_process->send(Messages::WebPage::SelectFindMatch(matchIndex), m_pageID);
1750 void WebPageProxy::hideFindUI()
1752 process()->send(Messages::WebPage::HideFindUI(), m_pageID);
1755 void WebPageProxy::countStringMatches(const String& string, FindOptions options, unsigned maxMatchCount)
1757 if (m_mainFrameHasCustomRepresentation) {
1758 m_pageClient->countStringMatchesInCustomRepresentation(string, options, maxMatchCount);
1765 process()->send(Messages::WebPage::CountStringMatches(string, options, maxMatchCount), m_pageID);
1768 void WebPageProxy::runJavaScriptInMainFrame(const String& script, PassRefPtr<ScriptValueCallback> prpCallback)
1770 RefPtr<ScriptValueCallback> callback = prpCallback;
1772 callback->invalidate();
1776 uint64_t callbackID = callback->callbackID();
1777 m_scriptValueCallbacks.set(callbackID, callback.get());
1778 process()->send(Messages::WebPage::RunJavaScriptInMainFrame(script, callbackID), m_pageID);
1781 void WebPageProxy::getRenderTreeExternalRepresentation(PassRefPtr<StringCallback> prpCallback)
1783 RefPtr<StringCallback> callback = prpCallback;
1785 callback->invalidate();
1789 uint64_t callbackID = callback->callbackID();
1790 m_stringCallbacks.set(callbackID, callback.get());
1791 process()->send(Messages::WebPage::GetRenderTreeExternalRepresentation(callbackID), m_pageID);
1794 void WebPageProxy::getSourceForFrame(WebFrameProxy* frame, PassRefPtr<StringCallback> prpCallback)
1796 RefPtr<StringCallback> callback = prpCallback;
1798 callback->invalidate();
1802 uint64_t callbackID = callback->callbackID();
1803 m_loadDependentStringCallbackIDs.add(callbackID);
1804 m_stringCallbacks.set(callbackID, callback.get());
1805 process()->send(Messages::WebPage::GetSourceForFrame(frame->frameID(), callbackID), m_pageID);
1808 #if ENABLE(WEB_INTENTS)
1809 void WebPageProxy::deliverIntentToFrame(WebFrameProxy* frame, WebIntentData* webIntentData)
1814 process()->send(Messages::WebPage::DeliverIntentToFrame(frame->frameID(), webIntentData->store()), m_pageID);
1818 void WebPageProxy::getContentsAsString(PassRefPtr<StringCallback> prpCallback)
1820 RefPtr<StringCallback> callback = prpCallback;
1822 callback->invalidate();
1826 uint64_t callbackID = callback->callbackID();
1827 m_loadDependentStringCallbackIDs.add(callbackID);
1828 m_stringCallbacks.set(callbackID, callback.get());
1829 process()->send(Messages::WebPage::GetContentsAsString(callbackID), m_pageID);
1833 void WebPageProxy::getContentsAsMHTMLData(PassRefPtr<DataCallback> prpCallback, bool useBinaryEncoding)
1835 RefPtr<DataCallback> callback = prpCallback;
1837 callback->invalidate();
1841 uint64_t callbackID = callback->callbackID();
1842 m_dataCallbacks.set(callbackID, callback.get());
1843 process()->send(Messages::WebPage::GetContentsAsMHTMLData(callbackID, useBinaryEncoding), m_pageID);
1847 void WebPageProxy::getSelectionOrContentsAsString(PassRefPtr<StringCallback> prpCallback)
1849 RefPtr<StringCallback> callback = prpCallback;
1851 callback->invalidate();
1855 uint64_t callbackID = callback->callbackID();
1856 m_stringCallbacks.set(callbackID, callback.get());
1857 process()->send(Messages::WebPage::GetSelectionOrContentsAsString(callbackID), m_pageID);
1860 void WebPageProxy::getMainResourceDataOfFrame(WebFrameProxy* frame, PassRefPtr<DataCallback> prpCallback)
1862 RefPtr<DataCallback> callback = prpCallback;
1864 callback->invalidate();
1868 uint64_t callbackID = callback->callbackID();
1869 m_dataCallbacks.set(callbackID, callback.get());
1870 process()->send(Messages::WebPage::GetMainResourceDataOfFrame(frame->frameID(), callbackID), m_pageID);
1873 void WebPageProxy::getResourceDataFromFrame(WebFrameProxy* frame, WebURL* resourceURL, PassRefPtr<DataCallback> prpCallback)
1875 RefPtr<DataCallback> callback = prpCallback;
1877 callback->invalidate();
1881 uint64_t callbackID = callback->callbackID();
1882 m_dataCallbacks.set(callbackID, callback.get());
1883 process()->send(Messages::WebPage::GetResourceDataFromFrame(frame->frameID(), resourceURL->string(), callbackID), m_pageID);
1886 void WebPageProxy::getWebArchiveOfFrame(WebFrameProxy* frame, PassRefPtr<DataCallback> prpCallback)
1888 RefPtr<DataCallback> callback = prpCallback;
1890 callback->invalidate();
1894 uint64_t callbackID = callback->callbackID();
1895 m_dataCallbacks.set(callbackID, callback.get());
1896 process()->send(Messages::WebPage::GetWebArchiveOfFrame(frame->frameID(), callbackID), m_pageID);
1899 void WebPageProxy::forceRepaint(PassRefPtr<VoidCallback> prpCallback)
1901 RefPtr<VoidCallback> callback = prpCallback;
1903 callback->invalidate();
1907 uint64_t callbackID = callback->callbackID();
1908 m_voidCallbacks.set(callbackID, callback.get());
1909 m_drawingArea->waitForBackingStoreUpdateOnNextPaint();
1910 process()->send(Messages::WebPage::ForceRepaint(callbackID), m_pageID);
1913 void WebPageProxy::preferencesDidChange()
1918 #if ENABLE(INSPECTOR_SERVER)
1919 if (m_pageGroup->preferences()->developerExtrasEnabled())
1920 inspector()->enableRemoteInspection();
1923 // FIXME: It probably makes more sense to send individual preference changes.
1924 // However, WebKitTestRunner depends on getting a preference change notification
1925 // even if nothing changed in UI process, so that overrides get removed.
1927 // Preferences need to be updated during synchronous printing to make "print backgrounds" preference work when toggled from a print dialog checkbox.
1928 process()->send(Messages::WebPage::PreferencesDidChange(pageGroup()->preferences()->store()), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
1931 void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
1933 if (messageID.is<CoreIPC::MessageClassDrawingAreaProxy>()) {
1934 m_drawingArea->didReceiveDrawingAreaProxyMessage(connection, messageID, arguments);
1938 #if USE(UI_SIDE_COMPOSITING)
1939 if (messageID.is<CoreIPC::MessageClassLayerTreeCoordinatorProxy>()) {
1940 m_drawingArea->didReceiveLayerTreeCoordinatorProxyMessage(connection, messageID, arguments);
1945 #if ENABLE(INSPECTOR)
1946 if (messageID.is<CoreIPC::MessageClassWebInspectorProxy>()) {
1947 if (WebInspectorProxy* inspector = this->inspector())
1948 inspector->didReceiveWebInspectorProxyMessage(connection, messageID, arguments);
1953 #if ENABLE(FULLSCREEN_API)
1954 if (messageID.is<CoreIPC::MessageClassWebFullScreenManagerProxy>()) {
1955 fullScreenManager()->didReceiveMessage(connection, messageID, arguments);
1960 didReceiveWebPageProxyMessage(connection, messageID, arguments);
1963 void WebPageProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, OwnPtr<CoreIPC::ArgumentEncoder>& reply)
1965 #if ENABLE(INSPECTOR)
1966 if (messageID.is<CoreIPC::MessageClassWebInspectorProxy>()) {
1967 if (WebInspectorProxy* inspector = this->inspector())
1968 inspector->didReceiveSyncWebInspectorProxyMessage(connection, messageID, arguments, reply);
1973 #if ENABLE(FULLSCREEN_API)
1974 if (messageID.is<CoreIPC::MessageClassWebFullScreenManagerProxy>()) {
1975 fullScreenManager()->didReceiveSyncMessage(connection, messageID, arguments, reply);
1980 // FIXME: Do something with reply.
1981 didReceiveSyncWebPageProxyMessage(connection, messageID, arguments, reply);
1984 void WebPageProxy::didCreateMainFrame(uint64_t frameID)
1986 MESSAGE_CHECK(!m_mainFrame);
1987 MESSAGE_CHECK(process()->canCreateFrame(frameID));
1989 m_mainFrame = WebFrameProxy::create(this, frameID);
1991 // Add the frame to the process wide map.
1992 process()->frameCreated(frameID, m_mainFrame.get());
1995 void WebPageProxy::didCreateSubframe(uint64_t frameID, uint64_t parentFrameID)
1997 MESSAGE_CHECK(m_mainFrame);
1999 WebFrameProxy* parentFrame = process()->webFrame(parentFrameID);
2000 MESSAGE_CHECK(parentFrame);
2001 MESSAGE_CHECK(parentFrame->isDescendantOf(m_mainFrame.get()));
2003 MESSAGE_CHECK(process()->canCreateFrame(frameID));
2005 RefPtr<WebFrameProxy> subFrame = WebFrameProxy::create(this, frameID);
2007 // Add the frame to the process wide map.
2008 process()->frameCreated(frameID, subFrame.get());
2010 // Insert the frame into the frame hierarchy.
2011 parentFrame->appendChild(subFrame.get());
2014 static bool isDisconnectedFrame(WebFrameProxy* frame)
2016 return !frame->page() || !frame->page()->mainFrame() || !frame->isDescendantOf(frame->page()->mainFrame());
2019 void WebPageProxy::didSaveFrameToPageCache(uint64_t frameID)
2021 MESSAGE_CHECK(m_mainFrame);
2023 WebFrameProxy* subframe = process()->webFrame(frameID);
2024 MESSAGE_CHECK(subframe);
2026 if (isDisconnectedFrame(subframe))
2029 MESSAGE_CHECK(subframe->isDescendantOf(m_mainFrame.get()));
2031 subframe->didRemoveFromHierarchy();
2034 void WebPageProxy::didRestoreFrameFromPageCache(uint64_t frameID, uint64_t parentFrameID)
2036 MESSAGE_CHECK(m_mainFrame);
2038 WebFrameProxy* subframe = process()->webFrame(frameID);
2039 MESSAGE_CHECK(subframe);
2040 MESSAGE_CHECK(!subframe->parentFrame());
2041 MESSAGE_CHECK(subframe->page() == m_mainFrame->page());
2043 WebFrameProxy* parentFrame = process()->webFrame(parentFrameID);
2044 MESSAGE_CHECK(parentFrame);
2045 MESSAGE_CHECK(parentFrame->isDescendantOf(m_mainFrame.get()));
2047 // Insert the frame into the frame hierarchy.
2048 parentFrame->appendChild(subframe);
2052 // Always start progress at initialProgressValue. This helps provide feedback as
2053 // soon as a load starts.
2055 static const double initialProgressValue = 0.1;
2057 double WebPageProxy::estimatedProgress() const
2059 if (!pendingAPIRequestURL().isNull())
2060 return initialProgressValue;
2061 return m_estimatedProgress;
2064 void WebPageProxy::didStartProgress()
2066 m_estimatedProgress = initialProgressValue;
2068 m_loaderClient.didStartProgress(this);
2071 void WebPageProxy::didChangeProgress(double value)
2073 m_estimatedProgress = value;
2075 m_loaderClient.didChangeProgress(this);
2078 void WebPageProxy::didFinishProgress()
2080 m_estimatedProgress = 1.0;
2082 m_loaderClient.didFinishProgress(this);
2085 #if ENABLE(WEB_INTENTS_TAG)
2086 void WebPageProxy::registerIntentServiceForFrame(uint64_t frameID, const IntentServiceInfo& serviceInfo, CoreIPC::ArgumentDecoder* arguments)
2088 RefPtr<APIObject> userData;
2089 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2090 if (!arguments->decode(messageDecoder))
2093 WebFrameProxy* frame = process()->webFrame(frameID);
2094 MESSAGE_CHECK(frame);
2096 RefPtr<WebIntentServiceInfo> webIntentServiceInfo = WebIntentServiceInfo::create(serviceInfo);
2097 m_loaderClient.registerIntentServiceForFrame(this, frame, webIntentServiceInfo.get(), userData.get());
2101 void WebPageProxy::didStartProvisionalLoadForFrame(uint64_t frameID, const String& url, const String& unreachableURL, CoreIPC::ArgumentDecoder* arguments)
2103 clearPendingAPIRequestURL();
2105 RefPtr<APIObject> userData;
2106 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2107 if (!arguments->decode(messageDecoder))
2110 WebFrameProxy* frame = process()->webFrame(frameID);
2111 MESSAGE_CHECK(frame);
2112 MESSAGE_CHECK_URL(url);
2114 frame->setUnreachableURL(unreachableURL);
2116 frame->didStartProvisionalLoad(url);
2117 m_loaderClient.didStartProvisionalLoadForFrame(this, frame, userData.get());
2120 void WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, const String& url, CoreIPC::ArgumentDecoder* arguments)
2122 RefPtr<APIObject> userData;
2123 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2124 if (!arguments->decode(messageDecoder))
2127 WebFrameProxy* frame = process()->webFrame(frameID);
2128 MESSAGE_CHECK(frame);
2129 MESSAGE_CHECK_URL(url);
2131 frame->didReceiveServerRedirectForProvisionalLoad(url);
2133 m_loaderClient.didReceiveServerRedirectForProvisionalLoadForFrame(this, frame, userData.get());
2136 void WebPageProxy::didFailProvisionalLoadForFrame(uint64_t frameID, const ResourceError& error, CoreIPC::ArgumentDecoder* arguments)
2138 RefPtr<APIObject> userData;
2139 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2140 if (!arguments->decode(messageDecoder))
2143 WebFrameProxy* frame = process()->webFrame(frameID);
2144 MESSAGE_CHECK(frame);
2146 frame->didFailProvisionalLoad();
2148 m_loaderClient.didFailProvisionalLoadWithErrorForFrame(this, frame, error, userData.get());
2151 void WebPageProxy::clearLoadDependentCallbacks()
2153 Vector<uint64_t> callbackIDsCopy;
2154 copyToVector(m_loadDependentStringCallbackIDs, callbackIDsCopy);
2155 m_loadDependentStringCallbackIDs.clear();
2157 for (size_t i = 0; i < callbackIDsCopy.size(); ++i) {
2158 RefPtr<StringCallback> callback = m_stringCallbacks.take(callbackIDsCopy[i]);
2160 callback->invalidate();
2164 void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, const String& mimeType, bool frameHasCustomRepresentation, const PlatformCertificateInfo& certificateInfo, CoreIPC::ArgumentDecoder* arguments)
2166 RefPtr<APIObject> userData;
2167 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2168 if (!arguments->decode(messageDecoder))
2171 WebFrameProxy* frame = process()->webFrame(frameID);
2172 MESSAGE_CHECK(frame);
2175 // FIXME (bug 59111): didCommitLoadForFrame comes too late when restoring a page from b/f cache, making us disable secure event mode in password fields.
2176 // FIXME (bug 59121): A load going on in one frame shouldn't affect typing in sibling frames.
2177 m_pageClient->resetTextInputState();
2178 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
2179 // FIXME: Should this be moved inside resetTextInputState()?
2180 dismissCorrectionPanel(ReasonForDismissingAlternativeTextIgnored);
2181 m_pageClient->dismissDictionaryLookupPanel();
2185 clearLoadDependentCallbacks();
2187 frame->didCommitLoad(mimeType, certificateInfo);
2189 if (frame->isMainFrame()) {
2190 m_mainFrameHasCustomRepresentation = frameHasCustomRepresentation;
2192 if (m_mainFrameHasCustomRepresentation) {
2193 // Always assume that the main frame is pinned here, since the custom representation view will handle
2194 // any wheel events and dispatch them to the WKView when necessary.
2195 m_mainFrameIsPinnedToLeftSide = true;
2196 m_mainFrameIsPinnedToRightSide = true;
2198 m_pageClient->didCommitLoadForMainFrame(frameHasCustomRepresentation);
2201 m_loaderClient.didCommitLoadForFrame(this, frame, userData.get());
2204 void WebPageProxy::didFinishDocumentLoadForFrame(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 m_loaderClient.didFinishDocumentLoadForFrame(this, frame, userData.get());
2217 #if ENABLE(TIZEN_NATIVE_MEMORY_SNAPSHOT)
2218 const char* isMemorySnapshot = getenv("TIZEN_MEMORY_SNAPSHOT");
2220 void WebPageProxy::didFinishLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2222 RefPtr<APIObject> userData;
2223 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2224 if (!arguments->decode(messageDecoder))
2227 WebFrameProxy* frame = process()->webFrame(frameID);
2228 MESSAGE_CHECK(frame);
2230 frame->didFinishLoad();
2232 m_loaderClient.didFinishLoadForFrame(this, frame, userData.get());
2233 #if ENABLE(TIZEN_NATIVE_MEMORY_SNAPSHOT)
2234 if (isMemorySnapshot && isMemorySnapshot[0] != '0')
2235 dumpMemorySnapshot();
2239 void WebPageProxy::didFailLoadForFrame(uint64_t frameID, const ResourceError& error, CoreIPC::ArgumentDecoder* arguments)
2241 RefPtr<APIObject> userData;
2242 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2243 if (!arguments->decode(messageDecoder))
2246 WebFrameProxy* frame = process()->webFrame(frameID);
2247 MESSAGE_CHECK(frame);
2249 clearLoadDependentCallbacks();
2251 frame->didFailLoad();
2253 m_loaderClient.didFailLoadWithErrorForFrame(this, frame, error, userData.get());
2256 void WebPageProxy::didSameDocumentNavigationForFrame(uint64_t frameID, uint32_t opaqueSameDocumentNavigationType, const String& url, CoreIPC::ArgumentDecoder* arguments)
2258 RefPtr<APIObject> userData;
2259 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2260 if (!arguments->decode(messageDecoder))
2263 WebFrameProxy* frame = process()->webFrame(frameID);
2264 MESSAGE_CHECK(frame);
2265 MESSAGE_CHECK_URL(url);
2267 clearPendingAPIRequestURL();
2268 frame->didSameDocumentNavigation(url);
2270 m_loaderClient.didSameDocumentNavigationForFrame(this, frame, static_cast<SameDocumentNavigationType>(opaqueSameDocumentNavigationType), userData.get());
2273 void WebPageProxy::didReceiveTitleForFrame(uint64_t frameID, const String& title, CoreIPC::ArgumentDecoder* arguments)
2275 RefPtr<APIObject> userData;
2276 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2277 if (!arguments->decode(messageDecoder))
2280 WebFrameProxy* frame = process()->webFrame(frameID);
2281 MESSAGE_CHECK(frame);
2283 frame->didChangeTitle(title);
2285 m_loaderClient.didReceiveTitleForFrame(this, title, frame, userData.get());
2288 void WebPageProxy::didFirstLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2290 RefPtr<APIObject> userData;
2291 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2292 if (!arguments->decode(messageDecoder))
2295 WebFrameProxy* frame = process()->webFrame(frameID);
2296 MESSAGE_CHECK(frame);
2298 m_loaderClient.didFirstLayoutForFrame(this, frame, userData.get());
2301 void WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2303 RefPtr<APIObject> userData;
2304 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2305 if (!arguments->decode(messageDecoder))
2308 WebFrameProxy* frame = process()->webFrame(frameID);
2309 MESSAGE_CHECK(frame);
2312 if (frame->isMainFrame())
2313 m_pageClient->didFirstVisuallyNonEmptyLayoutForMainFrame();
2316 m_loaderClient.didFirstVisuallyNonEmptyLayoutForFrame(this, frame, userData.get());
2319 void WebPageProxy::didNewFirstVisuallyNonEmptyLayout(CoreIPC::ArgumentDecoder* arguments)
2321 RefPtr<APIObject> userData;
2322 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2323 if (!arguments->decode(messageDecoder))
2326 m_loaderClient.didNewFirstVisuallyNonEmptyLayout(this, userData.get());
2329 void WebPageProxy::didRemoveFrameFromHierarchy(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2331 RefPtr<APIObject> userData;
2332 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2333 if (!arguments->decode(messageDecoder))
2336 WebFrameProxy* frame = process()->webFrame(frameID);
2337 MESSAGE_CHECK(frame);
2339 frame->didRemoveFromHierarchy();
2341 m_loaderClient.didRemoveFrameFromHierarchy(this, frame, userData.get());
2344 void WebPageProxy::didDisplayInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2346 RefPtr<APIObject> userData;
2347 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2348 if (!arguments->decode(messageDecoder))
2351 WebFrameProxy* frame = process()->webFrame(frameID);
2352 MESSAGE_CHECK(frame);
2354 m_loaderClient.didDisplayInsecureContentForFrame(this, frame, userData.get());
2357 void WebPageProxy::didRunInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2359 RefPtr<APIObject> userData;
2360 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2361 if (!arguments->decode(messageDecoder))
2364 WebFrameProxy* frame = process()->webFrame(frameID);
2365 MESSAGE_CHECK(frame);
2367 m_loaderClient.didRunInsecureContentForFrame(this, frame, userData.get());
2370 void WebPageProxy::didDetectXSSForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2372 RefPtr<APIObject> userData;
2373 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2374 if (!arguments->decode(messageDecoder))
2377 WebFrameProxy* frame = process()->webFrame(frameID);
2378 MESSAGE_CHECK(frame);
2380 m_loaderClient.didDetectXSSForFrame(this, frame, userData.get());
2383 #if ENABLE(WEB_INTENTS)
2384 void WebPageProxy::didReceiveIntentForFrame(uint64_t frameID, const IntentData& intentData, CoreIPC::ArgumentDecoder* arguments)
2386 RefPtr<APIObject> userData;
2387 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2388 if (!arguments->decode(messageDecoder))
2391 WebFrameProxy* frame = process()->webFrame(frameID);
2392 MESSAGE_CHECK(frame);
2394 RefPtr<WebIntentData> webIntentData = WebIntentData::create(intentData);
2395 m_loaderClient.didReceiveIntentForFrame(this, frame, webIntentData.get(), userData.get());
2399 void WebPageProxy::frameDidBecomeFrameSet(uint64_t frameID, bool value)
2401 WebFrameProxy* frame = process()->webFrame(frameID);
2402 MESSAGE_CHECK(frame);
2404 frame->setIsFrameSet(value);
2405 if (frame->isMainFrame())
2406 m_frameSetLargestFrame = value ? m_mainFrame : 0;
2410 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)
2412 RefPtr<APIObject> userData;
2413 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2414 if (!arguments->decode(messageDecoder))
2417 if (request.url() != pendingAPIRequestURL())
2418 clearPendingAPIRequestURL();
2420 WebFrameProxy* frame = process()->webFrame(frameID);
2421 MESSAGE_CHECK(frame);
2422 MESSAGE_CHECK_URL(request.url());
2424 NavigationType navigationType = static_cast<NavigationType>(opaqueNavigationType);
2425 WebEvent::Modifiers modifiers = static_cast<WebEvent::Modifiers>(opaqueModifiers);
2426 WebMouseEvent::Button mouseButton = static_cast<WebMouseEvent::Button>(opaqueMouseButton);
2428 RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID);
2430 ASSERT(!m_inDecidePolicyForNavigationAction);
2432 m_inDecidePolicyForNavigationAction = true;
2433 m_syncNavigationActionPolicyActionIsValid = false;
2435 if (!m_policyClient.decidePolicyForNavigationAction(this, frame, navigationType, modifiers, mouseButton, request, listener.get(), userData.get()))
2438 m_inDecidePolicyForNavigationAction = false;
2440 // Check if we received a policy decision already. If we did, we can just pass it back.
2441 receivedPolicyAction = m_syncNavigationActionPolicyActionIsValid;
2442 if (m_syncNavigationActionPolicyActionIsValid) {
2443 policyAction = m_syncNavigationActionPolicyAction;
2444 downloadID = m_syncNavigationActionPolicyDownloadID;
2448 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)
2450 RefPtr<APIObject> userData;
2451 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2452 if (!arguments->decode(messageDecoder))
2455 WebFrameProxy* frame = process()->webFrame(frameID);
2456 MESSAGE_CHECK(frame);
2457 MESSAGE_CHECK_URL(request.url());
2459 NavigationType navigationType = static_cast<NavigationType>(opaqueNavigationType);
2460 WebEvent::Modifiers modifiers = static_cast<WebEvent::Modifiers>(opaqueModifiers);
2461 WebMouseEvent::Button mouseButton = static_cast<WebMouseEvent::Button>(opaqueMouseButton);
2463 RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID);
2464 if (!m_policyClient.decidePolicyForNewWindowAction(this, frame, navigationType, modifiers, mouseButton, request, frameName, listener.get(), userData.get()))
2468 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)
2470 RefPtr<APIObject> userData;
2471 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2472 if (!arguments->decode(messageDecoder))
2475 WebFrameProxy* frame = process()->webFrame(frameID);
2476 MESSAGE_CHECK(frame);
2477 MESSAGE_CHECK_URL(request.url());
2478 MESSAGE_CHECK_URL(response.url());
2480 RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID);
2482 ASSERT(!m_inDecidePolicyForResponse);
2484 m_inDecidePolicyForResponse = true;
2485 m_syncMimeTypePolicyActionIsValid = false;
2487 if (!m_policyClient.decidePolicyForResponse(this, frame, response, request, listener.get(), userData.get()))
2490 m_inDecidePolicyForResponse = false;
2492 // Check if we received a policy decision already. If we did, we can just pass it back.
2493 receivedPolicyAction = m_syncMimeTypePolicyActionIsValid;
2494 if (m_syncMimeTypePolicyActionIsValid) {
2495 policyAction = m_syncMimeTypePolicyAction;
2496 downloadID = m_syncMimeTypePolicyDownloadID;
2500 void WebPageProxy::unableToImplementPolicy(uint64_t frameID, const ResourceError& error, CoreIPC::ArgumentDecoder* arguments)
2502 RefPtr<APIObject> userData;
2503 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2504 if (!arguments->decode(messageDecoder))
2507 WebFrameProxy* frame = process()->webFrame(frameID);
2508 MESSAGE_CHECK(frame);
2510 m_policyClient.unableToImplementPolicy(this, frame, error, userData.get());
2515 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
2516 void WebPageProxy::willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, bool containsPasswordData, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments)
2518 void WebPageProxy::willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments)
2521 RefPtr<APIObject> userData;
2522 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2523 if (!arguments->decode(messageDecoder))
2526 WebFrameProxy* frame = process()->webFrame(frameID);
2527 MESSAGE_CHECK(frame);
2529 WebFrameProxy* sourceFrame = process()->webFrame(sourceFrameID);
2530 MESSAGE_CHECK(sourceFrame);
2532 RefPtr<WebFormSubmissionListenerProxy> listener = frame->setUpFormSubmissionListenerProxy(listenerID);
2533 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
2534 if (!m_formClient.willSubmitForm(this, frame, sourceFrame, textFieldValues.stringPairVector(), containsPasswordData, userData.get(), listener.get()))
2536 if (!m_formClient.willSubmitForm(this, frame, sourceFrame, textFieldValues.stringPairVector(), userData.get(), listener.get()))
2538 listener->continueSubmission();
2541 // ResourceLoad Client
2543 void WebPageProxy::didInitiateLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceRequest& request, bool pageIsProvisionallyLoading)
2545 WebFrameProxy* frame = process()->webFrame(frameID);
2546 MESSAGE_CHECK(frame);
2547 MESSAGE_CHECK_URL(request.url());
2549 m_resourceLoadClient.didInitiateLoadForResource(this, frame, resourceIdentifier, request, pageIsProvisionallyLoading);
2552 void WebPageProxy::didSendRequestForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceRequest& request, const ResourceResponse& redirectResponse)
2554 WebFrameProxy* frame = process()->webFrame(frameID);
2555 MESSAGE_CHECK(frame);
2556 MESSAGE_CHECK_URL(request.url());
2558 m_resourceLoadClient.didSendRequestForResource(this, frame, resourceIdentifier, request, redirectResponse);
2561 void WebPageProxy::didReceiveResponseForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceResponse& response)
2563 WebFrameProxy* frame = process()->webFrame(frameID);
2564 MESSAGE_CHECK(frame);
2565 MESSAGE_CHECK_URL(response.url());
2567 m_resourceLoadClient.didReceiveResponseForResource(this, frame, resourceIdentifier, response);
2570 void WebPageProxy::didReceiveContentLengthForResource(uint64_t frameID, uint64_t resourceIdentifier, uint64_t contentLength)
2572 WebFrameProxy* frame = process()->webFrame(frameID);
2573 MESSAGE_CHECK(frame);
2575 m_resourceLoadClient.didReceiveContentLengthForResource(this, frame, resourceIdentifier, contentLength);
2578 void WebPageProxy::didFinishLoadForResource(uint64_t frameID, uint64_t resourceIdentifier)
2580 WebFrameProxy* frame = process()->webFrame(frameID);
2581 MESSAGE_CHECK(frame);
2583 m_resourceLoadClient.didFinishLoadForResource(this, frame, resourceIdentifier);
2586 void WebPageProxy::didFailLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceError& error)
2588 WebFrameProxy* frame = process()->webFrame(frameID);
2589 MESSAGE_CHECK(frame);
2591 m_resourceLoadClient.didFailLoadForResource(this, frame, resourceIdentifier, error);
2596 void WebPageProxy::createNewPage(const ResourceRequest& request, const WindowFeatures& windowFeatures, uint32_t opaqueModifiers, int32_t opaqueMouseButton, uint64_t& newPageID, WebPageCreationParameters& newPageParameters)
2598 RefPtr<WebPageProxy> newPage = m_uiClient.createNewPage(this, request, windowFeatures, static_cast<WebEvent::Modifiers>(opaqueModifiers), static_cast<WebMouseEvent::Button>(opaqueMouseButton));
2600 newPageID = newPage->pageID();
2601 newPageParameters = newPage->creationParameters();
2606 void WebPageProxy::showPage()
2608 m_uiClient.showPage(this);
2611 void WebPageProxy::closePage(bool stopResponsivenessTimer)
2613 if (stopResponsivenessTimer)
2614 process()->responsivenessTimer()->stop();
2616 m_pageClient->clearAllEditCommands();
2617 m_uiClient.close(this);
2620 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
2621 bool WebPageProxy::isWaitingForJavaScriptPopupReply()
2623 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
2624 return m_alertReply || m_confirmReply || m_promptReply || m_beforeUnloadConfirmPanelReply;
2626 return m_alertReply || m_confirmReply || m_promptReply;
2632 void WebPageProxy::runJavaScriptAlert(uint64_t frameID, const String& message, PassRefPtr<Messages::WebPageProxy::RunJavaScriptAlert::DelayedReply> reply)
2634 WebFrameProxy* frame = process()->webFrame(frameID);
2635 MESSAGE_CHECK(frame);
2637 // Since runJavaScriptAlert() can spin a nested run loop we need to turn off the responsiveness timer.
2638 process()->responsivenessTimer()->stop();
2640 m_alertReply = reply;
2641 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
2642 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
2644 if (!m_uiClient.runJavaScriptAlert(this, message, frame))
2645 replyJavaScriptAlert();
2648 void WebPageProxy::runJavaScriptConfirm(uint64_t frameID, const String& message, PassRefPtr<Messages::WebPageProxy::RunJavaScriptConfirm::DelayedReply> reply)
2650 WebFrameProxy* frame = process()->webFrame(frameID);
2651 MESSAGE_CHECK(frame);
2653 // Since runJavaScriptConfirm() can spin a nested run loop we need to turn off the responsiveness timer.
2654 process()->responsivenessTimer()->stop();
2656 m_confirmReply = reply;
2657 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
2658 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
2660 if (!m_uiClient.runJavaScriptConfirm(this, message, frame))
2661 replyJavaScriptConfirm(false);
2664 void WebPageProxy::runJavaScriptPrompt(uint64_t frameID, const String& message, const String& defaultValue, PassRefPtr<Messages::WebPageProxy::RunJavaScriptPrompt::DelayedReply> reply)
2666 WebFrameProxy* frame = process()->webFrame(frameID);
2667 MESSAGE_CHECK(frame);
2669 // Since runJavaScriptPrompt() can spin a nested run loop we need to turn off the responsiveness timer.
2670 process()->responsivenessTimer()->stop();
2672 m_promptReply = reply;
2673 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
2674 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
2676 if (!m_uiClient.runJavaScriptPrompt(this, message, defaultValue, frame))
2677 replyJavaScriptPrompt(String());
2680 void WebPageProxy::runJavaScriptAlert(uint64_t frameID, const String& message)
2682 WebFrameProxy* frame = process()->webFrame(frameID);
2683 MESSAGE_CHECK(frame);
2685 // Since runJavaScriptAlert() can spin a nested run loop we need to turn off the responsiveness timer.
2686 process()->responsivenessTimer()->stop();
2688 m_uiClient.runJavaScriptAlert(this, message, frame);
2691 void WebPageProxy::runJavaScriptConfirm(uint64_t frameID, const String& message, bool& result)
2693 WebFrameProxy* frame = process()->webFrame(frameID);
2694 MESSAGE_CHECK(frame);
2696 // Since runJavaScriptConfirm() can spin a nested run loop we need to turn off the responsiveness timer.
2697 process()->responsivenessTimer()->stop();
2699 result = m_uiClient.runJavaScriptConfirm(this, message, frame);
2702 void WebPageProxy::runJavaScriptPrompt(uint64_t frameID, const String& message, const String& defaultValue, String& result)
2704 WebFrameProxy* frame = process()->webFrame(frameID);
2705 MESSAGE_CHECK(frame);
2707 // Since runJavaScriptPrompt() can spin a nested run loop we need to turn off the responsiveness timer.
2708 process()->responsivenessTimer()->stop();
2710 result = m_uiClient.runJavaScriptPrompt(this, message, defaultValue, frame);
2714 void WebPageProxy::shouldInterruptJavaScript(bool& result)
2716 // Since shouldInterruptJavaScript() can spin a nested run loop we need to turn off the responsiveness timer.
2717 process()->responsivenessTimer()->stop();
2719 result = m_uiClient.shouldInterruptJavaScript(this);
2722 void WebPageProxy::setStatusText(const String& text)
2724 m_uiClient.setStatusText(this, text);
2727 void WebPageProxy::mouseDidMoveOverElement(const WebHitTestResult::Data& hitTestResultData, uint32_t opaqueModifiers, CoreIPC::ArgumentDecoder* arguments)
2729 RefPtr<APIObject> userData;
2730 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2731 if (!arguments->decode(messageDecoder))
2734 WebEvent::Modifiers modifiers = static_cast<WebEvent::Modifiers>(opaqueModifiers);
2736 m_uiClient.mouseDidMoveOverElement(this, hitTestResultData, modifiers, userData.get());
2739 void WebPageProxy::unavailablePluginButtonClicked(uint32_t opaquePluginUnavailabilityReason, const String& mimeType, const String& url, const String& pluginsPageURL)
2741 MESSAGE_CHECK_URL(url);
2742 MESSAGE_CHECK_URL(pluginsPageURL);
2744 WKPluginUnavailabilityReason pluginUnavailabilityReason = static_cast<WKPluginUnavailabilityReason>(opaquePluginUnavailabilityReason);
2745 m_uiClient.unavailablePluginButtonClicked(this, pluginUnavailabilityReason, mimeType, url, pluginsPageURL);
2748 void WebPageProxy::setToolbarsAreVisible(bool toolbarsAreVisible)
2750 m_uiClient.setToolbarsAreVisible(this, toolbarsAreVisible);
2753 void WebPageProxy::getToolbarsAreVisible(bool& toolbarsAreVisible)
2755 toolbarsAreVisible = m_uiClient.toolbarsAreVisible(this);
2758 void WebPageProxy::setMenuBarIsVisible(bool menuBarIsVisible)
2760 m_uiClient.setMenuBarIsVisible(this, menuBarIsVisible);
2763 void WebPageProxy::getMenuBarIsVisible(bool& menuBarIsVisible)
2765 menuBarIsVisible = m_uiClient.menuBarIsVisible(this);
2768 void WebPageProxy::setStatusBarIsVisible(bool statusBarIsVisible)
2770 m_uiClient.setStatusBarIsVisible(this, statusBarIsVisible);
2773 void WebPageProxy::getStatusBarIsVisible(bool& statusBarIsVisible)
2775 statusBarIsVisible = m_uiClient.statusBarIsVisible(this);
2778 void WebPageProxy::setIsResizable(bool isResizable)
2780 m_uiClient.setIsResizable(this, isResizable);
2783 void WebPageProxy::getIsResizable(bool& isResizable)
2785 isResizable = m_uiClient.isResizable(this);
2788 void WebPageProxy::setWindowFrame(const FloatRect& newWindowFrame)
2790 m_uiClient.setWindowFrame(this, m_pageClient->convertToDeviceSpace(newWindowFrame));
2793 void WebPageProxy::getWindowFrame(FloatRect& newWindowFrame)
2795 newWindowFrame = m_pageClient->convertToUserSpace(m_uiClient.windowFrame(this));
2798 void WebPageProxy::screenToWindow(const IntPoint& screenPoint, IntPoint& windowPoint)
2800 windowPoint = m_pageClient->screenToWindow(screenPoint);
2803 void WebPageProxy::windowToScreen(const IntRect& viewRect, IntRect& result)
2805 result = m_pageClient->windowToScreen(viewRect);
2808 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
2809 void WebPageProxy::runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, PassRefPtr<Messages::WebPageProxy::RunBeforeUnloadConfirmPanel::DelayedReply> reply)
2811 WebFrameProxy* frame = process()->webFrame(frameID);
2812 MESSAGE_CHECK(frame);
2814 // Since runBeforeUnloadConfirmPanel() can spin a nested run loop we need to turn off the responsiveness timer.
2815 process()->responsivenessTimer()->stop();
2817 m_beforeUnloadConfirmPanelReply = reply;
2818 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
2819 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
2821 if (!m_uiClient.runBeforeUnloadConfirmPanel(this, message, frame))
2822 replyBeforeUnloadConfirmPanel(false);
2825 void WebPageProxy::runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose)
2827 WebFrameProxy* frame = process()->webFrame(frameID);
2828 MESSAGE_CHECK(frame);
2830 // Since runBeforeUnloadConfirmPanel() can spin a nested run loop we need to turn off the responsiveness timer.
2831 process()->responsivenessTimer()->stop();
2833 shouldClose = m_uiClient.runBeforeUnloadConfirmPanel(this, message, frame);
2837 #if USE(TILED_BACKING_STORE)
2838 void WebPageProxy::pageDidRequestScroll(const IntPoint& point)
2840 m_pageClient->pageDidRequestScroll(point);
2844 void WebPageProxy::didChangeViewportProperties(const ViewportAttributes& attr)
2846 m_pageClient->didChangeViewportProperties(attr);
2849 void WebPageProxy::pageDidScroll()
2851 m_uiClient.pageDidScroll(this);
2852 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
2853 dismissCorrectionPanel(ReasonForDismissingAlternativeTextIgnored);
2857 void WebPageProxy::runOpenPanel(uint64_t frameID, const FileChooserSettings& settings)
2859 if (m_openPanelResultListener) {
2860 m_openPanelResultListener->invalidate();
2861 m_openPanelResultListener = 0;
2864 WebFrameProxy* frame = process()->webFrame(frameID);
2865 MESSAGE_CHECK(frame);
2867 RefPtr<WebOpenPanelParameters> parameters = WebOpenPanelParameters::create(settings);
2868 m_openPanelResultListener = WebOpenPanelResultListenerProxy::create(this);
2870 // Since runOpenPanel() can spin a nested run loop we need to turn off the responsiveness timer.
2871 process()->responsivenessTimer()->stop();
2873 if (!m_uiClient.runOpenPanel(this, frame, parameters.get(), m_openPanelResultListener.get()))
2874 didCancelForOpenPanel();
2877 void WebPageProxy::printFrame(uint64_t frameID)
2879 ASSERT(!m_isPerformingDOMPrintOperation);
2880 m_isPerformingDOMPrintOperation = true;
2882 WebFrameProxy* frame = process()->webFrame(frameID);
2883 MESSAGE_CHECK(frame);
2885 m_uiClient.printFrame(this, frame);
2887 endPrinting(); // Send a message synchronously while m_isPerformingDOMPrintOperation is still true.
2888 m_isPerformingDOMPrintOperation = false;
2891 void WebPageProxy::printMainFrame()
2893 printFrame(m_mainFrame->frameID());
2896 #if ENABLE(TIZEN_REGISTER_PROTOCOL_HANDLER)
2897 void WebPageProxy::registerProtocolHandler(const String& scheme, const String& baseURL, const String& url, const String& title)
2899 m_pageClient->registerProtocolHandler(scheme, baseURL, url, title);
2903 #if ENABLE(TIZEN_CUSTOM_SCHEME_HANDLER)
2904 void WebPageProxy::isProtocolHandlerRegistered(const String& scheme, const String& baseURL, const String& url, unsigned int& result)
2906 result = m_pageClient->isProtocolHandlerRegistered(scheme, baseURL, url);
2908 void WebPageProxy::unregisterProtocolHandler(const String& scheme, const String& baseURL, const String& url)
2910 m_pageClient->unregisterProtocolHandler(scheme, baseURL, url);
2914 #if ENABLE(TIZEN_REGISTER_CONTENT_HANDLER)
2915 void WebPageProxy::registerContentHandler(const String& mimeType, const String& baseURL, const String& url, const String& title)
2917 m_pageClient->registerContentHandler(mimeType, baseURL, url, title);
2920 void WebPageProxy::isContentHandlerRegistered(const String& mimeType, const String& baseURL, const String& url, unsigned int& result)
2922 result = m_pageClient->isContentHandlerRegistered(mimeType, baseURL, url);
2925 void WebPageProxy::unregisterContentHandler(const String& mimeType, const String& baseURL, const String& url)
2927 m_pageClient->unregisterContentHandler(mimeType, baseURL, url);
2931 #if ENABLE(TIZEN_SEARCH_PROVIDER)
2932 void WebPageProxy::addSearchProvider(const String& baseURL, const String& engineURL)
2934 m_pageClient->addSearchProvider(baseURL, engineURL);
2937 void WebPageProxy::isSearchProviderInstalled(const String& baseURL, const String& engineURL, uint64_t& result)
2939 result = m_pageClient->isSearchProviderInstalled(baseURL, engineURL);
2943 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
2944 void WebPageProxy::getStandaloneStatus(bool& standalone)
2946 standalone = m_pageClient->getStandaloneStatus();
2949 void WebPageProxy::getWebAppCapable(PassRefPtr<BooleanCallback> prpCallback)
2951 RefPtr<BooleanCallback> callback = prpCallback;
2953 callback->invalidate();
2957 uint64_t callbackID = callback->callbackID();
2958 m_booleanCallbacks.set(callbackID, callback.get());
2959 process()->send(Messages::WebPage::GetWebAppCapable(callbackID), m_pageID);
2962 void WebPageProxy::didGetWebAppCapable(const bool capable, uint64_t callbackID)
2964 RefPtr<BooleanCallback> callback = m_booleanCallbacks.take(callbackID);
2966 // FIXME: Log error or assert.
2967 // this can validly happen if a load invalidated the callback, though
2971 m_booleanCallbacks.remove(callbackID);
2972 callback->performCallbackWithReturnValue(WebBoolean::create(capable).leakRef());
2975 void WebPageProxy::getWebAppIconURL(PassRefPtr<StringCallback> prpCallback)
2977 RefPtr<StringCallback> callback = prpCallback;
2979 callback->invalidate();
2983 uint64_t callbackID = callback->callbackID();
2984 m_stringCallbacks.set(callbackID, callback.get());
2985 process()->send(Messages::WebPage::GetWebAppIconURL(callbackID), m_pageID);
2988 void WebPageProxy::didGetWebAppIconURL(const String& iconURL, uint64_t callbackID)
2990 RefPtr<StringCallback> callback = m_stringCallbacks.take(callbackID);
2992 // FIXME: Log error or assert.
2993 // this can validly happen if a load invalidated the callback, though
2997 m_stringCallbacks.remove(callbackID);
2998 callback->performCallbackWithReturnValue(iconURL.impl());
3002 void WebPageProxy::setMediaVolume(float volume)
3004 if (volume == m_mediaVolume)
3007 m_mediaVolume = volume;
3012 process()->send(Messages::WebPage::SetMediaVolume(volume), m_pageID);
3016 void WebPageProxy::didChangeContentsSize(const IntSize& size)
3018 m_pageClient->didChangeContentsSize(size);
3021 void WebPageProxy::didFindZoomableArea(const IntPoint& target, const IntRect& area)
3023 m_pageClient->didFindZoomableArea(target, area);
3026 void WebPageProxy::findZoomableAreaForPoint(const IntPoint& point, const IntSize& area)
3031 process()->send(Messages::WebPage::FindZoomableAreaForPoint(point, area), m_pageID);
3034 void WebPageProxy::didReceiveMessageFromNavigatorQtObject(const String& contents)
3036 m_pageClient->didReceiveMessageFromNavigatorQtObject(contents);
3039 void WebPageProxy::authenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password)
3041 m_pageClient->handleAuthenticationRequiredRequest(hostname, realm, prefilledUsername, username, password);
3044 void WebPageProxy::proxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password)
3046 m_pageClient->handleProxyAuthenticationRequiredRequest(hostname, port, prefilledUsername, username, password);
3049 void WebPageProxy::certificateVerificationRequest(const String& hostname, bool& ignoreErrors)
3051 m_pageClient->handleCertificateVerificationRequest(hostname, ignoreErrors);
3053 #endif // PLATFORM(QT).
3056 void WebPageProxy::didFindZoomableArea(const IntPoint& target, const IntRect& area)
3058 m_pageClient->didFindZoomableArea(target, area);
3061 void WebPageProxy::findZoomableAreaForPoint(const IntPoint& point, const IntSize& area)
3066 process()->send(Messages::WebPage::FindZoomableAreaForPoint(point, area), m_pageID);
3068 #endif // #if OS(TIZEN)
3070 #if PLATFORM(QT) || PLATFORM(EFL)
3071 void WebPageProxy::handleDownloadRequest(DownloadProxy* download)
3073 m_pageClient->handleDownloadRequest(download);
3075 #endif // PLATFORM(QT) || PLATFORM(EFL)
3077 #if ENABLE(TOUCH_EVENTS)
3078 void WebPageProxy::needTouchEvents(bool needTouchEvents)
3080 m_needTouchEvents = needTouchEvents;
3081 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
3082 // We don't have to ask overflow if we need touch events,
3083 // because we will check overflow in the web process when touch event is processed.
3084 m_askOverflow = !m_needTouchEvents;
3089 #if ENABLE(INPUT_TYPE_COLOR)
3090 void WebPageProxy::showColorChooser(const WebCore::Color& initialColor)
3092 ASSERT(!m_colorChooser);
3094 #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
3095 if (m_colorPickerResultListener) {
3096 m_colorPickerResultListener->invalidate();
3097 m_colorPickerResultListener = nullptr;
3100 m_colorPickerResultListener = WebColorPickerResultListenerProxy::create(this);
3101 m_colorChooser = WebColorChooserProxy::create(this);
3103 if (m_uiClient.showColorPicker(this, initialColor.serialized(), m_colorPickerResultListener.get()))
3107 m_colorChooser = m_pageClient->createColorChooserProxy(this, initialColor);
3108 #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
3109 if (!m_colorChooser)
3110 didEndColorChooser();
3114 void WebPageProxy::setColorChooserColor(const WebCore::Color& color)
3116 ASSERT(m_colorChooser);
3118 m_colorChooser->setSelectedColor(color);
3121 void WebPageProxy::endColorChooser()
3123 ASSERT(m_colorChooser);
3125 m_colorChooser->endChooser();
3128 void WebPageProxy::didChooseColor(const WebCore::Color& color)
3133 process()->send(Messages::WebPage::DidChooseColor(color), m_pageID);
3136 void WebPageProxy::didEndColorChooser()
3141 #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
3142 if (m_colorChooser) {
3143 m_colorChooser->invalidate();
3144 m_colorChooser = nullptr;
3147 ASSERT(m_colorChooser);
3149 m_colorChooser->invalidate();
3150 m_colorChooser = nullptr;
3153 #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
3154 m_process->send(Messages::WebPage::DidEndColorChooser(), m_pageID);
3156 m_colorPickerResultListener->invalidate();
3157 m_colorPickerResultListener = nullptr;
3159 m_uiClient.hideColorPicker(this);
3161 process()->send(Messages::WebPage::DidEndColorChooser(), m_pageID);
3166 void WebPageProxy::didDraw()
3168 m_uiClient.didDraw(this);
3173 #if ENABLE(INSPECTOR)
3175 WebInspectorProxy* WebPageProxy::inspector()
3177 if (isClosed() || !isValid())
3180 m_inspector = WebInspectorProxy::create(this);
3181 return m_inspector.get();
3186 #if ENABLE(FULLSCREEN_API)
3187 WebFullScreenManagerProxy* WebPageProxy::fullScreenManager()
3189 if (!m_fullScreenManager)
3190 m_fullScreenManager = WebFullScreenManagerProxy::create(this);
3191 return m_fullScreenManager.get();
3197 void WebPageProxy::backForwardAddItem(uint64_t itemID)
3199 m_backForwardList->addItem(process()->webBackForwardItem(itemID));
3202 void WebPageProxy::backForwardGoToItem(uint64_t itemID, SandboxExtension::Handle& sandboxExtensionHandle)
3204 WebBackForwardListItem* item = process()->webBackForwardItem(itemID);
3208 bool createdExtension = maybeInitializeSandboxExtensionHandle(KURL(KURL(), item->url()), sandboxExtensionHandle);
3209 if (createdExtension)
3210 process()->willAcquireUniversalFileReadSandboxExtension();
3211 m_backForwardList->goToItem(item);
3214 void WebPageProxy::backForwardItemAtIndex(int32_t index, uint64_t& itemID)
3216 WebBackForwardListItem* item = m_backForwardList->itemAtIndex(index);
3217 itemID = item ? item->itemID() : 0;
3220 void WebPageProxy::backForwardBackListCount(int32_t& count)
3222 count = m_backForwardList->backListCount();
3225 void WebPageProxy::backForwardForwardListCount(int32_t& count)
3227 count = m_backForwardList->forwardListCount();
3230 void WebPageProxy::editorStateChanged(const EditorState& editorState)
3233 bool couldChangeSecureInputState = m_editorState.isInPasswordField != editorState.isInPasswordField || m_editorState.selectionIsNone;
3236 m_editorState = editorState;
3239 m_pageClient->updateTextInputState(couldChangeSecureInputState);
3240 #elif PLATFORM(QT) || ENABLE(TIZEN_ISF_PORT)
3241 m_pageClient->updateTextInputState();
3247 void WebPageProxy::registerEditCommandForUndo(uint64_t commandID, uint32_t editAction)
3249 registerEditCommand(WebEditCommandProxy::create(commandID, static_cast<EditAction>(editAction), this), Undo);
3252 void WebPageProxy::canUndoRedo(uint32_t action, bool& result)
3254 result = m_pageClient->canUndoRedo(static_cast<UndoOrRedo>(action));
3257 void WebPageProxy::executeUndoRedo(uint32_t action, bool& result)
3259 m_pageClient->executeUndoRedo(static_cast<UndoOrRedo>(action));
3263 void WebPageProxy::clearAllEditCommands()
3265 m_pageClient->clearAllEditCommands();
3268 void WebPageProxy::didCountStringMatches(const String& string, uint32_t matchCount)
3270 m_findClient.didCountStringMatches(this, string, matchCount);
3273 void WebPageProxy::didGetImageForFindMatch(const ShareableBitmap::Handle& contentImageHandle, uint32_t matchIndex)
3275 m_findMatchesClient.didGetImageForMatchResult(this, WebImage::create(ShareableBitmap::create(contentImageHandle)).get(), matchIndex);
3278 void WebPageProxy::setFindIndicator(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, const ShareableBitmap::Handle& contentImageHandle, bool fadeOut, bool animate)
3280 RefPtr<FindIndicator> findIndicator = FindIndicator::create(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, contentImageScaleFactor, contentImageHandle);
3281 m_pageClient->setFindIndicator(findIndicator.release(), fadeOut, animate);
3284 void WebPageProxy::didFindString(const String& string, uint32_t matchCount)
3286 m_findClient.didFindString(this, string, matchCount);
3289 void WebPageProxy::didFindStringMatches(const String& string, Vector<Vector<WebCore::IntRect> > matchRects, int32_t firstIndexAfterSelection)
3291 Vector<RefPtr<APIObject> > matches;
3292 matches.reserveInitialCapacity(matchRects.size());
3294 for (size_t i = 0; i < matchRects.size(); ++i) {
3295 const Vector<WebCore::IntRect>& rects = matchRects[i];
3296 size_t numRects = matchRects[i].size();
3297 Vector<RefPtr<APIObject> > apiRects;
3298 apiRects.reserveInitialCapacity(numRects);
3300 for (size_t i = 0; i < numRects; ++i)
3301 apiRects.uncheckedAppend(WebRect::create(toAPI(rects[i])));
3302 matches.uncheckedAppend(ImmutableArray::adopt(apiRects));
3304 m_findMatchesClient.didFindStringMatches(this, string, ImmutableArray::adopt(matches).get(), firstIndexAfterSelection);
3307 void WebPageProxy::didFailToFindString(const String& string)
3309 m_findClient.didFailToFindString(this, string);
3312 void WebPageProxy::valueChangedForPopupMenu(WebPopupMenuProxy*, int32_t newSelectedIndex)
3314 process()->send(Messages::WebPage::DidChangeSelectedIndexForActivePopupMenu(newSelectedIndex), m_pageID);
3317 void WebPageProxy::setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index)
3319 process()->send(Messages::WebPage::SetTextForActivePopupMenu(index), m_pageID);
3322 NativeWebMouseEvent* WebPageProxy::currentlyProcessedMouseDownEvent()
3324 return m_currentlyProcessedMouseDownEvent.get();
3328 void WebPageProxy::failedToShowPopupMenu()
3330 process()->send(Messages::WebPage::FailedToShowPopupMenu(), m_pageID);
3334 void WebPageProxy::showPopupMenu(const IntRect& rect, uint64_t textDirection, const Vector<WebPopupItem>& items, int32_t selectedIndex, const PlatformPopupMenuData& data)
3336 if (m_activePopupMenu) {
3337 m_activePopupMenu->hidePopupMenu();
3338 m_activePopupMenu->invalidate();
3339 m_activePopupMenu = 0;
3342 m_activePopupMenu = m_pageClient->createPopupMenuProxy(this);
3344 // Since showPopupMenu() can spin a nested run loop we need to turn off the responsiveness timer.
3345 process()->responsivenessTimer()->stop();
3347 RefPtr<WebPopupMenuProxy> protectedActivePopupMenu = m_activePopupMenu;
3349 protectedActivePopupMenu->showPopupMenu(rect, static_cast<TextDirection>(textDirection), m_pageScaleFactor, items, data, selectedIndex);
3351 // Since Qt and Efl doesn't use a nested mainloop to show the popup and get the answer, we need to keep the client pointer valid.
3352 #if !PLATFORM(QT) && !PLATFORM(EFL)
3353 protectedActivePopupMenu->invalidate();
3355 protectedActivePopupMenu = 0;
3358 void WebPageProxy::hidePopupMenu()
3360 if (!m_activePopupMenu)
3363 m_activePopupMenu->hidePopupMenu();
3364 m_activePopupMenu->invalidate();
3365 m_activePopupMenu = 0;
3368 #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
3369 void WebPageProxy::updatePopupMenu(uint64_t textDirection, const Vector<WebPopupItem>& items, int32_t selectedIndex)
3371 if (!m_activePopupMenu)
3374 m_activePopupMenu->updatePopupMenu(static_cast<TextDirection>(textDirection), items, selectedIndex);
3378 #if ENABLE(CONTEXT_MENUS)
3379 void WebPageProxy::showContextMenu(const IntPoint& menuLocation, const WebHitTestResult::Data& hitTestResultData, const Vector<WebContextMenuItemData>& proposedItems, CoreIPC::ArgumentDecoder* arguments)
3381 internalShowContextMenu(menuLocation, hitTestResultData, proposedItems, arguments);
3383 // No matter the result of internalShowContextMenu, always notify the WebProcess that the menu is hidden so it starts handling mouse events again.
3384 process()->send(Messages::WebPage::ContextMenuHidden(), m_pageID);
3387 void WebPageProxy::internalShowContextMenu(const IntPoint& menuLocation, const WebHitTestResult::Data& hitTestResultData, const Vector<WebContextMenuItemData>& proposedItems, CoreIPC::ArgumentDecoder* arguments)
3389 RefPtr<APIObject> userData;
3390 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
3391 if (!arguments->decode(messageDecoder))
3394 m_activeContextMenuHitTestResultData = hitTestResultData;
3396 if (m_activeContextMenu) {
3397 m_activeContextMenu->hideContextMenu();
3398 m_activeContextMenu = 0;
3401 m_activeContextMenu = m_pageClient->createContextMenuProxy(this);
3403 // Since showContextMenu() can spin a nested run loop we need to turn off the responsiveness timer.
3404 process()->responsivenessTimer()->stop();
3406 // Give the PageContextMenuClient one last swipe at changing the menu.
3407 Vector<WebContextMenuItemData> items;
3408 if (!m_contextMenuClient.getContextMenuFromProposedMenu(this, proposedItems, items, hitTestResultData, userData.get()))
3409 m_activeContextMenu->showContextMenu(menuLocation, proposedItems);
3411 m_activeContextMenu->showContextMenu(menuLocation, items);
3413 m_contextMenuClient.contextMenuDismissed(this);
3416 void WebPageProxy::contextMenuItemSelected(const WebContextMenuItemData& item)
3418 TIZEN_LOGI("selected item : action(%d), title(%s)", item.action(), item.title().utf8().data());
3419 // Application custom items don't need to round-trip through to WebCore in the WebProcess.
3420 if (item.action() >= ContextMenuItemBaseApplicationTag) {
3421 m_contextMenuClient.customContextMenuItemSelected(this, item);
3422 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
3423 m_pageClient->setIsTextSelectionMode(false);
3428 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
3429 if (item.action() == ContextMenuItemTagPaste)
3430 m_pageClient->setIsTextSelectionMode(false);
3434 if (item.action() == ContextMenuItemTagSmartCopyPaste) {
3435 setSmartInsertDeleteEnabled(!isSmartInsertDeleteEnabled());
3438 if (item.action() == ContextMenuItemTagSmartQuotes) {
3439 TextChecker::setAutomaticQuoteSubstitutionEnabled(!TextChecker::state().isAutomaticQuoteSubstitutionEnabled);
3440 process()->updateTextCheckerState();
3443 if (item.action() == ContextMenuItemTagSmartDashes) {
3444 TextChecker::setAutomaticDashSubstitutionEnabled(!TextChecker::state().isAutomaticDashSubstitutionEnabled);
3445 process()->updateTextCheckerState();
3448 if (item.action() == ContextMenuItemTagSmartLinks) {
3449 TextChecker::setAutomaticLinkDetectionEnabled(!TextChecker::state().isAutomaticLinkDetectionEnabled);
3450 process()->updateTextCheckerState();
3453 if (item.action() == ContextMenuItemTagTextReplacement) {
3454 TextChecker::setAutomaticTextReplacementEnabled(!TextChecker::state().isAutomaticTextReplacementEnabled);
3455 process()->updateTextCheckerState();
3458 if (item.action() == ContextMenuItemTagCorrectSpellingAutomatically) {
3459 TextChecker::setAutomaticSpellingCorrectionEnabled(!TextChecker::state().isAutomaticSpellingCorrectionEnabled);
3460 process()->updateTextCheckerState();
3463 if (item.action() == ContextMenuItemTagShowSubstitutions) {
3464 TextChecker::toggleSubstitutionsPanelIsShowing();
3468 if (item.action() == ContextMenuItemTagDownloadImageToDisk) {
3469 m_process->context()->download(this, KURL(KURL(), m_activeContextMenuHitTestResultData.absoluteImageURL));
3472 if (item.action() == ContextMenuItemTagDownloadLinkToDisk) {
3473 m_process->context()->download(this, KURL(KURL(), m_activeContextMenuHitTestResultData.absoluteLinkURL));
3476 if (item.action() == ContextMenuItemTagCheckSpellingWhileTyping) {
3477 TextChecker::setContinuousSpellCheckingEnabled(!TextChecker::state().isContinuousSpellCheckingEnabled);
3478 process()->updateTextCheckerState();
3481 if (item.action() == ContextMenuItemTagCheckGrammarWithSpelling) {
3482 TextChecker::setGrammarCheckingEnabled(!TextChecker::state().isGrammarCheckingEnabled);
3483 process()->updateTextCheckerState();
3486 if (item.action() == ContextMenuItemTagShowSpellingPanel) {
3487 if (!TextChecker::spellingUIIsShowing())
3488 advanceToNextMisspelling(true);
3489 TextChecker::toggleSpellingUIIsShowing();
3492 if (item.action() == ContextMenuItemTagLearnSpelling || item.action() == ContextMenuItemTagIgnoreSpelling)
3493 ++m_pendingLearnOrIgnoreWordMessageCount;
3495 #if ENABLE(TIZEN_WEBKIT2_CLIPBOARD_HELPER)
3496 if (item.action() == ContextMenuItemTagPaste) {
3497 pasteContextMenuSelected();
3502 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_TEXT_SELECTION_MODE)
3503 if (item.action() == ContextMenuItemTagTextSelectionMode) {
3504 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
3505 m_pageClient->setIsTextSelectionMode(true);
3508 evas_object_focus_set(viewWidget(), true);
3509 WebCore::IntPoint positionForSelection = m_activeContextMenu->positionForSelection();
3510 bool result = false;
3511 process()->sendSync(Messages::WebPage::SelectLink(positionForSelection), Messages::WebPage::SelectLink::Reply(result), m_pageID);
3512 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
3513 if (result == false)
3514 m_pageClient->setIsTextSelectionMode(false);
3521 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
3522 if (item.action() == ContextMenuItemTagClipboard) {
3523 clipboardContextMenuSelected();
3528 #if ENABLE(CONTEXT_MENUS)
3529 process()->send(Messages::WebPage::DidSelectItemFromActiveContextMenu(item), m_pageID);
3532 #endif // ENABLE(CONTEXT_MENUS)
3534 void WebPageProxy::didChooseFilesForOpenPanel(const Vector<String>& fileURLs)
3539 #if ENABLE(WEB_PROCESS_SANDBOX)
3540 // FIXME: The sandbox extensions should be sent with the DidChooseFilesForOpenPanel message. This
3541 // is gated on a way of passing SandboxExtension::Handles in a Vector.
3542 for (size_t i = 0; i < fileURLs.size(); ++i) {
3543 SandboxExtension::Handle sandboxExtensionHandle;
3544 SandboxExtension::createHandle(fileURLs[i], SandboxExtension::ReadOnly, sandboxExtensionHandle);
3545 process()->send(Messages::WebPage::ExtendSandboxForFileFromOpenPanel(sandboxExtensionHandle), m_pageID);
3549 process()->send(Messages::WebPage::DidChooseFilesForOpenPanel(fileURLs), m_pageID);
3551 m_openPanelResultListener->invalidate();
3552 m_openPanelResultListener = 0;
3555 void WebPageProxy::didCancelForOpenPanel()
3560 process()->send(Messages::WebPage::DidCancelForOpenPanel(), m_pageID);
3562 m_openPanelResultListener->invalidate();
3563 m_openPanelResultListener = 0;
3566 void WebPageProxy::advanceToNextMisspelling(bool startBeforeSelection) const
3568 process()->send(Messages::WebPage::AdvanceToNextMisspelling(startBeforeSelection), m_pageID);
3571 void WebPageProxy::changeSpellingToWord(const String& word) const
3576 process()->send(Messages::WebPage::ChangeSpellingToWord(word), m_pageID);
3579 void WebPageProxy::registerEditCommand(PassRefPtr<WebEditCommandProxy> commandProxy, UndoOrRedo undoOrRedo)
3581 m_pageClient->registerEditCommand(commandProxy, undoOrRedo);
3584 void WebPageProxy::addEditCommand(WebEditCommandProxy* command)
3586 m_editCommandSet.add(command);
3589 void WebPageProxy::removeEditCommand(WebEditCommandProxy* command)
3591 m_editCommandSet.remove(command);
3595 process()->send(Messages::WebPage::DidRemoveEditCommand(command->commandID()), m_pageID);
3598 bool WebPageProxy::isValidEditCommand(WebEditCommandProxy* command)
3600 return m_editCommandSet.find(command) != m_editCommandSet.end();
3603 int64_t WebPageProxy::spellDocumentTag()
3605 if (!m_hasSpellDocumentTag) {
3606 m_spellDocumentTag = TextChecker::uniqueSpellDocumentTag(this);
3607 m_hasSpellDocumentTag = true;
3610 return m_spellDocumentTag;
3613 #if USE(UNIFIED_TEXT_CHECKING)
3614 void WebPageProxy::checkTextOfParagraph(const String& text, uint64_t checkingTypes, Vector<TextCheckingResult>& results)
3616 results = TextChecker::checkTextOfParagraph(spellDocumentTag(), text.characters(), text.length(), checkingTypes);
3620 void WebPageProxy::checkSpellingOfString(const String& text, int32_t& misspellingLocation, int32_t& misspellingLength)
3622 TextChecker::checkSpellingOfString(spellDocumentTag(), text.characters(), text.length(), misspellingLocation, misspellingLength);
3625 void WebPageProxy::checkGrammarOfString(const String& text, Vector<GrammarDetail>& grammarDetails, int32_t& badGrammarLocation, int32_t& badGrammarLength)
3627 TextChecker::checkGrammarOfString(spellDocumentTag(), text.characters(), text.length(), grammarDetails, badGrammarLocation, badGrammarLength);
3630 void WebPageProxy::spellingUIIsShowing(bool& isShowing)
3632 isShowing = TextChecker::spellingUIIsShowing();
3635 void WebPageProxy::updateSpellingUIWithMisspelledWord(const String& misspelledWord)
3637 TextChecker::updateSpellingUIWithMisspelledWord(spellDocumentTag(), misspelledWord);
3640 void WebPageProxy::updateSpellingUIWithGrammarString(const String& badGrammarPhrase, const GrammarDetail& grammarDetail)
3642 TextChecker::updateSpellingUIWithGrammarString(spellDocumentTag(), badGrammarPhrase, grammarDetail);
3645 void WebPageProxy::getGuessesForWord(const String& word, const String& context, Vector<String>& guesses)
3647 TextChecker::getGuessesForWord(spellDocumentTag(), word, context, guesses);
3650 void WebPageProxy::learnWord(const String& word)
3652 MESSAGE_CHECK(m_pendingLearnOrIgnoreWordMessageCount);
3653 --m_pendingLearnOrIgnoreWordMessageCount;
3655 TextChecker::learnWord(spellDocumentTag(), word);
3658 void WebPageProxy::ignoreWord(const String& word)
3660 MESSAGE_CHECK(m_pendingLearnOrIgnoreWordMessageCount);
3661 --m_pendingLearnOrIgnoreWordMessageCount;
3663 TextChecker::ignoreWord(spellDocumentTag(), word);
3668 void WebPageProxy::setFocus(bool focused)
3671 m_uiClient.focus(this);
3673 m_uiClient.unfocus(this);
3676 void WebPageProxy::takeFocus(uint32_t direction)
3678 m_uiClient.takeFocus(this, (static_cast<FocusDirection>(direction) == FocusDirectionForward) ? kWKFocusDirectionForward : kWKFocusDirectionBackward);
3681 void WebPageProxy::setToolTip(const String& toolTip)
3683 String oldToolTip = m_toolTip;
3684 m_toolTip = toolTip;
3685 m_pageClient->toolTipChanged(oldToolTip, m_toolTip);
3688 void WebPageProxy::setCursor(const WebCore::Cursor& cursor)
3690 m_pageClient->setCursor(cursor);
3693 void WebPageProxy::setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves)
3695 m_pageClient->setCursorHiddenUntilMouseMoves(hiddenUntilMouseMoves);
3698 void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
3700 WebEvent::Type type = static_cast<WebEvent::Type>(opaqueType);
3703 case WebEvent::NoType:
3704 case WebEvent::MouseMove:
3707 case WebEvent::MouseDown:
3708 case WebEvent::MouseUp:
3709 case WebEvent::Wheel:
3710 case WebEvent::KeyDown:
3711 case WebEvent::KeyUp:
3712 case WebEvent::RawKeyDown:
3713 case WebEvent::Char:
3714 #if ENABLE(GESTURE_EVENTS)
3715 case WebEvent::GestureScrollBegin:
3716 case WebEvent::GestureScrollEnd:
3717 case WebEvent::GestureSingleTap:
3719 #if ENABLE(TOUCH_EVENTS)
3720 case WebEvent::TouchStart:
3721 case WebEvent::TouchMove:
3722 case WebEvent::TouchEnd:
3723 case WebEvent::TouchCancel:
3725 process()->responsivenessTimer()->stop();
3730 case WebEvent::NoType:
3732 case WebEvent::MouseMove:
3733 m_processingMouseMoveEvent = false;
3734 if (m_nextMouseMoveEvent) {
3735 handleMouseEvent(*m_nextMouseMoveEvent);
3736 m_nextMouseMoveEvent = nullptr;
3739 case WebEvent::MouseDown:
3741 #if ENABLE(GESTURE_EVENTS)
3742 case WebEvent::GestureScrollBegin:
3743 case WebEvent::GestureScrollEnd:
3744 case WebEvent::GestureSingleTap: {
3745 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
3746 QueuedUIEvents<WebGestureEvent> queuedEvents = m_gestureEventQueue.first();
3747 MESSAGE_CHECK(type == queuedEvents.forwardedEvent.type());
3748 m_gestureEventQueue.removeFirst();
3750 m_pageClient->doneWithGestureEvent(queuedEvents.forwardedEvent, handled);
3751 for (size_t i = 0; i < queuedEvents.deferredEvents.size(); ++i) {
3752 bool isEventHandled = false;
3753 m_pageClient->doneWithGestureEvent(queuedEvents.deferredEvents.at(i), isEventHandled);
3756 WebGestureEvent event = m_gestureEventQueue.first();
3757 MESSAGE_CHECK(type == event.type());
3759 m_gestureEventQueue.removeFirst();
3760 m_pageClient->doneWithGestureEvent(event, handled);
3765 case WebEvent::MouseUp:
3766 m_currentlyProcessedMouseDownEvent = nullptr;
3769 case WebEvent::Wheel: {
3770 ASSERT(!m_currentlyProcessedWheelEvents.isEmpty());
3772 OwnPtr<Vector<NativeWebWheelEvent> > oldestCoalescedEvent = m_currentlyProcessedWheelEvents.takeFirst();
3774 // FIXME: Dispatch additional events to the didNotHandleWheelEvent client function.
3775 if (!handled && m_uiClient.implementsDidNotHandleWheelEvent())
3776 m_uiClient.didNotHandleWheelEvent(this, oldestCoalescedEvent->last());
3778 if (!m_wheelEventQueue.isEmpty())
3779 processNextQueuedWheelEvent();
3783 case WebEvent::KeyDown:
3784 case WebEvent::KeyUp:
3785 case WebEvent::RawKeyDown:
3786 case WebEvent::Char: {
3787 LOG(KeyHandling, "WebPageProxy::didReceiveEvent: %s", webKeyboardEventTypeString(type));
3789 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
3790 QueuedUIEvents<NativeWebKeyboardEvent> queuedEvents = m_keyEventQueue.first();
3791 MESSAGE_CHECK(type == queuedEvents.forwardedEvent.type());
3792 m_keyEventQueue.removeFirst();
3794 m_pageClient->doneWithKeyEvent(queuedEvents.forwardedEvent, handled);
3797 if (m_uiClient.implementsDidNotHandleKeyEvent())
3798 m_uiClient.didNotHandleKeyEvent(this, queuedEvents.forwardedEvent);
3801 ::TranslateMessage(queuedEvents.forwardedEvent.nativeEvent());
3805 for (size_t i = 0; i < queuedEvents.deferredEvents.size(); ++i) {
3806 bool isEventHandled = false;
3807 m_pageClient->doneWithKeyEvent(queuedEvents.deferredEvents.at(i), isEventHandled);
3810 NativeWebKeyboardEvent event = m_keyEventQueue.first();
3811 MESSAGE_CHECK(type == event.type());
3813 m_keyEventQueue.removeFirst();
3815 if (!m_keyEventQueue.isEmpty())
3816 process()->send(Messages::WebPage::KeyEvent(m_keyEventQueue.first()), m_pageID);
3818 m_pageClient->doneWithKeyEvent(event, handled);
3822 if (m_uiClient.implementsDidNotHandleKeyEvent())
3823 m_uiClient.didNotHandleKeyEvent(this, event);
3826 ::TranslateMessage(event.nativeEvent());
3828 #endif // #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
3831 #if ENABLE(TOUCH_EVENTS)
3832 case WebEvent::TouchStart:
3833 case WebEvent::TouchMove:
3834 case WebEvent::TouchEnd:
3835 case WebEvent::TouchCancel: {
3836 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
3837 QueuedUIEvents<NativeWebTouchEvent> queuedEvents = m_touchEventQueue.first();
3838 MESSAGE_CHECK(type == queuedEvents.forwardedEvent.type());
3839 m_touchEventQueue.removeFirst();
3841 m_pageClient->doneWithTouchEvent(queuedEvents.forwardedEvent, handled);
3842 for (size_t i = 0; i < queuedEvents.deferredEvents.size(); ++i) {
3843 bool isEventHandled = false;
3844 m_pageClient->doneWithTouchEvent(queuedEvents.deferredEvents.at(i), isEventHandled);
3847 QueuedTouchEvents queuedEvents = m_touchEventQueue.first();
3848 MESSAGE_CHECK(type == queuedEvents.forwardedEvent.type());
3849 m_touchEventQueue.removeFirst();
3851 m_pageClient->doneWithTouchEvent(queuedEvents.forwardedEvent, handled);
3852 for (size_t i = 0; i < queuedEvents.deferredTouchEvents.size(); ++i) {
3853 bool isEventHandled = false;
3854 m_pageClient->doneWithTouchEvent(queuedEvents.deferredTouchEvents.at(i), isEventHandled);
3863 void WebPageProxy::stopResponsivenessTimer()
3865 process()->responsivenessTimer()->stop();
3868 void WebPageProxy::voidCallback(uint64_t callbackID)
3870 RefPtr<VoidCallback> callback = m_voidCallbacks.take(callbackID);
3872 // FIXME: Log error or assert.
3876 callback->performCallback();
3879 void WebPageProxy::dataCallback(const CoreIPC::DataReference& dataReference, uint64_t callbackID)
3881 RefPtr<DataCallback> callback = m_dataCallbacks.take(callbackID);
3883 // FIXME: Log error or assert.
3887 callback->performCallbackWithReturnValue(WebData::create(dataReference.data(), dataReference.size()).get());
3890 void WebPageProxy::stringCallback(const String& resultString, uint64_t callbackID)
3892 RefPtr<StringCallback> callback = m_stringCallbacks.take(callbackID);
3894 // FIXME: Log error or assert.
3895 // this can validly happen if a load invalidated the callback, though
3899 m_loadDependentStringCallbackIDs.remove(callbackID);
3901 callback->performCallbackWithReturnValue(resultString.impl());
3904 void WebPageProxy::scriptValueCallback(const CoreIPC::DataReference& dataReference, uint64_t callbackID)
3906 RefPtr<ScriptValueCallback> callback = m_scriptValueCallbacks.take(callbackID);
3908 // FIXME: Log error or assert.
3912 Vector<uint8_t> data;
3913 data.reserveInitialCapacity(dataReference.size());
3914 data.append(dataReference.data(), dataReference.size());
3916 callback->performCallbackWithReturnValue(data.size() ? WebSerializedScriptValue::adopt(data).get() : 0);
3919 void WebPageProxy::computedPagesCallback(const Vector<IntRect>& pageRects, double totalScaleFactorForPrinting, uint64_t callbackID)
3921 RefPtr<ComputedPagesCallback> callback = m_computedPagesCallbacks.take(callbackID);
3923 // FIXME: Log error or assert.
3927 callback->performCallbackWithReturnValue(pageRects, totalScaleFactorForPrinting);
3930 void WebPageProxy::validateCommandCallback(const String& commandName, bool isEnabled, int state, uint64_t callbackID)
3932 RefPtr<ValidateCommandCallback> callback = m_validateCommandCallbacks.take(callbackID);
3934 // FIXME: Log error or assert.
3938 callback->performCallbackWithReturnValue(commandName.impl(), isEnabled, state);
3942 void WebPageProxy::printFinishedCallback(const ResourceError& printError, uint64_t callbackID)
3944 RefPtr<PrintFinishedCallback> callback = m_printFinishedCallbacks.take(callbackID);
3946 // FIXME: Log error or assert.
3950 RefPtr<WebError> error = WebError::create(printError);
3951 callback->performCallbackWithReturnValue(error.get());
3955 void WebPageProxy::focusedFrameChanged(uint64_t frameID)
3962 WebFrameProxy* frame = process()->webFrame(frameID);
3963 MESSAGE_CHECK(frame);
3965 m_focusedFrame = frame;
3968 void WebPageProxy::frameSetLargestFrameChanged(uint64_t frameID)
3971 m_frameSetLargestFrame = 0;
3975 WebFrameProxy* frame = process()->webFrame(frameID);
3976 MESSAGE_CHECK(frame);
3978 m_frameSetLargestFrame = frame;
3981 void WebPageProxy::processDidBecomeUnresponsive()
3986 updateBackingStoreDiscardableState();
3988 m_loaderClient.processDidBecomeUnresponsive(this);
3991 void WebPageProxy::interactionOccurredWhileProcessUnresponsive()
3996 m_loaderClient.interactionOccurredWhileProcessUnresponsive(this);
3999 void WebPageProxy::processDidBecomeResponsive()
4004 updateBackingStoreDiscardableState();
4006 m_loaderClient.processDidBecomeResponsive(this);
4009 void WebPageProxy::processDidCrash()
4011 ASSERT(m_pageClient);
4014 m_isPageSuspended = false;
4017 m_urlAtProcessExit = m_mainFrame->url();
4018 m_loadStateAtProcessExit = m_mainFrame->loadState();
4021 m_mainFrame = nullptr;
4022 m_drawingArea = nullptr;
4024 #if ENABLE(INSPECTOR)
4026 m_inspector->invalidate();
4027 m_inspector = nullptr;
4031 #if ENABLE(FULLSCREEN_API)
4032 if (m_fullScreenManager) {
4033 m_fullScreenManager->invalidate();
4034 m_fullScreenManager = nullptr;
4038 if (m_openPanelResultListener) {
4039 m_openPanelResultListener->invalidate();
4040 m_openPanelResultListener = nullptr;
4043 #if ENABLE(INPUT_TYPE_COLOR)
4044 if (m_colorChooser) {
4045 m_colorChooser->invalidate();
4046 m_colorChooser = nullptr;
4049 #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
4050 if (m_colorPickerResultListener) {
4051 m_colorPickerResultListener->invalidate();
4052 m_colorPickerResultListener = nullptr;
4057 #if ENABLE(GEOLOCATION)
4058 m_geolocationPermissionRequestManager.invalidateRequests();
4061 m_notificationPermissionRequestManager.invalidateRequests();
4063 m_toolTip = String();
4065 m_mainFrameHasHorizontalScrollbar = false;
4066 m_mainFrameHasVerticalScrollbar = false;
4068 m_mainFrameIsPinnedToLeftSide = false;
4069 m_mainFrameIsPinnedToRightSide = false;
4071 m_visibleScrollerThumbRect = IntRect();
4073 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
4074 invalidateCallbackMap(m_booleanCallbacks);
4076 invalidateCallbackMap(m_voidCallbacks);
4077 invalidateCallbackMap(m_dataCallbacks);
4078 invalidateCallbackMap(m_stringCallbacks);
4079 m_loadDependentStringCallbackIDs.clear();
4080 invalidateCallbackMap(m_scriptValueCallbacks);
4081 invalidateCallbackMap(m_computedPagesCallbacks);
4082 invalidateCallbackMap(m_validateCommandCallbacks);
4084 invalidateCallbackMap(m_printFinishedCallbacks);
4087 Vector<WebEditCommandProxy*> editCommandVector;
4088 copyToVector(m_editCommandSet, editCommandVector);
4089 m_editCommandSet.clear();
4090 for (size_t i = 0, size = editCommandVector.size(); i < size; ++i)
4091 editCommandVector[i]->invalidate();
4092 m_pageClient->clearAllEditCommands();
4094 m_activePopupMenu = 0;
4096 m_estimatedProgress = 0.0;
4098 m_pendingLearnOrIgnoreWordMessageCount = 0;
4100 m_pageClient->processDidCrash();
4101 m_loaderClient.processDidCrash(this);
4104 // If the call out to the loader client didn't cause the web process to be relaunched,
4105 // we'll call setNeedsDisplay on the view so that we won't have the old contents showing.
4106 // If the call did cause the web process to be relaunched, we'll keep the old page contents showing
4107 // until the new web process has painted its contents.
4108 setViewNeedsDisplay(IntRect(IntPoint(), viewSize()));
4111 // Can't expect DidReceiveEvent notifications from a crashed web process.
4112 m_keyEventQueue.clear();
4114 m_wheelEventQueue.clear();
4115 m_currentlyProcessedWheelEvents.clear();
4117 m_nextMouseMoveEvent = nullptr;
4118 m_currentlyProcessedMouseDownEvent = nullptr;
4120 m_processingMouseMoveEvent = false;
4122 #if ENABLE(TOUCH_EVENTS)
4123 m_needTouchEvents = false;
4124 m_touchEventQueue.clear();
4127 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
4128 dismissCorrectionPanel(ReasonForDismissingAlternativeTextIgnored);
4129 m_pageClient->dismissDictionaryLookupPanel();
4133 WebPageCreationParameters WebPageProxy::creationParameters() const
4135 WebPageCreationParameters parameters;
4137 parameters.viewSize = m_pageClient->viewSize();
4138 parameters.isActive = m_pageClient->isViewWindowActive();
4139 parameters.isFocused = m_pageClient->isViewFocused();
4140 parameters.isVisible = m_pageClient->isViewVisible();
4141 parameters.isInWindow = m_pageClient->isViewInWindow();
4142 parameters.drawingAreaType = m_drawingArea->type();
4143 parameters.store = m_pageGroup->preferences()->store();
4144 parameters.pageGroupData = m_pageGroup->data();
4145 parameters.drawsBackground = m_drawsBackground;
4146 parameters.drawsTransparentBackground = m_drawsTransparentBackground;
4147 parameters.areMemoryCacheClientCallsEnabled = m_areMemoryCacheClientCallsEnabled;
4148 parameters.useFixedLayout = m_useFixedLayout;
4149 parameters.fixedLayoutSize = m_fixedLayoutSize;
4150 parameters.paginationMode = m_paginationMode;
4151 parameters.paginationBehavesLikeColumns = m_paginationBehavesLikeColumns;
4152 parameters.pageLength = m_pageLength;
4153 parameters.gapBetweenPages = m_gapBetweenPages;
4154 parameters.userAgent = userAgent();
4155 parameters.sessionState = SessionState(m_backForwardList->entries(), m_backForwardList->currentIndex());
4156 parameters.highestUsedBackForwardItemID = WebBackForwardListItem::highedUsedItemID();
4157 parameters.canRunBeforeUnloadConfirmPanel = m_uiClient.canRunBeforeUnloadConfirmPanel();
4158 parameters.canRunModal = m_canRunModal;
4159 parameters.deviceScaleFactor = m_intrinsicDeviceScaleFactor;
4160 parameters.mediaVolume = m_mediaVolume;
4163 parameters.isSmartInsertDeleteEnabled = m_isSmartInsertDeleteEnabled;
4164 parameters.layerHostingMode = m_layerHostingMode;
4165 parameters.colorSpace = m_pageClient->colorSpace();
4169 parameters.nativeWindow = m_pageClient->nativeWindow();
4174 #if USE(ACCELERATED_COMPOSITING)
4175 void WebPageProxy::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
4177 m_pageClient->enterAcceleratedCompositingMode(layerTreeContext);
4180 void WebPageProxy::exitAcceleratedCompositingMode()
4182 #if ENABLE(TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE)
4183 process()->platformSurfaceTexturePool()->removeAllPlatformSurfaceTextures();
4185 m_pageClient->exitAcceleratedCompositingMode();
4188 void WebPageProxy::updateAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
4190 m_pageClient->updateAcceleratedCompositingMode(layerTreeContext);
4192 #endif // USE(ACCELERATED_COMPOSITING)
4194 void WebPageProxy::backForwardClear()
4196 m_backForwardList->clear();
4199 void WebPageProxy::canAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, const ProtectionSpace& coreProtectionSpace, bool& canAuthenticate)
4201 WebFrameProxy* frame = process()->webFrame(frameID);
4202 MESSAGE_CHECK(frame);
4204 RefPtr<WebProtectionSpace> protectionSpace = WebProtectionSpace::create(coreProtectionSpace);
4206 canAuthenticate = m_loaderClient.canAuthenticateAgainstProtectionSpaceInFrame(this, frame, protectionSpace.get());
4209 void WebPageProxy::didReceiveAuthenticationChallenge(uint64_t frameID, const AuthenticationChallenge& coreChallenge, uint64_t challengeID)
4211 WebFrameProxy* frame = process()->webFrame(frameID);
4212 MESSAGE_CHECK(frame);
4214 #if ENABLE(TIZEN_ON_AUTHENTICATION_REQUESTED)
4215 RefPtr<AuthenticationChallengeProxy> authenticationChallenge = frame->setUpAuthenticationChallengeProxy(coreChallenge, challengeID, process());
4217 RefPtr<AuthenticationChallengeProxy> authenticationChallenge = AuthenticationChallengeProxy::create(coreChallenge, challengeID, process());
4220 m_loaderClient.didReceiveAuthenticationChallengeInFrame(this, frame, authenticationChallenge.get());
4223 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)
4225 WebFrameProxy* frame = process()->webFrame(frameID);
4226 MESSAGE_CHECK(frame);
4228 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
4230 newQuota = m_uiClient.exceededDatabaseQuota(this, frame, origin.get(), databaseName, displayName, currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage);
4233 void WebPageProxy::requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier)
4235 WebFrameProxy* frame = process()->webFrame(frameID);
4236 MESSAGE_CHECK(frame);
4238 // FIXME: Geolocation should probably be using toString() as its string representation instead of databaseIdentifier().
4239 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
4240 RefPtr<GeolocationPermissionRequestProxy> request = m_geolocationPermissionRequestManager.createRequest(geolocationID);
4242 if (!m_uiClient.decidePolicyForGeolocationPermissionRequest(this, frame, origin.get(), request.get()))
4246 void WebPageProxy::requestNotificationPermission(uint64_t requestID, const String& originString)
4248 if (!isRequestIDValid(requestID))
4251 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromString(originString);
4252 RefPtr<NotificationPermissionRequest> request = m_notificationPermissionRequestManager.createRequest(requestID);
4254 if (!m_uiClient.decidePolicyForNotificationPermissionRequest(this, origin.get(), request.get()))
4258 void WebPageProxy::showNotification(const String& title, const String& body, const String& iconURL, const String& tag, const String& originString, uint64_t notificationID)
4260 m_process->context()->notificationManagerProxy()->show(this, title, body, iconURL, tag, originString, notificationID);
4263 #if ENABLE(TIZEN_MEDIA_STREAM)
4264 void WebPageProxy::requestUserMediaPermission(uint64_t requestID)
4266 RefPtr<UserMediaPermissionRequest> request = m_userMediaPermissionRequestManager.createRequest(requestID);
4268 if (!m_tizenClient.decidePolicyForUserMediaPermissionRequest(this, request.get()))
4273 float WebPageProxy::headerHeight(WebFrameProxy* frame)
4275 if (frame->isDisplayingPDFDocument())
4277 return m_uiClient.headerHeight(this, frame);
4280 float WebPageProxy::footerHeight(WebFrameProxy* frame)
4282 if (frame->isDisplayingPDFDocument())
4284 return m_uiClient.footerHeight(this, frame);
4287 void WebPageProxy::drawHeader(WebFrameProxy* frame, const FloatRect& rect)
4289 if (frame->isDisplayingPDFDocument())
4291 m_uiClient.drawHeader(this, frame, rect);
4294 void WebPageProxy::drawFooter(WebFrameProxy* frame, const FloatRect& rect)
4296 if (frame->isDisplayingPDFDocument())
4298 m_uiClient.drawFooter(this, frame, rect);
4301 void WebPageProxy::runModal()
4303 // Since runModal() can (and probably will) spin a nested run loop we need to turn off the responsiveness timer.
4304 process()->responsivenessTimer()->stop();
4306 // Our Connection's run loop might have more messages waiting to be handled after this RunModal message.
4307 // To make sure they are handled inside of the the nested modal run loop we must first signal the Connection's
4308 // run loop so we're guaranteed that it has a chance to wake up.
4309 // See http://webkit.org/b/89590 for more discussion.
4310 process()->connection()->wakeUpRunLoop();
4312 m_uiClient.runModal(this);
4315 void WebPageProxy::notifyScrollerThumbIsVisibleInRect(const IntRect& scrollerThumb)
4317 m_visibleScrollerThumbRect = scrollerThumb;
4320 void WebPageProxy::recommendedScrollbarStyleDidChange(int32_t newStyle)
4323 m_pageClient->recommendedScrollbarStyleDidChange(newStyle);
4327 void WebPageProxy::didChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar)
4329 m_mainFrameHasHorizontalScrollbar = hasHorizontalScrollbar;
4330 m_mainFrameHasVerticalScrollbar = hasVerticalScrollbar;
4332 m_pageClient->didChangeScrollbarsForMainFrame();
4335 void WebPageProxy::didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide)
4337 m_mainFrameIsPinnedToLeftSide = pinnedToLeftSide;
4338 m_mainFrameIsPinnedToRightSide = pinnedToRightSide;
4341 void WebPageProxy::didChangePageCount(unsigned pageCount)
4343 m_pageCount = pageCount;
4346 void WebPageProxy::didFailToInitializePlugin(const String& mimeType)
4348 m_loaderClient.didFailToInitializePlugin(this, mimeType);
4351 void WebPageProxy::didBlockInsecurePluginVersion(const String& mimeType, const String& urlString)
4353 String pluginIdentifier;
4354 String pluginVersion;
4355 String newMimeType = mimeType;
4358 PluginModuleInfo plugin = m_process->context()->pluginInfoStore().findPlugin(newMimeType, KURL(KURL(), urlString));
4360 pluginIdentifier = plugin.bundleIdentifier;
4361 pluginVersion = plugin.versionString;
4364 m_loaderClient.didBlockInsecurePluginVersion(this, newMimeType, pluginIdentifier, pluginVersion);
4367 bool WebPageProxy::willHandleHorizontalScrollEvents() const
4369 return !m_canShortCircuitHorizontalWheelEvents;
4372 void WebPageProxy::didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference& dataReference)
4374 m_pageClient->didFinishLoadingDataForCustomRepresentation(suggestedFilename, dataReference);
4377 void WebPageProxy::backForwardRemovedItem(uint64_t itemID)
4379 process()->send(Messages::WebPage::DidRemoveBackForwardItem(itemID), m_pageID);
4382 void WebPageProxy::setCanRunModal(bool canRunModal)
4387 // It's only possible to change the state for a WebPage which
4388 // already qualifies for running modal child web pages, otherwise
4389 // there's no other possibility than not allowing it.
4390 m_canRunModal = m_uiClient.canRunModal() && canRunModal;
4391 process()->send(Messages::WebPage::SetCanRunModal(m_canRunModal), m_pageID);
4394 bool WebPageProxy::canRunModal()
4396 return isValid() ? m_canRunModal : false;
4399 void WebPageProxy::beginPrinting(WebFrameProxy* frame, const PrintInfo& printInfo)
4401 if (m_isInPrintingMode)
4404 m_isInPrintingMode = true;
4405 process()->send(Messages::WebPage::BeginPrinting(frame->frameID(), printInfo), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
4408 void WebPageProxy::endPrinting()
4410 if (!m_isInPrintingMode)
4413 m_isInPrintingMode = false;
4414 process()->send(Messages::WebPage::EndPrinting(), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
4417 void WebPageProxy::computePagesForPrinting(WebFrameProxy* frame, const PrintInfo& printInfo, PassRefPtr<ComputedPagesCallback> prpCallback)
4419 RefPtr<ComputedPagesCallback> callback = prpCallback;
4421 callback->invalidate();
4425 uint64_t callbackID = callback->callbackID();
4426 m_computedPagesCallbacks.set(callbackID, callback.get());
4427 m_isInPrintingMode = true;
4428 process()->send(Messages::WebPage::ComputePagesForPrinting(frame->frameID(), printInfo, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
4431 #if PLATFORM(MAC) || PLATFORM(WIN)
4432 void WebPageProxy::drawRectToPDF(WebFrameProxy* frame, const PrintInfo& printInfo, const IntRect& rect, PassRefPtr<DataCallback> prpCallback)
4434 RefPtr<DataCallback> callback = prpCallback;
4436 callback->invalidate();
4440 uint64_t callbackID = callback->callbackID();
4441 m_dataCallbacks.set(callbackID, callback.get());
4442 process()->send(Messages::WebPage::DrawRectToPDF(frame->frameID(), printInfo, rect, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
4445 void WebPageProxy::drawPagesToPDF(WebFrameProxy* frame, const PrintInfo& printInfo, uint32_t first, uint32_t count, PassRefPtr<DataCallback> prpCallback)
4447 RefPtr<DataCallback> callback = prpCallback;
4449 callback->invalidate();
4453 uint64_t callbackID = callback->callbackID();
4454 m_dataCallbacks.set(callbackID, callback.get());
4455 process()->send(Messages::WebPage::DrawPagesToPDF(frame->frameID(), printInfo, first, count, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
4458 void WebPageProxy::drawPagesForPrinting(WebFrameProxy* frame, const PrintInfo& printInfo, PassRefPtr<PrintFinishedCallback> didPrintCallback)
4460 RefPtr<PrintFinishedCallback> callback = didPrintCallback;
4462 callback->invalidate();
4466 uint64_t callbackID = callback->callbackID();
4467 m_printFinishedCallbacks.set(callbackID, callback.get());
4468 m_isInPrintingMode = true;
4469 process()->send(Messages::WebPage::DrawPagesForPrinting(frame->frameID(), printInfo, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
4473 void WebPageProxy::flashBackingStoreUpdates(const Vector<IntRect>& updateRects)
4475 m_pageClient->flashBackingStoreUpdates(updateRects);
4478 void WebPageProxy::updateBackingStoreDiscardableState()
4484 if (!process()->responsivenessTimer()->isResponsive())
4485 isDiscardable = false;
4487 isDiscardable = !m_pageClient->isViewWindowActive() || !isViewVisible();
4489 m_drawingArea->setBackingStoreIsDiscardable(isDiscardable);
4492 Color WebPageProxy::viewUpdatesFlashColor()
4494 return Color(0, 200, 255);
4497 Color WebPageProxy::backingStoreUpdatesFlashColor()
4499 return Color(200, 0, 255);
4502 void WebPageProxy::saveDataToFileInDownloadsFolder(const String& suggestedFilename, const String& mimeType, const String& originatingURLString, WebData* data)
4504 m_uiClient.saveDataToFileInDownloadsFolder(this, suggestedFilename, mimeType, originatingURLString, data);
4507 void WebPageProxy::linkClicked(const String& url, const WebMouseEvent& event)
4509 process()->send(Messages::WebPage::LinkClicked(url, event), m_pageID, 0);
4514 void WebPageProxy::substitutionsPanelIsShowing(bool& isShowing)
4516 isShowing = TextChecker::substitutionsPanelIsShowing();
4519 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
4520 void WebPageProxy::showCorrectionPanel(int32_t panelType, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings)
4522 m_pageClient->showCorrectionPanel((AlternativeTextType)panelType, boundingBoxOfReplacedString, replacedString, replacementString, alternativeReplacementStrings);
4525 void WebPageProxy::dismissCorrectionPanel(int32_t reason)
4527 m_pageClient->dismissCorrectionPanel((ReasonForDismissingAlternativeText)reason);
4530 void WebPageProxy::dismissCorrectionPanelSoon(int32_t reason, String& result)
4532 result = m_pageClient->dismissCorrectionPanelSoon((ReasonForDismissingAlternativeText)reason);
4535 void WebPageProxy::recordAutocorrectionResponse(int32_t responseType, const String& replacedString, const String& replacementString)
4537 m_pageClient->recordAutocorrectionResponse((AutocorrectionResponseType)responseType, replacedString, replacementString);
4539 #endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
4541 void WebPageProxy::handleAlternativeTextUIResult(const String& result)
4543 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
4545 process()->send(Messages::WebPage::HandleAlternativeTextUIResult(result), m_pageID, 0);
4549 #if USE(DICTATION_ALTERNATIVES)
4550 void WebPageProxy::showDictationAlternativeUI(const WebCore::FloatRect& boundingBoxOfDictatedText, uint64_t dictationContext)
4552 m_pageClient->showDictationAlternativeUI(boundingBoxOfDictatedText, dictationContext);
4555 void WebPageProxy::dismissDictationAlternativeUI()
4557 m_pageClient->dismissDictationAlternativeUI();
4560 void WebPageProxy::removeDictationAlternatives(uint64_t dictationContext)
4562 m_pageClient->removeDictationAlternatives(dictationContext);
4565 void WebPageProxy::dictationAlternatives(uint64_t dictationContext, Vector<String>& result)
4567 result = m_pageClient->dictationAlternatives(dictationContext);
4571 #endif // PLATFORM(MAC)
4573 #if ENABLE(TIZEN_PAGE_VISIBILITY_API)
4574 void WebPageProxy::setPageVisibility(WebCore::PageVisibilityState pageVisibilityState, bool isInitialState)
4576 process()->send(Messages::WebPage::SetVisibilityState(static_cast<uint32_t>(pageVisibilityState), isInitialState), m_pageID);
4580 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
4581 void WebPageProxy::decidePolicyForCertificateError(const String& url, const String& certificate, int error, PassRefPtr<Messages::WebPageProxy::DecidePolicyForCertificateError::DelayedReply> reply)
4583 m_allowedReply = reply;
4585 if (!m_tizenClient.decidePolicyForCertificateError(this, url, certificate, error))
4586 replyPolicyForCertificateError(true);
4590 #if ENABLE(TIZEN_NATIVE_MEMORY_SNAPSHOT)
4591 void WebPageProxy::dumpMemorySnapshot()
4593 process()->send(Messages::WebPage::DumpMemorySnapshot(), m_pageID);
4597 } // namespace WebKit