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"
113 #include "WebSoupRequestManagerProxy.h"
116 #if ENABLE(TIZEN_DRAG_SUPPORT)
117 #include "ArgumentCodersTizen.h"
121 #include <wtf/RefCountedLeakCounter.h>
124 #if ENABLE(TIZEN_ISF_PORT) || ENABLE(TIZEN_GESTURE)
125 #include "EwkViewImpl.h"
126 #include "InputMethodContextEfl.h"
129 // This controls what strategy we use for mouse wheel coalescing.
130 #define MERGE_WHEEL_EVENTS 1
132 #define MESSAGE_CHECK(assertion) MESSAGE_CHECK_BASE(assertion, m_process->connection())
133 #define MESSAGE_CHECK_URL(url) MESSAGE_CHECK_BASE(m_process->checkURLReceivedFromWebProcess(url), m_process->connection())
135 using namespace WebCore;
137 // Represents the number of wheel events we can hold in the queue before we start pushing them preemptively.
138 static const unsigned wheelEventQueueSizeThreshold = 10;
142 WKPageDebugPaintFlags WebPageProxy::s_debugPaintFlags = 0;
144 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, webPageProxyCounter, ("WebPageProxy"));
147 static const char* webKeyboardEventTypeString(WebEvent::Type type)
150 case WebEvent::KeyDown:
153 case WebEvent::KeyUp:
156 case WebEvent::RawKeyDown:
163 ASSERT_NOT_REACHED();
167 #endif // !LOG_DISABLED
169 PassRefPtr<WebPageProxy> WebPageProxy::create(PageClient* pageClient, PassRefPtr<WebProcessProxy> process, WebPageGroup* pageGroup, uint64_t pageID)
171 return adoptRef(new WebPageProxy(pageClient, process, pageGroup, pageID));
174 WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> process, WebPageGroup* pageGroup, uint64_t pageID)
175 : m_pageClient(pageClient)
177 , m_pageGroup(pageGroup)
179 , m_userAgent(standardUserAgent())
180 , m_geolocationPermissionRequestManager(this)
181 , m_notificationPermissionRequestManager(this)
182 #if ENABLE(TIZEN_MEDIA_STREAM)
183 , m_userMediaPermissionRequestManager(this)
185 , m_estimatedProgress(0)
186 , m_isInWindow(m_pageClient->isViewInWindow())
187 , m_isVisible(m_pageClient->isViewVisible())
188 , m_backForwardList(WebBackForwardList::create(this))
189 , m_loadStateAtProcessExit(WebFrameProxy::LoadStateFinished)
190 , m_textZoomFactor(1)
191 , m_pageZoomFactor(1)
192 , m_pageScaleFactor(1)
193 , m_intrinsicDeviceScaleFactor(1)
194 , m_customDeviceScaleFactor(0)
195 #if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
196 , m_layerHostingMode(LayerHostingModeInWindowServer)
198 , m_layerHostingMode(LayerHostingModeDefault)
200 , m_drawsBackground(true)
201 , m_drawsTransparentBackground(false)
202 , m_areMemoryCacheClientCallsEnabled(true)
203 , m_useFixedLayout(false)
204 , m_paginationMode(Page::Pagination::Unpaginated)
205 , m_paginationBehavesLikeColumns(false)
207 , m_gapBetweenPages(0)
210 , m_canRunModal(false)
211 , m_isInPrintingMode(false)
212 , m_isPerformingDOMPrintOperation(false)
213 , m_inDecidePolicyForResponse(false)
214 , m_syncMimeTypePolicyActionIsValid(false)
215 , m_syncMimeTypePolicyAction(PolicyUse)
216 , m_syncMimeTypePolicyDownloadID(0)
217 , m_inDecidePolicyForNavigationAction(false)
218 , m_syncNavigationActionPolicyActionIsValid(false)
219 , m_syncNavigationActionPolicyAction(PolicyUse)
220 , m_syncNavigationActionPolicyDownloadID(0)
221 , m_processingMouseMoveEvent(false)
222 #if ENABLE(TOUCH_EVENTS)
223 , m_needTouchEvents(false)
225 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
226 , m_askOverflow(true)
229 , m_isPageSuspended(false)
231 , m_isSmartInsertDeleteEnabled(TextChecker::isSmartInsertDeleteEnabled())
233 , m_spellDocumentTag(0)
234 , m_hasSpellDocumentTag(false)
235 , m_pendingLearnOrIgnoreWordMessageCount(0)
236 , m_mainFrameHasCustomRepresentation(false)
237 , m_mainFrameHasHorizontalScrollbar(false)
238 , m_mainFrameHasVerticalScrollbar(false)
239 , m_canShortCircuitHorizontalWheelEvents(true)
240 , m_mainFrameIsPinnedToLeftSide(false)
241 , m_mainFrameIsPinnedToRightSide(false)
243 , m_renderTreeSize(0)
244 , m_shouldSendEventsSynchronously(false)
245 , m_suppressVisibilityUpdates(false)
247 #if ENABLE(PAGE_VISIBILITY_API)
248 , m_visibilityState(PageVisibilityStateVisible)
250 #if ENABLE(TIZEN_REDUCE_KEY_LAGGING)
251 , m_pageContentResumeTimer(0)
253 #if ENABLE(TIZEN_ISF_PORT)
254 , m_didCancelCompositionFromWebProcess(false)
258 webPageProxyCounter.increment();
261 WebContext::statistics().wkPageCount++;
263 m_pageGroup->addPage(this);
266 WebPageProxy::~WebPageProxy()
271 WebContext::statistics().wkPageCount--;
273 if (m_hasSpellDocumentTag)
274 TextChecker::closeSpellDocumentWithTag(m_spellDocumentTag);
276 m_pageGroup->removePage(this);
279 webPageProxyCounter.decrement();
281 #if ENABLE(TIZEN_REDUCE_KEY_LAGGING)
282 if (m_pageContentResumeTimer)
283 ecore_timer_del(m_pageContentResumeTimer);
287 WebProcessProxy* WebPageProxy::process() const
289 return m_process.get();
292 PlatformProcessIdentifier WebPageProxy::processIdentifier() const
297 return m_process->processIdentifier();
300 bool WebPageProxy::isValid()
302 // A page that has been explicitly closed is never valid.
309 void WebPageProxy::initializeLoaderClient(const WKPageLoaderClient* loadClient)
311 m_loaderClient.initialize(loadClient);
316 process()->send(Messages::WebPage::SetWillGoToBackForwardItemCallbackEnabled(loadClient->version > 0), m_pageID);
319 void WebPageProxy::initializePolicyClient(const WKPagePolicyClient* policyClient)
321 m_policyClient.initialize(policyClient);
324 void WebPageProxy::initializeFormClient(const WKPageFormClient* formClient)
326 m_formClient.initialize(formClient);
329 void WebPageProxy::initializeResourceLoadClient(const WKPageResourceLoadClient* client)
331 m_resourceLoadClient.initialize(client);
334 void WebPageProxy::initializeUIClient(const WKPageUIClient* client)
339 m_uiClient.initialize(client);
341 process()->send(Messages::WebPage::SetCanRunBeforeUnloadConfirmPanel(m_uiClient.canRunBeforeUnloadConfirmPanel()), m_pageID);
342 setCanRunModal(m_uiClient.canRunModal());
345 void WebPageProxy::initializeFindClient(const WKPageFindClient* client)
347 m_findClient.initialize(client);
350 void WebPageProxy::initializeFindMatchesClient(const WKPageFindMatchesClient* client)
352 m_findMatchesClient.initialize(client);
355 #if ENABLE(CONTEXT_MENUS)
356 void WebPageProxy::initializeContextMenuClient(const WKPageContextMenuClient* client)
358 m_contextMenuClient.initialize(client);
362 void WebPageProxy::reattachToWebProcess()
368 m_process = m_process->context()->relaunchProcessIfNecessary();
369 process()->addExistingWebPage(this, m_pageID);
373 m_pageClient->didRelaunchProcess();
374 m_drawingArea->waitForBackingStoreUpdateOnNextPaint();
377 void WebPageProxy::reattachToWebProcessWithItem(WebBackForwardListItem* item)
379 if (item && item != m_backForwardList->currentItem())
380 m_backForwardList->goToItem(item);
382 reattachToWebProcess();
387 process()->send(Messages::WebPage::GoToBackForwardItem(item->itemID()), m_pageID);
388 process()->responsivenessTimer()->start();
391 void WebPageProxy::initializeWebPage()
395 BackForwardListItemVector items = m_backForwardList->entries();
396 for (size_t i = 0; i < items.size(); ++i)
397 process()->registerNewWebBackForwardListItem(items[i].get());
399 m_drawingArea = m_pageClient->createDrawingAreaProxy();
400 ASSERT(m_drawingArea);
402 #if ENABLE(INSPECTOR_SERVER)
403 if (m_pageGroup->preferences()->developerExtrasEnabled())
404 inspector()->enableRemoteInspection();
407 process()->send(Messages::WebProcess::CreateWebPage(m_pageID, creationParameters()), 0);
409 #if ENABLE(PAGE_VISIBILITY_API)
410 process()->send(Messages::WebPage::SetVisibilityState(m_visibilityState, /* isInitialState */ true), m_pageID);
414 void WebPageProxy::close()
421 m_backForwardList->pageClosed();
422 m_pageClient->pageClosed();
424 process()->disconnectFramesFromPage(this);
427 #if ENABLE(INSPECTOR)
429 m_inspector->invalidate();
434 #if ENABLE(FULLSCREEN_API)
435 if (m_fullScreenManager) {
436 m_fullScreenManager->invalidate();
437 m_fullScreenManager = 0;
441 if (m_openPanelResultListener) {
442 m_openPanelResultListener->invalidate();
443 m_openPanelResultListener = 0;
446 #if ENABLE(INPUT_TYPE_COLOR)
447 if (m_colorChooser) {
448 m_colorChooser->invalidate();
449 m_colorChooser = nullptr;
452 #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
453 if (m_colorPickerResultListener) {
454 m_colorPickerResultListener->invalidate();
455 m_colorPickerResultListener = nullptr;
460 #if ENABLE(GEOLOCATION)
461 m_geolocationPermissionRequestManager.invalidateRequests();
464 m_notificationPermissionRequestManager.invalidateRequests();
465 #if ENABLE(TIZEN_MEDIA_STREAM)
466 m_userMediaPermissionRequestManager.invalidateRequests();
469 m_toolTip = String();
471 m_mainFrameHasHorizontalScrollbar = false;
472 m_mainFrameHasVerticalScrollbar = false;
474 m_mainFrameIsPinnedToLeftSide = false;
475 m_mainFrameIsPinnedToRightSide = false;
477 m_visibleScrollerThumbRect = IntRect();
479 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
480 invalidateCallbackMap(m_booleanCallbacks);
481 invalidateCallbackMap(m_dictionaryCallbacks);
483 invalidateCallbackMap(m_voidCallbacks);
484 invalidateCallbackMap(m_dataCallbacks);
485 invalidateCallbackMap(m_stringCallbacks);
486 m_loadDependentStringCallbackIDs.clear();
487 invalidateCallbackMap(m_scriptValueCallbacks);
488 invalidateCallbackMap(m_computedPagesCallbacks);
490 invalidateCallbackMap(m_printFinishedCallbacks);
493 Vector<WebEditCommandProxy*> editCommandVector;
494 copyToVector(m_editCommandSet, editCommandVector);
495 m_editCommandSet.clear();
496 for (size_t i = 0, size = editCommandVector.size(); i < size; ++i)
497 editCommandVector[i]->invalidate();
499 m_activePopupMenu = 0;
501 m_estimatedProgress = 0.0;
503 m_loaderClient.initialize(0);
504 m_policyClient.initialize(0);
505 m_uiClient.initialize(0);
507 m_drawingArea = nullptr;
509 process()->send(Messages::WebPage::Close(), m_pageID);
510 process()->removeWebPage(m_pageID);
513 bool WebPageProxy::tryClose()
518 process()->send(Messages::WebPage::TryClose(), m_pageID);
519 process()->responsivenessTimer()->start();
523 bool WebPageProxy::maybeInitializeSandboxExtensionHandle(const KURL& url, SandboxExtension::Handle& sandboxExtensionHandle)
525 if (!url.isLocalFile())
528 #if ENABLE(INSPECTOR)
529 // Don't give the inspector full access to the file system.
530 if (WebInspectorProxy::isInspectorPage(this))
534 SandboxExtension::createHandle("/", SandboxExtension::ReadOnly, sandboxExtensionHandle);
538 void WebPageProxy::loadURL(const String& url)
540 setPendingAPIRequestURL(url);
543 reattachToWebProcess();
545 SandboxExtension::Handle sandboxExtensionHandle;
546 bool createdExtension = maybeInitializeSandboxExtensionHandle(KURL(KURL(), url), sandboxExtensionHandle);
547 if (createdExtension)
548 process()->willAcquireUniversalFileReadSandboxExtension();
549 process()->send(Messages::WebPage::LoadURL(url, sandboxExtensionHandle), m_pageID);
550 process()->responsivenessTimer()->start();
553 void WebPageProxy::loadURLRequest(WebURLRequest* urlRequest)
555 setPendingAPIRequestURL(urlRequest->resourceRequest().url());
558 reattachToWebProcess();
560 SandboxExtension::Handle sandboxExtensionHandle;
561 bool createdExtension = maybeInitializeSandboxExtensionHandle(urlRequest->resourceRequest().url(), sandboxExtensionHandle);
562 if (createdExtension)
563 process()->willAcquireUniversalFileReadSandboxExtension();
564 process()->send(Messages::WebPage::LoadURLRequest(urlRequest->resourceRequest(), sandboxExtensionHandle), m_pageID);
565 process()->responsivenessTimer()->start();
568 void WebPageProxy::loadHTMLString(const String& htmlString, const String& baseURL)
571 reattachToWebProcess();
573 process()->assumeReadAccessToBaseURL(baseURL);
574 process()->send(Messages::WebPage::LoadHTMLString(htmlString, baseURL), m_pageID);
575 process()->responsivenessTimer()->start();
578 void WebPageProxy::loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL)
581 reattachToWebProcess();
584 m_mainFrame->setUnreachableURL(unreachableURL);
586 process()->assumeReadAccessToBaseURL(baseURL);
587 process()->send(Messages::WebPage::LoadAlternateHTMLString(htmlString, baseURL, unreachableURL), m_pageID);
588 process()->responsivenessTimer()->start();
591 void WebPageProxy::loadPlainTextString(const String& string)
594 reattachToWebProcess();
596 process()->send(Messages::WebPage::LoadPlainTextString(string), m_pageID);
597 process()->responsivenessTimer()->start();
600 void WebPageProxy::loadWebArchiveData(const WebData* webArchiveData)
603 reattachToWebProcess();
605 process()->send(Messages::WebPage::LoadWebArchiveData(webArchiveData->dataReference()), m_pageID);
606 process()->responsivenessTimer()->start();
610 void WebPageProxy::loadContentsbyMimeType(const WebData* contents, const String& mimeType, const String& encoding, const String& baseURL)
613 reattachToWebProcess();
615 process()->assumeReadAccessToBaseURL(baseURL);
616 #if ENABLE(TIZEN_UNIVERSAL_FILE_READ_ACCESS)
617 SandboxExtension::Handle sandboxExtensionHandleEmail;
618 bool createdExtension = maybeInitializeSandboxExtensionHandle(KURL(KURL(), baseURL), sandboxExtensionHandleEmail);
619 if (createdExtension)
620 process()->willAcquireUniversalFileReadSandboxExtension();
622 process()->send(Messages::WebPage::LoadContentsbyMimeType(contents->dataReference(), mimeType, encoding, baseURL), m_pageID);
623 process()->responsivenessTimer()->start();
627 void WebPageProxy::stopLoading()
632 process()->send(Messages::WebPage::StopLoading(), m_pageID);
633 process()->responsivenessTimer()->start();
636 void WebPageProxy::reload(bool reloadFromOrigin)
638 SandboxExtension::Handle sandboxExtensionHandle;
640 if (m_backForwardList->currentItem()) {
641 String url = m_backForwardList->currentItem()->url();
642 setPendingAPIRequestURL(url);
644 // We may not have an extension yet if back/forward list was reinstated after a WebProcess crash or a browser relaunch
645 bool createdExtension = maybeInitializeSandboxExtensionHandle(KURL(KURL(), url), sandboxExtensionHandle);
646 if (createdExtension)
647 process()->willAcquireUniversalFileReadSandboxExtension();
651 reattachToWebProcessWithItem(m_backForwardList->currentItem());
655 process()->send(Messages::WebPage::Reload(reloadFromOrigin, sandboxExtensionHandle), m_pageID);
656 process()->responsivenessTimer()->start();
659 void WebPageProxy::goForward()
661 if (isValid() && !canGoForward())
664 WebBackForwardListItem* forwardItem = m_backForwardList->forwardItem();
668 setPendingAPIRequestURL(forwardItem->url());
671 reattachToWebProcessWithItem(forwardItem);
675 process()->send(Messages::WebPage::GoForward(forwardItem->itemID()), m_pageID);
676 process()->responsivenessTimer()->start();
679 bool WebPageProxy::canGoForward() const
681 return m_backForwardList->forwardItem();
684 void WebPageProxy::goBack()
686 if (isValid() && !canGoBack())
689 WebBackForwardListItem* backItem = m_backForwardList->backItem();
693 setPendingAPIRequestURL(backItem->url());
696 reattachToWebProcessWithItem(backItem);
700 process()->send(Messages::WebPage::GoBack(backItem->itemID()), m_pageID);
701 process()->responsivenessTimer()->start();
704 bool WebPageProxy::canGoBack() const
706 return m_backForwardList->backItem();
709 void WebPageProxy::goToBackForwardItem(WebBackForwardListItem* item)
712 reattachToWebProcessWithItem(item);
716 setPendingAPIRequestURL(item->url());
718 process()->send(Messages::WebPage::GoToBackForwardItem(item->itemID()), m_pageID);
719 process()->responsivenessTimer()->start();
722 void WebPageProxy::tryRestoreScrollPosition()
727 process()->send(Messages::WebPage::TryRestoreScrollPosition(), m_pageID);
730 void WebPageProxy::didChangeBackForwardList(WebBackForwardListItem* added, Vector<RefPtr<APIObject> >* removed)
732 m_loaderClient.didChangeBackForwardList(this, added, removed);
735 void WebPageProxy::shouldGoToBackForwardListItem(uint64_t itemID, bool& shouldGoToBackForwardItem)
737 WebBackForwardListItem* item = process()->webBackForwardItem(itemID);
738 shouldGoToBackForwardItem = item && m_loaderClient.shouldGoToBackForwardListItem(this, item);
741 void WebPageProxy::willGoToBackForwardListItem(uint64_t itemID, CoreIPC::ArgumentDecoder* arguments)
743 RefPtr<APIObject> userData;
744 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
745 if (!arguments->decode(messageDecoder))
748 if (WebBackForwardListItem* item = process()->webBackForwardItem(itemID))
749 m_loaderClient.willGoToBackForwardListItem(this, item, userData.get());
752 String WebPageProxy::activeURL() const
754 // If there is a currently pending url, it is the active URL,
755 // even when there's no main frame yet, as it might be the
756 // first API request.
757 if (!m_pendingAPIRequestURL.isNull())
758 return m_pendingAPIRequestURL;
763 if (!m_mainFrame->unreachableURL().isEmpty())
764 return m_mainFrame->unreachableURL();
766 switch (m_mainFrame->loadState()) {
767 case WebFrameProxy::LoadStateProvisional:
768 return m_mainFrame->provisionalURL();
769 case WebFrameProxy::LoadStateCommitted:
770 case WebFrameProxy::LoadStateFinished:
771 return m_mainFrame->url();
774 ASSERT_NOT_REACHED();
778 String WebPageProxy::provisionalURL() const
782 return m_mainFrame->provisionalURL();
785 String WebPageProxy::committedURL() const
790 return m_mainFrame->url();
793 bool WebPageProxy::canShowMIMEType(const String& mimeType) const
795 if (MIMETypeRegistry::canShowMIMEType(mimeType))
798 String newMimeType = mimeType;
799 PluginModuleInfo plugin = m_process->context()->pluginInfoStore().findPlugin(newMimeType, KURL());
800 if (!plugin.path.isNull() && m_pageGroup->preferences()->pluginsEnabled())
806 void WebPageProxy::setDrawsBackground(bool drawsBackground)
808 if (m_drawsBackground == drawsBackground)
811 m_drawsBackground = drawsBackground;
814 process()->send(Messages::WebPage::SetDrawsBackground(drawsBackground), m_pageID);
817 void WebPageProxy::setDrawsTransparentBackground(bool drawsTransparentBackground)
819 if (m_drawsTransparentBackground == drawsTransparentBackground)
822 m_drawsTransparentBackground = drawsTransparentBackground;
825 process()->send(Messages::WebPage::SetDrawsTransparentBackground(drawsTransparentBackground), m_pageID);
828 void WebPageProxy::viewWillStartLiveResize()
832 process()->send(Messages::WebPage::ViewWillStartLiveResize(), m_pageID);
835 void WebPageProxy::viewWillEndLiveResize()
839 process()->send(Messages::WebPage::ViewWillEndLiveResize(), m_pageID);
842 void WebPageProxy::setViewNeedsDisplay(const IntRect& rect)
844 m_pageClient->setViewNeedsDisplay(rect);
847 void WebPageProxy::displayView()
849 m_pageClient->displayView();
852 void WebPageProxy::scrollView(const IntRect& scrollRect, const IntSize& scrollOffset)
854 m_pageClient->scrollView(scrollRect, scrollOffset);
857 void WebPageProxy::viewStateDidChange(ViewStateFlags flags)
862 if (flags & ViewIsFocused)
863 process()->send(Messages::WebPage::SetFocused(m_pageClient->isViewFocused()), m_pageID);
865 if (flags & ViewWindowIsActive)
866 process()->send(Messages::WebPage::SetActive(m_pageClient->isViewWindowActive()), m_pageID);
868 if (flags & ViewIsVisible) {
869 bool isVisible = m_pageClient->isViewVisible();
870 if (isVisible != m_isVisible) {
871 m_isVisible = isVisible;
872 m_drawingArea->visibilityDidChange();
875 // If we've started the responsiveness timer as part of telling the web process to update the backing store
876 // state, it might not send back a reply (since it won't paint anything if the web page is hidden) so we
877 // stop the unresponsiveness timer here.
878 process()->responsivenessTimer()->stop();
883 if (flags & ViewIsInWindow) {
884 bool isInWindow = m_pageClient->isViewInWindow();
885 if (m_isInWindow != isInWindow) {
886 m_isInWindow = isInWindow;
887 process()->send(Messages::WebPage::SetIsInWindow(isInWindow), m_pageID);
891 LayerHostingMode layerHostingMode = m_pageClient->viewLayerHostingMode();
892 if (m_layerHostingMode != layerHostingMode) {
893 m_layerHostingMode = layerHostingMode;
894 m_drawingArea->layerHostingModeDidChange();
899 #if ENABLE(PAGE_VISIBILITY_API)
900 PageVisibilityState visibilityState = PageVisibilityStateHidden;
902 if (m_pageClient->isViewVisible())
903 visibilityState = PageVisibilityStateVisible;
905 if (visibilityState != m_visibilityState) {
906 m_visibilityState = visibilityState;
907 process()->send(Messages::WebPage::SetVisibilityState(visibilityState, false), m_pageID);
911 updateBackingStoreDiscardableState();
914 IntSize WebPageProxy::viewSize() const
916 return m_pageClient->viewSize();
919 void WebPageProxy::setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent& keyboardEvent)
923 process()->send(Messages::WebPage::SetInitialFocus(forward, isKeyboardEventValid, keyboardEvent), m_pageID);
926 void WebPageProxy::setWindowResizerSize(const IntSize& windowResizerSize)
930 process()->send(Messages::WebPage::SetWindowResizerSize(windowResizerSize), m_pageID);
933 void WebPageProxy::clearSelection()
937 process()->send(Messages::WebPage::ClearSelection(), m_pageID);
940 void WebPageProxy::validateCommand(const String& commandName, PassRefPtr<ValidateCommandCallback> callback)
943 callback->invalidate();
947 uint64_t callbackID = callback->callbackID();
948 m_validateCommandCallbacks.set(callbackID, callback.get());
949 process()->send(Messages::WebPage::ValidateCommand(commandName, callbackID), m_pageID);
952 void WebPageProxy::setMaintainsInactiveSelection(bool newValue)
954 m_maintainsInactiveSelection = newValue;
957 void WebPageProxy::executeEditCommand(const String& commandName)
962 DEFINE_STATIC_LOCAL(String, ignoreSpellingCommandName, ("ignoreSpelling"));
963 if (commandName == ignoreSpellingCommandName)
964 ++m_pendingLearnOrIgnoreWordMessageCount;
966 process()->send(Messages::WebPage::ExecuteEditCommand(commandName), m_pageID);
969 #if USE(TILED_BACKING_STORE)
970 void WebPageProxy::setViewportSize(const IntSize& size)
975 process()->send(Messages::WebPage::SetViewportSize(size), m_pageID);
979 #if ENABLE(DRAG_SUPPORT)
980 void WebPageProxy::dragEntered(DragData* dragData, const String& dragStorageName)
982 SandboxExtension::Handle sandboxExtensionHandle;
983 SandboxExtension::HandleArray sandboxExtensionHandleEmptyArray;
984 performDragControllerAction(DragControllerActionEntered, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionHandleEmptyArray);
987 void WebPageProxy::dragUpdated(DragData* dragData, const String& dragStorageName)
989 SandboxExtension::Handle sandboxExtensionHandle;
990 SandboxExtension::HandleArray sandboxExtensionHandleEmptyArray;
991 performDragControllerAction(DragControllerActionUpdated, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionHandleEmptyArray);
994 void WebPageProxy::dragExited(DragData* dragData, const String& dragStorageName)
996 SandboxExtension::Handle sandboxExtensionHandle;
997 SandboxExtension::HandleArray sandboxExtensionHandleEmptyArray;
998 performDragControllerAction(DragControllerActionExited, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionHandleEmptyArray);
1001 #if ENABLE(TIZEN_DRAG_SUPPORT)
1002 void WebPageProxy::performDrag(DragData* dragData, const String& dragStorageName)
1004 void WebPageProxy::performDrag(DragData* dragData, const String& dragStorageName, const SandboxExtension::Handle& sandboxExtensionHandle, const SandboxExtension::HandleArray& sandboxExtensionsForUpload)
1007 #if ENABLE(TIZEN_DRAG_SUPPORT)
1008 TIZEN_LOGI("dragData (%p)", dragData);
1009 SandboxExtension::Handle sandboxExtensionHandle;
1010 SandboxExtension::HandleArray sandboxExtensionHandleEmptyArray;
1011 performDragControllerAction(DragControllerActionPerformDrag, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionHandleEmptyArray);
1013 performDragControllerAction(DragControllerActionPerformDrag, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionsForUpload);
1017 void WebPageProxy::performDragControllerAction(DragControllerAction action, DragData* dragData, const String& dragStorageName, const SandboxExtension::Handle& sandboxExtensionHandle, const SandboxExtension::HandleArray& sandboxExtensionsForUpload)
1022 // FIXME: We should pass the drag data map only on DragEnter.
1023 process()->send(Messages::WebPage::PerformDragControllerAction(action, dragData->clientPosition(), dragData->globalPosition(),
1024 dragData->draggingSourceOperationMask(), dragData->dragDataMap(), dragData->flags()), m_pageID);
1025 #elif PLATFORM(QT) || PLATFORM(GTK) || ENABLE(TIZEN_DRAG_SUPPORT)
1026 process()->send(Messages::WebPage::PerformDragControllerAction(action, *dragData), m_pageID);
1028 process()->send(Messages::WebPage::PerformDragControllerAction(action, dragData->clientPosition(), dragData->globalPosition(), dragData->draggingSourceOperationMask(), dragStorageName, dragData->flags(), sandboxExtensionHandle, sandboxExtensionsForUpload), m_pageID);
1032 void WebPageProxy::didPerformDragControllerAction(WebCore::DragSession dragSession)
1034 m_currentDragSession = dragSession;
1037 #if PLATFORM(QT) || PLATFORM(GTK) || ENABLE(TIZEN_DRAG_SUPPORT)
1038 void WebPageProxy::startDrag(const DragData& dragData, const ShareableBitmap::Handle& dragImageHandle)
1040 TIZEN_LOGI("dragData (%p)", dragData);
1041 RefPtr<ShareableBitmap> dragImage = 0;
1042 if (!dragImageHandle.isNull()) {
1043 dragImage = ShareableBitmap::create(dragImageHandle);
1048 m_pageClient->startDrag(dragData, dragImage.release());
1052 void WebPageProxy::dragEnded(const IntPoint& clientPosition, const IntPoint& globalPosition, uint64_t operation)
1054 TIZEN_LOGI("clientPosition (%p)", clientPosition);
1057 process()->send(Messages::WebPage::DragEnded(clientPosition, globalPosition, operation), m_pageID);
1059 #endif // ENABLE(DRAG_SUPPORT)
1061 void WebPageProxy::handleMouseEvent(const NativeWebMouseEvent& event)
1066 // NOTE: This does not start the responsiveness timer because mouse move should not indicate interaction.
1067 if (event.type() != WebEvent::MouseMove)
1068 process()->responsivenessTimer()->start();
1070 if (m_processingMouseMoveEvent) {
1071 m_nextMouseMoveEvent = adoptPtr(new NativeWebMouseEvent(event));
1075 m_processingMouseMoveEvent = true;
1078 // <https://bugs.webkit.org/show_bug.cgi?id=57904> We need to keep track of the mouse down event in the case where we
1079 // display a popup menu for select elements. When the user changes the selected item,
1080 // we fake a mouse up event by using this stored down event. This event gets cleared
1081 // when the mouse up message is received from WebProcess.
1082 if (event.type() == WebEvent::MouseDown)
1083 m_currentlyProcessedMouseDownEvent = adoptPtr(new NativeWebMouseEvent(event));
1085 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
1086 // We have to hide text-selection's context menu when other area is clicked.
1087 // In case of normal context menu, it is hided by elm_ctxpopup's logic.
1088 if (event.type() == WebEvent::MouseDown)
1092 if (m_shouldSendEventsSynchronously) {
1093 bool handled = false;
1094 process()->sendSync(Messages::WebPage::MouseEventSyncForTesting(event), Messages::WebPage::MouseEventSyncForTesting::Reply(handled), m_pageID);
1095 didReceiveEvent(event.type(), handled);
1097 process()->send(Messages::WebPage::MouseEvent(event), m_pageID);
1100 #if MERGE_WHEEL_EVENTS
1101 static bool canCoalesce(const WebWheelEvent& a, const WebWheelEvent& b)
1103 if (a.position() != b.position())
1105 if (a.globalPosition() != b.globalPosition())
1107 if (a.modifiers() != b.modifiers())
1109 if (a.granularity() != b.granularity())
1112 if (a.phase() != b.phase())
1114 if (a.momentumPhase() != b.momentumPhase())
1116 if (a.hasPreciseScrollingDeltas() != b.hasPreciseScrollingDeltas())
1123 static WebWheelEvent coalesce(const WebWheelEvent& a, const WebWheelEvent& b)
1125 ASSERT(canCoalesce(a, b));
1127 FloatSize mergedDelta = a.delta() + b.delta();
1128 FloatSize mergedWheelTicks = a.wheelTicks() + b.wheelTicks();
1131 FloatSize mergedUnacceleratedScrollingDelta = a.unacceleratedScrollingDelta() + b.unacceleratedScrollingDelta();
1133 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());
1135 return WebWheelEvent(WebEvent::Wheel, b.position(), b.globalPosition(), mergedDelta, mergedWheelTicks, b.granularity(), b.modifiers(), b.timestamp());
1138 #endif // MERGE_WHEEL_EVENTS
1140 static WebWheelEvent coalescedWheelEvent(Deque<NativeWebWheelEvent>& queue, Vector<NativeWebWheelEvent>& coalescedEvents)
1142 ASSERT(!queue.isEmpty());
1143 ASSERT(coalescedEvents.isEmpty());
1145 #if MERGE_WHEEL_EVENTS
1146 NativeWebWheelEvent firstEvent = queue.takeFirst();
1147 coalescedEvents.append(firstEvent);
1149 WebWheelEvent event = firstEvent;
1150 while (!queue.isEmpty() && canCoalesce(event, queue.first())) {
1151 NativeWebWheelEvent firstEvent = queue.takeFirst();
1152 coalescedEvents.append(firstEvent);
1153 event = coalesce(event, firstEvent);
1158 while (!queue.isEmpty())
1159 coalescedEvents.append(queue.takeFirst());
1160 return coalescedEvents.last();
1164 void WebPageProxy::handleWheelEvent(const NativeWebWheelEvent& event)
1169 if (!m_currentlyProcessedWheelEvents.isEmpty()) {
1170 m_wheelEventQueue.append(event);
1171 if (m_wheelEventQueue.size() < wheelEventQueueSizeThreshold)
1173 // The queue has too many wheel events, so push a new event.
1176 if (!m_wheelEventQueue.isEmpty()) {
1177 processNextQueuedWheelEvent();
1181 OwnPtr<Vector<NativeWebWheelEvent> > coalescedWheelEvent = adoptPtr(new Vector<NativeWebWheelEvent>);
1182 coalescedWheelEvent->append(event);
1183 m_currentlyProcessedWheelEvents.append(coalescedWheelEvent.release());
1184 sendWheelEvent(event);
1187 void WebPageProxy::processNextQueuedWheelEvent()
1189 OwnPtr<Vector<NativeWebWheelEvent> > nextCoalescedEvent = adoptPtr(new Vector<NativeWebWheelEvent>);
1190 WebWheelEvent nextWheelEvent = coalescedWheelEvent(m_wheelEventQueue, *nextCoalescedEvent.get());
1191 m_currentlyProcessedWheelEvents.append(nextCoalescedEvent.release());
1192 sendWheelEvent(nextWheelEvent);
1195 void WebPageProxy::sendWheelEvent(const WebWheelEvent& event)
1197 process()->responsivenessTimer()->start();
1199 if (m_shouldSendEventsSynchronously) {
1200 bool handled = false;
1201 process()->sendSync(Messages::WebPage::WheelEventSyncForTesting(event), Messages::WebPage::WheelEventSyncForTesting::Reply(handled), m_pageID);
1202 didReceiveEvent(event.type(), handled);
1206 process()->send(Messages::EventDispatcher::WheelEvent(m_pageID, event, canGoBack(), canGoForward()), 0);
1209 void WebPageProxy::handleKeyboardEvent(const NativeWebKeyboardEvent& event)
1214 LOG(KeyHandling, "WebPageProxy::handleKeyboardEvent: %s", webKeyboardEventTypeString(event.type()));
1216 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1217 if (!isWaitingForJavaScriptPopupReply()) {
1218 m_keyEventQueue.append(event);
1220 process()->responsivenessTimer()->start();
1221 if (m_shouldSendEventsSynchronously) {
1222 bool handled = false;
1223 process()->sendSync(Messages::WebPage::KeyEventSyncForTesting(event), Messages::WebPage::KeyEventSyncForTesting::Reply(handled), m_pageID);
1224 didReceiveEvent(event.type(), handled);
1226 process()->send(Messages::WebPage::KeyEvent(event), m_pageID);
1228 if (m_keyEventQueue.isEmpty()) {
1229 bool handled = false;
1230 m_pageClient->doneWithKeyEvent(event, handled);
1232 QueuedUIEvents<NativeWebKeyboardEvent>& lastEvent = m_keyEventQueue.last();
1233 lastEvent.deferredEvents.append(event);
1237 m_keyEventQueue.append(event);
1239 process()->responsivenessTimer()->start();
1240 if (m_shouldSendEventsSynchronously) {
1241 bool handled = false;
1242 process()->sendSync(Messages::WebPage::KeyEventSyncForTesting(event), Messages::WebPage::KeyEventSyncForTesting::Reply(handled), m_pageID);
1243 didReceiveEvent(event.type(), handled);
1244 } else if (m_keyEventQueue.size() == 1) // Otherwise, sent from DidReceiveEvent message handler.
1245 process()->send(Messages::WebPage::KeyEvent(event), m_pageID);
1249 #if ENABLE(GESTURE_EVENTS)
1250 void WebPageProxy::handleGestureEvent(const WebGestureEvent& event)
1255 #if ENABLE(TIZEN_ISF_PORT)
1256 if (event.type() == WebEvent::GestureSingleTap) {
1257 InputMethodContextEfl* inputMethodContext = static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->inputMethodContext();
1258 if (inputMethodContext)
1259 inputMethodContext->resetIMFContext();
1263 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1264 if (!isWaitingForJavaScriptPopupReply()) {
1265 m_gestureEventQueue.append(event);
1267 process()->responsivenessTimer()->start();
1268 process()->send(Messages::EventDispatcher::GestureEvent(m_pageID, event), 0);
1270 if (m_gestureEventQueue.isEmpty()) {
1271 bool isEventHandled = false;
1272 m_pageClient->doneWithGestureEvent(event, isEventHandled);
1274 QueuedUIEvents<WebGestureEvent>& lastEvent = m_gestureEventQueue.last();
1275 lastEvent.deferredEvents.append(event);
1279 m_gestureEventQueue.append(event);
1281 process()->responsivenessTimer()->start();
1282 process()->send(Messages::EventDispatcher::GestureEvent(m_pageID, event), 0);
1287 #if ENABLE(TOUCH_EVENTS)
1289 void WebPageProxy::handlePotentialActivation(const IntPoint& touchPoint, const IntSize& touchArea)
1291 process()->send(Messages::WebPage::HighlightPotentialActivation(touchPoint, touchArea), m_pageID);
1295 void WebPageProxy::handleTouchEvent(const NativeWebTouchEvent& event)
1300 // If the page is suspended, which should be the case during panning, pinching
1301 // and animation on the page itself (kinetic scrolling, tap to zoom) etc, then
1302 // we do not send any of the events to the page even if is has listeners.
1303 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1304 if (m_needTouchEvents && !m_isPageSuspended && !isWaitingForJavaScriptPopupReply()) {
1306 if (m_needTouchEvents && !m_isPageSuspended) {
1309 // Do not send the TouchMove event if last TouchMove is not processed yet.
1310 // TouchMove event will be sent too many times without below codes,
1311 // and it will affect Web Applications' performance.
1312 if (event.type() == WebEvent::TouchMove
1313 && !m_touchEventQueue.isEmpty()
1314 && m_touchEventQueue.last().forwardedEvent.type() == event.type())
1317 m_touchEventQueue.append(event);
1318 process()->responsivenessTimer()->start();
1319 if (m_shouldSendEventsSynchronously) {
1320 bool handled = false;
1321 process()->sendSync(Messages::WebPage::TouchEventSyncForTesting(event), Messages::WebPage::TouchEventSyncForTesting::Reply(handled), m_pageID);
1322 didReceiveEvent(event.type(), handled);
1324 process()->send(Messages::WebPage::TouchEvent(event), m_pageID);
1326 if (m_touchEventQueue.isEmpty()) {
1327 bool isEventHandled = false;
1328 m_pageClient->doneWithTouchEvent(event, isEventHandled);
1330 // We attach the incoming events to the newest queued event so that all
1331 // the events are delivered in the correct order when the event is dequed.
1332 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1333 QueuedUIEvents<NativeWebTouchEvent>& lastEvent = m_touchEventQueue.last();
1334 lastEvent.deferredEvents.append(event);
1336 QueuedTouchEvents& lastEvent = m_touchEventQueue.last();
1337 lastEvent.deferredTouchEvents.append(event);
1344 #if ENABLE(SCREEN_ORIENTATION_SUPPORT) && ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT)
1345 void WebPageProxy::lockOrientation(int willLockOrientation, bool& result)
1347 result = m_pageClient->lockOrientation(willLockOrientation);
1349 void WebPageProxy::unlockOrientation()
1351 m_pageClient->unlockOrientation();
1355 void WebPageProxy::scrollBy(ScrollDirection direction, ScrollGranularity granularity)
1360 process()->send(Messages::WebPage::ScrollBy(direction, granularity), m_pageID);
1363 void WebPageProxy::centerSelectionInVisibleArea()
1368 process()->send(Messages::WebPage::CenterSelectionInVisibleArea(), m_pageID);
1371 #if ENABLE(TIZEN_DOWNLOAD_ATTRIBUTE)
1372 void WebPageProxy::startDownload(const ResourceRequest& request, const String& /*suggestedName*/)
1374 // FIXME: suggestedName need to be passed to provide a suggested destination file name
1375 m_process->context()->download(this, request);
1379 void WebPageProxy::receivedPolicyDecision(PolicyAction action, WebFrameProxy* frame, uint64_t listenerID)
1384 if (action == PolicyIgnore)
1385 clearPendingAPIRequestURL();
1387 uint64_t downloadID = 0;
1388 if (action == PolicyDownload) {
1389 // Create a download proxy.
1390 DownloadProxy* download = m_process->context()->createDownloadProxy();
1391 downloadID = download->downloadID();
1392 #if PLATFORM(QT) || PLATFORM(EFL)
1393 // Our design does not suppport downloads without a WebPage.
1394 handleDownloadRequest(download);
1398 // If we received a policy decision while in decidePolicyForResponse the decision will
1399 // be sent back to the web process by decidePolicyForResponse.
1400 if (m_inDecidePolicyForResponse) {
1401 m_syncMimeTypePolicyActionIsValid = true;
1402 m_syncMimeTypePolicyAction = action;
1403 m_syncMimeTypePolicyDownloadID = downloadID;
1407 // If we received a policy decision while in decidePolicyForNavigationAction the decision will
1408 // be sent back to the web process by decidePolicyForNavigationAction.
1409 if (m_inDecidePolicyForNavigationAction) {
1410 m_syncNavigationActionPolicyActionIsValid = true;
1411 m_syncNavigationActionPolicyAction = action;
1412 m_syncNavigationActionPolicyDownloadID = downloadID;
1416 process()->send(Messages::WebPage::DidReceivePolicyDecision(frame->frameID(), listenerID, action, downloadID), m_pageID);
1419 String WebPageProxy::pageTitle() const
1421 // Return the null string if there is no main frame (e.g. nothing has been loaded in the page yet, WebProcess has
1422 // crashed, page has been closed).
1426 return m_mainFrame->title();
1429 void WebPageProxy::setUserAgent(const String& userAgent)
1431 if (m_userAgent == userAgent)
1433 m_userAgent = userAgent;
1437 process()->send(Messages::WebPage::SetUserAgent(m_userAgent), m_pageID);
1440 void WebPageProxy::setApplicationNameForUserAgent(const String& applicationName)
1442 if (m_applicationNameForUserAgent == applicationName)
1445 m_applicationNameForUserAgent = applicationName;
1446 if (!m_customUserAgent.isEmpty())
1449 setUserAgent(standardUserAgent(m_applicationNameForUserAgent));
1452 void WebPageProxy::setCustomUserAgent(const String& customUserAgent)
1454 if (m_customUserAgent == customUserAgent)
1457 m_customUserAgent = customUserAgent;
1459 if (m_customUserAgent.isEmpty()) {
1460 setUserAgent(standardUserAgent(m_applicationNameForUserAgent));
1464 setUserAgent(m_customUserAgent);
1467 void WebPageProxy::resumeActiveDOMObjectsAndAnimations()
1469 if (!isValid() || !m_isPageSuspended)
1472 m_isPageSuspended = false;
1474 process()->send(Messages::WebPage::ResumeActiveDOMObjectsAndAnimations(), m_pageID);
1477 void WebPageProxy::suspendActiveDOMObjectsAndAnimations()
1479 if (!isValid() || m_isPageSuspended)
1482 m_isPageSuspended = true;
1484 process()->send(Messages::WebPage::SuspendActiveDOMObjectsAndAnimations(), m_pageID);
1487 bool WebPageProxy::supportsTextEncoding() const
1489 return !m_mainFrameHasCustomRepresentation && m_mainFrame && !m_mainFrame->isDisplayingStandaloneImageDocument();
1492 void WebPageProxy::setCustomTextEncodingName(const String& encodingName)
1494 if (m_customTextEncodingName == encodingName)
1496 m_customTextEncodingName = encodingName;
1500 process()->send(Messages::WebPage::SetCustomTextEncodingName(encodingName), m_pageID);
1503 void WebPageProxy::terminateProcess()
1505 // NOTE: This uses a check of m_isValid rather than calling isValid() since
1506 // we want this to run even for pages being closed or that already closed.
1510 process()->terminate();
1513 #if !USE(CF) || defined(BUILDING_QT__)
1514 PassRefPtr<WebData> WebPageProxy::sessionStateData(WebPageProxySessionStateFilterCallback, void* context) const
1516 // FIXME: Return session state data for saving Page state.
1520 void WebPageProxy::restoreFromSessionStateData(WebData*)
1522 // FIXME: Restore the Page from the passed in session state data.
1526 bool WebPageProxy::supportsTextZoom() const
1528 if (m_mainFrameHasCustomRepresentation)
1531 // FIXME: This should also return false for standalone media and plug-in documents.
1532 if (!m_mainFrame || m_mainFrame->isDisplayingStandaloneImageDocument())
1538 void WebPageProxy::setTextZoomFactor(double zoomFactor)
1543 if (m_mainFrameHasCustomRepresentation)
1546 if (m_textZoomFactor == zoomFactor)
1549 m_textZoomFactor = zoomFactor;
1550 process()->send(Messages::WebPage::SetTextZoomFactor(m_textZoomFactor), m_pageID);
1553 double WebPageProxy::pageZoomFactor() const
1555 return m_mainFrameHasCustomRepresentation ? m_pageClient->customRepresentationZoomFactor() : m_pageZoomFactor;
1558 void WebPageProxy::setPageZoomFactor(double zoomFactor)
1563 if (m_mainFrameHasCustomRepresentation) {
1564 m_pageClient->setCustomRepresentationZoomFactor(zoomFactor);
1568 if (m_pageZoomFactor == zoomFactor)
1571 m_pageZoomFactor = zoomFactor;
1572 process()->send(Messages::WebPage::SetPageZoomFactor(m_pageZoomFactor), m_pageID);
1575 void WebPageProxy::setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor)
1580 if (m_mainFrameHasCustomRepresentation) {
1581 m_pageClient->setCustomRepresentationZoomFactor(pageZoomFactor);
1585 if (m_pageZoomFactor == pageZoomFactor && m_textZoomFactor == textZoomFactor)
1588 m_pageZoomFactor = pageZoomFactor;
1589 m_textZoomFactor = textZoomFactor;
1590 process()->send(Messages::WebPage::SetPageAndTextZoomFactors(m_pageZoomFactor, m_textZoomFactor), m_pageID);
1593 void WebPageProxy::scalePage(double scale, const IntPoint& origin)
1598 process()->send(Messages::WebPage::ScalePage(scale, origin), m_pageID);
1601 void WebPageProxy::setIntrinsicDeviceScaleFactor(float scaleFactor)
1603 if (m_intrinsicDeviceScaleFactor == scaleFactor)
1606 m_intrinsicDeviceScaleFactor = scaleFactor;
1609 m_drawingArea->deviceScaleFactorDidChange();
1612 void WebPageProxy::windowScreenDidChange(PlatformDisplayID displayID)
1617 process()->send(Messages::WebPage::WindowScreenDidChange(displayID), m_pageID);
1620 float WebPageProxy::deviceScaleFactor() const
1622 if (m_customDeviceScaleFactor)
1623 return m_customDeviceScaleFactor;
1624 return m_intrinsicDeviceScaleFactor;
1627 void WebPageProxy::setCustomDeviceScaleFactor(float customScaleFactor)
1632 if (m_customDeviceScaleFactor == customScaleFactor)
1635 float oldScaleFactor = deviceScaleFactor();
1637 m_customDeviceScaleFactor = customScaleFactor;
1639 if (deviceScaleFactor() != oldScaleFactor)
1640 m_drawingArea->deviceScaleFactorDidChange();
1643 void WebPageProxy::setUseFixedLayout(bool fixed)
1648 // This check is fine as the value is initialized in the web
1649 // process as part of the creation parameters.
1650 if (fixed == m_useFixedLayout)
1653 m_useFixedLayout = fixed;
1655 m_fixedLayoutSize = IntSize();
1656 process()->send(Messages::WebPage::SetUseFixedLayout(fixed), m_pageID);
1659 void WebPageProxy::setFixedLayoutSize(const IntSize& size)
1664 if (size == m_fixedLayoutSize)
1667 m_fixedLayoutSize = size;
1668 process()->send(Messages::WebPage::SetFixedLayoutSize(size), m_pageID);
1671 void WebPageProxy::setPaginationMode(WebCore::Page::Pagination::Mode mode)
1673 if (mode == m_paginationMode)
1676 m_paginationMode = mode;
1680 process()->send(Messages::WebPage::SetPaginationMode(mode), m_pageID);
1683 void WebPageProxy::setPaginationBehavesLikeColumns(bool behavesLikeColumns)
1685 if (behavesLikeColumns == m_paginationBehavesLikeColumns)
1688 m_paginationBehavesLikeColumns = behavesLikeColumns;
1692 process()->send(Messages::WebPage::SetPaginationBehavesLikeColumns(behavesLikeColumns), m_pageID);
1695 void WebPageProxy::setPageLength(double pageLength)
1697 if (pageLength == m_pageLength)
1700 m_pageLength = pageLength;
1704 process()->send(Messages::WebPage::SetPageLength(pageLength), m_pageID);
1707 void WebPageProxy::setGapBetweenPages(double gap)
1709 if (gap == m_gapBetweenPages)
1712 m_gapBetweenPages = gap;
1716 process()->send(Messages::WebPage::SetGapBetweenPages(gap), m_pageID);
1719 void WebPageProxy::pageScaleFactorDidChange(double scaleFactor)
1721 m_pageScaleFactor = scaleFactor;
1722 m_pageClient->pageScaleFactorDidChange();
1725 void WebPageProxy::setMemoryCacheClientCallsEnabled(bool memoryCacheClientCallsEnabled)
1730 if (m_areMemoryCacheClientCallsEnabled == memoryCacheClientCallsEnabled)
1733 m_areMemoryCacheClientCallsEnabled = memoryCacheClientCallsEnabled;
1734 process()->send(Messages::WebPage::SetMemoryCacheMessagesEnabled(memoryCacheClientCallsEnabled), m_pageID);
1737 void WebPageProxy::findStringMatches(const String& string, FindOptions options, unsigned maxMatchCount)
1739 if (string.isEmpty()) {
1740 didFindStringMatches(string, Vector<Vector<WebCore::IntRect> > (), 0);
1744 m_process->send(Messages::WebPage::FindStringMatches(string, options, maxMatchCount), m_pageID);
1747 void WebPageProxy::findString(const String& string, FindOptions options, unsigned maxMatchCount)
1749 if (m_mainFrameHasCustomRepresentation)
1750 m_pageClient->findStringInCustomRepresentation(string, options, maxMatchCount);
1752 process()->send(Messages::WebPage::FindString(string, options, maxMatchCount), m_pageID);
1755 void WebPageProxy::getImageForFindMatch(int32_t matchIndex)
1757 m_process->send(Messages::WebPage::GetImageForFindMatch(matchIndex), m_pageID);
1760 void WebPageProxy::selectFindMatch(int32_t matchIndex)
1762 m_process->send(Messages::WebPage::SelectFindMatch(matchIndex), m_pageID);
1765 void WebPageProxy::hideFindUI()
1767 process()->send(Messages::WebPage::HideFindUI(), m_pageID);
1770 void WebPageProxy::countStringMatches(const String& string, FindOptions options, unsigned maxMatchCount)
1772 if (m_mainFrameHasCustomRepresentation) {
1773 m_pageClient->countStringMatchesInCustomRepresentation(string, options, maxMatchCount);
1780 process()->send(Messages::WebPage::CountStringMatches(string, options, maxMatchCount), m_pageID);
1783 void WebPageProxy::runJavaScriptInMainFrame(const String& script, PassRefPtr<ScriptValueCallback> prpCallback)
1785 RefPtr<ScriptValueCallback> callback = prpCallback;
1787 callback->invalidate();
1791 uint64_t callbackID = callback->callbackID();
1792 m_scriptValueCallbacks.set(callbackID, callback.get());
1793 process()->send(Messages::WebPage::RunJavaScriptInMainFrame(script, callbackID), m_pageID);
1796 void WebPageProxy::getRenderTreeExternalRepresentation(PassRefPtr<StringCallback> prpCallback)
1798 RefPtr<StringCallback> callback = prpCallback;
1800 callback->invalidate();
1804 uint64_t callbackID = callback->callbackID();
1805 m_stringCallbacks.set(callbackID, callback.get());
1806 process()->send(Messages::WebPage::GetRenderTreeExternalRepresentation(callbackID), m_pageID);
1809 void WebPageProxy::getSourceForFrame(WebFrameProxy* frame, PassRefPtr<StringCallback> prpCallback)
1811 RefPtr<StringCallback> callback = prpCallback;
1813 callback->invalidate();
1817 uint64_t callbackID = callback->callbackID();
1818 m_loadDependentStringCallbackIDs.add(callbackID);
1819 m_stringCallbacks.set(callbackID, callback.get());
1820 process()->send(Messages::WebPage::GetSourceForFrame(frame->frameID(), callbackID), m_pageID);
1823 #if ENABLE(WEB_INTENTS)
1824 void WebPageProxy::deliverIntentToFrame(WebFrameProxy* frame, WebIntentData* webIntentData)
1829 process()->send(Messages::WebPage::DeliverIntentToFrame(frame->frameID(), webIntentData->store()), m_pageID);
1833 void WebPageProxy::getContentsAsString(PassRefPtr<StringCallback> prpCallback)
1835 RefPtr<StringCallback> callback = prpCallback;
1837 callback->invalidate();
1841 uint64_t callbackID = callback->callbackID();
1842 m_loadDependentStringCallbackIDs.add(callbackID);
1843 m_stringCallbacks.set(callbackID, callback.get());
1844 process()->send(Messages::WebPage::GetContentsAsString(callbackID), m_pageID);
1848 void WebPageProxy::getContentsAsMHTMLData(PassRefPtr<DataCallback> prpCallback, bool useBinaryEncoding)
1850 RefPtr<DataCallback> callback = prpCallback;
1852 callback->invalidate();
1856 uint64_t callbackID = callback->callbackID();
1857 m_dataCallbacks.set(callbackID, callback.get());
1858 process()->send(Messages::WebPage::GetContentsAsMHTMLData(callbackID, useBinaryEncoding), m_pageID);
1862 void WebPageProxy::getSelectionOrContentsAsString(PassRefPtr<StringCallback> prpCallback)
1864 RefPtr<StringCallback> callback = prpCallback;
1866 callback->invalidate();
1870 uint64_t callbackID = callback->callbackID();
1871 m_stringCallbacks.set(callbackID, callback.get());
1872 process()->send(Messages::WebPage::GetSelectionOrContentsAsString(callbackID), m_pageID);
1875 void WebPageProxy::getMainResourceDataOfFrame(WebFrameProxy* frame, PassRefPtr<DataCallback> prpCallback)
1877 RefPtr<DataCallback> callback = prpCallback;
1879 callback->invalidate();
1883 uint64_t callbackID = callback->callbackID();
1884 m_dataCallbacks.set(callbackID, callback.get());
1885 process()->send(Messages::WebPage::GetMainResourceDataOfFrame(frame->frameID(), callbackID), m_pageID);
1888 void WebPageProxy::getResourceDataFromFrame(WebFrameProxy* frame, WebURL* resourceURL, PassRefPtr<DataCallback> prpCallback)
1890 RefPtr<DataCallback> callback = prpCallback;
1892 callback->invalidate();
1896 uint64_t callbackID = callback->callbackID();
1897 m_dataCallbacks.set(callbackID, callback.get());
1898 process()->send(Messages::WebPage::GetResourceDataFromFrame(frame->frameID(), resourceURL->string(), callbackID), m_pageID);
1901 void WebPageProxy::getWebArchiveOfFrame(WebFrameProxy* frame, PassRefPtr<DataCallback> prpCallback)
1903 RefPtr<DataCallback> callback = prpCallback;
1905 callback->invalidate();
1909 uint64_t callbackID = callback->callbackID();
1910 m_dataCallbacks.set(callbackID, callback.get());
1911 process()->send(Messages::WebPage::GetWebArchiveOfFrame(frame->frameID(), callbackID), m_pageID);
1914 void WebPageProxy::forceRepaint(PassRefPtr<VoidCallback> prpCallback)
1916 RefPtr<VoidCallback> callback = prpCallback;
1918 callback->invalidate();
1922 uint64_t callbackID = callback->callbackID();
1923 m_voidCallbacks.set(callbackID, callback.get());
1924 m_drawingArea->waitForBackingStoreUpdateOnNextPaint();
1925 process()->send(Messages::WebPage::ForceRepaint(callbackID), m_pageID);
1928 void WebPageProxy::preferencesDidChange()
1933 #if ENABLE(INSPECTOR_SERVER)
1934 if (m_pageGroup->preferences()->developerExtrasEnabled())
1935 inspector()->enableRemoteInspection();
1938 // FIXME: It probably makes more sense to send individual preference changes.
1939 // However, WebKitTestRunner depends on getting a preference change notification
1940 // even if nothing changed in UI process, so that overrides get removed.
1942 // Preferences need to be updated during synchronous printing to make "print backgrounds" preference work when toggled from a print dialog checkbox.
1943 process()->send(Messages::WebPage::PreferencesDidChange(pageGroup()->preferences()->store()), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
1946 void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
1948 if (messageID.is<CoreIPC::MessageClassDrawingAreaProxy>()) {
1949 m_drawingArea->didReceiveDrawingAreaProxyMessage(connection, messageID, arguments);
1953 #if USE(UI_SIDE_COMPOSITING)
1954 if (messageID.is<CoreIPC::MessageClassLayerTreeCoordinatorProxy>()) {
1955 m_drawingArea->didReceiveLayerTreeCoordinatorProxyMessage(connection, messageID, arguments);
1960 #if ENABLE(INSPECTOR)
1961 if (messageID.is<CoreIPC::MessageClassWebInspectorProxy>()) {
1962 if (WebInspectorProxy* inspector = this->inspector())
1963 inspector->didReceiveWebInspectorProxyMessage(connection, messageID, arguments);
1968 #if ENABLE(FULLSCREEN_API)
1969 if (messageID.is<CoreIPC::MessageClassWebFullScreenManagerProxy>()) {
1970 fullScreenManager()->didReceiveMessage(connection, messageID, arguments);
1975 didReceiveWebPageProxyMessage(connection, messageID, arguments);
1978 void WebPageProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, OwnPtr<CoreIPC::ArgumentEncoder>& reply)
1980 #if ENABLE(INSPECTOR)
1981 if (messageID.is<CoreIPC::MessageClassWebInspectorProxy>()) {
1982 if (WebInspectorProxy* inspector = this->inspector())
1983 inspector->didReceiveSyncWebInspectorProxyMessage(connection, messageID, arguments, reply);
1988 #if ENABLE(FULLSCREEN_API)
1989 if (messageID.is<CoreIPC::MessageClassWebFullScreenManagerProxy>()) {
1990 fullScreenManager()->didReceiveSyncMessage(connection, messageID, arguments, reply);
1995 // FIXME: Do something with reply.
1996 didReceiveSyncWebPageProxyMessage(connection, messageID, arguments, reply);
1999 void WebPageProxy::didCreateMainFrame(uint64_t frameID)
2001 MESSAGE_CHECK(!m_mainFrame);
2002 MESSAGE_CHECK(process()->canCreateFrame(frameID));
2004 m_mainFrame = WebFrameProxy::create(this, frameID);
2006 // Add the frame to the process wide map.
2007 process()->frameCreated(frameID, m_mainFrame.get());
2010 void WebPageProxy::didCreateSubframe(uint64_t frameID, uint64_t parentFrameID)
2012 MESSAGE_CHECK(m_mainFrame);
2014 WebFrameProxy* parentFrame = process()->webFrame(parentFrameID);
2015 MESSAGE_CHECK(parentFrame);
2016 MESSAGE_CHECK(parentFrame->isDescendantOf(m_mainFrame.get()));
2018 MESSAGE_CHECK(process()->canCreateFrame(frameID));
2020 RefPtr<WebFrameProxy> subFrame = WebFrameProxy::create(this, frameID);
2022 // Add the frame to the process wide map.
2023 process()->frameCreated(frameID, subFrame.get());
2025 // Insert the frame into the frame hierarchy.
2026 parentFrame->appendChild(subFrame.get());
2029 static bool isDisconnectedFrame(WebFrameProxy* frame)
2031 return !frame->page() || !frame->page()->mainFrame() || !frame->isDescendantOf(frame->page()->mainFrame());
2034 void WebPageProxy::didSaveFrameToPageCache(uint64_t frameID)
2036 MESSAGE_CHECK(m_mainFrame);
2038 WebFrameProxy* subframe = process()->webFrame(frameID);
2039 MESSAGE_CHECK(subframe);
2041 if (isDisconnectedFrame(subframe))
2044 MESSAGE_CHECK(subframe->isDescendantOf(m_mainFrame.get()));
2046 subframe->didRemoveFromHierarchy();
2049 void WebPageProxy::didRestoreFrameFromPageCache(uint64_t frameID, uint64_t parentFrameID)
2051 MESSAGE_CHECK(m_mainFrame);
2053 WebFrameProxy* subframe = process()->webFrame(frameID);
2054 MESSAGE_CHECK(subframe);
2055 MESSAGE_CHECK(!subframe->parentFrame());
2056 MESSAGE_CHECK(subframe->page() == m_mainFrame->page());
2058 WebFrameProxy* parentFrame = process()->webFrame(parentFrameID);
2059 MESSAGE_CHECK(parentFrame);
2060 MESSAGE_CHECK(parentFrame->isDescendantOf(m_mainFrame.get()));
2062 // Insert the frame into the frame hierarchy.
2063 parentFrame->appendChild(subframe);
2067 // Always start progress at initialProgressValue. This helps provide feedback as
2068 // soon as a load starts.
2070 static const double initialProgressValue = 0.1;
2072 double WebPageProxy::estimatedProgress() const
2074 if (!pendingAPIRequestURL().isNull())
2075 return initialProgressValue;
2076 return m_estimatedProgress;
2079 void WebPageProxy::didStartProgress()
2081 m_estimatedProgress = initialProgressValue;
2083 m_loaderClient.didStartProgress(this);
2086 void WebPageProxy::didChangeProgress(double value)
2088 m_estimatedProgress = value;
2090 m_loaderClient.didChangeProgress(this);
2093 void WebPageProxy::didFinishProgress()
2095 m_estimatedProgress = 1.0;
2097 m_loaderClient.didFinishProgress(this);
2100 #if ENABLE(WEB_INTENTS_TAG)
2101 void WebPageProxy::registerIntentServiceForFrame(uint64_t frameID, const IntentServiceInfo& serviceInfo, CoreIPC::ArgumentDecoder* arguments)
2103 RefPtr<APIObject> userData;
2104 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2105 if (!arguments->decode(messageDecoder))
2108 WebFrameProxy* frame = process()->webFrame(frameID);
2109 MESSAGE_CHECK(frame);
2111 RefPtr<WebIntentServiceInfo> webIntentServiceInfo = WebIntentServiceInfo::create(serviceInfo);
2112 m_loaderClient.registerIntentServiceForFrame(this, frame, webIntentServiceInfo.get(), userData.get());
2116 void WebPageProxy::didStartProvisionalLoadForFrame(uint64_t frameID, const String& url, const String& unreachableURL, CoreIPC::ArgumentDecoder* arguments)
2118 clearPendingAPIRequestURL();
2120 RefPtr<APIObject> userData;
2121 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2122 if (!arguments->decode(messageDecoder))
2125 WebFrameProxy* frame = process()->webFrame(frameID);
2126 MESSAGE_CHECK(frame);
2127 MESSAGE_CHECK_URL(url);
2129 frame->setUnreachableURL(unreachableURL);
2131 frame->didStartProvisionalLoad(url);
2132 m_loaderClient.didStartProvisionalLoadForFrame(this, frame, userData.get());
2135 void WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, const String& url, CoreIPC::ArgumentDecoder* arguments)
2137 RefPtr<APIObject> userData;
2138 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2139 if (!arguments->decode(messageDecoder))
2142 WebFrameProxy* frame = process()->webFrame(frameID);
2143 MESSAGE_CHECK(frame);
2144 MESSAGE_CHECK_URL(url);
2146 frame->didReceiveServerRedirectForProvisionalLoad(url);
2148 m_loaderClient.didReceiveServerRedirectForProvisionalLoadForFrame(this, frame, userData.get());
2151 void WebPageProxy::didFailProvisionalLoadForFrame(uint64_t frameID, const ResourceError& error, CoreIPC::ArgumentDecoder* arguments)
2153 RefPtr<APIObject> userData;
2154 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2155 if (!arguments->decode(messageDecoder))
2158 WebFrameProxy* frame = process()->webFrame(frameID);
2159 MESSAGE_CHECK(frame);
2161 frame->didFailProvisionalLoad();
2163 m_loaderClient.didFailProvisionalLoadWithErrorForFrame(this, frame, error, userData.get());
2166 void WebPageProxy::clearLoadDependentCallbacks()
2168 Vector<uint64_t> callbackIDsCopy;
2169 copyToVector(m_loadDependentStringCallbackIDs, callbackIDsCopy);
2170 m_loadDependentStringCallbackIDs.clear();
2172 for (size_t i = 0; i < callbackIDsCopy.size(); ++i) {
2173 RefPtr<StringCallback> callback = m_stringCallbacks.take(callbackIDsCopy[i]);
2175 callback->invalidate();
2179 void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, const String& mimeType, bool frameHasCustomRepresentation, const PlatformCertificateInfo& certificateInfo, CoreIPC::ArgumentDecoder* arguments)
2181 RefPtr<APIObject> userData;
2182 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2183 if (!arguments->decode(messageDecoder))
2186 WebFrameProxy* frame = process()->webFrame(frameID);
2187 MESSAGE_CHECK(frame);
2190 // FIXME (bug 59111): didCommitLoadForFrame comes too late when restoring a page from b/f cache, making us disable secure event mode in password fields.
2191 // FIXME (bug 59121): A load going on in one frame shouldn't affect typing in sibling frames.
2192 m_pageClient->resetTextInputState();
2193 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
2194 // FIXME: Should this be moved inside resetTextInputState()?
2195 dismissCorrectionPanel(ReasonForDismissingAlternativeTextIgnored);
2196 m_pageClient->dismissDictionaryLookupPanel();
2200 clearLoadDependentCallbacks();
2202 frame->didCommitLoad(mimeType, certificateInfo);
2204 if (frame->isMainFrame()) {
2205 m_mainFrameHasCustomRepresentation = frameHasCustomRepresentation;
2207 if (m_mainFrameHasCustomRepresentation) {
2208 // Always assume that the main frame is pinned here, since the custom representation view will handle
2209 // any wheel events and dispatch them to the WKView when necessary.
2210 m_mainFrameIsPinnedToLeftSide = true;
2211 m_mainFrameIsPinnedToRightSide = true;
2213 m_pageClient->didCommitLoadForMainFrame(frameHasCustomRepresentation);
2216 m_loaderClient.didCommitLoadForFrame(this, frame, userData.get());
2219 void WebPageProxy::didFinishDocumentLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2221 RefPtr<APIObject> userData;
2222 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2223 if (!arguments->decode(messageDecoder))
2226 WebFrameProxy* frame = process()->webFrame(frameID);
2227 MESSAGE_CHECK(frame);
2229 m_loaderClient.didFinishDocumentLoadForFrame(this, frame, userData.get());
2232 #if ENABLE(TIZEN_NATIVE_MEMORY_SNAPSHOT)
2233 const char* isMemorySnapshot = getenv("TIZEN_MEMORY_SNAPSHOT");
2235 void WebPageProxy::didFinishLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2237 RefPtr<APIObject> userData;
2238 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2239 if (!arguments->decode(messageDecoder))
2242 WebFrameProxy* frame = process()->webFrame(frameID);
2243 MESSAGE_CHECK(frame);
2245 frame->didFinishLoad();
2247 m_loaderClient.didFinishLoadForFrame(this, frame, userData.get());
2248 #if ENABLE(TIZEN_NATIVE_MEMORY_SNAPSHOT)
2249 if (isMemorySnapshot && isMemorySnapshot[0] != '0')
2250 dumpMemorySnapshot();
2254 void WebPageProxy::didFailLoadForFrame(uint64_t frameID, const ResourceError& error, CoreIPC::ArgumentDecoder* arguments)
2256 RefPtr<APIObject> userData;
2257 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2258 if (!arguments->decode(messageDecoder))
2261 WebFrameProxy* frame = process()->webFrame(frameID);
2262 MESSAGE_CHECK(frame);
2264 clearLoadDependentCallbacks();
2266 frame->didFailLoad();
2268 m_loaderClient.didFailLoadWithErrorForFrame(this, frame, error, userData.get());
2271 void WebPageProxy::didSameDocumentNavigationForFrame(uint64_t frameID, uint32_t opaqueSameDocumentNavigationType, const String& url, CoreIPC::ArgumentDecoder* arguments)
2273 RefPtr<APIObject> userData;
2274 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2275 if (!arguments->decode(messageDecoder))
2278 WebFrameProxy* frame = process()->webFrame(frameID);
2279 MESSAGE_CHECK(frame);
2280 MESSAGE_CHECK_URL(url);
2282 clearPendingAPIRequestURL();
2283 frame->didSameDocumentNavigation(url);
2285 m_loaderClient.didSameDocumentNavigationForFrame(this, frame, static_cast<SameDocumentNavigationType>(opaqueSameDocumentNavigationType), userData.get());
2288 void WebPageProxy::didReceiveTitleForFrame(uint64_t frameID, const String& title, 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 frame->didChangeTitle(title);
2300 m_loaderClient.didReceiveTitleForFrame(this, title, frame, userData.get());
2303 void WebPageProxy::didFirstLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2305 RefPtr<APIObject> userData;
2306 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2307 if (!arguments->decode(messageDecoder))
2310 WebFrameProxy* frame = process()->webFrame(frameID);
2311 MESSAGE_CHECK(frame);
2313 m_loaderClient.didFirstLayoutForFrame(this, frame, userData.get());
2316 void WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2318 RefPtr<APIObject> userData;
2319 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2320 if (!arguments->decode(messageDecoder))
2323 WebFrameProxy* frame = process()->webFrame(frameID);
2324 MESSAGE_CHECK(frame);
2327 if (frame->isMainFrame())
2328 m_pageClient->didFirstVisuallyNonEmptyLayoutForMainFrame();
2331 m_loaderClient.didFirstVisuallyNonEmptyLayoutForFrame(this, frame, userData.get());
2334 void WebPageProxy::didNewFirstVisuallyNonEmptyLayout(CoreIPC::ArgumentDecoder* arguments)
2336 RefPtr<APIObject> userData;
2337 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2338 if (!arguments->decode(messageDecoder))
2341 m_loaderClient.didNewFirstVisuallyNonEmptyLayout(this, userData.get());
2344 void WebPageProxy::didRemoveFrameFromHierarchy(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 frame->didRemoveFromHierarchy();
2356 m_loaderClient.didRemoveFrameFromHierarchy(this, frame, userData.get());
2359 void WebPageProxy::didDisplayInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2361 RefPtr<APIObject> userData;
2362 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2363 if (!arguments->decode(messageDecoder))
2366 WebFrameProxy* frame = process()->webFrame(frameID);
2367 MESSAGE_CHECK(frame);
2369 m_loaderClient.didDisplayInsecureContentForFrame(this, frame, userData.get());
2372 void WebPageProxy::didRunInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2374 RefPtr<APIObject> userData;
2375 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2376 if (!arguments->decode(messageDecoder))
2379 WebFrameProxy* frame = process()->webFrame(frameID);
2380 MESSAGE_CHECK(frame);
2382 m_loaderClient.didRunInsecureContentForFrame(this, frame, userData.get());
2385 void WebPageProxy::didDetectXSSForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2387 RefPtr<APIObject> userData;
2388 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2389 if (!arguments->decode(messageDecoder))
2392 WebFrameProxy* frame = process()->webFrame(frameID);
2393 MESSAGE_CHECK(frame);
2395 m_loaderClient.didDetectXSSForFrame(this, frame, userData.get());
2398 #if ENABLE(WEB_INTENTS)
2399 void WebPageProxy::didReceiveIntentForFrame(uint64_t frameID, const IntentData& intentData, CoreIPC::ArgumentDecoder* arguments)
2401 RefPtr<APIObject> userData;
2402 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2403 if (!arguments->decode(messageDecoder))
2406 WebFrameProxy* frame = process()->webFrame(frameID);
2407 MESSAGE_CHECK(frame);
2409 RefPtr<WebIntentData> webIntentData = WebIntentData::create(intentData);
2410 m_loaderClient.didReceiveIntentForFrame(this, frame, webIntentData.get(), userData.get());
2414 void WebPageProxy::frameDidBecomeFrameSet(uint64_t frameID, bool value)
2416 WebFrameProxy* frame = process()->webFrame(frameID);
2417 MESSAGE_CHECK(frame);
2419 frame->setIsFrameSet(value);
2420 if (frame->isMainFrame())
2421 m_frameSetLargestFrame = value ? m_mainFrame : 0;
2425 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)
2427 RefPtr<APIObject> userData;
2428 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2429 if (!arguments->decode(messageDecoder))
2432 if (request.url() != pendingAPIRequestURL())
2433 clearPendingAPIRequestURL();
2435 WebFrameProxy* frame = process()->webFrame(frameID);
2436 MESSAGE_CHECK(frame);
2437 MESSAGE_CHECK_URL(request.url());
2439 NavigationType navigationType = static_cast<NavigationType>(opaqueNavigationType);
2440 WebEvent::Modifiers modifiers = static_cast<WebEvent::Modifiers>(opaqueModifiers);
2441 WebMouseEvent::Button mouseButton = static_cast<WebMouseEvent::Button>(opaqueMouseButton);
2443 RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID);
2445 ASSERT(!m_inDecidePolicyForNavigationAction);
2447 m_inDecidePolicyForNavigationAction = true;
2448 m_syncNavigationActionPolicyActionIsValid = false;
2450 if (!m_policyClient.decidePolicyForNavigationAction(this, frame, navigationType, modifiers, mouseButton, request, listener.get(), userData.get()))
2453 m_inDecidePolicyForNavigationAction = false;
2455 // Check if we received a policy decision already. If we did, we can just pass it back.
2456 receivedPolicyAction = m_syncNavigationActionPolicyActionIsValid;
2457 if (m_syncNavigationActionPolicyActionIsValid) {
2458 policyAction = m_syncNavigationActionPolicyAction;
2459 downloadID = m_syncNavigationActionPolicyDownloadID;
2463 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)
2465 RefPtr<APIObject> userData;
2466 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2467 if (!arguments->decode(messageDecoder))
2470 WebFrameProxy* frame = process()->webFrame(frameID);
2471 MESSAGE_CHECK(frame);
2472 MESSAGE_CHECK_URL(request.url());
2474 NavigationType navigationType = static_cast<NavigationType>(opaqueNavigationType);
2475 WebEvent::Modifiers modifiers = static_cast<WebEvent::Modifiers>(opaqueModifiers);
2476 WebMouseEvent::Button mouseButton = static_cast<WebMouseEvent::Button>(opaqueMouseButton);
2478 RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID);
2479 if (!m_policyClient.decidePolicyForNewWindowAction(this, frame, navigationType, modifiers, mouseButton, request, frameName, listener.get(), userData.get()))
2483 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)
2485 RefPtr<APIObject> userData;
2486 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2487 if (!arguments->decode(messageDecoder))
2490 WebFrameProxy* frame = process()->webFrame(frameID);
2491 MESSAGE_CHECK(frame);
2492 MESSAGE_CHECK_URL(request.url());
2493 MESSAGE_CHECK_URL(response.url());
2495 RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID);
2497 ASSERT(!m_inDecidePolicyForResponse);
2499 m_inDecidePolicyForResponse = true;
2500 m_syncMimeTypePolicyActionIsValid = false;
2502 if (!m_policyClient.decidePolicyForResponse(this, frame, response, request, listener.get(), userData.get()))
2505 m_inDecidePolicyForResponse = false;
2507 // Check if we received a policy decision already. If we did, we can just pass it back.
2508 receivedPolicyAction = m_syncMimeTypePolicyActionIsValid;
2509 if (m_syncMimeTypePolicyActionIsValid) {
2510 policyAction = m_syncMimeTypePolicyAction;
2511 downloadID = m_syncMimeTypePolicyDownloadID;
2515 void WebPageProxy::unableToImplementPolicy(uint64_t frameID, const ResourceError& error, CoreIPC::ArgumentDecoder* arguments)
2517 RefPtr<APIObject> userData;
2518 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2519 if (!arguments->decode(messageDecoder))
2522 WebFrameProxy* frame = process()->webFrame(frameID);
2523 MESSAGE_CHECK(frame);
2525 m_policyClient.unableToImplementPolicy(this, frame, error, userData.get());
2530 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
2531 void WebPageProxy::willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, bool containsPasswordData, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments)
2533 void WebPageProxy::willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments)
2536 RefPtr<APIObject> userData;
2537 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2538 if (!arguments->decode(messageDecoder))
2541 WebFrameProxy* frame = process()->webFrame(frameID);
2542 MESSAGE_CHECK(frame);
2544 WebFrameProxy* sourceFrame = process()->webFrame(sourceFrameID);
2545 MESSAGE_CHECK(sourceFrame);
2547 RefPtr<WebFormSubmissionListenerProxy> listener = frame->setUpFormSubmissionListenerProxy(listenerID);
2548 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
2549 if (!m_formClient.willSubmitForm(this, frame, sourceFrame, textFieldValues.stringPairVector(), containsPasswordData, userData.get(), listener.get()))
2551 if (!m_formClient.willSubmitForm(this, frame, sourceFrame, textFieldValues.stringPairVector(), userData.get(), listener.get()))
2553 listener->continueSubmission();
2556 // ResourceLoad Client
2558 void WebPageProxy::didInitiateLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceRequest& request, bool pageIsProvisionallyLoading)
2560 WebFrameProxy* frame = process()->webFrame(frameID);
2561 MESSAGE_CHECK(frame);
2562 MESSAGE_CHECK_URL(request.url());
2564 m_resourceLoadClient.didInitiateLoadForResource(this, frame, resourceIdentifier, request, pageIsProvisionallyLoading);
2567 void WebPageProxy::didSendRequestForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceRequest& request, const ResourceResponse& redirectResponse)
2569 WebFrameProxy* frame = process()->webFrame(frameID);
2570 MESSAGE_CHECK(frame);
2571 MESSAGE_CHECK_URL(request.url());
2573 m_resourceLoadClient.didSendRequestForResource(this, frame, resourceIdentifier, request, redirectResponse);
2576 void WebPageProxy::didReceiveResponseForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceResponse& response)
2578 WebFrameProxy* frame = process()->webFrame(frameID);
2579 MESSAGE_CHECK(frame);
2580 MESSAGE_CHECK_URL(response.url());
2582 m_resourceLoadClient.didReceiveResponseForResource(this, frame, resourceIdentifier, response);
2585 void WebPageProxy::didReceiveContentLengthForResource(uint64_t frameID, uint64_t resourceIdentifier, uint64_t contentLength)
2587 WebFrameProxy* frame = process()->webFrame(frameID);
2588 MESSAGE_CHECK(frame);
2590 m_resourceLoadClient.didReceiveContentLengthForResource(this, frame, resourceIdentifier, contentLength);
2593 void WebPageProxy::didFinishLoadForResource(uint64_t frameID, uint64_t resourceIdentifier)
2595 WebFrameProxy* frame = process()->webFrame(frameID);
2596 MESSAGE_CHECK(frame);
2598 m_resourceLoadClient.didFinishLoadForResource(this, frame, resourceIdentifier);
2601 void WebPageProxy::didFailLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceError& error)
2603 WebFrameProxy* frame = process()->webFrame(frameID);
2604 MESSAGE_CHECK(frame);
2606 m_resourceLoadClient.didFailLoadForResource(this, frame, resourceIdentifier, error);
2611 void WebPageProxy::createNewPage(const ResourceRequest& request, const WindowFeatures& windowFeatures, uint32_t opaqueModifiers, int32_t opaqueMouseButton, uint64_t& newPageID, WebPageCreationParameters& newPageParameters)
2613 RefPtr<WebPageProxy> newPage = m_uiClient.createNewPage(this, request, windowFeatures, static_cast<WebEvent::Modifiers>(opaqueModifiers), static_cast<WebMouseEvent::Button>(opaqueMouseButton));
2615 newPageID = newPage->pageID();
2616 newPageParameters = newPage->creationParameters();
2621 void WebPageProxy::showPage()
2623 m_uiClient.showPage(this);
2626 void WebPageProxy::closePage(bool stopResponsivenessTimer)
2628 if (stopResponsivenessTimer)
2629 process()->responsivenessTimer()->stop();
2631 m_pageClient->clearAllEditCommands();
2632 m_uiClient.close(this);
2635 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
2636 bool WebPageProxy::isWaitingForJavaScriptPopupReply()
2638 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
2639 return m_alertReply || m_confirmReply || m_promptReply || m_beforeUnloadConfirmPanelReply;
2641 return m_alertReply || m_confirmReply || m_promptReply;
2647 void WebPageProxy::runJavaScriptAlert(uint64_t frameID, const String& message, PassRefPtr<Messages::WebPageProxy::RunJavaScriptAlert::DelayedReply> reply)
2649 WebFrameProxy* frame = process()->webFrame(frameID);
2650 MESSAGE_CHECK(frame);
2652 // Since runJavaScriptAlert() can spin a nested run loop we need to turn off the responsiveness timer.
2653 process()->responsivenessTimer()->stop();
2655 m_alertReply = reply;
2656 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
2657 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
2659 if (!m_uiClient.runJavaScriptAlert(this, message, frame))
2660 replyJavaScriptAlert();
2663 void WebPageProxy::runJavaScriptConfirm(uint64_t frameID, const String& message, PassRefPtr<Messages::WebPageProxy::RunJavaScriptConfirm::DelayedReply> reply)
2665 WebFrameProxy* frame = process()->webFrame(frameID);
2666 MESSAGE_CHECK(frame);
2668 // Since runJavaScriptConfirm() can spin a nested run loop we need to turn off the responsiveness timer.
2669 process()->responsivenessTimer()->stop();
2671 m_confirmReply = reply;
2672 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
2673 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
2675 if (!m_uiClient.runJavaScriptConfirm(this, message, frame))
2676 replyJavaScriptConfirm(false);
2679 void WebPageProxy::runJavaScriptPrompt(uint64_t frameID, const String& message, const String& defaultValue, PassRefPtr<Messages::WebPageProxy::RunJavaScriptPrompt::DelayedReply> reply)
2681 WebFrameProxy* frame = process()->webFrame(frameID);
2682 MESSAGE_CHECK(frame);
2684 // Since runJavaScriptPrompt() can spin a nested run loop we need to turn off the responsiveness timer.
2685 process()->responsivenessTimer()->stop();
2687 m_promptReply = reply;
2688 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
2689 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
2691 if (!m_uiClient.runJavaScriptPrompt(this, message, defaultValue, frame))
2692 replyJavaScriptPrompt(String());
2695 void WebPageProxy::runJavaScriptAlert(uint64_t frameID, const String& message)
2697 WebFrameProxy* frame = process()->webFrame(frameID);
2698 MESSAGE_CHECK(frame);
2700 // Since runJavaScriptAlert() can spin a nested run loop we need to turn off the responsiveness timer.
2701 process()->responsivenessTimer()->stop();
2703 m_uiClient.runJavaScriptAlert(this, message, frame);
2706 void WebPageProxy::runJavaScriptConfirm(uint64_t frameID, const String& message, bool& result)
2708 WebFrameProxy* frame = process()->webFrame(frameID);
2709 MESSAGE_CHECK(frame);
2711 // Since runJavaScriptConfirm() can spin a nested run loop we need to turn off the responsiveness timer.
2712 process()->responsivenessTimer()->stop();
2714 result = m_uiClient.runJavaScriptConfirm(this, message, frame);
2717 void WebPageProxy::runJavaScriptPrompt(uint64_t frameID, const String& message, const String& defaultValue, String& result)
2719 WebFrameProxy* frame = process()->webFrame(frameID);
2720 MESSAGE_CHECK(frame);
2722 // Since runJavaScriptPrompt() can spin a nested run loop we need to turn off the responsiveness timer.
2723 process()->responsivenessTimer()->stop();
2725 result = m_uiClient.runJavaScriptPrompt(this, message, defaultValue, frame);
2729 void WebPageProxy::shouldInterruptJavaScript(bool& result)
2731 // Since shouldInterruptJavaScript() can spin a nested run loop we need to turn off the responsiveness timer.
2732 process()->responsivenessTimer()->stop();
2734 result = m_uiClient.shouldInterruptJavaScript(this);
2737 void WebPageProxy::setStatusText(const String& text)
2739 m_uiClient.setStatusText(this, text);
2742 void WebPageProxy::mouseDidMoveOverElement(const WebHitTestResult::Data& hitTestResultData, uint32_t opaqueModifiers, CoreIPC::ArgumentDecoder* arguments)
2744 RefPtr<APIObject> userData;
2745 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2746 if (!arguments->decode(messageDecoder))
2749 WebEvent::Modifiers modifiers = static_cast<WebEvent::Modifiers>(opaqueModifiers);
2751 m_uiClient.mouseDidMoveOverElement(this, hitTestResultData, modifiers, userData.get());
2754 void WebPageProxy::unavailablePluginButtonClicked(uint32_t opaquePluginUnavailabilityReason, const String& mimeType, const String& url, const String& pluginsPageURL)
2756 MESSAGE_CHECK_URL(url);
2757 MESSAGE_CHECK_URL(pluginsPageURL);
2759 WKPluginUnavailabilityReason pluginUnavailabilityReason = static_cast<WKPluginUnavailabilityReason>(opaquePluginUnavailabilityReason);
2760 m_uiClient.unavailablePluginButtonClicked(this, pluginUnavailabilityReason, mimeType, url, pluginsPageURL);
2763 void WebPageProxy::setToolbarsAreVisible(bool toolbarsAreVisible)
2765 m_uiClient.setToolbarsAreVisible(this, toolbarsAreVisible);
2768 void WebPageProxy::getToolbarsAreVisible(bool& toolbarsAreVisible)
2770 toolbarsAreVisible = m_uiClient.toolbarsAreVisible(this);
2773 void WebPageProxy::setMenuBarIsVisible(bool menuBarIsVisible)
2775 m_uiClient.setMenuBarIsVisible(this, menuBarIsVisible);
2778 void WebPageProxy::getMenuBarIsVisible(bool& menuBarIsVisible)
2780 menuBarIsVisible = m_uiClient.menuBarIsVisible(this);
2783 void WebPageProxy::setStatusBarIsVisible(bool statusBarIsVisible)
2785 m_uiClient.setStatusBarIsVisible(this, statusBarIsVisible);
2788 void WebPageProxy::getStatusBarIsVisible(bool& statusBarIsVisible)
2790 statusBarIsVisible = m_uiClient.statusBarIsVisible(this);
2793 void WebPageProxy::setIsResizable(bool isResizable)
2795 m_uiClient.setIsResizable(this, isResizable);
2798 void WebPageProxy::getIsResizable(bool& isResizable)
2800 isResizable = m_uiClient.isResizable(this);
2803 void WebPageProxy::setWindowFrame(const FloatRect& newWindowFrame)
2805 m_uiClient.setWindowFrame(this, m_pageClient->convertToDeviceSpace(newWindowFrame));
2808 void WebPageProxy::getWindowFrame(FloatRect& newWindowFrame)
2810 newWindowFrame = m_pageClient->convertToUserSpace(m_uiClient.windowFrame(this));
2813 void WebPageProxy::screenToWindow(const IntPoint& screenPoint, IntPoint& windowPoint)
2815 windowPoint = m_pageClient->screenToWindow(screenPoint);
2818 void WebPageProxy::windowToScreen(const IntRect& viewRect, IntRect& result)
2820 result = m_pageClient->windowToScreen(viewRect);
2823 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
2824 void WebPageProxy::runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, PassRefPtr<Messages::WebPageProxy::RunBeforeUnloadConfirmPanel::DelayedReply> reply)
2826 WebFrameProxy* frame = process()->webFrame(frameID);
2827 MESSAGE_CHECK(frame);
2829 // Since runBeforeUnloadConfirmPanel() can spin a nested run loop we need to turn off the responsiveness timer.
2830 process()->responsivenessTimer()->stop();
2832 m_beforeUnloadConfirmPanelReply = reply;
2833 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
2834 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
2836 if (!m_uiClient.runBeforeUnloadConfirmPanel(this, message, frame))
2837 replyBeforeUnloadConfirmPanel(false);
2840 void WebPageProxy::runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose)
2842 WebFrameProxy* frame = process()->webFrame(frameID);
2843 MESSAGE_CHECK(frame);
2845 // Since runBeforeUnloadConfirmPanel() can spin a nested run loop we need to turn off the responsiveness timer.
2846 process()->responsivenessTimer()->stop();
2848 shouldClose = m_uiClient.runBeforeUnloadConfirmPanel(this, message, frame);
2852 #if USE(TILED_BACKING_STORE)
2853 void WebPageProxy::pageDidRequestScroll(const IntPoint& point)
2855 m_pageClient->pageDidRequestScroll(point);
2859 void WebPageProxy::didChangeViewportProperties(const ViewportAttributes& attr)
2861 m_pageClient->didChangeViewportProperties(attr);
2864 void WebPageProxy::pageDidScroll()
2866 m_uiClient.pageDidScroll(this);
2867 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
2868 dismissCorrectionPanel(ReasonForDismissingAlternativeTextIgnored);
2872 void WebPageProxy::runOpenPanel(uint64_t frameID, const FileChooserSettings& settings)
2874 if (m_openPanelResultListener) {
2875 m_openPanelResultListener->invalidate();
2876 m_openPanelResultListener = 0;
2879 WebFrameProxy* frame = process()->webFrame(frameID);
2880 MESSAGE_CHECK(frame);
2882 RefPtr<WebOpenPanelParameters> parameters = WebOpenPanelParameters::create(settings);
2883 m_openPanelResultListener = WebOpenPanelResultListenerProxy::create(this);
2885 // Since runOpenPanel() can spin a nested run loop we need to turn off the responsiveness timer.
2886 process()->responsivenessTimer()->stop();
2888 if (!m_uiClient.runOpenPanel(this, frame, parameters.get(), m_openPanelResultListener.get()))
2889 didCancelForOpenPanel();
2892 void WebPageProxy::printFrame(uint64_t frameID)
2894 ASSERT(!m_isPerformingDOMPrintOperation);
2895 m_isPerformingDOMPrintOperation = true;
2897 WebFrameProxy* frame = process()->webFrame(frameID);
2898 MESSAGE_CHECK(frame);
2900 m_uiClient.printFrame(this, frame);
2902 endPrinting(); // Send a message synchronously while m_isPerformingDOMPrintOperation is still true.
2903 m_isPerformingDOMPrintOperation = false;
2906 void WebPageProxy::printMainFrame()
2908 printFrame(m_mainFrame->frameID());
2911 #if ENABLE(TIZEN_REGISTER_PROTOCOL_HANDLER)
2912 void WebPageProxy::registerProtocolHandler(const String& scheme, const String& baseURL, const String& url, const String& title)
2914 m_pageClient->registerProtocolHandler(scheme, baseURL, url, title);
2918 #if ENABLE(TIZEN_CUSTOM_SCHEME_HANDLER)
2919 void WebPageProxy::isProtocolHandlerRegistered(const String& scheme, const String& baseURL, const String& url, unsigned int& result)
2921 result = m_pageClient->isProtocolHandlerRegistered(scheme, baseURL, url);
2923 void WebPageProxy::unregisterProtocolHandler(const String& scheme, const String& baseURL, const String& url)
2925 m_pageClient->unregisterProtocolHandler(scheme, baseURL, url);
2929 #if ENABLE(TIZEN_REGISTER_CONTENT_HANDLER)
2930 void WebPageProxy::registerContentHandler(const String& mimeType, const String& baseURL, const String& url, const String& title)
2932 m_pageClient->registerContentHandler(mimeType, baseURL, url, title);
2935 void WebPageProxy::isContentHandlerRegistered(const String& mimeType, const String& baseURL, const String& url, unsigned int& result)
2937 result = m_pageClient->isContentHandlerRegistered(mimeType, baseURL, url);
2940 void WebPageProxy::unregisterContentHandler(const String& mimeType, const String& baseURL, const String& url)
2942 m_pageClient->unregisterContentHandler(mimeType, baseURL, url);
2946 #if ENABLE(TIZEN_SEARCH_PROVIDER)
2947 void WebPageProxy::addSearchProvider(const String& baseURL, const String& engineURL)
2949 m_pageClient->addSearchProvider(baseURL, engineURL);
2952 void WebPageProxy::isSearchProviderInstalled(const String& baseURL, const String& engineURL, uint64_t& result)
2954 result = m_pageClient->isSearchProviderInstalled(baseURL, engineURL);
2958 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
2959 void WebPageProxy::getStandaloneStatus(bool& standalone)
2961 standalone = m_pageClient->getStandaloneStatus();
2964 void WebPageProxy::getWebAppCapable(PassRefPtr<BooleanCallback> prpCallback)
2966 RefPtr<BooleanCallback> callback = prpCallback;
2968 callback->invalidate();
2972 uint64_t callbackID = callback->callbackID();
2973 m_booleanCallbacks.set(callbackID, callback.get());
2974 process()->send(Messages::WebPage::GetWebAppCapable(callbackID), m_pageID);
2977 void WebPageProxy::didGetWebAppCapable(const bool capable, uint64_t callbackID)
2979 RefPtr<BooleanCallback> callback = m_booleanCallbacks.take(callbackID);
2980 m_booleanCallbacks.remove(callbackID);
2981 callback->performCallbackWithReturnValue(WebBoolean::create(capable).leakRef());
2984 void WebPageProxy::getWebAppIconURL(PassRefPtr<StringCallback> prpCallback)
2986 RefPtr<StringCallback> callback = prpCallback;
2988 callback->invalidate();
2992 uint64_t callbackID = callback->callbackID();
2993 m_stringCallbacks.set(callbackID, callback.get());
2994 process()->send(Messages::WebPage::GetWebAppIconURL(callbackID), m_pageID);
2997 void WebPageProxy::didGetWebAppIconURL(const String& iconURL, uint64_t callbackID)
2999 RefPtr<StringCallback> callback = m_stringCallbacks.take(callbackID);
3001 // FIXME: Log error or assert.
3002 // this can validly happen if a load invalidated the callback, though
3006 m_stringCallbacks.remove(callbackID);
3007 callback->performCallbackWithReturnValue(iconURL.impl());
3010 void WebPageProxy::getWebAppIconURLs(PassRefPtr<DictionaryCallback> prpCallback)
3012 RefPtr<DictionaryCallback> callback = prpCallback;
3014 callback->invalidate();
3018 uint64_t callbackID = callback->callbackID();
3019 m_dictionaryCallbacks.set(callbackID, callback.get());
3020 process()->send(Messages::WebPage::GetWebAppIconURLs(callbackID), m_pageID);
3023 void WebPageProxy::didGetWebAppIconURLs(const StringPairVector& iconURLs, uint64_t callbackID)
3025 RefPtr<DictionaryCallback> callback = m_dictionaryCallbacks.take(callbackID);
3026 ImmutableDictionary::MapType iconURLList;
3027 size_t iconURLCount = iconURLs.stringPairVector().size();
3028 for (size_t i = 0; i < iconURLCount; ++i)
3029 iconURLList.set(iconURLs.stringPairVector()[i].first, WebString::create(iconURLs.stringPairVector()[i].second));
3031 callback->performCallbackWithReturnValue(ImmutableDictionary::adopt(iconURLList).get());
3035 void WebPageProxy::setMediaVolume(float volume)
3037 if (volume == m_mediaVolume)
3040 m_mediaVolume = volume;
3045 process()->send(Messages::WebPage::SetMediaVolume(volume), m_pageID);
3049 void WebPageProxy::didChangeContentsSize(const IntSize& size)
3051 m_pageClient->didChangeContentsSize(size);
3054 void WebPageProxy::didFindZoomableArea(const IntPoint& target, const IntRect& area)
3056 m_pageClient->didFindZoomableArea(target, area);
3059 void WebPageProxy::findZoomableAreaForPoint(const IntPoint& point, const IntSize& area)
3064 process()->send(Messages::WebPage::FindZoomableAreaForPoint(point, area), m_pageID);
3067 void WebPageProxy::didReceiveMessageFromNavigatorQtObject(const String& contents)
3069 m_pageClient->didReceiveMessageFromNavigatorQtObject(contents);
3072 void WebPageProxy::authenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password)
3074 m_pageClient->handleAuthenticationRequiredRequest(hostname, realm, prefilledUsername, username, password);
3077 void WebPageProxy::proxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password)
3079 m_pageClient->handleProxyAuthenticationRequiredRequest(hostname, port, prefilledUsername, username, password);
3082 void WebPageProxy::certificateVerificationRequest(const String& hostname, bool& ignoreErrors)
3084 m_pageClient->handleCertificateVerificationRequest(hostname, ignoreErrors);
3086 #endif // PLATFORM(QT).
3089 void WebPageProxy::didFindZoomableArea(const IntPoint& target, const IntRect& area)
3091 m_pageClient->didFindZoomableArea(target, area);
3094 void WebPageProxy::findZoomableAreaForPoint(const IntPoint& point, const IntSize& area)
3099 process()->send(Messages::WebPage::FindZoomableAreaForPoint(point, area), m_pageID);
3101 #endif // #if OS(TIZEN)
3103 #if PLATFORM(QT) || PLATFORM(EFL)
3104 void WebPageProxy::handleDownloadRequest(DownloadProxy* download)
3106 m_pageClient->handleDownloadRequest(download);
3108 #endif // PLATFORM(QT) || PLATFORM(EFL)
3110 #if ENABLE(TOUCH_EVENTS)
3111 void WebPageProxy::needTouchEvents(bool needTouchEvents)
3113 m_needTouchEvents = needTouchEvents;
3114 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
3115 // We don't have to ask overflow if we need touch events,
3116 // because we will check overflow in the web process when touch event is processed.
3117 m_askOverflow = !m_needTouchEvents;
3122 #if ENABLE(INPUT_TYPE_COLOR)
3123 void WebPageProxy::showColorChooser(const WebCore::Color& initialColor)
3125 ASSERT(!m_colorChooser);
3127 #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
3128 if (m_colorPickerResultListener) {
3129 m_colorPickerResultListener->invalidate();
3130 m_colorPickerResultListener = nullptr;
3133 m_colorPickerResultListener = WebColorPickerResultListenerProxy::create(this);
3134 m_colorChooser = WebColorChooserProxy::create(this);
3136 if (m_uiClient.showColorPicker(this, initialColor.serialized(), m_colorPickerResultListener.get()))
3140 m_colorChooser = m_pageClient->createColorChooserProxy(this, initialColor);
3141 #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
3142 if (!m_colorChooser)
3143 didEndColorChooser();
3147 void WebPageProxy::setColorChooserColor(const WebCore::Color& color)
3149 ASSERT(m_colorChooser);
3151 m_colorChooser->setSelectedColor(color);
3154 void WebPageProxy::endColorChooser()
3156 ASSERT(m_colorChooser);
3158 m_colorChooser->endChooser();
3161 void WebPageProxy::didChooseColor(const WebCore::Color& color)
3166 process()->send(Messages::WebPage::DidChooseColor(color), m_pageID);
3169 void WebPageProxy::didEndColorChooser()
3174 #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
3175 if (m_colorChooser) {
3176 m_colorChooser->invalidate();
3177 m_colorChooser = nullptr;
3180 ASSERT(m_colorChooser);
3182 m_colorChooser->invalidate();
3183 m_colorChooser = nullptr;
3186 #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
3187 m_process->send(Messages::WebPage::DidEndColorChooser(), m_pageID);
3189 m_colorPickerResultListener->invalidate();
3190 m_colorPickerResultListener = nullptr;
3192 m_uiClient.hideColorPicker(this);
3194 process()->send(Messages::WebPage::DidEndColorChooser(), m_pageID);
3199 void WebPageProxy::didDraw()
3201 m_uiClient.didDraw(this);
3206 #if ENABLE(INSPECTOR)
3208 WebInspectorProxy* WebPageProxy::inspector()
3210 if (isClosed() || !isValid())
3213 m_inspector = WebInspectorProxy::create(this);
3214 return m_inspector.get();
3219 #if ENABLE(FULLSCREEN_API)
3220 WebFullScreenManagerProxy* WebPageProxy::fullScreenManager()
3222 if (!m_fullScreenManager)
3223 m_fullScreenManager = WebFullScreenManagerProxy::create(this);
3224 return m_fullScreenManager.get();
3230 void WebPageProxy::backForwardAddItem(uint64_t itemID)
3232 m_backForwardList->addItem(process()->webBackForwardItem(itemID));
3235 void WebPageProxy::backForwardGoToItem(uint64_t itemID, SandboxExtension::Handle& sandboxExtensionHandle)
3237 WebBackForwardListItem* item = process()->webBackForwardItem(itemID);
3241 bool createdExtension = maybeInitializeSandboxExtensionHandle(KURL(KURL(), item->url()), sandboxExtensionHandle);
3242 if (createdExtension)
3243 process()->willAcquireUniversalFileReadSandboxExtension();
3244 m_backForwardList->goToItem(item);
3247 void WebPageProxy::backForwardItemAtIndex(int32_t index, uint64_t& itemID)
3249 WebBackForwardListItem* item = m_backForwardList->itemAtIndex(index);
3250 itemID = item ? item->itemID() : 0;
3253 void WebPageProxy::backForwardBackListCount(int32_t& count)
3255 count = m_backForwardList->backListCount();
3258 void WebPageProxy::backForwardForwardListCount(int32_t& count)
3260 count = m_backForwardList->forwardListCount();
3263 void WebPageProxy::editorStateChanged(const EditorState& editorState)
3266 bool couldChangeSecureInputState = m_editorState.isInPasswordField != editorState.isInPasswordField || m_editorState.selectionIsNone;
3269 m_editorState = editorState;
3272 m_pageClient->updateTextInputState(couldChangeSecureInputState);
3273 #elif PLATFORM(QT) || PLATFORM(EFL)
3274 m_pageClient->updateTextInputState();
3280 void WebPageProxy::registerEditCommandForUndo(uint64_t commandID, uint32_t editAction)
3282 registerEditCommand(WebEditCommandProxy::create(commandID, static_cast<EditAction>(editAction), this), Undo);
3285 void WebPageProxy::canUndoRedo(uint32_t action, bool& result)
3287 result = m_pageClient->canUndoRedo(static_cast<UndoOrRedo>(action));
3290 void WebPageProxy::executeUndoRedo(uint32_t action, bool& result)
3292 m_pageClient->executeUndoRedo(static_cast<UndoOrRedo>(action));
3296 void WebPageProxy::clearAllEditCommands()
3298 m_pageClient->clearAllEditCommands();
3301 void WebPageProxy::didCountStringMatches(const String& string, uint32_t matchCount)
3303 m_findClient.didCountStringMatches(this, string, matchCount);
3306 void WebPageProxy::didGetImageForFindMatch(const ShareableBitmap::Handle& contentImageHandle, uint32_t matchIndex)
3308 m_findMatchesClient.didGetImageForMatchResult(this, WebImage::create(ShareableBitmap::create(contentImageHandle)).get(), matchIndex);
3311 void WebPageProxy::setFindIndicator(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, const ShareableBitmap::Handle& contentImageHandle, bool fadeOut, bool animate)
3313 RefPtr<FindIndicator> findIndicator = FindIndicator::create(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, contentImageScaleFactor, contentImageHandle);
3314 m_pageClient->setFindIndicator(findIndicator.release(), fadeOut, animate);
3317 void WebPageProxy::didFindString(const String& string, uint32_t matchCount)
3319 m_findClient.didFindString(this, string, matchCount);
3322 void WebPageProxy::didFindStringMatches(const String& string, Vector<Vector<WebCore::IntRect> > matchRects, int32_t firstIndexAfterSelection)
3324 Vector<RefPtr<APIObject> > matches;
3325 matches.reserveInitialCapacity(matchRects.size());
3327 for (size_t i = 0; i < matchRects.size(); ++i) {
3328 const Vector<WebCore::IntRect>& rects = matchRects[i];
3329 size_t numRects = matchRects[i].size();
3330 Vector<RefPtr<APIObject> > apiRects;
3331 apiRects.reserveInitialCapacity(numRects);
3333 for (size_t i = 0; i < numRects; ++i)
3334 apiRects.uncheckedAppend(WebRect::create(toAPI(rects[i])));
3335 matches.uncheckedAppend(ImmutableArray::adopt(apiRects));
3337 m_findMatchesClient.didFindStringMatches(this, string, ImmutableArray::adopt(matches).get(), firstIndexAfterSelection);
3340 void WebPageProxy::didFailToFindString(const String& string)
3342 m_findClient.didFailToFindString(this, string);
3345 void WebPageProxy::valueChangedForPopupMenu(WebPopupMenuProxy*, int32_t newSelectedIndex)
3347 process()->send(Messages::WebPage::DidChangeSelectedIndexForActivePopupMenu(newSelectedIndex), m_pageID);
3350 void WebPageProxy::setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index)
3352 process()->send(Messages::WebPage::SetTextForActivePopupMenu(index), m_pageID);
3355 NativeWebMouseEvent* WebPageProxy::currentlyProcessedMouseDownEvent()
3357 return m_currentlyProcessedMouseDownEvent.get();
3361 void WebPageProxy::failedToShowPopupMenu()
3363 process()->send(Messages::WebPage::FailedToShowPopupMenu(), m_pageID);
3367 void WebPageProxy::showPopupMenu(const IntRect& rect, uint64_t textDirection, const Vector<WebPopupItem>& items, int32_t selectedIndex, const PlatformPopupMenuData& data)
3369 if (m_activePopupMenu) {
3370 m_activePopupMenu->hidePopupMenu();
3371 m_activePopupMenu->invalidate();
3372 m_activePopupMenu = 0;
3375 m_activePopupMenu = m_pageClient->createPopupMenuProxy(this);
3377 // Since showPopupMenu() can spin a nested run loop we need to turn off the responsiveness timer.
3378 process()->responsivenessTimer()->stop();
3380 RefPtr<WebPopupMenuProxy> protectedActivePopupMenu = m_activePopupMenu;
3382 protectedActivePopupMenu->showPopupMenu(rect, static_cast<TextDirection>(textDirection), m_pageScaleFactor, items, data, selectedIndex);
3384 // 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.
3385 #if !PLATFORM(QT) && !PLATFORM(EFL)
3386 protectedActivePopupMenu->invalidate();
3388 protectedActivePopupMenu = 0;
3391 void WebPageProxy::hidePopupMenu()
3393 if (!m_activePopupMenu)
3396 m_activePopupMenu->hidePopupMenu();
3397 m_activePopupMenu->invalidate();
3398 m_activePopupMenu = 0;
3401 #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
3402 void WebPageProxy::updatePopupMenu(uint64_t textDirection, const Vector<WebPopupItem>& items, int32_t selectedIndex)
3404 if (!m_activePopupMenu)
3407 m_activePopupMenu->updatePopupMenu(static_cast<TextDirection>(textDirection), items, selectedIndex);
3411 #if ENABLE(CONTEXT_MENUS)
3412 void WebPageProxy::showContextMenu(const IntPoint& menuLocation, const WebHitTestResult::Data& hitTestResultData, const Vector<WebContextMenuItemData>& proposedItems, CoreIPC::ArgumentDecoder* arguments)
3414 internalShowContextMenu(menuLocation, hitTestResultData, proposedItems, arguments);
3416 // No matter the result of internalShowContextMenu, always notify the WebProcess that the menu is hidden so it starts handling mouse events again.
3417 process()->send(Messages::WebPage::ContextMenuHidden(), m_pageID);
3420 void WebPageProxy::internalShowContextMenu(const IntPoint& menuLocation, const WebHitTestResult::Data& hitTestResultData, const Vector<WebContextMenuItemData>& proposedItems, CoreIPC::ArgumentDecoder* arguments)
3422 RefPtr<APIObject> userData;
3423 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
3424 if (!arguments->decode(messageDecoder))
3427 m_activeContextMenuHitTestResultData = hitTestResultData;
3429 if (m_activeContextMenu) {
3430 m_activeContextMenu->hideContextMenu();
3431 m_activeContextMenu = 0;
3434 m_activeContextMenu = m_pageClient->createContextMenuProxy(this);
3436 // Since showContextMenu() can spin a nested run loop we need to turn off the responsiveness timer.
3437 process()->responsivenessTimer()->stop();
3439 // Give the PageContextMenuClient one last swipe at changing the menu.
3440 Vector<WebContextMenuItemData> items;
3441 if (!m_contextMenuClient.getContextMenuFromProposedMenu(this, proposedItems, items, hitTestResultData, userData.get()))
3442 m_activeContextMenu->showContextMenu(menuLocation, proposedItems);
3444 m_activeContextMenu->showContextMenu(menuLocation, items);
3446 m_contextMenuClient.contextMenuDismissed(this);
3449 void WebPageProxy::contextMenuItemSelected(const WebContextMenuItemData& item)
3451 TIZEN_LOGI("selected item : action(%d), title(%s)", item.action(), item.title().utf8().data());
3452 // Application custom items don't need to round-trip through to WebCore in the WebProcess.
3453 if (item.action() >= ContextMenuItemBaseApplicationTag) {
3454 m_contextMenuClient.customContextMenuItemSelected(this, item);
3455 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
3456 m_pageClient->setIsTextSelectionMode(false);
3462 if (item.action() == ContextMenuItemTagSmartCopyPaste) {
3463 setSmartInsertDeleteEnabled(!isSmartInsertDeleteEnabled());
3466 if (item.action() == ContextMenuItemTagSmartQuotes) {
3467 TextChecker::setAutomaticQuoteSubstitutionEnabled(!TextChecker::state().isAutomaticQuoteSubstitutionEnabled);
3468 process()->updateTextCheckerState();
3471 if (item.action() == ContextMenuItemTagSmartDashes) {
3472 TextChecker::setAutomaticDashSubstitutionEnabled(!TextChecker::state().isAutomaticDashSubstitutionEnabled);
3473 process()->updateTextCheckerState();
3476 if (item.action() == ContextMenuItemTagSmartLinks) {
3477 TextChecker::setAutomaticLinkDetectionEnabled(!TextChecker::state().isAutomaticLinkDetectionEnabled);
3478 process()->updateTextCheckerState();
3481 if (item.action() == ContextMenuItemTagTextReplacement) {
3482 TextChecker::setAutomaticTextReplacementEnabled(!TextChecker::state().isAutomaticTextReplacementEnabled);
3483 process()->updateTextCheckerState();
3486 if (item.action() == ContextMenuItemTagCorrectSpellingAutomatically) {
3487 TextChecker::setAutomaticSpellingCorrectionEnabled(!TextChecker::state().isAutomaticSpellingCorrectionEnabled);
3488 process()->updateTextCheckerState();
3491 if (item.action() == ContextMenuItemTagShowSubstitutions) {
3492 TextChecker::toggleSubstitutionsPanelIsShowing();
3496 if (item.action() == ContextMenuItemTagDownloadImageToDisk) {
3497 m_process->context()->download(this, KURL(KURL(), m_activeContextMenuHitTestResultData.absoluteImageURL));
3500 if (item.action() == ContextMenuItemTagDownloadLinkToDisk) {
3501 m_process->context()->download(this, KURL(KURL(), m_activeContextMenuHitTestResultData.absoluteLinkURL));
3504 if (item.action() == ContextMenuItemTagCheckSpellingWhileTyping) {
3505 TextChecker::setContinuousSpellCheckingEnabled(!TextChecker::state().isContinuousSpellCheckingEnabled);
3506 process()->updateTextCheckerState();
3509 if (item.action() == ContextMenuItemTagCheckGrammarWithSpelling) {
3510 TextChecker::setGrammarCheckingEnabled(!TextChecker::state().isGrammarCheckingEnabled);
3511 process()->updateTextCheckerState();
3514 if (item.action() == ContextMenuItemTagShowSpellingPanel) {
3515 if (!TextChecker::spellingUIIsShowing())
3516 advanceToNextMisspelling(true);
3517 TextChecker::toggleSpellingUIIsShowing();
3520 if (item.action() == ContextMenuItemTagLearnSpelling || item.action() == ContextMenuItemTagIgnoreSpelling)
3521 ++m_pendingLearnOrIgnoreWordMessageCount;
3523 #if ENABLE(TIZEN_WEBKIT2_CLIPBOARD_HELPER)
3524 if (item.action() == ContextMenuItemTagPaste) {
3525 pasteContextMenuSelected();
3530 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_TEXT_SELECTION_MODE)
3531 if (item.action() == ContextMenuItemTagTextSelectionMode) {
3532 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
3533 m_pageClient->setIsTextSelectionMode(true);
3536 evas_object_focus_set(viewWidget(), true);
3537 WebCore::IntPoint positionForSelection = m_activeContextMenu->positionForSelection();
3538 bool result = false;
3539 process()->sendSync(Messages::WebPage::SelectLink(positionForSelection), Messages::WebPage::SelectLink::Reply(result), m_pageID);
3540 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
3541 if (result == false)
3542 m_pageClient->setIsTextSelectionMode(false);
3549 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
3550 if (item.action() == ContextMenuItemTagClipboard) {
3551 clipboardContextMenuSelected();
3556 #if ENABLE(CONTEXT_MENUS)
3557 process()->send(Messages::WebPage::DidSelectItemFromActiveContextMenu(item), m_pageID);
3560 #endif // ENABLE(CONTEXT_MENUS)
3562 void WebPageProxy::didChooseFilesForOpenPanel(const Vector<String>& fileURLs)
3567 #if ENABLE(WEB_PROCESS_SANDBOX)
3568 // FIXME: The sandbox extensions should be sent with the DidChooseFilesForOpenPanel message. This
3569 // is gated on a way of passing SandboxExtension::Handles in a Vector.
3570 for (size_t i = 0; i < fileURLs.size(); ++i) {
3571 SandboxExtension::Handle sandboxExtensionHandle;
3572 SandboxExtension::createHandle(fileURLs[i], SandboxExtension::ReadOnly, sandboxExtensionHandle);
3573 process()->send(Messages::WebPage::ExtendSandboxForFileFromOpenPanel(sandboxExtensionHandle), m_pageID);
3577 process()->send(Messages::WebPage::DidChooseFilesForOpenPanel(fileURLs), m_pageID);
3579 m_openPanelResultListener->invalidate();
3580 m_openPanelResultListener = 0;
3583 void WebPageProxy::didCancelForOpenPanel()
3588 process()->send(Messages::WebPage::DidCancelForOpenPanel(), m_pageID);
3590 m_openPanelResultListener->invalidate();
3591 m_openPanelResultListener = 0;
3594 void WebPageProxy::advanceToNextMisspelling(bool startBeforeSelection) const
3596 process()->send(Messages::WebPage::AdvanceToNextMisspelling(startBeforeSelection), m_pageID);
3599 void WebPageProxy::changeSpellingToWord(const String& word) const
3604 process()->send(Messages::WebPage::ChangeSpellingToWord(word), m_pageID);
3607 void WebPageProxy::registerEditCommand(PassRefPtr<WebEditCommandProxy> commandProxy, UndoOrRedo undoOrRedo)
3609 m_pageClient->registerEditCommand(commandProxy, undoOrRedo);
3612 void WebPageProxy::addEditCommand(WebEditCommandProxy* command)
3614 m_editCommandSet.add(command);
3617 void WebPageProxy::removeEditCommand(WebEditCommandProxy* command)
3619 m_editCommandSet.remove(command);
3623 process()->send(Messages::WebPage::DidRemoveEditCommand(command->commandID()), m_pageID);
3626 bool WebPageProxy::isValidEditCommand(WebEditCommandProxy* command)
3628 return m_editCommandSet.find(command) != m_editCommandSet.end();
3631 int64_t WebPageProxy::spellDocumentTag()
3633 if (!m_hasSpellDocumentTag) {
3634 m_spellDocumentTag = TextChecker::uniqueSpellDocumentTag(this);
3635 m_hasSpellDocumentTag = true;
3638 return m_spellDocumentTag;
3641 #if USE(UNIFIED_TEXT_CHECKING)
3642 void WebPageProxy::checkTextOfParagraph(const String& text, uint64_t checkingTypes, Vector<TextCheckingResult>& results)
3644 results = TextChecker::checkTextOfParagraph(spellDocumentTag(), text.characters(), text.length(), checkingTypes);
3648 void WebPageProxy::checkSpellingOfString(const String& text, int32_t& misspellingLocation, int32_t& misspellingLength)
3650 TextChecker::checkSpellingOfString(spellDocumentTag(), text.characters(), text.length(), misspellingLocation, misspellingLength);
3653 void WebPageProxy::checkGrammarOfString(const String& text, Vector<GrammarDetail>& grammarDetails, int32_t& badGrammarLocation, int32_t& badGrammarLength)
3655 TextChecker::checkGrammarOfString(spellDocumentTag(), text.characters(), text.length(), grammarDetails, badGrammarLocation, badGrammarLength);
3658 void WebPageProxy::spellingUIIsShowing(bool& isShowing)
3660 isShowing = TextChecker::spellingUIIsShowing();
3663 void WebPageProxy::updateSpellingUIWithMisspelledWord(const String& misspelledWord)
3665 TextChecker::updateSpellingUIWithMisspelledWord(spellDocumentTag(), misspelledWord);
3668 void WebPageProxy::updateSpellingUIWithGrammarString(const String& badGrammarPhrase, const GrammarDetail& grammarDetail)
3670 TextChecker::updateSpellingUIWithGrammarString(spellDocumentTag(), badGrammarPhrase, grammarDetail);
3673 void WebPageProxy::getGuessesForWord(const String& word, const String& context, Vector<String>& guesses)
3675 TextChecker::getGuessesForWord(spellDocumentTag(), word, context, guesses);
3678 void WebPageProxy::learnWord(const String& word)
3680 MESSAGE_CHECK(m_pendingLearnOrIgnoreWordMessageCount);
3681 --m_pendingLearnOrIgnoreWordMessageCount;
3683 TextChecker::learnWord(spellDocumentTag(), word);
3686 void WebPageProxy::ignoreWord(const String& word)
3688 MESSAGE_CHECK(m_pendingLearnOrIgnoreWordMessageCount);
3689 --m_pendingLearnOrIgnoreWordMessageCount;
3691 TextChecker::ignoreWord(spellDocumentTag(), word);
3696 void WebPageProxy::setFocus(bool focused)
3699 m_uiClient.focus(this);
3701 m_uiClient.unfocus(this);
3704 void WebPageProxy::takeFocus(uint32_t direction)
3706 m_uiClient.takeFocus(this, (static_cast<FocusDirection>(direction) == FocusDirectionForward) ? kWKFocusDirectionForward : kWKFocusDirectionBackward);
3709 void WebPageProxy::setToolTip(const String& toolTip)
3711 String oldToolTip = m_toolTip;
3712 m_toolTip = toolTip;
3713 m_pageClient->toolTipChanged(oldToolTip, m_toolTip);
3716 void WebPageProxy::setCursor(const WebCore::Cursor& cursor)
3718 m_pageClient->setCursor(cursor);
3721 void WebPageProxy::setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves)
3723 m_pageClient->setCursorHiddenUntilMouseMoves(hiddenUntilMouseMoves);
3726 void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
3728 WebEvent::Type type = static_cast<WebEvent::Type>(opaqueType);
3731 case WebEvent::NoType:
3732 case WebEvent::MouseMove:
3735 case WebEvent::MouseDown:
3736 case WebEvent::MouseUp:
3737 case WebEvent::Wheel:
3738 case WebEvent::KeyDown:
3739 case WebEvent::KeyUp:
3740 case WebEvent::RawKeyDown:
3741 case WebEvent::Char:
3742 #if ENABLE(GESTURE_EVENTS)
3743 case WebEvent::GestureScrollBegin:
3744 case WebEvent::GestureScrollEnd:
3745 case WebEvent::GestureSingleTap:
3747 #if ENABLE(TOUCH_EVENTS)
3748 case WebEvent::TouchStart:
3749 case WebEvent::TouchMove:
3750 case WebEvent::TouchEnd:
3751 case WebEvent::TouchCancel:
3753 process()->responsivenessTimer()->stop();
3758 case WebEvent::NoType:
3760 case WebEvent::MouseMove:
3761 m_processingMouseMoveEvent = false;
3762 if (m_nextMouseMoveEvent) {
3763 handleMouseEvent(*m_nextMouseMoveEvent);
3764 m_nextMouseMoveEvent = nullptr;
3767 case WebEvent::MouseDown:
3769 #if ENABLE(GESTURE_EVENTS)
3770 case WebEvent::GestureScrollBegin:
3771 case WebEvent::GestureScrollEnd:
3772 case WebEvent::GestureSingleTap: {
3773 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
3774 QueuedUIEvents<WebGestureEvent> queuedEvents = m_gestureEventQueue.first();
3775 MESSAGE_CHECK(type == queuedEvents.forwardedEvent.type());
3776 m_gestureEventQueue.removeFirst();
3778 m_pageClient->doneWithGestureEvent(queuedEvents.forwardedEvent, handled);
3779 for (size_t i = 0; i < queuedEvents.deferredEvents.size(); ++i) {
3780 bool isEventHandled = false;
3781 m_pageClient->doneWithGestureEvent(queuedEvents.deferredEvents.at(i), isEventHandled);
3784 WebGestureEvent event = m_gestureEventQueue.first();
3785 MESSAGE_CHECK(type == event.type());
3787 m_gestureEventQueue.removeFirst();
3788 m_pageClient->doneWithGestureEvent(event, handled);
3790 #if ENABLE(TIZEN_ISF_PORT)
3791 if (type == WebEvent::GestureSingleTap)
3792 evas_object_focus_set(viewWidget(), true);
3797 case WebEvent::MouseUp:
3798 m_currentlyProcessedMouseDownEvent = nullptr;
3801 case WebEvent::Wheel: {
3802 ASSERT(!m_currentlyProcessedWheelEvents.isEmpty());
3804 OwnPtr<Vector<NativeWebWheelEvent> > oldestCoalescedEvent = m_currentlyProcessedWheelEvents.takeFirst();
3806 // FIXME: Dispatch additional events to the didNotHandleWheelEvent client function.
3807 if (!handled && m_uiClient.implementsDidNotHandleWheelEvent())
3808 m_uiClient.didNotHandleWheelEvent(this, oldestCoalescedEvent->last());
3810 if (!m_wheelEventQueue.isEmpty())
3811 processNextQueuedWheelEvent();
3815 case WebEvent::KeyDown:
3816 case WebEvent::KeyUp:
3817 case WebEvent::RawKeyDown:
3818 case WebEvent::Char: {
3819 LOG(KeyHandling, "WebPageProxy::didReceiveEvent: %s", webKeyboardEventTypeString(type));
3821 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
3822 QueuedUIEvents<NativeWebKeyboardEvent> queuedEvents = m_keyEventQueue.first();
3823 NativeWebKeyboardEvent event = queuedEvents.forwardedEvent;
3824 MESSAGE_CHECK(type == event.type());
3825 m_keyEventQueue.removeFirst();
3827 m_pageClient->doneWithKeyEvent(event, handled);
3828 for (size_t i = 0; i < queuedEvents.deferredEvents.size(); ++i) {
3829 bool isEventHandled = false;
3830 m_pageClient->doneWithKeyEvent(queuedEvents.deferredEvents.at(i), isEventHandled);
3833 NativeWebKeyboardEvent event = m_keyEventQueue.first();
3834 MESSAGE_CHECK(type == event.type());
3836 m_keyEventQueue.removeFirst();
3838 if (!m_keyEventQueue.isEmpty())
3839 process()->send(Messages::WebPage::KeyEvent(m_keyEventQueue.first()), m_pageID);
3841 m_pageClient->doneWithKeyEvent(event, handled);
3842 #endif // #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
3847 #if ENABLE(TIZEN_ISF_PORT)
3848 InputMethodContextEfl* inputMethodContext = static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->inputMethodContext();
3849 if (inputMethodContext && event.keyIdentifier() == "Enter" && inputMethodContext->autoCapitalType() == ECORE_IMF_AUTOCAPITAL_TYPE_NONE)
3850 inputMethodContext->hideIMFContext();
3853 if (m_uiClient.implementsDidNotHandleKeyEvent())
3854 m_uiClient.didNotHandleKeyEvent(this, event);
3857 ::TranslateMessage(event.nativeEvent());
3861 #if ENABLE(TOUCH_EVENTS)
3862 case WebEvent::TouchStart:
3863 case WebEvent::TouchMove:
3864 case WebEvent::TouchEnd:
3865 case WebEvent::TouchCancel: {
3866 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
3867 QueuedUIEvents<NativeWebTouchEvent> queuedEvents = m_touchEventQueue.first();
3868 MESSAGE_CHECK(type == queuedEvents.forwardedEvent.type());
3869 m_touchEventQueue.removeFirst();
3871 m_pageClient->doneWithTouchEvent(queuedEvents.forwardedEvent, handled);
3872 for (size_t i = 0; i < queuedEvents.deferredEvents.size(); ++i) {
3873 bool isEventHandled = false;
3874 m_pageClient->doneWithTouchEvent(queuedEvents.deferredEvents.at(i), isEventHandled);
3877 QueuedTouchEvents queuedEvents = m_touchEventQueue.first();
3878 MESSAGE_CHECK(type == queuedEvents.forwardedEvent.type());
3879 m_touchEventQueue.removeFirst();
3881 m_pageClient->doneWithTouchEvent(queuedEvents.forwardedEvent, handled);
3882 for (size_t i = 0; i < queuedEvents.deferredTouchEvents.size(); ++i) {
3883 bool isEventHandled = false;
3884 m_pageClient->doneWithTouchEvent(queuedEvents.deferredTouchEvents.at(i), isEventHandled);
3893 void WebPageProxy::stopResponsivenessTimer()
3895 process()->responsivenessTimer()->stop();
3898 void WebPageProxy::voidCallback(uint64_t callbackID)
3900 RefPtr<VoidCallback> callback = m_voidCallbacks.take(callbackID);
3902 // FIXME: Log error or assert.
3906 callback->performCallback();
3909 void WebPageProxy::dataCallback(const CoreIPC::DataReference& dataReference, uint64_t callbackID)
3911 RefPtr<DataCallback> callback = m_dataCallbacks.take(callbackID);
3913 // FIXME: Log error or assert.
3917 callback->performCallbackWithReturnValue(WebData::create(dataReference.data(), dataReference.size()).get());
3920 void WebPageProxy::stringCallback(const String& resultString, uint64_t callbackID)
3922 RefPtr<StringCallback> callback = m_stringCallbacks.take(callbackID);
3924 // FIXME: Log error or assert.
3925 // this can validly happen if a load invalidated the callback, though
3929 m_loadDependentStringCallbackIDs.remove(callbackID);
3931 callback->performCallbackWithReturnValue(resultString.impl());
3934 void WebPageProxy::scriptValueCallback(const CoreIPC::DataReference& dataReference, uint64_t callbackID)
3936 RefPtr<ScriptValueCallback> callback = m_scriptValueCallbacks.take(callbackID);
3938 // FIXME: Log error or assert.
3942 Vector<uint8_t> data;
3943 data.reserveInitialCapacity(dataReference.size());
3944 data.append(dataReference.data(), dataReference.size());
3946 callback->performCallbackWithReturnValue(data.size() ? WebSerializedScriptValue::adopt(data).get() : 0);
3949 void WebPageProxy::computedPagesCallback(const Vector<IntRect>& pageRects, double totalScaleFactorForPrinting, uint64_t callbackID)
3951 RefPtr<ComputedPagesCallback> callback = m_computedPagesCallbacks.take(callbackID);
3953 // FIXME: Log error or assert.
3957 callback->performCallbackWithReturnValue(pageRects, totalScaleFactorForPrinting);
3960 void WebPageProxy::validateCommandCallback(const String& commandName, bool isEnabled, int state, uint64_t callbackID)
3962 RefPtr<ValidateCommandCallback> callback = m_validateCommandCallbacks.take(callbackID);
3964 // FIXME: Log error or assert.
3968 callback->performCallbackWithReturnValue(commandName.impl(), isEnabled, state);
3972 void WebPageProxy::printFinishedCallback(const ResourceError& printError, uint64_t callbackID)
3974 RefPtr<PrintFinishedCallback> callback = m_printFinishedCallbacks.take(callbackID);
3976 // FIXME: Log error or assert.
3980 RefPtr<WebError> error = WebError::create(printError);
3981 callback->performCallbackWithReturnValue(error.get());
3985 void WebPageProxy::focusedFrameChanged(uint64_t frameID)
3992 WebFrameProxy* frame = process()->webFrame(frameID);
3993 MESSAGE_CHECK(frame);
3995 m_focusedFrame = frame;
3998 void WebPageProxy::frameSetLargestFrameChanged(uint64_t frameID)
4001 m_frameSetLargestFrame = 0;
4005 WebFrameProxy* frame = process()->webFrame(frameID);
4006 MESSAGE_CHECK(frame);
4008 m_frameSetLargestFrame = frame;
4011 void WebPageProxy::processDidBecomeUnresponsive()
4016 updateBackingStoreDiscardableState();
4018 m_loaderClient.processDidBecomeUnresponsive(this);
4021 void WebPageProxy::interactionOccurredWhileProcessUnresponsive()
4026 m_loaderClient.interactionOccurredWhileProcessUnresponsive(this);
4029 void WebPageProxy::processDidBecomeResponsive()
4034 updateBackingStoreDiscardableState();
4036 m_loaderClient.processDidBecomeResponsive(this);
4039 void WebPageProxy::processDidCrash()
4041 ASSERT(m_pageClient);
4044 m_isPageSuspended = false;
4047 m_urlAtProcessExit = m_mainFrame->url();
4048 m_loadStateAtProcessExit = m_mainFrame->loadState();
4051 m_mainFrame = nullptr;
4052 m_drawingArea = nullptr;
4054 #if ENABLE(INSPECTOR)
4056 m_inspector->invalidate();
4057 m_inspector = nullptr;
4061 #if ENABLE(FULLSCREEN_API)
4062 if (m_fullScreenManager) {
4063 m_fullScreenManager->invalidate();
4064 m_fullScreenManager = nullptr;
4068 if (m_openPanelResultListener) {
4069 m_openPanelResultListener->invalidate();
4070 m_openPanelResultListener = nullptr;
4073 #if ENABLE(INPUT_TYPE_COLOR)
4074 if (m_colorChooser) {
4075 m_colorChooser->invalidate();
4076 m_colorChooser = nullptr;
4079 #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
4080 if (m_colorPickerResultListener) {
4081 m_colorPickerResultListener->invalidate();
4082 m_colorPickerResultListener = nullptr;
4087 #if ENABLE(GEOLOCATION)
4088 m_geolocationPermissionRequestManager.invalidateRequests();
4091 m_notificationPermissionRequestManager.invalidateRequests();
4093 m_toolTip = String();
4095 m_mainFrameHasHorizontalScrollbar = false;
4096 m_mainFrameHasVerticalScrollbar = false;
4098 m_mainFrameIsPinnedToLeftSide = false;
4099 m_mainFrameIsPinnedToRightSide = false;
4101 m_visibleScrollerThumbRect = IntRect();
4103 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
4104 invalidateCallbackMap(m_booleanCallbacks);
4105 invalidateCallbackMap(m_dictionaryCallbacks);
4107 invalidateCallbackMap(m_voidCallbacks);
4108 invalidateCallbackMap(m_dataCallbacks);
4109 invalidateCallbackMap(m_stringCallbacks);
4110 m_loadDependentStringCallbackIDs.clear();
4111 invalidateCallbackMap(m_scriptValueCallbacks);
4112 invalidateCallbackMap(m_computedPagesCallbacks);
4113 invalidateCallbackMap(m_validateCommandCallbacks);
4115 invalidateCallbackMap(m_printFinishedCallbacks);
4118 Vector<WebEditCommandProxy*> editCommandVector;
4119 copyToVector(m_editCommandSet, editCommandVector);
4120 m_editCommandSet.clear();
4121 for (size_t i = 0, size = editCommandVector.size(); i < size; ++i)
4122 editCommandVector[i]->invalidate();
4123 m_pageClient->clearAllEditCommands();
4125 m_activePopupMenu = 0;
4127 m_estimatedProgress = 0.0;
4129 m_pendingLearnOrIgnoreWordMessageCount = 0;
4131 m_pageClient->processDidCrash();
4132 m_loaderClient.processDidCrash(this);
4135 // If the call out to the loader client didn't cause the web process to be relaunched,
4136 // we'll call setNeedsDisplay on the view so that we won't have the old contents showing.
4137 // If the call did cause the web process to be relaunched, we'll keep the old page contents showing
4138 // until the new web process has painted its contents.
4139 setViewNeedsDisplay(IntRect(IntPoint(), viewSize()));
4142 // Can't expect DidReceiveEvent notifications from a crashed web process.
4143 m_keyEventQueue.clear();
4145 m_wheelEventQueue.clear();
4146 m_currentlyProcessedWheelEvents.clear();
4148 m_nextMouseMoveEvent = nullptr;
4149 m_currentlyProcessedMouseDownEvent = nullptr;
4151 m_processingMouseMoveEvent = false;
4153 #if ENABLE(TOUCH_EVENTS)
4154 m_needTouchEvents = false;
4155 m_touchEventQueue.clear();
4158 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
4159 dismissCorrectionPanel(ReasonForDismissingAlternativeTextIgnored);
4160 m_pageClient->dismissDictionaryLookupPanel();
4164 WebPageCreationParameters WebPageProxy::creationParameters() const
4166 WebPageCreationParameters parameters;
4168 parameters.viewSize = m_pageClient->viewSize();
4169 parameters.isActive = m_pageClient->isViewWindowActive();
4170 parameters.isFocused = m_pageClient->isViewFocused();
4171 parameters.isVisible = m_pageClient->isViewVisible();
4172 parameters.isInWindow = m_pageClient->isViewInWindow();
4173 parameters.drawingAreaType = m_drawingArea->type();
4174 parameters.store = m_pageGroup->preferences()->store();
4175 parameters.pageGroupData = m_pageGroup->data();
4176 parameters.drawsBackground = m_drawsBackground;
4177 parameters.drawsTransparentBackground = m_drawsTransparentBackground;
4178 parameters.areMemoryCacheClientCallsEnabled = m_areMemoryCacheClientCallsEnabled;
4179 parameters.useFixedLayout = m_useFixedLayout;
4180 parameters.fixedLayoutSize = m_fixedLayoutSize;
4181 parameters.paginationMode = m_paginationMode;
4182 parameters.paginationBehavesLikeColumns = m_paginationBehavesLikeColumns;
4183 parameters.pageLength = m_pageLength;
4184 parameters.gapBetweenPages = m_gapBetweenPages;
4185 parameters.userAgent = userAgent();
4186 parameters.sessionState = SessionState(m_backForwardList->entries(), m_backForwardList->currentIndex());
4187 parameters.highestUsedBackForwardItemID = WebBackForwardListItem::highedUsedItemID();
4188 parameters.canRunBeforeUnloadConfirmPanel = m_uiClient.canRunBeforeUnloadConfirmPanel();
4189 parameters.canRunModal = m_canRunModal;
4190 parameters.deviceScaleFactor = m_intrinsicDeviceScaleFactor;
4191 parameters.mediaVolume = m_mediaVolume;
4194 parameters.isSmartInsertDeleteEnabled = m_isSmartInsertDeleteEnabled;
4195 parameters.layerHostingMode = m_layerHostingMode;
4196 parameters.colorSpace = m_pageClient->colorSpace();
4200 parameters.nativeWindow = m_pageClient->nativeWindow();
4205 #if USE(ACCELERATED_COMPOSITING)
4206 void WebPageProxy::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
4208 m_pageClient->enterAcceleratedCompositingMode(layerTreeContext);
4211 void WebPageProxy::exitAcceleratedCompositingMode()
4213 #if ENABLE(TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE)
4214 process()->platformSurfaceTexturePool()->removeAllPlatformSurfaceTextures();
4216 m_pageClient->exitAcceleratedCompositingMode();
4219 void WebPageProxy::updateAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
4221 m_pageClient->updateAcceleratedCompositingMode(layerTreeContext);
4223 #endif // USE(ACCELERATED_COMPOSITING)
4225 void WebPageProxy::backForwardClear()
4227 m_backForwardList->clear();
4230 void WebPageProxy::canAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, const ProtectionSpace& coreProtectionSpace, bool& canAuthenticate)
4232 WebFrameProxy* frame = process()->webFrame(frameID);
4233 MESSAGE_CHECK(frame);
4235 RefPtr<WebProtectionSpace> protectionSpace = WebProtectionSpace::create(coreProtectionSpace);
4237 canAuthenticate = m_loaderClient.canAuthenticateAgainstProtectionSpaceInFrame(this, frame, protectionSpace.get());
4240 #if ENABLE(TIZEN_ON_AUTHENTICATION_REQUESTED)
4241 void WebPageProxy::didReceiveAuthenticationChallenge(uint64_t frameID, const AuthenticationChallenge& coreChallenge, uint64_t challengeID, PassRefPtr<Messages::WebPageProxy::DidReceiveAuthenticationChallenge::DelayedReply> reply)
4243 void WebPageProxy::didReceiveAuthenticationChallenge(uint64_t frameID, const AuthenticationChallenge& coreChallenge, uint64_t challengeID)
4246 WebFrameProxy* frame = process()->webFrame(frameID);
4247 MESSAGE_CHECK(frame);
4249 #if ENABLE(TIZEN_ON_AUTHENTICATION_REQUESTED)
4250 RefPtr<AuthenticationChallengeProxy> authenticationChallenge = frame->setUpAuthenticationChallengeProxy(coreChallenge, challengeID, process());
4251 m_AuthReply = reply;
4253 if (!m_loaderClient.didReceiveAuthenticationChallengeInFrame(this, frame, authenticationChallenge.get()))
4254 replyReceiveAuthenticationChallengeInFrame(true);
4256 RefPtr<AuthenticationChallengeProxy> authenticationChallenge = AuthenticationChallengeProxy::create(coreChallenge, challengeID, process());
4258 m_loaderClient.didReceiveAuthenticationChallengeInFrame(this, frame, authenticationChallenge.get());
4262 #if ENABLE(TIZEN_SQL_DATABASE)
4263 void WebPageProxy::exceededDatabaseQuota(uint64_t frameID, const String& originIdentifier, const String& displayName, uint64_t expectedUsage, PassRefPtr<Messages::WebPageProxy::ExceededDatabaseQuota::DelayedReply> allowExceed)
4265 WebFrameProxy* frame = process()->webFrame(frameID);
4266 MESSAGE_CHECK(frame);
4268 // Since exceededDatabaseQuota() can spin a nested run loop we need to turn off the responsiveness timer.
4269 process()->responsivenessTimer()->stop();
4271 m_exceededDatabaseQuotaReply = allowExceed;
4272 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
4273 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
4274 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
4277 if (!m_uiClient.exceededDatabaseQuota(this, frame, origin.get(), displayName, expectedUsage))
4278 replyExceededDatabaseQuota(true);
4281 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)
4283 WebFrameProxy* frame = process()->webFrame(frameID);
4284 MESSAGE_CHECK(frame);
4286 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
4288 newQuota = m_uiClient.exceededDatabaseQuota(this, frame, origin.get(), databaseName, displayName, currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage);
4292 void WebPageProxy::requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier)
4294 WebFrameProxy* frame = process()->webFrame(frameID);
4295 MESSAGE_CHECK(frame);
4297 // FIXME: Geolocation should probably be using toString() as its string representation instead of databaseIdentifier().
4298 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
4299 RefPtr<GeolocationPermissionRequestProxy> request = m_geolocationPermissionRequestManager.createRequest(geolocationID);
4301 if (!m_uiClient.decidePolicyForGeolocationPermissionRequest(this, frame, origin.get(), request.get()))
4305 void WebPageProxy::requestNotificationPermission(uint64_t requestID, const String& originString)
4307 if (!isRequestIDValid(requestID))
4310 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromString(originString);
4311 RefPtr<NotificationPermissionRequest> request = m_notificationPermissionRequestManager.createRequest(requestID);
4313 if (!m_uiClient.decidePolicyForNotificationPermissionRequest(this, origin.get(), request.get()))
4317 void WebPageProxy::showNotification(const String& title, const String& body, const String& iconURL, const String& tag, const String& originString, uint64_t notificationID)
4319 m_process->context()->notificationManagerProxy()->show(this, title, body, iconURL, tag, originString, notificationID);
4322 #if ENABLE(TIZEN_MEDIA_STREAM)
4323 void WebPageProxy::requestUserMediaPermission(uint64_t requestID)
4325 RefPtr<UserMediaPermissionRequest> request = m_userMediaPermissionRequestManager.createRequest(requestID);
4327 if (!m_tizenClient.decidePolicyForUserMediaPermissionRequest(this, request.get()))
4332 float WebPageProxy::headerHeight(WebFrameProxy* frame)
4334 if (frame->isDisplayingPDFDocument())
4336 return m_uiClient.headerHeight(this, frame);
4339 float WebPageProxy::footerHeight(WebFrameProxy* frame)
4341 if (frame->isDisplayingPDFDocument())
4343 return m_uiClient.footerHeight(this, frame);
4346 void WebPageProxy::drawHeader(WebFrameProxy* frame, const FloatRect& rect)
4348 if (frame->isDisplayingPDFDocument())
4350 m_uiClient.drawHeader(this, frame, rect);
4353 void WebPageProxy::drawFooter(WebFrameProxy* frame, const FloatRect& rect)
4355 if (frame->isDisplayingPDFDocument())
4357 m_uiClient.drawFooter(this, frame, rect);
4360 void WebPageProxy::runModal()
4362 // Since runModal() can (and probably will) spin a nested run loop we need to turn off the responsiveness timer.
4363 process()->responsivenessTimer()->stop();
4365 // Our Connection's run loop might have more messages waiting to be handled after this RunModal message.
4366 // To make sure they are handled inside of the the nested modal run loop we must first signal the Connection's
4367 // run loop so we're guaranteed that it has a chance to wake up.
4368 // See http://webkit.org/b/89590 for more discussion.
4369 process()->connection()->wakeUpRunLoop();
4371 m_uiClient.runModal(this);
4374 void WebPageProxy::notifyScrollerThumbIsVisibleInRect(const IntRect& scrollerThumb)
4376 m_visibleScrollerThumbRect = scrollerThumb;
4379 void WebPageProxy::recommendedScrollbarStyleDidChange(int32_t newStyle)
4382 m_pageClient->recommendedScrollbarStyleDidChange(newStyle);
4386 void WebPageProxy::didChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar)
4388 m_mainFrameHasHorizontalScrollbar = hasHorizontalScrollbar;
4389 m_mainFrameHasVerticalScrollbar = hasVerticalScrollbar;
4391 m_pageClient->didChangeScrollbarsForMainFrame();
4394 void WebPageProxy::didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide)
4396 m_mainFrameIsPinnedToLeftSide = pinnedToLeftSide;
4397 m_mainFrameIsPinnedToRightSide = pinnedToRightSide;
4400 void WebPageProxy::didChangePageCount(unsigned pageCount)
4402 m_pageCount = pageCount;
4405 void WebPageProxy::didFailToInitializePlugin(const String& mimeType)
4407 m_loaderClient.didFailToInitializePlugin(this, mimeType);
4410 void WebPageProxy::didBlockInsecurePluginVersion(const String& mimeType, const String& urlString)
4412 String pluginIdentifier;
4413 String pluginVersion;
4414 String newMimeType = mimeType;
4417 PluginModuleInfo plugin = m_process->context()->pluginInfoStore().findPlugin(newMimeType, KURL(KURL(), urlString));
4419 pluginIdentifier = plugin.bundleIdentifier;
4420 pluginVersion = plugin.versionString;
4423 m_loaderClient.didBlockInsecurePluginVersion(this, newMimeType, pluginIdentifier, pluginVersion);
4426 bool WebPageProxy::willHandleHorizontalScrollEvents() const
4428 return !m_canShortCircuitHorizontalWheelEvents;
4431 void WebPageProxy::didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference& dataReference)
4433 m_pageClient->didFinishLoadingDataForCustomRepresentation(suggestedFilename, dataReference);
4436 void WebPageProxy::backForwardRemovedItem(uint64_t itemID)
4438 process()->send(Messages::WebPage::DidRemoveBackForwardItem(itemID), m_pageID);
4441 void WebPageProxy::setCanRunModal(bool canRunModal)
4446 // It's only possible to change the state for a WebPage which
4447 // already qualifies for running modal child web pages, otherwise
4448 // there's no other possibility than not allowing it.
4449 m_canRunModal = m_uiClient.canRunModal() && canRunModal;
4450 process()->send(Messages::WebPage::SetCanRunModal(m_canRunModal), m_pageID);
4453 bool WebPageProxy::canRunModal()
4455 return isValid() ? m_canRunModal : false;
4458 void WebPageProxy::beginPrinting(WebFrameProxy* frame, const PrintInfo& printInfo)
4460 if (m_isInPrintingMode)
4463 m_isInPrintingMode = true;
4464 process()->send(Messages::WebPage::BeginPrinting(frame->frameID(), printInfo), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
4467 void WebPageProxy::endPrinting()
4469 if (!m_isInPrintingMode)
4472 m_isInPrintingMode = false;
4473 process()->send(Messages::WebPage::EndPrinting(), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
4476 void WebPageProxy::computePagesForPrinting(WebFrameProxy* frame, const PrintInfo& printInfo, PassRefPtr<ComputedPagesCallback> prpCallback)
4478 RefPtr<ComputedPagesCallback> callback = prpCallback;
4480 callback->invalidate();
4484 uint64_t callbackID = callback->callbackID();
4485 m_computedPagesCallbacks.set(callbackID, callback.get());
4486 m_isInPrintingMode = true;
4487 process()->send(Messages::WebPage::ComputePagesForPrinting(frame->frameID(), printInfo, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
4490 #if PLATFORM(MAC) || PLATFORM(WIN)
4491 void WebPageProxy::drawRectToPDF(WebFrameProxy* frame, const PrintInfo& printInfo, const IntRect& rect, PassRefPtr<DataCallback> prpCallback)
4493 RefPtr<DataCallback> callback = prpCallback;
4495 callback->invalidate();
4499 uint64_t callbackID = callback->callbackID();
4500 m_dataCallbacks.set(callbackID, callback.get());
4501 process()->send(Messages::WebPage::DrawRectToPDF(frame->frameID(), printInfo, rect, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
4504 void WebPageProxy::drawPagesToPDF(WebFrameProxy* frame, const PrintInfo& printInfo, uint32_t first, uint32_t count, PassRefPtr<DataCallback> prpCallback)
4506 RefPtr<DataCallback> callback = prpCallback;
4508 callback->invalidate();
4512 uint64_t callbackID = callback->callbackID();
4513 m_dataCallbacks.set(callbackID, callback.get());
4514 process()->send(Messages::WebPage::DrawPagesToPDF(frame->frameID(), printInfo, first, count, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
4517 void WebPageProxy::drawPagesForPrinting(WebFrameProxy* frame, const PrintInfo& printInfo, PassRefPtr<PrintFinishedCallback> didPrintCallback)
4519 RefPtr<PrintFinishedCallback> callback = didPrintCallback;
4521 callback->invalidate();
4525 uint64_t callbackID = callback->callbackID();
4526 m_printFinishedCallbacks.set(callbackID, callback.get());
4527 m_isInPrintingMode = true;
4528 process()->send(Messages::WebPage::DrawPagesForPrinting(frame->frameID(), printInfo, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
4532 void WebPageProxy::flashBackingStoreUpdates(const Vector<IntRect>& updateRects)
4534 m_pageClient->flashBackingStoreUpdates(updateRects);
4537 void WebPageProxy::updateBackingStoreDiscardableState()
4543 if (!process()->responsivenessTimer()->isResponsive())
4544 isDiscardable = false;
4546 isDiscardable = !m_pageClient->isViewWindowActive() || !isViewVisible();
4548 m_drawingArea->setBackingStoreIsDiscardable(isDiscardable);
4551 Color WebPageProxy::viewUpdatesFlashColor()
4553 return Color(0, 200, 255);
4556 Color WebPageProxy::backingStoreUpdatesFlashColor()
4558 return Color(200, 0, 255);
4561 void WebPageProxy::saveDataToFileInDownloadsFolder(const String& suggestedFilename, const String& mimeType, const String& originatingURLString, WebData* data)
4563 m_uiClient.saveDataToFileInDownloadsFolder(this, suggestedFilename, mimeType, originatingURLString, data);
4566 void WebPageProxy::linkClicked(const String& url, const WebMouseEvent& event)
4568 process()->send(Messages::WebPage::LinkClicked(url, event), m_pageID, 0);
4573 void WebPageProxy::substitutionsPanelIsShowing(bool& isShowing)
4575 isShowing = TextChecker::substitutionsPanelIsShowing();
4578 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
4579 void WebPageProxy::showCorrectionPanel(int32_t panelType, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings)
4581 m_pageClient->showCorrectionPanel((AlternativeTextType)panelType, boundingBoxOfReplacedString, replacedString, replacementString, alternativeReplacementStrings);
4584 void WebPageProxy::dismissCorrectionPanel(int32_t reason)
4586 m_pageClient->dismissCorrectionPanel((ReasonForDismissingAlternativeText)reason);
4589 void WebPageProxy::dismissCorrectionPanelSoon(int32_t reason, String& result)
4591 result = m_pageClient->dismissCorrectionPanelSoon((ReasonForDismissingAlternativeText)reason);
4594 void WebPageProxy::recordAutocorrectionResponse(int32_t responseType, const String& replacedString, const String& replacementString)
4596 m_pageClient->recordAutocorrectionResponse((AutocorrectionResponseType)responseType, replacedString, replacementString);
4598 #endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
4600 void WebPageProxy::handleAlternativeTextUIResult(const String& result)
4602 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
4604 process()->send(Messages::WebPage::HandleAlternativeTextUIResult(result), m_pageID, 0);
4608 #if USE(DICTATION_ALTERNATIVES)
4609 void WebPageProxy::showDictationAlternativeUI(const WebCore::FloatRect& boundingBoxOfDictatedText, uint64_t dictationContext)
4611 m_pageClient->showDictationAlternativeUI(boundingBoxOfDictatedText, dictationContext);
4614 void WebPageProxy::dismissDictationAlternativeUI()
4616 m_pageClient->dismissDictationAlternativeUI();
4619 void WebPageProxy::removeDictationAlternatives(uint64_t dictationContext)
4621 m_pageClient->removeDictationAlternatives(dictationContext);
4624 void WebPageProxy::dictationAlternatives(uint64_t dictationContext, Vector<String>& result)
4626 result = m_pageClient->dictationAlternatives(dictationContext);
4630 #endif // PLATFORM(MAC)
4633 void WebPageProxy::didReceiveURIRequest(String uriString, uint64_t requestID)
4635 m_process->context()->soupRequestManagerProxy()->didReceiveURIRequest(uriString, this, requestID);
4639 #if ENABLE(TIZEN_PAGE_VISIBILITY_API)
4640 void WebPageProxy::setPageVisibility(WebCore::PageVisibilityState pageVisibilityState, bool isInitialState)
4642 process()->send(Messages::WebPage::SetVisibilityState(static_cast<uint32_t>(pageVisibilityState), isInitialState), m_pageID);
4646 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
4647 void WebPageProxy::decidePolicyForCertificateError(const String& url, const String& certificate, int error, PassRefPtr<Messages::WebPageProxy::DecidePolicyForCertificateError::DelayedReply> reply)
4649 m_allowedReply = reply;
4651 if (!m_tizenClient.decidePolicyForCertificateError(this, url, certificate, error))
4652 replyPolicyForCertificateError(true);
4656 #if ENABLE(TIZEN_NATIVE_MEMORY_SNAPSHOT)
4657 void WebPageProxy::dumpMemorySnapshot()
4659 process()->send(Messages::WebPage::DumpMemorySnapshot(), m_pageID);
4663 } // namespace WebKit