2 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Corporation. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
18 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
24 * THE POSSIBILITY OF SUCH DAMAGE.
28 #include "WebPageProxy.h"
30 #include "AuthenticationChallengeProxy.h"
31 #include "AuthenticationDecisionListener.h"
32 #include "DataReference.h"
33 #include "DownloadProxy.h"
34 #include "DrawingAreaProxy.h"
35 #include "EventDispatcherMessages.h"
36 #include "FindIndicator.h"
37 #include "ImmutableArray.h"
39 #include "MessageID.h"
40 #include "NativeWebKeyboardEvent.h"
41 #include "NativeWebMouseEvent.h"
42 #include "NativeWebWheelEvent.h"
43 #include "NotificationPermissionRequest.h"
44 #include "NotificationPermissionRequestManager.h"
45 #include "PageClient.h"
46 #include "PrintInfo.h"
47 #include "SessionState.h"
48 #include "StringPairVector.h"
49 #include "TextChecker.h"
50 #include "TextCheckerState.h"
51 #include "WKContextPrivate.h"
52 #include "WebBackForwardList.h"
53 #include "WebBackForwardListItem.h"
54 #include "WebCertificateInfo.h"
55 #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
56 #include "WebColorPickerResultListenerProxy.h"
58 #include "WebContext.h"
59 #include "WebContextMenuProxy.h"
60 #include "WebContextUserMessageCoders.h"
61 #include "WebCoreArgumentCoders.h"
63 #include "WebEditCommandProxy.h"
65 #include "WebFormSubmissionListenerProxy.h"
66 #include "WebFramePolicyListenerProxy.h"
67 #include "WebFullScreenManagerProxy.h"
68 #include "WebInspectorProxy.h"
69 #include "WebNotificationManagerProxy.h"
70 #include "WebOpenPanelResultListenerProxy.h"
71 #include "WebPageCreationParameters.h"
72 #include "WebPageGroup.h"
73 #include "WebPageGroupData.h"
74 #include "WebPageMessages.h"
75 #include "WebPopupItem.h"
76 #include "WebPopupMenuProxy.h"
77 #include "WebPreferences.h"
78 #include "WebProcessMessages.h"
79 #include "WebProcessProxy.h"
80 #include "WebProtectionSpace.h"
81 #include "WebSecurityOrigin.h"
82 #include "WebURLRequest.h"
83 #include <WebCore/DragController.h>
84 #include <WebCore/DragData.h>
85 #include <WebCore/DragSession.h>
86 #include <WebCore/FloatRect.h>
87 #include <WebCore/FocusDirection.h>
88 #include <WebCore/MIMETypeRegistry.h>
89 #include <WebCore/TextCheckerClient.h>
90 #include <WebCore/WindowFeatures.h>
93 #if ENABLE(WEB_INTENTS)
94 #include "IntentData.h"
95 #include "IntentServiceInfo.h"
96 #include "WebIntentData.h"
97 #include "WebIntentServiceInfo.h"
100 #if USE(UI_SIDE_COMPOSITING)
101 #include "LayerTreeCoordinatorProxyMessages.h"
105 #include "ArgumentCodersQt.h"
109 #include "ArgumentCodersGtk.h"
112 #if ENABLE(TIZEN_DRAG_SUPPORT)
113 #include "ArgumentCodersTizen.h"
117 #include <wtf/RefCountedLeakCounter.h>
120 #if ENABLE(TIZEN_ISF_PORT) || ENABLE(TIZEN_GESTURE)
121 #include "ewk_view_private.h"
124 // This controls what strategy we use for mouse wheel coalescing.
125 #define MERGE_WHEEL_EVENTS 1
127 #define MESSAGE_CHECK(assertion) MESSAGE_CHECK_BASE(assertion, m_process->connection())
128 #define MESSAGE_CHECK_URL(url) MESSAGE_CHECK_BASE(m_process->checkURLReceivedFromWebProcess(url), m_process->connection())
130 using namespace WebCore;
132 // Represents the number of wheel events we can hold in the queue before we start pushing them preemptively.
133 static const unsigned wheelEventQueueSizeThreshold = 10;
137 WKPageDebugPaintFlags WebPageProxy::s_debugPaintFlags = 0;
139 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, webPageProxyCounter, ("WebPageProxy"));
142 static const char* webKeyboardEventTypeString(WebEvent::Type type)
145 case WebEvent::KeyDown:
148 case WebEvent::KeyUp:
151 case WebEvent::RawKeyDown:
158 ASSERT_NOT_REACHED();
162 #endif // !LOG_DISABLED
164 PassRefPtr<WebPageProxy> WebPageProxy::create(PageClient* pageClient, PassRefPtr<WebProcessProxy> process, WebPageGroup* pageGroup, uint64_t pageID)
166 return adoptRef(new WebPageProxy(pageClient, process, pageGroup, pageID));
169 WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> process, WebPageGroup* pageGroup, uint64_t pageID)
170 : m_pageClient(pageClient)
172 , m_pageGroup(pageGroup)
174 , m_userAgent(standardUserAgent())
175 , m_geolocationPermissionRequestManager(this)
176 , m_notificationPermissionRequestManager(this)
177 #if ENABLE(TIZEN_MEDIA_STREAM)
178 , m_userMediaPermissionRequestManager(this)
180 , m_estimatedProgress(0)
181 , m_isInWindow(m_pageClient->isViewInWindow())
182 , m_isVisible(m_pageClient->isViewVisible())
183 , m_backForwardList(WebBackForwardList::create(this))
184 , m_loadStateAtProcessExit(WebFrameProxy::LoadStateFinished)
185 , m_textZoomFactor(1)
186 , m_pageZoomFactor(1)
187 , m_pageScaleFactor(1)
188 , m_intrinsicDeviceScaleFactor(1)
189 , m_customDeviceScaleFactor(0)
190 #if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
191 , m_layerHostingMode(LayerHostingModeInWindowServer)
193 , m_layerHostingMode(LayerHostingModeDefault)
195 , m_drawsBackground(true)
196 , m_drawsTransparentBackground(false)
197 , m_areMemoryCacheClientCallsEnabled(true)
198 , m_useFixedLayout(false)
199 , m_paginationMode(Page::Pagination::Unpaginated)
200 , m_paginationBehavesLikeColumns(false)
202 , m_gapBetweenPages(0)
205 , m_canRunModal(false)
206 , m_isInPrintingMode(false)
207 , m_isPerformingDOMPrintOperation(false)
208 , m_inDecidePolicyForResponse(false)
209 , m_syncMimeTypePolicyActionIsValid(false)
210 , m_syncMimeTypePolicyAction(PolicyUse)
211 , m_syncMimeTypePolicyDownloadID(0)
212 , m_inDecidePolicyForNavigationAction(false)
213 , m_syncNavigationActionPolicyActionIsValid(false)
214 , m_syncNavigationActionPolicyAction(PolicyUse)
215 , m_syncNavigationActionPolicyDownloadID(0)
216 , m_processingMouseMoveEvent(false)
217 #if ENABLE(TOUCH_EVENTS)
218 , m_needTouchEvents(false)
220 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
221 , m_askOverflow(true)
224 , m_isPageSuspended(false)
226 , m_isSmartInsertDeleteEnabled(TextChecker::isSmartInsertDeleteEnabled())
228 , m_spellDocumentTag(0)
229 , m_hasSpellDocumentTag(false)
230 , m_pendingLearnOrIgnoreWordMessageCount(0)
231 , m_mainFrameHasCustomRepresentation(false)
232 , m_mainFrameHasHorizontalScrollbar(false)
233 , m_mainFrameHasVerticalScrollbar(false)
234 , m_canShortCircuitHorizontalWheelEvents(true)
235 , m_mainFrameIsPinnedToLeftSide(false)
236 , m_mainFrameIsPinnedToRightSide(false)
238 , m_renderTreeSize(0)
239 , m_shouldSendEventsSynchronously(false)
240 , m_suppressVisibilityUpdates(false)
242 #if ENABLE(PAGE_VISIBILITY_API)
243 , m_visibilityState(PageVisibilityStateVisible)
245 #if ENABLE(TIZEN_REDUCE_KEY_LAGGING)
246 , m_pageContentResumeTimer(0)
248 #if ENABLE(TIZEN_ISF_PORT)
249 , m_didCancelCompositionFromWebProcess(false)
253 webPageProxyCounter.increment();
256 WebContext::statistics().wkPageCount++;
258 m_pageGroup->addPage(this);
261 WebPageProxy::~WebPageProxy()
266 WebContext::statistics().wkPageCount--;
268 if (m_hasSpellDocumentTag)
269 TextChecker::closeSpellDocumentWithTag(m_spellDocumentTag);
271 m_pageGroup->removePage(this);
274 webPageProxyCounter.decrement();
276 #if ENABLE(TIZEN_REDUCE_KEY_LAGGING)
277 if (m_pageContentResumeTimer)
278 ecore_timer_del(m_pageContentResumeTimer);
282 WebProcessProxy* WebPageProxy::process() const
284 return m_process.get();
287 PlatformProcessIdentifier WebPageProxy::processIdentifier() const
292 return m_process->processIdentifier();
295 bool WebPageProxy::isValid()
297 // A page that has been explicitly closed is never valid.
304 void WebPageProxy::initializeLoaderClient(const WKPageLoaderClient* loadClient)
306 m_loaderClient.initialize(loadClient);
311 process()->send(Messages::WebPage::SetWillGoToBackForwardItemCallbackEnabled(loadClient->version > 0), m_pageID);
314 void WebPageProxy::initializePolicyClient(const WKPagePolicyClient* policyClient)
316 m_policyClient.initialize(policyClient);
319 void WebPageProxy::initializeFormClient(const WKPageFormClient* formClient)
321 m_formClient.initialize(formClient);
324 void WebPageProxy::initializeResourceLoadClient(const WKPageResourceLoadClient* client)
326 m_resourceLoadClient.initialize(client);
329 void WebPageProxy::initializeUIClient(const WKPageUIClient* client)
334 m_uiClient.initialize(client);
336 process()->send(Messages::WebPage::SetCanRunBeforeUnloadConfirmPanel(m_uiClient.canRunBeforeUnloadConfirmPanel()), m_pageID);
337 setCanRunModal(m_uiClient.canRunModal());
340 void WebPageProxy::initializeFindClient(const WKPageFindClient* client)
342 m_findClient.initialize(client);
345 void WebPageProxy::initializeFindMatchesClient(const WKPageFindMatchesClient* client)
347 m_findMatchesClient.initialize(client);
350 #if ENABLE(CONTEXT_MENUS)
351 void WebPageProxy::initializeContextMenuClient(const WKPageContextMenuClient* client)
353 m_contextMenuClient.initialize(client);
357 void WebPageProxy::reattachToWebProcess()
363 m_process = m_process->context()->relaunchProcessIfNecessary();
364 process()->addExistingWebPage(this, m_pageID);
368 m_pageClient->didRelaunchProcess();
369 m_drawingArea->waitForBackingStoreUpdateOnNextPaint();
372 void WebPageProxy::reattachToWebProcessWithItem(WebBackForwardListItem* item)
374 if (item && item != m_backForwardList->currentItem())
375 m_backForwardList->goToItem(item);
377 reattachToWebProcess();
382 process()->send(Messages::WebPage::GoToBackForwardItem(item->itemID()), m_pageID);
383 process()->responsivenessTimer()->start();
386 void WebPageProxy::initializeWebPage()
390 BackForwardListItemVector items = m_backForwardList->entries();
391 for (size_t i = 0; i < items.size(); ++i)
392 process()->registerNewWebBackForwardListItem(items[i].get());
394 m_drawingArea = m_pageClient->createDrawingAreaProxy();
395 ASSERT(m_drawingArea);
397 #if ENABLE(INSPECTOR_SERVER)
398 if (m_pageGroup->preferences()->developerExtrasEnabled())
399 inspector()->enableRemoteInspection();
402 process()->send(Messages::WebProcess::CreateWebPage(m_pageID, creationParameters()), 0);
404 #if ENABLE(PAGE_VISIBILITY_API)
405 process()->send(Messages::WebPage::SetVisibilityState(m_visibilityState, /* isInitialState */ true), m_pageID);
409 void WebPageProxy::close()
416 m_backForwardList->pageClosed();
417 m_pageClient->pageClosed();
419 process()->disconnectFramesFromPage(this);
422 #if ENABLE(INSPECTOR)
424 m_inspector->invalidate();
429 #if ENABLE(FULLSCREEN_API)
430 if (m_fullScreenManager) {
431 m_fullScreenManager->invalidate();
432 m_fullScreenManager = 0;
436 if (m_openPanelResultListener) {
437 m_openPanelResultListener->invalidate();
438 m_openPanelResultListener = 0;
441 #if ENABLE(INPUT_TYPE_COLOR)
442 if (m_colorChooser) {
443 m_colorChooser->invalidate();
444 m_colorChooser = nullptr;
447 #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
448 if (m_colorPickerResultListener) {
449 m_colorPickerResultListener->invalidate();
450 m_colorPickerResultListener = nullptr;
455 #if ENABLE(GEOLOCATION)
456 m_geolocationPermissionRequestManager.invalidateRequests();
459 m_notificationPermissionRequestManager.invalidateRequests();
460 #if ENABLE(TIZEN_MEDIA_STREAM)
461 m_userMediaPermissionRequestManager.invalidateRequests();
464 m_toolTip = String();
466 m_mainFrameHasHorizontalScrollbar = false;
467 m_mainFrameHasVerticalScrollbar = false;
469 m_mainFrameIsPinnedToLeftSide = false;
470 m_mainFrameIsPinnedToRightSide = false;
472 m_visibleScrollerThumbRect = IntRect();
474 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
475 invalidateCallbackMap(m_booleanCallbacks);
476 invalidateCallbackMap(m_dictionaryCallbacks);
478 invalidateCallbackMap(m_voidCallbacks);
479 invalidateCallbackMap(m_dataCallbacks);
480 invalidateCallbackMap(m_stringCallbacks);
481 m_loadDependentStringCallbackIDs.clear();
482 invalidateCallbackMap(m_scriptValueCallbacks);
483 invalidateCallbackMap(m_computedPagesCallbacks);
485 invalidateCallbackMap(m_printFinishedCallbacks);
488 Vector<WebEditCommandProxy*> editCommandVector;
489 copyToVector(m_editCommandSet, editCommandVector);
490 m_editCommandSet.clear();
491 for (size_t i = 0, size = editCommandVector.size(); i < size; ++i)
492 editCommandVector[i]->invalidate();
494 m_activePopupMenu = 0;
496 m_estimatedProgress = 0.0;
498 m_loaderClient.initialize(0);
499 m_policyClient.initialize(0);
500 m_uiClient.initialize(0);
502 m_drawingArea = nullptr;
504 process()->send(Messages::WebPage::Close(), m_pageID);
505 process()->removeWebPage(m_pageID);
508 bool WebPageProxy::tryClose()
513 process()->send(Messages::WebPage::TryClose(), m_pageID);
514 process()->responsivenessTimer()->start();
518 bool WebPageProxy::maybeInitializeSandboxExtensionHandle(const KURL& url, SandboxExtension::Handle& sandboxExtensionHandle)
520 if (!url.isLocalFile())
523 #if ENABLE(INSPECTOR)
524 // Don't give the inspector full access to the file system.
525 if (WebInspectorProxy::isInspectorPage(this))
529 SandboxExtension::createHandle("/", SandboxExtension::ReadOnly, sandboxExtensionHandle);
533 void WebPageProxy::loadURL(const String& url)
535 setPendingAPIRequestURL(url);
538 reattachToWebProcess();
540 SandboxExtension::Handle sandboxExtensionHandle;
541 bool createdExtension = maybeInitializeSandboxExtensionHandle(KURL(KURL(), url), sandboxExtensionHandle);
542 if (createdExtension)
543 process()->willAcquireUniversalFileReadSandboxExtension();
544 process()->send(Messages::WebPage::LoadURL(url, sandboxExtensionHandle), m_pageID);
545 process()->responsivenessTimer()->start();
548 void WebPageProxy::loadURLRequest(WebURLRequest* urlRequest)
550 setPendingAPIRequestURL(urlRequest->resourceRequest().url());
553 reattachToWebProcess();
555 SandboxExtension::Handle sandboxExtensionHandle;
556 bool createdExtension = maybeInitializeSandboxExtensionHandle(urlRequest->resourceRequest().url(), sandboxExtensionHandle);
557 if (createdExtension)
558 process()->willAcquireUniversalFileReadSandboxExtension();
559 process()->send(Messages::WebPage::LoadURLRequest(urlRequest->resourceRequest(), sandboxExtensionHandle), m_pageID);
560 process()->responsivenessTimer()->start();
563 void WebPageProxy::loadHTMLString(const String& htmlString, const String& baseURL)
566 reattachToWebProcess();
568 process()->assumeReadAccessToBaseURL(baseURL);
569 process()->send(Messages::WebPage::LoadHTMLString(htmlString, baseURL), m_pageID);
570 process()->responsivenessTimer()->start();
573 void WebPageProxy::loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL)
576 reattachToWebProcess();
579 m_mainFrame->setUnreachableURL(unreachableURL);
581 process()->assumeReadAccessToBaseURL(baseURL);
582 process()->send(Messages::WebPage::LoadAlternateHTMLString(htmlString, baseURL, unreachableURL), m_pageID);
583 process()->responsivenessTimer()->start();
586 void WebPageProxy::loadPlainTextString(const String& string)
589 reattachToWebProcess();
591 process()->send(Messages::WebPage::LoadPlainTextString(string), m_pageID);
592 process()->responsivenessTimer()->start();
595 void WebPageProxy::loadWebArchiveData(const WebData* webArchiveData)
598 reattachToWebProcess();
600 process()->send(Messages::WebPage::LoadWebArchiveData(webArchiveData->dataReference()), m_pageID);
601 process()->responsivenessTimer()->start();
605 void WebPageProxy::loadContentsbyMimeType(const WebData* contents, const String& mimeType, const String& encoding, const String& baseURL)
608 reattachToWebProcess();
610 process()->assumeReadAccessToBaseURL(baseURL);
611 process()->send(Messages::WebPage::LoadContentsbyMimeType(contents->dataReference(), mimeType, encoding, baseURL), m_pageID);
612 process()->responsivenessTimer()->start();
616 void WebPageProxy::stopLoading()
621 process()->send(Messages::WebPage::StopLoading(), m_pageID);
622 process()->responsivenessTimer()->start();
625 void WebPageProxy::reload(bool reloadFromOrigin)
627 SandboxExtension::Handle sandboxExtensionHandle;
629 if (m_backForwardList->currentItem()) {
630 String url = m_backForwardList->currentItem()->url();
631 setPendingAPIRequestURL(url);
633 // We may not have an extension yet if back/forward list was reinstated after a WebProcess crash or a browser relaunch
634 bool createdExtension = maybeInitializeSandboxExtensionHandle(KURL(KURL(), url), sandboxExtensionHandle);
635 if (createdExtension)
636 process()->willAcquireUniversalFileReadSandboxExtension();
640 reattachToWebProcessWithItem(m_backForwardList->currentItem());
644 process()->send(Messages::WebPage::Reload(reloadFromOrigin, sandboxExtensionHandle), m_pageID);
645 process()->responsivenessTimer()->start();
648 void WebPageProxy::goForward()
650 if (isValid() && !canGoForward())
653 WebBackForwardListItem* forwardItem = m_backForwardList->forwardItem();
657 setPendingAPIRequestURL(forwardItem->url());
660 reattachToWebProcessWithItem(forwardItem);
664 process()->send(Messages::WebPage::GoForward(forwardItem->itemID()), m_pageID);
665 process()->responsivenessTimer()->start();
668 bool WebPageProxy::canGoForward() const
670 return m_backForwardList->forwardItem();
673 void WebPageProxy::goBack()
675 if (isValid() && !canGoBack())
678 WebBackForwardListItem* backItem = m_backForwardList->backItem();
682 setPendingAPIRequestURL(backItem->url());
685 reattachToWebProcessWithItem(backItem);
689 process()->send(Messages::WebPage::GoBack(backItem->itemID()), m_pageID);
690 process()->responsivenessTimer()->start();
693 bool WebPageProxy::canGoBack() const
695 return m_backForwardList->backItem();
698 void WebPageProxy::goToBackForwardItem(WebBackForwardListItem* item)
701 reattachToWebProcessWithItem(item);
705 setPendingAPIRequestURL(item->url());
707 process()->send(Messages::WebPage::GoToBackForwardItem(item->itemID()), m_pageID);
708 process()->responsivenessTimer()->start();
711 void WebPageProxy::tryRestoreScrollPosition()
716 process()->send(Messages::WebPage::TryRestoreScrollPosition(), m_pageID);
719 void WebPageProxy::didChangeBackForwardList(WebBackForwardListItem* added, Vector<RefPtr<APIObject> >* removed)
721 m_loaderClient.didChangeBackForwardList(this, added, removed);
724 void WebPageProxy::shouldGoToBackForwardListItem(uint64_t itemID, bool& shouldGoToBackForwardItem)
726 WebBackForwardListItem* item = process()->webBackForwardItem(itemID);
727 shouldGoToBackForwardItem = item && m_loaderClient.shouldGoToBackForwardListItem(this, item);
730 void WebPageProxy::willGoToBackForwardListItem(uint64_t itemID, CoreIPC::ArgumentDecoder* arguments)
732 RefPtr<APIObject> userData;
733 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
734 if (!arguments->decode(messageDecoder))
737 if (WebBackForwardListItem* item = process()->webBackForwardItem(itemID))
738 m_loaderClient.willGoToBackForwardListItem(this, item, userData.get());
741 String WebPageProxy::activeURL() const
743 // If there is a currently pending url, it is the active URL,
744 // even when there's no main frame yet, as it might be the
745 // first API request.
746 if (!m_pendingAPIRequestURL.isNull())
747 return m_pendingAPIRequestURL;
752 if (!m_mainFrame->unreachableURL().isEmpty())
753 return m_mainFrame->unreachableURL();
755 switch (m_mainFrame->loadState()) {
756 case WebFrameProxy::LoadStateProvisional:
757 return m_mainFrame->provisionalURL();
758 case WebFrameProxy::LoadStateCommitted:
759 case WebFrameProxy::LoadStateFinished:
760 return m_mainFrame->url();
763 ASSERT_NOT_REACHED();
767 String WebPageProxy::provisionalURL() const
771 return m_mainFrame->provisionalURL();
774 String WebPageProxy::committedURL() const
779 return m_mainFrame->url();
782 bool WebPageProxy::canShowMIMEType(const String& mimeType) const
784 if (MIMETypeRegistry::canShowMIMEType(mimeType))
787 String newMimeType = mimeType;
788 PluginModuleInfo plugin = m_process->context()->pluginInfoStore().findPlugin(newMimeType, KURL());
789 if (!plugin.path.isNull() && m_pageGroup->preferences()->pluginsEnabled())
795 void WebPageProxy::setDrawsBackground(bool drawsBackground)
797 if (m_drawsBackground == drawsBackground)
800 m_drawsBackground = drawsBackground;
803 process()->send(Messages::WebPage::SetDrawsBackground(drawsBackground), m_pageID);
806 void WebPageProxy::setDrawsTransparentBackground(bool drawsTransparentBackground)
808 if (m_drawsTransparentBackground == drawsTransparentBackground)
811 m_drawsTransparentBackground = drawsTransparentBackground;
814 process()->send(Messages::WebPage::SetDrawsTransparentBackground(drawsTransparentBackground), m_pageID);
817 void WebPageProxy::viewWillStartLiveResize()
821 process()->send(Messages::WebPage::ViewWillStartLiveResize(), m_pageID);
824 void WebPageProxy::viewWillEndLiveResize()
828 process()->send(Messages::WebPage::ViewWillEndLiveResize(), m_pageID);
831 void WebPageProxy::setViewNeedsDisplay(const IntRect& rect)
833 m_pageClient->setViewNeedsDisplay(rect);
836 void WebPageProxy::displayView()
838 m_pageClient->displayView();
841 void WebPageProxy::scrollView(const IntRect& scrollRect, const IntSize& scrollOffset)
843 m_pageClient->scrollView(scrollRect, scrollOffset);
846 void WebPageProxy::viewStateDidChange(ViewStateFlags flags)
851 if (flags & ViewIsFocused)
852 process()->send(Messages::WebPage::SetFocused(m_pageClient->isViewFocused()), m_pageID);
854 if (flags & ViewWindowIsActive)
855 process()->send(Messages::WebPage::SetActive(m_pageClient->isViewWindowActive()), m_pageID);
857 if (flags & ViewIsVisible) {
858 bool isVisible = m_pageClient->isViewVisible();
859 if (isVisible != m_isVisible) {
860 m_isVisible = isVisible;
861 m_drawingArea->visibilityDidChange();
864 // If we've started the responsiveness timer as part of telling the web process to update the backing store
865 // state, it might not send back a reply (since it won't paint anything if the web page is hidden) so we
866 // stop the unresponsiveness timer here.
867 process()->responsivenessTimer()->stop();
872 if (flags & ViewIsInWindow) {
873 bool isInWindow = m_pageClient->isViewInWindow();
874 if (m_isInWindow != isInWindow) {
875 m_isInWindow = isInWindow;
876 process()->send(Messages::WebPage::SetIsInWindow(isInWindow), m_pageID);
880 LayerHostingMode layerHostingMode = m_pageClient->viewLayerHostingMode();
881 if (m_layerHostingMode != layerHostingMode) {
882 m_layerHostingMode = layerHostingMode;
883 m_drawingArea->layerHostingModeDidChange();
888 #if ENABLE(PAGE_VISIBILITY_API)
889 PageVisibilityState visibilityState = PageVisibilityStateHidden;
891 if (m_pageClient->isViewVisible())
892 visibilityState = PageVisibilityStateVisible;
894 if (visibilityState != m_visibilityState) {
895 m_visibilityState = visibilityState;
896 process()->send(Messages::WebPage::SetVisibilityState(visibilityState, false), m_pageID);
900 updateBackingStoreDiscardableState();
903 IntSize WebPageProxy::viewSize() const
905 return m_pageClient->viewSize();
908 void WebPageProxy::setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent& keyboardEvent)
912 process()->send(Messages::WebPage::SetInitialFocus(forward, isKeyboardEventValid, keyboardEvent), m_pageID);
915 void WebPageProxy::setWindowResizerSize(const IntSize& windowResizerSize)
919 process()->send(Messages::WebPage::SetWindowResizerSize(windowResizerSize), m_pageID);
922 void WebPageProxy::clearSelection()
926 process()->send(Messages::WebPage::ClearSelection(), m_pageID);
929 void WebPageProxy::validateCommand(const String& commandName, PassRefPtr<ValidateCommandCallback> callback)
932 callback->invalidate();
936 uint64_t callbackID = callback->callbackID();
937 m_validateCommandCallbacks.set(callbackID, callback.get());
938 process()->send(Messages::WebPage::ValidateCommand(commandName, callbackID), m_pageID);
941 void WebPageProxy::setMaintainsInactiveSelection(bool newValue)
943 m_maintainsInactiveSelection = newValue;
946 void WebPageProxy::executeEditCommand(const String& commandName)
951 DEFINE_STATIC_LOCAL(String, ignoreSpellingCommandName, ("ignoreSpelling"));
952 if (commandName == ignoreSpellingCommandName)
953 ++m_pendingLearnOrIgnoreWordMessageCount;
955 process()->send(Messages::WebPage::ExecuteEditCommand(commandName), m_pageID);
958 #if USE(TILED_BACKING_STORE)
959 void WebPageProxy::setViewportSize(const IntSize& size)
964 process()->send(Messages::WebPage::SetViewportSize(size), m_pageID);
968 #if ENABLE(DRAG_SUPPORT)
969 void WebPageProxy::dragEntered(DragData* dragData, const String& dragStorageName)
971 SandboxExtension::Handle sandboxExtensionHandle;
972 SandboxExtension::HandleArray sandboxExtensionHandleEmptyArray;
973 performDragControllerAction(DragControllerActionEntered, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionHandleEmptyArray);
976 void WebPageProxy::dragUpdated(DragData* dragData, const String& dragStorageName)
978 SandboxExtension::Handle sandboxExtensionHandle;
979 SandboxExtension::HandleArray sandboxExtensionHandleEmptyArray;
980 performDragControllerAction(DragControllerActionUpdated, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionHandleEmptyArray);
983 void WebPageProxy::dragExited(DragData* dragData, const String& dragStorageName)
985 SandboxExtension::Handle sandboxExtensionHandle;
986 SandboxExtension::HandleArray sandboxExtensionHandleEmptyArray;
987 performDragControllerAction(DragControllerActionExited, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionHandleEmptyArray);
990 #if ENABLE(TIZEN_DRAG_SUPPORT)
991 void WebPageProxy::performDrag(DragData* dragData, const String& dragStorageName)
993 void WebPageProxy::performDrag(DragData* dragData, const String& dragStorageName, const SandboxExtension::Handle& sandboxExtensionHandle, const SandboxExtension::HandleArray& sandboxExtensionsForUpload)
996 #if ENABLE(TIZEN_DRAG_SUPPORT)
997 TIZEN_LOGI("dragData (%p)", dragData);
998 SandboxExtension::Handle sandboxExtensionHandle;
999 SandboxExtension::HandleArray sandboxExtensionHandleEmptyArray;
1000 performDragControllerAction(DragControllerActionPerformDrag, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionHandleEmptyArray);
1002 performDragControllerAction(DragControllerActionPerformDrag, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionsForUpload);
1006 void WebPageProxy::performDragControllerAction(DragControllerAction action, DragData* dragData, const String& dragStorageName, const SandboxExtension::Handle& sandboxExtensionHandle, const SandboxExtension::HandleArray& sandboxExtensionsForUpload)
1011 // FIXME: We should pass the drag data map only on DragEnter.
1012 process()->send(Messages::WebPage::PerformDragControllerAction(action, dragData->clientPosition(), dragData->globalPosition(),
1013 dragData->draggingSourceOperationMask(), dragData->dragDataMap(), dragData->flags()), m_pageID);
1014 #elif PLATFORM(QT) || PLATFORM(GTK) || ENABLE(TIZEN_DRAG_SUPPORT)
1015 process()->send(Messages::WebPage::PerformDragControllerAction(action, *dragData), m_pageID);
1017 process()->send(Messages::WebPage::PerformDragControllerAction(action, dragData->clientPosition(), dragData->globalPosition(), dragData->draggingSourceOperationMask(), dragStorageName, dragData->flags(), sandboxExtensionHandle, sandboxExtensionsForUpload), m_pageID);
1021 void WebPageProxy::didPerformDragControllerAction(WebCore::DragSession dragSession)
1023 m_currentDragSession = dragSession;
1026 #if PLATFORM(QT) || PLATFORM(GTK) || ENABLE(TIZEN_DRAG_SUPPORT)
1027 void WebPageProxy::startDrag(const DragData& dragData, const ShareableBitmap::Handle& dragImageHandle)
1029 TIZEN_LOGI("dragData (%p)", dragData);
1030 RefPtr<ShareableBitmap> dragImage = 0;
1031 if (!dragImageHandle.isNull()) {
1032 dragImage = ShareableBitmap::create(dragImageHandle);
1037 m_pageClient->startDrag(dragData, dragImage.release());
1041 void WebPageProxy::dragEnded(const IntPoint& clientPosition, const IntPoint& globalPosition, uint64_t operation)
1043 TIZEN_LOGI("clientPosition (%p)", clientPosition);
1046 process()->send(Messages::WebPage::DragEnded(clientPosition, globalPosition, operation), m_pageID);
1048 #endif // ENABLE(DRAG_SUPPORT)
1050 void WebPageProxy::handleMouseEvent(const NativeWebMouseEvent& event)
1055 // NOTE: This does not start the responsiveness timer because mouse move should not indicate interaction.
1056 if (event.type() != WebEvent::MouseMove)
1057 process()->responsivenessTimer()->start();
1059 if (m_processingMouseMoveEvent) {
1060 m_nextMouseMoveEvent = adoptPtr(new NativeWebMouseEvent(event));
1064 m_processingMouseMoveEvent = true;
1067 // <https://bugs.webkit.org/show_bug.cgi?id=57904> We need to keep track of the mouse down event in the case where we
1068 // display a popup menu for select elements. When the user changes the selected item,
1069 // we fake a mouse up event by using this stored down event. This event gets cleared
1070 // when the mouse up message is received from WebProcess.
1071 if (event.type() == WebEvent::MouseDown)
1072 m_currentlyProcessedMouseDownEvent = adoptPtr(new NativeWebMouseEvent(event));
1074 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
1075 // We have to hide text-selection's context menu when other area is clicked.
1076 // In case of normal context menu, it is hided by elm_ctxpopup's logic.
1077 if (event.type() == WebEvent::MouseDown)
1081 if (m_shouldSendEventsSynchronously) {
1082 bool handled = false;
1083 process()->sendSync(Messages::WebPage::MouseEventSyncForTesting(event), Messages::WebPage::MouseEventSyncForTesting::Reply(handled), m_pageID);
1084 didReceiveEvent(event.type(), handled);
1086 process()->send(Messages::WebPage::MouseEvent(event), m_pageID);
1089 #if MERGE_WHEEL_EVENTS
1090 static bool canCoalesce(const WebWheelEvent& a, const WebWheelEvent& b)
1092 if (a.position() != b.position())
1094 if (a.globalPosition() != b.globalPosition())
1096 if (a.modifiers() != b.modifiers())
1098 if (a.granularity() != b.granularity())
1101 if (a.phase() != b.phase())
1103 if (a.momentumPhase() != b.momentumPhase())
1105 if (a.hasPreciseScrollingDeltas() != b.hasPreciseScrollingDeltas())
1112 static WebWheelEvent coalesce(const WebWheelEvent& a, const WebWheelEvent& b)
1114 ASSERT(canCoalesce(a, b));
1116 FloatSize mergedDelta = a.delta() + b.delta();
1117 FloatSize mergedWheelTicks = a.wheelTicks() + b.wheelTicks();
1120 FloatSize mergedUnacceleratedScrollingDelta = a.unacceleratedScrollingDelta() + b.unacceleratedScrollingDelta();
1122 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());
1124 return WebWheelEvent(WebEvent::Wheel, b.position(), b.globalPosition(), mergedDelta, mergedWheelTicks, b.granularity(), b.modifiers(), b.timestamp());
1127 #endif // MERGE_WHEEL_EVENTS
1129 static WebWheelEvent coalescedWheelEvent(Deque<NativeWebWheelEvent>& queue, Vector<NativeWebWheelEvent>& coalescedEvents)
1131 ASSERT(!queue.isEmpty());
1132 ASSERT(coalescedEvents.isEmpty());
1134 #if MERGE_WHEEL_EVENTS
1135 NativeWebWheelEvent firstEvent = queue.takeFirst();
1136 coalescedEvents.append(firstEvent);
1138 WebWheelEvent event = firstEvent;
1139 while (!queue.isEmpty() && canCoalesce(event, queue.first())) {
1140 NativeWebWheelEvent firstEvent = queue.takeFirst();
1141 coalescedEvents.append(firstEvent);
1142 event = coalesce(event, firstEvent);
1147 while (!queue.isEmpty())
1148 coalescedEvents.append(queue.takeFirst());
1149 return coalescedEvents.last();
1153 void WebPageProxy::handleWheelEvent(const NativeWebWheelEvent& event)
1158 if (!m_currentlyProcessedWheelEvents.isEmpty()) {
1159 m_wheelEventQueue.append(event);
1160 if (m_wheelEventQueue.size() < wheelEventQueueSizeThreshold)
1162 // The queue has too many wheel events, so push a new event.
1165 if (!m_wheelEventQueue.isEmpty()) {
1166 processNextQueuedWheelEvent();
1170 OwnPtr<Vector<NativeWebWheelEvent> > coalescedWheelEvent = adoptPtr(new Vector<NativeWebWheelEvent>);
1171 coalescedWheelEvent->append(event);
1172 m_currentlyProcessedWheelEvents.append(coalescedWheelEvent.release());
1173 sendWheelEvent(event);
1176 void WebPageProxy::processNextQueuedWheelEvent()
1178 OwnPtr<Vector<NativeWebWheelEvent> > nextCoalescedEvent = adoptPtr(new Vector<NativeWebWheelEvent>);
1179 WebWheelEvent nextWheelEvent = coalescedWheelEvent(m_wheelEventQueue, *nextCoalescedEvent.get());
1180 m_currentlyProcessedWheelEvents.append(nextCoalescedEvent.release());
1181 sendWheelEvent(nextWheelEvent);
1184 void WebPageProxy::sendWheelEvent(const WebWheelEvent& event)
1186 process()->responsivenessTimer()->start();
1188 if (m_shouldSendEventsSynchronously) {
1189 bool handled = false;
1190 process()->sendSync(Messages::WebPage::WheelEventSyncForTesting(event), Messages::WebPage::WheelEventSyncForTesting::Reply(handled), m_pageID);
1191 didReceiveEvent(event.type(), handled);
1195 process()->send(Messages::EventDispatcher::WheelEvent(m_pageID, event, canGoBack(), canGoForward()), 0);
1198 void WebPageProxy::handleKeyboardEvent(const NativeWebKeyboardEvent& event)
1203 LOG(KeyHandling, "WebPageProxy::handleKeyboardEvent: %s", webKeyboardEventTypeString(event.type()));
1205 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1206 if (!isWaitingForJavaScriptPopupReply()) {
1207 m_keyEventQueue.append(event);
1209 process()->responsivenessTimer()->start();
1210 if (m_shouldSendEventsSynchronously) {
1211 bool handled = false;
1212 process()->sendSync(Messages::WebPage::KeyEventSyncForTesting(event), Messages::WebPage::KeyEventSyncForTesting::Reply(handled), m_pageID);
1213 didReceiveEvent(event.type(), handled);
1215 process()->send(Messages::WebPage::KeyEvent(event), m_pageID);
1217 if (m_keyEventQueue.isEmpty()) {
1218 bool handled = false;
1219 m_pageClient->doneWithKeyEvent(event, handled);
1221 QueuedUIEvents<NativeWebKeyboardEvent>& lastEvent = m_keyEventQueue.last();
1222 lastEvent.deferredEvents.append(event);
1226 m_keyEventQueue.append(event);
1228 process()->responsivenessTimer()->start();
1229 if (m_shouldSendEventsSynchronously) {
1230 bool handled = false;
1231 process()->sendSync(Messages::WebPage::KeyEventSyncForTesting(event), Messages::WebPage::KeyEventSyncForTesting::Reply(handled), m_pageID);
1232 didReceiveEvent(event.type(), handled);
1233 } else if (m_keyEventQueue.size() == 1) // Otherwise, sent from DidReceiveEvent message handler.
1234 process()->send(Messages::WebPage::KeyEvent(event), m_pageID);
1238 #if ENABLE(GESTURE_EVENTS)
1239 void WebPageProxy::handleGestureEvent(const WebGestureEvent& event)
1244 #if ENABLE(TIZEN_ISF_PORT)
1245 if (event.type() == WebEvent::GestureSingleTap)
1246 ewk_view_imf_context_reset(viewWidget());
1249 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1250 if (!isWaitingForJavaScriptPopupReply()) {
1251 m_gestureEventQueue.append(event);
1253 process()->responsivenessTimer()->start();
1254 process()->send(Messages::EventDispatcher::GestureEvent(m_pageID, event), 0);
1256 if (m_gestureEventQueue.isEmpty()) {
1257 bool isEventHandled = false;
1258 m_pageClient->doneWithGestureEvent(event, isEventHandled);
1260 QueuedUIEvents<WebGestureEvent>& lastEvent = m_gestureEventQueue.last();
1261 lastEvent.deferredEvents.append(event);
1265 m_gestureEventQueue.append(event);
1267 process()->responsivenessTimer()->start();
1268 process()->send(Messages::EventDispatcher::GestureEvent(m_pageID, event), 0);
1273 #if ENABLE(TOUCH_EVENTS)
1275 void WebPageProxy::handlePotentialActivation(const IntPoint& touchPoint, const IntSize& touchArea)
1277 process()->send(Messages::WebPage::HighlightPotentialActivation(touchPoint, touchArea), m_pageID);
1281 void WebPageProxy::handleTouchEvent(const NativeWebTouchEvent& event)
1286 // If the page is suspended, which should be the case during panning, pinching
1287 // and animation on the page itself (kinetic scrolling, tap to zoom) etc, then
1288 // we do not send any of the events to the page even if is has listeners.
1289 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1290 if (m_needTouchEvents && !m_isPageSuspended && !isWaitingForJavaScriptPopupReply()) {
1292 if (m_needTouchEvents && !m_isPageSuspended) {
1295 // Do not send the TouchMove event if last TouchMove is not processed yet.
1296 // TouchMove event will be sent too many times without below codes,
1297 // and it will affect Web Applications' performance.
1298 if (event.type() == WebEvent::TouchMove
1299 && !m_touchEventQueue.isEmpty()
1300 && m_touchEventQueue.last().forwardedEvent.type() == event.type())
1303 m_touchEventQueue.append(event);
1304 process()->responsivenessTimer()->start();
1305 if (m_shouldSendEventsSynchronously) {
1306 bool handled = false;
1307 process()->sendSync(Messages::WebPage::TouchEventSyncForTesting(event), Messages::WebPage::TouchEventSyncForTesting::Reply(handled), m_pageID);
1308 didReceiveEvent(event.type(), handled);
1310 process()->send(Messages::WebPage::TouchEvent(event), m_pageID);
1312 if (m_touchEventQueue.isEmpty()) {
1313 bool isEventHandled = false;
1314 m_pageClient->doneWithTouchEvent(event, isEventHandled);
1316 // We attach the incoming events to the newest queued event so that all
1317 // the events are delivered in the correct order when the event is dequed.
1318 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1319 QueuedUIEvents<NativeWebTouchEvent>& lastEvent = m_touchEventQueue.last();
1320 lastEvent.deferredEvents.append(event);
1322 QueuedTouchEvents& lastEvent = m_touchEventQueue.last();
1323 lastEvent.deferredTouchEvents.append(event);
1330 #if ENABLE(SCREEN_ORIENTATION_SUPPORT) && ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT)
1331 void WebPageProxy::lockOrientation(int willLockOrientation, bool& result)
1333 result = m_pageClient->lockOrientation(willLockOrientation);
1335 void WebPageProxy::unlockOrientation()
1337 m_pageClient->unlockOrientation();
1341 void WebPageProxy::scrollBy(ScrollDirection direction, ScrollGranularity granularity)
1346 process()->send(Messages::WebPage::ScrollBy(direction, granularity), m_pageID);
1349 void WebPageProxy::centerSelectionInVisibleArea()
1354 process()->send(Messages::WebPage::CenterSelectionInVisibleArea(), m_pageID);
1357 #if ENABLE(TIZEN_DOWNLOAD_ATTRIBUTE)
1358 void WebPageProxy::startDownload(const ResourceRequest& request, const String& /*suggestedName*/)
1360 // FIXME: suggestedName need to be passed to provide a suggested destination file name
1361 m_process->context()->download(this, request);
1365 void WebPageProxy::receivedPolicyDecision(PolicyAction action, WebFrameProxy* frame, uint64_t listenerID)
1370 if (action == PolicyIgnore)
1371 clearPendingAPIRequestURL();
1373 uint64_t downloadID = 0;
1374 if (action == PolicyDownload) {
1375 // Create a download proxy.
1376 DownloadProxy* download = m_process->context()->createDownloadProxy();
1377 downloadID = download->downloadID();
1378 #if PLATFORM(QT) || PLATFORM(EFL)
1379 // Our design does not suppport downloads without a WebPage.
1380 handleDownloadRequest(download);
1384 // If we received a policy decision while in decidePolicyForResponse the decision will
1385 // be sent back to the web process by decidePolicyForResponse.
1386 if (m_inDecidePolicyForResponse) {
1387 m_syncMimeTypePolicyActionIsValid = true;
1388 m_syncMimeTypePolicyAction = action;
1389 m_syncMimeTypePolicyDownloadID = downloadID;
1393 // If we received a policy decision while in decidePolicyForNavigationAction the decision will
1394 // be sent back to the web process by decidePolicyForNavigationAction.
1395 if (m_inDecidePolicyForNavigationAction) {
1396 m_syncNavigationActionPolicyActionIsValid = true;
1397 m_syncNavigationActionPolicyAction = action;
1398 m_syncNavigationActionPolicyDownloadID = downloadID;
1402 process()->send(Messages::WebPage::DidReceivePolicyDecision(frame->frameID(), listenerID, action, downloadID), m_pageID);
1405 String WebPageProxy::pageTitle() const
1407 // Return the null string if there is no main frame (e.g. nothing has been loaded in the page yet, WebProcess has
1408 // crashed, page has been closed).
1412 return m_mainFrame->title();
1415 void WebPageProxy::setUserAgent(const String& userAgent)
1417 if (m_userAgent == userAgent)
1419 m_userAgent = userAgent;
1423 process()->send(Messages::WebPage::SetUserAgent(m_userAgent), m_pageID);
1426 void WebPageProxy::setApplicationNameForUserAgent(const String& applicationName)
1428 if (m_applicationNameForUserAgent == applicationName)
1431 m_applicationNameForUserAgent = applicationName;
1432 if (!m_customUserAgent.isEmpty())
1435 setUserAgent(standardUserAgent(m_applicationNameForUserAgent));
1438 void WebPageProxy::setCustomUserAgent(const String& customUserAgent)
1440 if (m_customUserAgent == customUserAgent)
1443 m_customUserAgent = customUserAgent;
1445 if (m_customUserAgent.isEmpty()) {
1446 setUserAgent(standardUserAgent(m_applicationNameForUserAgent));
1450 setUserAgent(m_customUserAgent);
1453 void WebPageProxy::resumeActiveDOMObjectsAndAnimations()
1455 if (!isValid() || !m_isPageSuspended)
1458 m_isPageSuspended = false;
1460 process()->send(Messages::WebPage::ResumeActiveDOMObjectsAndAnimations(), m_pageID);
1463 void WebPageProxy::suspendActiveDOMObjectsAndAnimations()
1465 if (!isValid() || m_isPageSuspended)
1468 m_isPageSuspended = true;
1470 process()->send(Messages::WebPage::SuspendActiveDOMObjectsAndAnimations(), m_pageID);
1473 bool WebPageProxy::supportsTextEncoding() const
1475 return !m_mainFrameHasCustomRepresentation && m_mainFrame && !m_mainFrame->isDisplayingStandaloneImageDocument();
1478 void WebPageProxy::setCustomTextEncodingName(const String& encodingName)
1480 if (m_customTextEncodingName == encodingName)
1482 m_customTextEncodingName = encodingName;
1486 process()->send(Messages::WebPage::SetCustomTextEncodingName(encodingName), m_pageID);
1489 void WebPageProxy::terminateProcess()
1491 // NOTE: This uses a check of m_isValid rather than calling isValid() since
1492 // we want this to run even for pages being closed or that already closed.
1496 process()->terminate();
1499 #if !USE(CF) || defined(BUILDING_QT__)
1500 PassRefPtr<WebData> WebPageProxy::sessionStateData(WebPageProxySessionStateFilterCallback, void* context) const
1502 // FIXME: Return session state data for saving Page state.
1506 void WebPageProxy::restoreFromSessionStateData(WebData*)
1508 // FIXME: Restore the Page from the passed in session state data.
1512 bool WebPageProxy::supportsTextZoom() const
1514 if (m_mainFrameHasCustomRepresentation)
1517 // FIXME: This should also return false for standalone media and plug-in documents.
1518 if (!m_mainFrame || m_mainFrame->isDisplayingStandaloneImageDocument())
1524 void WebPageProxy::setTextZoomFactor(double zoomFactor)
1529 if (m_mainFrameHasCustomRepresentation)
1532 if (m_textZoomFactor == zoomFactor)
1535 m_textZoomFactor = zoomFactor;
1536 process()->send(Messages::WebPage::SetTextZoomFactor(m_textZoomFactor), m_pageID);
1539 double WebPageProxy::pageZoomFactor() const
1541 return m_mainFrameHasCustomRepresentation ? m_pageClient->customRepresentationZoomFactor() : m_pageZoomFactor;
1544 void WebPageProxy::setPageZoomFactor(double zoomFactor)
1549 if (m_mainFrameHasCustomRepresentation) {
1550 m_pageClient->setCustomRepresentationZoomFactor(zoomFactor);
1554 if (m_pageZoomFactor == zoomFactor)
1557 m_pageZoomFactor = zoomFactor;
1558 process()->send(Messages::WebPage::SetPageZoomFactor(m_pageZoomFactor), m_pageID);
1561 void WebPageProxy::setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor)
1566 if (m_mainFrameHasCustomRepresentation) {
1567 m_pageClient->setCustomRepresentationZoomFactor(pageZoomFactor);
1571 if (m_pageZoomFactor == pageZoomFactor && m_textZoomFactor == textZoomFactor)
1574 m_pageZoomFactor = pageZoomFactor;
1575 m_textZoomFactor = textZoomFactor;
1576 process()->send(Messages::WebPage::SetPageAndTextZoomFactors(m_pageZoomFactor, m_textZoomFactor), m_pageID);
1579 void WebPageProxy::scalePage(double scale, const IntPoint& origin)
1584 process()->send(Messages::WebPage::ScalePage(scale, origin), m_pageID);
1587 void WebPageProxy::setIntrinsicDeviceScaleFactor(float scaleFactor)
1589 if (m_intrinsicDeviceScaleFactor == scaleFactor)
1592 m_intrinsicDeviceScaleFactor = scaleFactor;
1595 m_drawingArea->deviceScaleFactorDidChange();
1598 void WebPageProxy::windowScreenDidChange(PlatformDisplayID displayID)
1603 process()->send(Messages::WebPage::WindowScreenDidChange(displayID), m_pageID);
1606 float WebPageProxy::deviceScaleFactor() const
1608 if (m_customDeviceScaleFactor)
1609 return m_customDeviceScaleFactor;
1610 return m_intrinsicDeviceScaleFactor;
1613 void WebPageProxy::setCustomDeviceScaleFactor(float customScaleFactor)
1618 if (m_customDeviceScaleFactor == customScaleFactor)
1621 float oldScaleFactor = deviceScaleFactor();
1623 m_customDeviceScaleFactor = customScaleFactor;
1625 if (deviceScaleFactor() != oldScaleFactor)
1626 m_drawingArea->deviceScaleFactorDidChange();
1629 void WebPageProxy::setUseFixedLayout(bool fixed)
1634 // This check is fine as the value is initialized in the web
1635 // process as part of the creation parameters.
1636 if (fixed == m_useFixedLayout)
1639 m_useFixedLayout = fixed;
1641 m_fixedLayoutSize = IntSize();
1642 process()->send(Messages::WebPage::SetUseFixedLayout(fixed), m_pageID);
1645 void WebPageProxy::setFixedLayoutSize(const IntSize& size)
1650 if (size == m_fixedLayoutSize)
1653 m_fixedLayoutSize = size;
1654 process()->send(Messages::WebPage::SetFixedLayoutSize(size), m_pageID);
1657 void WebPageProxy::setPaginationMode(WebCore::Page::Pagination::Mode mode)
1659 if (mode == m_paginationMode)
1662 m_paginationMode = mode;
1666 process()->send(Messages::WebPage::SetPaginationMode(mode), m_pageID);
1669 void WebPageProxy::setPaginationBehavesLikeColumns(bool behavesLikeColumns)
1671 if (behavesLikeColumns == m_paginationBehavesLikeColumns)
1674 m_paginationBehavesLikeColumns = behavesLikeColumns;
1678 process()->send(Messages::WebPage::SetPaginationBehavesLikeColumns(behavesLikeColumns), m_pageID);
1681 void WebPageProxy::setPageLength(double pageLength)
1683 if (pageLength == m_pageLength)
1686 m_pageLength = pageLength;
1690 process()->send(Messages::WebPage::SetPageLength(pageLength), m_pageID);
1693 void WebPageProxy::setGapBetweenPages(double gap)
1695 if (gap == m_gapBetweenPages)
1698 m_gapBetweenPages = gap;
1702 process()->send(Messages::WebPage::SetGapBetweenPages(gap), m_pageID);
1705 void WebPageProxy::pageScaleFactorDidChange(double scaleFactor)
1707 m_pageScaleFactor = scaleFactor;
1708 m_pageClient->pageScaleFactorDidChange();
1711 void WebPageProxy::setMemoryCacheClientCallsEnabled(bool memoryCacheClientCallsEnabled)
1716 if (m_areMemoryCacheClientCallsEnabled == memoryCacheClientCallsEnabled)
1719 m_areMemoryCacheClientCallsEnabled = memoryCacheClientCallsEnabled;
1720 process()->send(Messages::WebPage::SetMemoryCacheMessagesEnabled(memoryCacheClientCallsEnabled), m_pageID);
1723 void WebPageProxy::findStringMatches(const String& string, FindOptions options, unsigned maxMatchCount)
1725 if (string.isEmpty()) {
1726 didFindStringMatches(string, Vector<Vector<WebCore::IntRect> > (), 0);
1730 m_process->send(Messages::WebPage::FindStringMatches(string, options, maxMatchCount), m_pageID);
1733 void WebPageProxy::findString(const String& string, FindOptions options, unsigned maxMatchCount)
1735 if (m_mainFrameHasCustomRepresentation)
1736 m_pageClient->findStringInCustomRepresentation(string, options, maxMatchCount);
1738 process()->send(Messages::WebPage::FindString(string, options, maxMatchCount), m_pageID);
1741 void WebPageProxy::getImageForFindMatch(int32_t matchIndex)
1743 m_process->send(Messages::WebPage::GetImageForFindMatch(matchIndex), m_pageID);
1746 void WebPageProxy::selectFindMatch(int32_t matchIndex)
1748 m_process->send(Messages::WebPage::SelectFindMatch(matchIndex), m_pageID);
1751 void WebPageProxy::hideFindUI()
1753 process()->send(Messages::WebPage::HideFindUI(), m_pageID);
1756 void WebPageProxy::countStringMatches(const String& string, FindOptions options, unsigned maxMatchCount)
1758 if (m_mainFrameHasCustomRepresentation) {
1759 m_pageClient->countStringMatchesInCustomRepresentation(string, options, maxMatchCount);
1766 process()->send(Messages::WebPage::CountStringMatches(string, options, maxMatchCount), m_pageID);
1769 void WebPageProxy::runJavaScriptInMainFrame(const String& script, PassRefPtr<ScriptValueCallback> prpCallback)
1771 RefPtr<ScriptValueCallback> callback = prpCallback;
1773 callback->invalidate();
1777 uint64_t callbackID = callback->callbackID();
1778 m_scriptValueCallbacks.set(callbackID, callback.get());
1779 process()->send(Messages::WebPage::RunJavaScriptInMainFrame(script, callbackID), m_pageID);
1782 void WebPageProxy::getRenderTreeExternalRepresentation(PassRefPtr<StringCallback> prpCallback)
1784 RefPtr<StringCallback> callback = prpCallback;
1786 callback->invalidate();
1790 uint64_t callbackID = callback->callbackID();
1791 m_stringCallbacks.set(callbackID, callback.get());
1792 process()->send(Messages::WebPage::GetRenderTreeExternalRepresentation(callbackID), m_pageID);
1795 void WebPageProxy::getSourceForFrame(WebFrameProxy* frame, PassRefPtr<StringCallback> prpCallback)
1797 RefPtr<StringCallback> callback = prpCallback;
1799 callback->invalidate();
1803 uint64_t callbackID = callback->callbackID();
1804 m_loadDependentStringCallbackIDs.add(callbackID);
1805 m_stringCallbacks.set(callbackID, callback.get());
1806 process()->send(Messages::WebPage::GetSourceForFrame(frame->frameID(), callbackID), m_pageID);
1809 #if ENABLE(WEB_INTENTS)
1810 void WebPageProxy::deliverIntentToFrame(WebFrameProxy* frame, WebIntentData* webIntentData)
1815 process()->send(Messages::WebPage::DeliverIntentToFrame(frame->frameID(), webIntentData->store()), m_pageID);
1819 void WebPageProxy::getContentsAsString(PassRefPtr<StringCallback> prpCallback)
1821 RefPtr<StringCallback> callback = prpCallback;
1823 callback->invalidate();
1827 uint64_t callbackID = callback->callbackID();
1828 m_loadDependentStringCallbackIDs.add(callbackID);
1829 m_stringCallbacks.set(callbackID, callback.get());
1830 process()->send(Messages::WebPage::GetContentsAsString(callbackID), m_pageID);
1834 void WebPageProxy::getContentsAsMHTMLData(PassRefPtr<DataCallback> prpCallback, bool useBinaryEncoding)
1836 RefPtr<DataCallback> callback = prpCallback;
1838 callback->invalidate();
1842 uint64_t callbackID = callback->callbackID();
1843 m_dataCallbacks.set(callbackID, callback.get());
1844 process()->send(Messages::WebPage::GetContentsAsMHTMLData(callbackID, useBinaryEncoding), m_pageID);
1848 void WebPageProxy::getSelectionOrContentsAsString(PassRefPtr<StringCallback> prpCallback)
1850 RefPtr<StringCallback> callback = prpCallback;
1852 callback->invalidate();
1856 uint64_t callbackID = callback->callbackID();
1857 m_stringCallbacks.set(callbackID, callback.get());
1858 process()->send(Messages::WebPage::GetSelectionOrContentsAsString(callbackID), m_pageID);
1861 void WebPageProxy::getMainResourceDataOfFrame(WebFrameProxy* frame, PassRefPtr<DataCallback> prpCallback)
1863 RefPtr<DataCallback> callback = prpCallback;
1865 callback->invalidate();
1869 uint64_t callbackID = callback->callbackID();
1870 m_dataCallbacks.set(callbackID, callback.get());
1871 process()->send(Messages::WebPage::GetMainResourceDataOfFrame(frame->frameID(), callbackID), m_pageID);
1874 void WebPageProxy::getResourceDataFromFrame(WebFrameProxy* frame, WebURL* resourceURL, PassRefPtr<DataCallback> prpCallback)
1876 RefPtr<DataCallback> callback = prpCallback;
1878 callback->invalidate();
1882 uint64_t callbackID = callback->callbackID();
1883 m_dataCallbacks.set(callbackID, callback.get());
1884 process()->send(Messages::WebPage::GetResourceDataFromFrame(frame->frameID(), resourceURL->string(), callbackID), m_pageID);
1887 void WebPageProxy::getWebArchiveOfFrame(WebFrameProxy* frame, PassRefPtr<DataCallback> prpCallback)
1889 RefPtr<DataCallback> callback = prpCallback;
1891 callback->invalidate();
1895 uint64_t callbackID = callback->callbackID();
1896 m_dataCallbacks.set(callbackID, callback.get());
1897 process()->send(Messages::WebPage::GetWebArchiveOfFrame(frame->frameID(), callbackID), m_pageID);
1900 void WebPageProxy::forceRepaint(PassRefPtr<VoidCallback> prpCallback)
1902 RefPtr<VoidCallback> callback = prpCallback;
1904 callback->invalidate();
1908 uint64_t callbackID = callback->callbackID();
1909 m_voidCallbacks.set(callbackID, callback.get());
1910 m_drawingArea->waitForBackingStoreUpdateOnNextPaint();
1911 process()->send(Messages::WebPage::ForceRepaint(callbackID), m_pageID);
1914 void WebPageProxy::preferencesDidChange()
1919 #if ENABLE(INSPECTOR_SERVER)
1920 if (m_pageGroup->preferences()->developerExtrasEnabled())
1921 inspector()->enableRemoteInspection();
1924 // FIXME: It probably makes more sense to send individual preference changes.
1925 // However, WebKitTestRunner depends on getting a preference change notification
1926 // even if nothing changed in UI process, so that overrides get removed.
1928 // Preferences need to be updated during synchronous printing to make "print backgrounds" preference work when toggled from a print dialog checkbox.
1929 process()->send(Messages::WebPage::PreferencesDidChange(pageGroup()->preferences()->store()), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
1932 void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
1934 if (messageID.is<CoreIPC::MessageClassDrawingAreaProxy>()) {
1935 m_drawingArea->didReceiveDrawingAreaProxyMessage(connection, messageID, arguments);
1939 #if USE(UI_SIDE_COMPOSITING)
1940 if (messageID.is<CoreIPC::MessageClassLayerTreeCoordinatorProxy>()) {
1941 m_drawingArea->didReceiveLayerTreeCoordinatorProxyMessage(connection, messageID, arguments);
1946 #if ENABLE(INSPECTOR)
1947 if (messageID.is<CoreIPC::MessageClassWebInspectorProxy>()) {
1948 if (WebInspectorProxy* inspector = this->inspector())
1949 inspector->didReceiveWebInspectorProxyMessage(connection, messageID, arguments);
1954 #if ENABLE(FULLSCREEN_API)
1955 if (messageID.is<CoreIPC::MessageClassWebFullScreenManagerProxy>()) {
1956 fullScreenManager()->didReceiveMessage(connection, messageID, arguments);
1961 didReceiveWebPageProxyMessage(connection, messageID, arguments);
1964 void WebPageProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, OwnPtr<CoreIPC::ArgumentEncoder>& reply)
1966 #if ENABLE(INSPECTOR)
1967 if (messageID.is<CoreIPC::MessageClassWebInspectorProxy>()) {
1968 if (WebInspectorProxy* inspector = this->inspector())
1969 inspector->didReceiveSyncWebInspectorProxyMessage(connection, messageID, arguments, reply);
1974 #if ENABLE(FULLSCREEN_API)
1975 if (messageID.is<CoreIPC::MessageClassWebFullScreenManagerProxy>()) {
1976 fullScreenManager()->didReceiveSyncMessage(connection, messageID, arguments, reply);
1981 // FIXME: Do something with reply.
1982 didReceiveSyncWebPageProxyMessage(connection, messageID, arguments, reply);
1985 void WebPageProxy::didCreateMainFrame(uint64_t frameID)
1987 MESSAGE_CHECK(!m_mainFrame);
1988 MESSAGE_CHECK(process()->canCreateFrame(frameID));
1990 m_mainFrame = WebFrameProxy::create(this, frameID);
1992 // Add the frame to the process wide map.
1993 process()->frameCreated(frameID, m_mainFrame.get());
1996 void WebPageProxy::didCreateSubframe(uint64_t frameID, uint64_t parentFrameID)
1998 MESSAGE_CHECK(m_mainFrame);
2000 WebFrameProxy* parentFrame = process()->webFrame(parentFrameID);
2001 MESSAGE_CHECK(parentFrame);
2002 MESSAGE_CHECK(parentFrame->isDescendantOf(m_mainFrame.get()));
2004 MESSAGE_CHECK(process()->canCreateFrame(frameID));
2006 RefPtr<WebFrameProxy> subFrame = WebFrameProxy::create(this, frameID);
2008 // Add the frame to the process wide map.
2009 process()->frameCreated(frameID, subFrame.get());
2011 // Insert the frame into the frame hierarchy.
2012 parentFrame->appendChild(subFrame.get());
2015 static bool isDisconnectedFrame(WebFrameProxy* frame)
2017 return !frame->page() || !frame->page()->mainFrame() || !frame->isDescendantOf(frame->page()->mainFrame());
2020 void WebPageProxy::didSaveFrameToPageCache(uint64_t frameID)
2022 MESSAGE_CHECK(m_mainFrame);
2024 WebFrameProxy* subframe = process()->webFrame(frameID);
2025 MESSAGE_CHECK(subframe);
2027 if (isDisconnectedFrame(subframe))
2030 MESSAGE_CHECK(subframe->isDescendantOf(m_mainFrame.get()));
2032 subframe->didRemoveFromHierarchy();
2035 void WebPageProxy::didRestoreFrameFromPageCache(uint64_t frameID, uint64_t parentFrameID)
2037 MESSAGE_CHECK(m_mainFrame);
2039 WebFrameProxy* subframe = process()->webFrame(frameID);
2040 MESSAGE_CHECK(subframe);
2041 MESSAGE_CHECK(!subframe->parentFrame());
2042 MESSAGE_CHECK(subframe->page() == m_mainFrame->page());
2044 WebFrameProxy* parentFrame = process()->webFrame(parentFrameID);
2045 MESSAGE_CHECK(parentFrame);
2046 MESSAGE_CHECK(parentFrame->isDescendantOf(m_mainFrame.get()));
2048 // Insert the frame into the frame hierarchy.
2049 parentFrame->appendChild(subframe);
2053 // Always start progress at initialProgressValue. This helps provide feedback as
2054 // soon as a load starts.
2056 static const double initialProgressValue = 0.1;
2058 double WebPageProxy::estimatedProgress() const
2060 if (!pendingAPIRequestURL().isNull())
2061 return initialProgressValue;
2062 return m_estimatedProgress;
2065 void WebPageProxy::didStartProgress()
2067 m_estimatedProgress = initialProgressValue;
2069 m_loaderClient.didStartProgress(this);
2072 void WebPageProxy::didChangeProgress(double value)
2074 m_estimatedProgress = value;
2076 m_loaderClient.didChangeProgress(this);
2079 void WebPageProxy::didFinishProgress()
2081 m_estimatedProgress = 1.0;
2083 m_loaderClient.didFinishProgress(this);
2086 #if ENABLE(WEB_INTENTS_TAG)
2087 void WebPageProxy::registerIntentServiceForFrame(uint64_t frameID, const IntentServiceInfo& serviceInfo, CoreIPC::ArgumentDecoder* arguments)
2089 RefPtr<APIObject> userData;
2090 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2091 if (!arguments->decode(messageDecoder))
2094 WebFrameProxy* frame = process()->webFrame(frameID);
2095 MESSAGE_CHECK(frame);
2097 RefPtr<WebIntentServiceInfo> webIntentServiceInfo = WebIntentServiceInfo::create(serviceInfo);
2098 m_loaderClient.registerIntentServiceForFrame(this, frame, webIntentServiceInfo.get(), userData.get());
2102 void WebPageProxy::didStartProvisionalLoadForFrame(uint64_t frameID, const String& url, const String& unreachableURL, CoreIPC::ArgumentDecoder* arguments)
2104 clearPendingAPIRequestURL();
2106 RefPtr<APIObject> userData;
2107 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2108 if (!arguments->decode(messageDecoder))
2111 WebFrameProxy* frame = process()->webFrame(frameID);
2112 MESSAGE_CHECK(frame);
2113 MESSAGE_CHECK_URL(url);
2115 frame->setUnreachableURL(unreachableURL);
2117 frame->didStartProvisionalLoad(url);
2118 m_loaderClient.didStartProvisionalLoadForFrame(this, frame, userData.get());
2121 void WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, const String& url, CoreIPC::ArgumentDecoder* arguments)
2123 RefPtr<APIObject> userData;
2124 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2125 if (!arguments->decode(messageDecoder))
2128 WebFrameProxy* frame = process()->webFrame(frameID);
2129 MESSAGE_CHECK(frame);
2130 MESSAGE_CHECK_URL(url);
2132 frame->didReceiveServerRedirectForProvisionalLoad(url);
2134 m_loaderClient.didReceiveServerRedirectForProvisionalLoadForFrame(this, frame, userData.get());
2137 void WebPageProxy::didFailProvisionalLoadForFrame(uint64_t frameID, const ResourceError& error, CoreIPC::ArgumentDecoder* arguments)
2139 RefPtr<APIObject> userData;
2140 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2141 if (!arguments->decode(messageDecoder))
2144 WebFrameProxy* frame = process()->webFrame(frameID);
2145 MESSAGE_CHECK(frame);
2147 frame->didFailProvisionalLoad();
2149 m_loaderClient.didFailProvisionalLoadWithErrorForFrame(this, frame, error, userData.get());
2152 void WebPageProxy::clearLoadDependentCallbacks()
2154 Vector<uint64_t> callbackIDsCopy;
2155 copyToVector(m_loadDependentStringCallbackIDs, callbackIDsCopy);
2156 m_loadDependentStringCallbackIDs.clear();
2158 for (size_t i = 0; i < callbackIDsCopy.size(); ++i) {
2159 RefPtr<StringCallback> callback = m_stringCallbacks.take(callbackIDsCopy[i]);
2161 callback->invalidate();
2165 void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, const String& mimeType, bool frameHasCustomRepresentation, const PlatformCertificateInfo& certificateInfo, CoreIPC::ArgumentDecoder* arguments)
2167 RefPtr<APIObject> userData;
2168 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2169 if (!arguments->decode(messageDecoder))
2172 WebFrameProxy* frame = process()->webFrame(frameID);
2173 MESSAGE_CHECK(frame);
2176 // FIXME (bug 59111): didCommitLoadForFrame comes too late when restoring a page from b/f cache, making us disable secure event mode in password fields.
2177 // FIXME (bug 59121): A load going on in one frame shouldn't affect typing in sibling frames.
2178 m_pageClient->resetTextInputState();
2179 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
2180 // FIXME: Should this be moved inside resetTextInputState()?
2181 dismissCorrectionPanel(ReasonForDismissingAlternativeTextIgnored);
2182 m_pageClient->dismissDictionaryLookupPanel();
2186 clearLoadDependentCallbacks();
2188 frame->didCommitLoad(mimeType, certificateInfo);
2190 if (frame->isMainFrame()) {
2191 m_mainFrameHasCustomRepresentation = frameHasCustomRepresentation;
2193 if (m_mainFrameHasCustomRepresentation) {
2194 // Always assume that the main frame is pinned here, since the custom representation view will handle
2195 // any wheel events and dispatch them to the WKView when necessary.
2196 m_mainFrameIsPinnedToLeftSide = true;
2197 m_mainFrameIsPinnedToRightSide = true;
2199 m_pageClient->didCommitLoadForMainFrame(frameHasCustomRepresentation);
2202 m_loaderClient.didCommitLoadForFrame(this, frame, userData.get());
2205 void WebPageProxy::didFinishDocumentLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2207 RefPtr<APIObject> userData;
2208 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2209 if (!arguments->decode(messageDecoder))
2212 WebFrameProxy* frame = process()->webFrame(frameID);
2213 MESSAGE_CHECK(frame);
2215 m_loaderClient.didFinishDocumentLoadForFrame(this, frame, userData.get());
2218 #if ENABLE(TIZEN_NATIVE_MEMORY_SNAPSHOT)
2219 const char* isMemorySnapshot = getenv("TIZEN_MEMORY_SNAPSHOT");
2221 void WebPageProxy::didFinishLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2223 RefPtr<APIObject> userData;
2224 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2225 if (!arguments->decode(messageDecoder))
2228 WebFrameProxy* frame = process()->webFrame(frameID);
2229 MESSAGE_CHECK(frame);
2231 frame->didFinishLoad();
2233 m_loaderClient.didFinishLoadForFrame(this, frame, userData.get());
2234 #if ENABLE(TIZEN_NATIVE_MEMORY_SNAPSHOT)
2235 if (isMemorySnapshot && isMemorySnapshot[0] != '0')
2236 dumpMemorySnapshot();
2240 void WebPageProxy::didFailLoadForFrame(uint64_t frameID, const ResourceError& error, CoreIPC::ArgumentDecoder* arguments)
2242 RefPtr<APIObject> userData;
2243 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2244 if (!arguments->decode(messageDecoder))
2247 WebFrameProxy* frame = process()->webFrame(frameID);
2248 MESSAGE_CHECK(frame);
2250 clearLoadDependentCallbacks();
2252 frame->didFailLoad();
2254 m_loaderClient.didFailLoadWithErrorForFrame(this, frame, error, userData.get());
2257 void WebPageProxy::didSameDocumentNavigationForFrame(uint64_t frameID, uint32_t opaqueSameDocumentNavigationType, const String& url, CoreIPC::ArgumentDecoder* arguments)
2259 RefPtr<APIObject> userData;
2260 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2261 if (!arguments->decode(messageDecoder))
2264 WebFrameProxy* frame = process()->webFrame(frameID);
2265 MESSAGE_CHECK(frame);
2266 MESSAGE_CHECK_URL(url);
2268 clearPendingAPIRequestURL();
2269 frame->didSameDocumentNavigation(url);
2271 m_loaderClient.didSameDocumentNavigationForFrame(this, frame, static_cast<SameDocumentNavigationType>(opaqueSameDocumentNavigationType), userData.get());
2274 void WebPageProxy::didReceiveTitleForFrame(uint64_t frameID, const String& title, CoreIPC::ArgumentDecoder* arguments)
2276 RefPtr<APIObject> userData;
2277 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2278 if (!arguments->decode(messageDecoder))
2281 WebFrameProxy* frame = process()->webFrame(frameID);
2282 MESSAGE_CHECK(frame);
2284 frame->didChangeTitle(title);
2286 m_loaderClient.didReceiveTitleForFrame(this, title, frame, userData.get());
2289 void WebPageProxy::didFirstLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2291 RefPtr<APIObject> userData;
2292 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2293 if (!arguments->decode(messageDecoder))
2296 WebFrameProxy* frame = process()->webFrame(frameID);
2297 MESSAGE_CHECK(frame);
2299 m_loaderClient.didFirstLayoutForFrame(this, frame, userData.get());
2302 void WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2304 RefPtr<APIObject> userData;
2305 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2306 if (!arguments->decode(messageDecoder))
2309 WebFrameProxy* frame = process()->webFrame(frameID);
2310 MESSAGE_CHECK(frame);
2313 if (frame->isMainFrame())
2314 m_pageClient->didFirstVisuallyNonEmptyLayoutForMainFrame();
2317 m_loaderClient.didFirstVisuallyNonEmptyLayoutForFrame(this, frame, userData.get());
2320 void WebPageProxy::didNewFirstVisuallyNonEmptyLayout(CoreIPC::ArgumentDecoder* arguments)
2322 RefPtr<APIObject> userData;
2323 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2324 if (!arguments->decode(messageDecoder))
2327 m_loaderClient.didNewFirstVisuallyNonEmptyLayout(this, userData.get());
2330 void WebPageProxy::didRemoveFrameFromHierarchy(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2332 RefPtr<APIObject> userData;
2333 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2334 if (!arguments->decode(messageDecoder))
2337 WebFrameProxy* frame = process()->webFrame(frameID);
2338 MESSAGE_CHECK(frame);
2340 frame->didRemoveFromHierarchy();
2342 m_loaderClient.didRemoveFrameFromHierarchy(this, frame, userData.get());
2345 void WebPageProxy::didDisplayInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2347 RefPtr<APIObject> userData;
2348 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2349 if (!arguments->decode(messageDecoder))
2352 WebFrameProxy* frame = process()->webFrame(frameID);
2353 MESSAGE_CHECK(frame);
2355 m_loaderClient.didDisplayInsecureContentForFrame(this, frame, userData.get());
2358 void WebPageProxy::didRunInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2360 RefPtr<APIObject> userData;
2361 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2362 if (!arguments->decode(messageDecoder))
2365 WebFrameProxy* frame = process()->webFrame(frameID);
2366 MESSAGE_CHECK(frame);
2368 m_loaderClient.didRunInsecureContentForFrame(this, frame, userData.get());
2371 void WebPageProxy::didDetectXSSForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2373 RefPtr<APIObject> userData;
2374 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2375 if (!arguments->decode(messageDecoder))
2378 WebFrameProxy* frame = process()->webFrame(frameID);
2379 MESSAGE_CHECK(frame);
2381 m_loaderClient.didDetectXSSForFrame(this, frame, userData.get());
2384 #if ENABLE(WEB_INTENTS)
2385 void WebPageProxy::didReceiveIntentForFrame(uint64_t frameID, const IntentData& intentData, 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 RefPtr<WebIntentData> webIntentData = WebIntentData::create(intentData);
2396 m_loaderClient.didReceiveIntentForFrame(this, frame, webIntentData.get(), userData.get());
2400 void WebPageProxy::frameDidBecomeFrameSet(uint64_t frameID, bool value)
2402 WebFrameProxy* frame = process()->webFrame(frameID);
2403 MESSAGE_CHECK(frame);
2405 frame->setIsFrameSet(value);
2406 if (frame->isMainFrame())
2407 m_frameSetLargestFrame = value ? m_mainFrame : 0;
2411 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)
2413 RefPtr<APIObject> userData;
2414 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2415 if (!arguments->decode(messageDecoder))
2418 if (request.url() != pendingAPIRequestURL())
2419 clearPendingAPIRequestURL();
2421 WebFrameProxy* frame = process()->webFrame(frameID);
2422 MESSAGE_CHECK(frame);
2423 MESSAGE_CHECK_URL(request.url());
2425 NavigationType navigationType = static_cast<NavigationType>(opaqueNavigationType);
2426 WebEvent::Modifiers modifiers = static_cast<WebEvent::Modifiers>(opaqueModifiers);
2427 WebMouseEvent::Button mouseButton = static_cast<WebMouseEvent::Button>(opaqueMouseButton);
2429 RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID);
2431 ASSERT(!m_inDecidePolicyForNavigationAction);
2433 m_inDecidePolicyForNavigationAction = true;
2434 m_syncNavigationActionPolicyActionIsValid = false;
2436 if (!m_policyClient.decidePolicyForNavigationAction(this, frame, navigationType, modifiers, mouseButton, request, listener.get(), userData.get()))
2439 m_inDecidePolicyForNavigationAction = false;
2441 // Check if we received a policy decision already. If we did, we can just pass it back.
2442 receivedPolicyAction = m_syncNavigationActionPolicyActionIsValid;
2443 if (m_syncNavigationActionPolicyActionIsValid) {
2444 policyAction = m_syncNavigationActionPolicyAction;
2445 downloadID = m_syncNavigationActionPolicyDownloadID;
2449 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)
2451 RefPtr<APIObject> userData;
2452 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2453 if (!arguments->decode(messageDecoder))
2456 WebFrameProxy* frame = process()->webFrame(frameID);
2457 MESSAGE_CHECK(frame);
2458 MESSAGE_CHECK_URL(request.url());
2460 NavigationType navigationType = static_cast<NavigationType>(opaqueNavigationType);
2461 WebEvent::Modifiers modifiers = static_cast<WebEvent::Modifiers>(opaqueModifiers);
2462 WebMouseEvent::Button mouseButton = static_cast<WebMouseEvent::Button>(opaqueMouseButton);
2464 RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID);
2465 if (!m_policyClient.decidePolicyForNewWindowAction(this, frame, navigationType, modifiers, mouseButton, request, frameName, listener.get(), userData.get()))
2469 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)
2471 RefPtr<APIObject> userData;
2472 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2473 if (!arguments->decode(messageDecoder))
2476 WebFrameProxy* frame = process()->webFrame(frameID);
2477 MESSAGE_CHECK(frame);
2478 MESSAGE_CHECK_URL(request.url());
2479 MESSAGE_CHECK_URL(response.url());
2481 RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID);
2483 ASSERT(!m_inDecidePolicyForResponse);
2485 m_inDecidePolicyForResponse = true;
2486 m_syncMimeTypePolicyActionIsValid = false;
2488 if (!m_policyClient.decidePolicyForResponse(this, frame, response, request, listener.get(), userData.get()))
2491 m_inDecidePolicyForResponse = false;
2493 // Check if we received a policy decision already. If we did, we can just pass it back.
2494 receivedPolicyAction = m_syncMimeTypePolicyActionIsValid;
2495 if (m_syncMimeTypePolicyActionIsValid) {
2496 policyAction = m_syncMimeTypePolicyAction;
2497 downloadID = m_syncMimeTypePolicyDownloadID;
2501 void WebPageProxy::unableToImplementPolicy(uint64_t frameID, const ResourceError& error, CoreIPC::ArgumentDecoder* arguments)
2503 RefPtr<APIObject> userData;
2504 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2505 if (!arguments->decode(messageDecoder))
2508 WebFrameProxy* frame = process()->webFrame(frameID);
2509 MESSAGE_CHECK(frame);
2511 m_policyClient.unableToImplementPolicy(this, frame, error, userData.get());
2516 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
2517 void WebPageProxy::willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, bool containsPasswordData, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments)
2519 void WebPageProxy::willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments)
2522 RefPtr<APIObject> userData;
2523 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2524 if (!arguments->decode(messageDecoder))
2527 WebFrameProxy* frame = process()->webFrame(frameID);
2528 MESSAGE_CHECK(frame);
2530 WebFrameProxy* sourceFrame = process()->webFrame(sourceFrameID);
2531 MESSAGE_CHECK(sourceFrame);
2533 RefPtr<WebFormSubmissionListenerProxy> listener = frame->setUpFormSubmissionListenerProxy(listenerID);
2534 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
2535 if (!m_formClient.willSubmitForm(this, frame, sourceFrame, textFieldValues.stringPairVector(), containsPasswordData, userData.get(), listener.get()))
2537 if (!m_formClient.willSubmitForm(this, frame, sourceFrame, textFieldValues.stringPairVector(), userData.get(), listener.get()))
2539 listener->continueSubmission();
2542 // ResourceLoad Client
2544 void WebPageProxy::didInitiateLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceRequest& request, bool pageIsProvisionallyLoading)
2546 WebFrameProxy* frame = process()->webFrame(frameID);
2547 MESSAGE_CHECK(frame);
2548 MESSAGE_CHECK_URL(request.url());
2550 m_resourceLoadClient.didInitiateLoadForResource(this, frame, resourceIdentifier, request, pageIsProvisionallyLoading);
2553 void WebPageProxy::didSendRequestForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceRequest& request, const ResourceResponse& redirectResponse)
2555 WebFrameProxy* frame = process()->webFrame(frameID);
2556 MESSAGE_CHECK(frame);
2557 MESSAGE_CHECK_URL(request.url());
2559 m_resourceLoadClient.didSendRequestForResource(this, frame, resourceIdentifier, request, redirectResponse);
2562 void WebPageProxy::didReceiveResponseForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceResponse& response)
2564 WebFrameProxy* frame = process()->webFrame(frameID);
2565 MESSAGE_CHECK(frame);
2566 MESSAGE_CHECK_URL(response.url());
2568 m_resourceLoadClient.didReceiveResponseForResource(this, frame, resourceIdentifier, response);
2571 void WebPageProxy::didReceiveContentLengthForResource(uint64_t frameID, uint64_t resourceIdentifier, uint64_t contentLength)
2573 WebFrameProxy* frame = process()->webFrame(frameID);
2574 MESSAGE_CHECK(frame);
2576 m_resourceLoadClient.didReceiveContentLengthForResource(this, frame, resourceIdentifier, contentLength);
2579 void WebPageProxy::didFinishLoadForResource(uint64_t frameID, uint64_t resourceIdentifier)
2581 WebFrameProxy* frame = process()->webFrame(frameID);
2582 MESSAGE_CHECK(frame);
2584 m_resourceLoadClient.didFinishLoadForResource(this, frame, resourceIdentifier);
2587 void WebPageProxy::didFailLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceError& error)
2589 WebFrameProxy* frame = process()->webFrame(frameID);
2590 MESSAGE_CHECK(frame);
2592 m_resourceLoadClient.didFailLoadForResource(this, frame, resourceIdentifier, error);
2597 void WebPageProxy::createNewPage(const ResourceRequest& request, const WindowFeatures& windowFeatures, uint32_t opaqueModifiers, int32_t opaqueMouseButton, uint64_t& newPageID, WebPageCreationParameters& newPageParameters)
2599 RefPtr<WebPageProxy> newPage = m_uiClient.createNewPage(this, request, windowFeatures, static_cast<WebEvent::Modifiers>(opaqueModifiers), static_cast<WebMouseEvent::Button>(opaqueMouseButton));
2601 newPageID = newPage->pageID();
2602 newPageParameters = newPage->creationParameters();
2607 void WebPageProxy::showPage()
2609 m_uiClient.showPage(this);
2612 void WebPageProxy::closePage(bool stopResponsivenessTimer)
2614 if (stopResponsivenessTimer)
2615 process()->responsivenessTimer()->stop();
2617 m_pageClient->clearAllEditCommands();
2618 m_uiClient.close(this);
2621 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
2622 bool WebPageProxy::isWaitingForJavaScriptPopupReply()
2624 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
2625 return m_alertReply || m_confirmReply || m_promptReply || m_beforeUnloadConfirmPanelReply;
2627 return m_alertReply || m_confirmReply || m_promptReply;
2633 void WebPageProxy::runJavaScriptAlert(uint64_t frameID, const String& message, PassRefPtr<Messages::WebPageProxy::RunJavaScriptAlert::DelayedReply> reply)
2635 WebFrameProxy* frame = process()->webFrame(frameID);
2636 MESSAGE_CHECK(frame);
2638 // Since runJavaScriptAlert() can spin a nested run loop we need to turn off the responsiveness timer.
2639 process()->responsivenessTimer()->stop();
2641 m_alertReply = reply;
2642 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
2643 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
2645 if (!m_uiClient.runJavaScriptAlert(this, message, frame))
2646 replyJavaScriptAlert();
2649 void WebPageProxy::runJavaScriptConfirm(uint64_t frameID, const String& message, PassRefPtr<Messages::WebPageProxy::RunJavaScriptConfirm::DelayedReply> reply)
2651 WebFrameProxy* frame = process()->webFrame(frameID);
2652 MESSAGE_CHECK(frame);
2654 // Since runJavaScriptConfirm() can spin a nested run loop we need to turn off the responsiveness timer.
2655 process()->responsivenessTimer()->stop();
2657 m_confirmReply = reply;
2658 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
2659 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
2661 if (!m_uiClient.runJavaScriptConfirm(this, message, frame))
2662 replyJavaScriptConfirm(false);
2665 void WebPageProxy::runJavaScriptPrompt(uint64_t frameID, const String& message, const String& defaultValue, PassRefPtr<Messages::WebPageProxy::RunJavaScriptPrompt::DelayedReply> reply)
2667 WebFrameProxy* frame = process()->webFrame(frameID);
2668 MESSAGE_CHECK(frame);
2670 // Since runJavaScriptPrompt() can spin a nested run loop we need to turn off the responsiveness timer.
2671 process()->responsivenessTimer()->stop();
2673 m_promptReply = reply;
2674 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
2675 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
2677 if (!m_uiClient.runJavaScriptPrompt(this, message, defaultValue, frame))
2678 replyJavaScriptPrompt(String());
2681 void WebPageProxy::runJavaScriptAlert(uint64_t frameID, const String& message)
2683 WebFrameProxy* frame = process()->webFrame(frameID);
2684 MESSAGE_CHECK(frame);
2686 // Since runJavaScriptAlert() can spin a nested run loop we need to turn off the responsiveness timer.
2687 process()->responsivenessTimer()->stop();
2689 m_uiClient.runJavaScriptAlert(this, message, frame);
2692 void WebPageProxy::runJavaScriptConfirm(uint64_t frameID, const String& message, bool& result)
2694 WebFrameProxy* frame = process()->webFrame(frameID);
2695 MESSAGE_CHECK(frame);
2697 // Since runJavaScriptConfirm() can spin a nested run loop we need to turn off the responsiveness timer.
2698 process()->responsivenessTimer()->stop();
2700 result = m_uiClient.runJavaScriptConfirm(this, message, frame);
2703 void WebPageProxy::runJavaScriptPrompt(uint64_t frameID, const String& message, const String& defaultValue, String& result)
2705 WebFrameProxy* frame = process()->webFrame(frameID);
2706 MESSAGE_CHECK(frame);
2708 // Since runJavaScriptPrompt() can spin a nested run loop we need to turn off the responsiveness timer.
2709 process()->responsivenessTimer()->stop();
2711 result = m_uiClient.runJavaScriptPrompt(this, message, defaultValue, frame);
2715 void WebPageProxy::shouldInterruptJavaScript(bool& result)
2717 // Since shouldInterruptJavaScript() can spin a nested run loop we need to turn off the responsiveness timer.
2718 process()->responsivenessTimer()->stop();
2720 result = m_uiClient.shouldInterruptJavaScript(this);
2723 void WebPageProxy::setStatusText(const String& text)
2725 m_uiClient.setStatusText(this, text);
2728 void WebPageProxy::mouseDidMoveOverElement(const WebHitTestResult::Data& hitTestResultData, uint32_t opaqueModifiers, CoreIPC::ArgumentDecoder* arguments)
2730 RefPtr<APIObject> userData;
2731 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2732 if (!arguments->decode(messageDecoder))
2735 WebEvent::Modifiers modifiers = static_cast<WebEvent::Modifiers>(opaqueModifiers);
2737 m_uiClient.mouseDidMoveOverElement(this, hitTestResultData, modifiers, userData.get());
2740 void WebPageProxy::unavailablePluginButtonClicked(uint32_t opaquePluginUnavailabilityReason, const String& mimeType, const String& url, const String& pluginsPageURL)
2742 MESSAGE_CHECK_URL(url);
2743 MESSAGE_CHECK_URL(pluginsPageURL);
2745 WKPluginUnavailabilityReason pluginUnavailabilityReason = static_cast<WKPluginUnavailabilityReason>(opaquePluginUnavailabilityReason);
2746 m_uiClient.unavailablePluginButtonClicked(this, pluginUnavailabilityReason, mimeType, url, pluginsPageURL);
2749 void WebPageProxy::setToolbarsAreVisible(bool toolbarsAreVisible)
2751 m_uiClient.setToolbarsAreVisible(this, toolbarsAreVisible);
2754 void WebPageProxy::getToolbarsAreVisible(bool& toolbarsAreVisible)
2756 toolbarsAreVisible = m_uiClient.toolbarsAreVisible(this);
2759 void WebPageProxy::setMenuBarIsVisible(bool menuBarIsVisible)
2761 m_uiClient.setMenuBarIsVisible(this, menuBarIsVisible);
2764 void WebPageProxy::getMenuBarIsVisible(bool& menuBarIsVisible)
2766 menuBarIsVisible = m_uiClient.menuBarIsVisible(this);
2769 void WebPageProxy::setStatusBarIsVisible(bool statusBarIsVisible)
2771 m_uiClient.setStatusBarIsVisible(this, statusBarIsVisible);
2774 void WebPageProxy::getStatusBarIsVisible(bool& statusBarIsVisible)
2776 statusBarIsVisible = m_uiClient.statusBarIsVisible(this);
2779 void WebPageProxy::setIsResizable(bool isResizable)
2781 m_uiClient.setIsResizable(this, isResizable);
2784 void WebPageProxy::getIsResizable(bool& isResizable)
2786 isResizable = m_uiClient.isResizable(this);
2789 void WebPageProxy::setWindowFrame(const FloatRect& newWindowFrame)
2791 m_uiClient.setWindowFrame(this, m_pageClient->convertToDeviceSpace(newWindowFrame));
2794 void WebPageProxy::getWindowFrame(FloatRect& newWindowFrame)
2796 newWindowFrame = m_pageClient->convertToUserSpace(m_uiClient.windowFrame(this));
2799 void WebPageProxy::screenToWindow(const IntPoint& screenPoint, IntPoint& windowPoint)
2801 windowPoint = m_pageClient->screenToWindow(screenPoint);
2804 void WebPageProxy::windowToScreen(const IntRect& viewRect, IntRect& result)
2806 result = m_pageClient->windowToScreen(viewRect);
2809 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
2810 void WebPageProxy::runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, PassRefPtr<Messages::WebPageProxy::RunBeforeUnloadConfirmPanel::DelayedReply> reply)
2812 WebFrameProxy* frame = process()->webFrame(frameID);
2813 MESSAGE_CHECK(frame);
2815 // Since runBeforeUnloadConfirmPanel() can spin a nested run loop we need to turn off the responsiveness timer.
2816 process()->responsivenessTimer()->stop();
2818 m_beforeUnloadConfirmPanelReply = reply;
2819 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
2820 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
2822 if (!m_uiClient.runBeforeUnloadConfirmPanel(this, message, frame))
2823 replyBeforeUnloadConfirmPanel(false);
2826 void WebPageProxy::runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose)
2828 WebFrameProxy* frame = process()->webFrame(frameID);
2829 MESSAGE_CHECK(frame);
2831 // Since runBeforeUnloadConfirmPanel() can spin a nested run loop we need to turn off the responsiveness timer.
2832 process()->responsivenessTimer()->stop();
2834 shouldClose = m_uiClient.runBeforeUnloadConfirmPanel(this, message, frame);
2838 #if USE(TILED_BACKING_STORE)
2839 void WebPageProxy::pageDidRequestScroll(const IntPoint& point)
2841 m_pageClient->pageDidRequestScroll(point);
2845 void WebPageProxy::didChangeViewportProperties(const ViewportAttributes& attr)
2847 m_pageClient->didChangeViewportProperties(attr);
2850 void WebPageProxy::pageDidScroll()
2852 m_uiClient.pageDidScroll(this);
2853 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
2854 dismissCorrectionPanel(ReasonForDismissingAlternativeTextIgnored);
2858 void WebPageProxy::runOpenPanel(uint64_t frameID, const FileChooserSettings& settings)
2860 if (m_openPanelResultListener) {
2861 m_openPanelResultListener->invalidate();
2862 m_openPanelResultListener = 0;
2865 WebFrameProxy* frame = process()->webFrame(frameID);
2866 MESSAGE_CHECK(frame);
2868 RefPtr<WebOpenPanelParameters> parameters = WebOpenPanelParameters::create(settings);
2869 m_openPanelResultListener = WebOpenPanelResultListenerProxy::create(this);
2871 // Since runOpenPanel() can spin a nested run loop we need to turn off the responsiveness timer.
2872 process()->responsivenessTimer()->stop();
2874 if (!m_uiClient.runOpenPanel(this, frame, parameters.get(), m_openPanelResultListener.get()))
2875 didCancelForOpenPanel();
2878 void WebPageProxy::printFrame(uint64_t frameID)
2880 ASSERT(!m_isPerformingDOMPrintOperation);
2881 m_isPerformingDOMPrintOperation = true;
2883 WebFrameProxy* frame = process()->webFrame(frameID);
2884 MESSAGE_CHECK(frame);
2886 m_uiClient.printFrame(this, frame);
2888 endPrinting(); // Send a message synchronously while m_isPerformingDOMPrintOperation is still true.
2889 m_isPerformingDOMPrintOperation = false;
2892 void WebPageProxy::printMainFrame()
2894 printFrame(m_mainFrame->frameID());
2897 #if ENABLE(TIZEN_REGISTER_PROTOCOL_HANDLER)
2898 void WebPageProxy::registerProtocolHandler(const String& scheme, const String& baseURL, const String& url, const String& title)
2900 m_pageClient->registerProtocolHandler(scheme, baseURL, url, title);
2904 #if ENABLE(TIZEN_CUSTOM_SCHEME_HANDLER)
2905 void WebPageProxy::isProtocolHandlerRegistered(const String& scheme, const String& baseURL, const String& url, unsigned int& result)
2907 result = m_pageClient->isProtocolHandlerRegistered(scheme, baseURL, url);
2909 void WebPageProxy::unregisterProtocolHandler(const String& scheme, const String& baseURL, const String& url)
2911 m_pageClient->unregisterProtocolHandler(scheme, baseURL, url);
2915 #if ENABLE(TIZEN_REGISTER_CONTENT_HANDLER)
2916 void WebPageProxy::registerContentHandler(const String& mimeType, const String& baseURL, const String& url, const String& title)
2918 m_pageClient->registerContentHandler(mimeType, baseURL, url, title);
2921 void WebPageProxy::isContentHandlerRegistered(const String& mimeType, const String& baseURL, const String& url, unsigned int& result)
2923 result = m_pageClient->isContentHandlerRegistered(mimeType, baseURL, url);
2926 void WebPageProxy::unregisterContentHandler(const String& mimeType, const String& baseURL, const String& url)
2928 m_pageClient->unregisterContentHandler(mimeType, baseURL, url);
2932 #if ENABLE(TIZEN_SEARCH_PROVIDER)
2933 void WebPageProxy::addSearchProvider(const String& baseURL, const String& engineURL)
2935 m_pageClient->addSearchProvider(baseURL, engineURL);
2938 void WebPageProxy::isSearchProviderInstalled(const String& baseURL, const String& engineURL, uint64_t& result)
2940 result = m_pageClient->isSearchProviderInstalled(baseURL, engineURL);
2944 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
2945 void WebPageProxy::getStandaloneStatus(bool& standalone)
2947 standalone = m_pageClient->getStandaloneStatus();
2950 void WebPageProxy::getWebAppCapable(PassRefPtr<BooleanCallback> prpCallback)
2952 RefPtr<BooleanCallback> callback = prpCallback;
2954 callback->invalidate();
2958 uint64_t callbackID = callback->callbackID();
2959 m_booleanCallbacks.set(callbackID, callback.get());
2960 process()->send(Messages::WebPage::GetWebAppCapable(callbackID), m_pageID);
2963 void WebPageProxy::didGetWebAppCapable(const bool capable, uint64_t callbackID)
2965 RefPtr<BooleanCallback> callback = m_booleanCallbacks.take(callbackID);
2966 m_booleanCallbacks.remove(callbackID);
2967 callback->performCallbackWithReturnValue(WebBoolean::create(capable).leakRef());
2970 void WebPageProxy::getWebAppIconURL(PassRefPtr<StringCallback> prpCallback)
2972 RefPtr<StringCallback> callback = prpCallback;
2974 callback->invalidate();
2978 uint64_t callbackID = callback->callbackID();
2979 m_stringCallbacks.set(callbackID, callback.get());
2980 process()->send(Messages::WebPage::GetWebAppIconURL(callbackID), m_pageID);
2983 void WebPageProxy::didGetWebAppIconURL(const String& iconURL, uint64_t callbackID)
2985 RefPtr<StringCallback> callback = m_stringCallbacks.take(callbackID);
2987 // FIXME: Log error or assert.
2988 // this can validly happen if a load invalidated the callback, though
2992 m_stringCallbacks.remove(callbackID);
2993 callback->performCallbackWithReturnValue(iconURL.impl());
2996 void WebPageProxy::getWebAppIconURLs(PassRefPtr<DictionaryCallback> prpCallback)
2998 RefPtr<DictionaryCallback> callback = prpCallback;
3000 callback->invalidate();
3004 uint64_t callbackID = callback->callbackID();
3005 m_dictionaryCallbacks.set(callbackID, callback.get());
3006 process()->send(Messages::WebPage::GetWebAppIconURLs(callbackID), m_pageID);
3009 void WebPageProxy::didGetWebAppIconURLs(const StringPairVector& iconURLs, uint64_t callbackID)
3011 RefPtr<DictionaryCallback> callback = m_dictionaryCallbacks.take(callbackID);
3012 ImmutableDictionary::MapType iconURLList;
3013 size_t iconURLCount = iconURLs.stringPairVector().size();
3014 for (size_t i = 0; i < iconURLCount; ++i)
3015 iconURLList.set(iconURLs.stringPairVector()[i].first, WebString::create(iconURLs.stringPairVector()[i].second));
3017 callback->performCallbackWithReturnValue(ImmutableDictionary::adopt(iconURLList).get());
3021 void WebPageProxy::setMediaVolume(float volume)
3023 if (volume == m_mediaVolume)
3026 m_mediaVolume = volume;
3031 process()->send(Messages::WebPage::SetMediaVolume(volume), m_pageID);
3035 void WebPageProxy::didChangeContentsSize(const IntSize& size)
3037 m_pageClient->didChangeContentsSize(size);
3040 void WebPageProxy::didFindZoomableArea(const IntPoint& target, const IntRect& area)
3042 m_pageClient->didFindZoomableArea(target, area);
3045 void WebPageProxy::findZoomableAreaForPoint(const IntPoint& point, const IntSize& area)
3050 process()->send(Messages::WebPage::FindZoomableAreaForPoint(point, area), m_pageID);
3053 void WebPageProxy::didReceiveMessageFromNavigatorQtObject(const String& contents)
3055 m_pageClient->didReceiveMessageFromNavigatorQtObject(contents);
3058 void WebPageProxy::authenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password)
3060 m_pageClient->handleAuthenticationRequiredRequest(hostname, realm, prefilledUsername, username, password);
3063 void WebPageProxy::proxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password)
3065 m_pageClient->handleProxyAuthenticationRequiredRequest(hostname, port, prefilledUsername, username, password);
3068 void WebPageProxy::certificateVerificationRequest(const String& hostname, bool& ignoreErrors)
3070 m_pageClient->handleCertificateVerificationRequest(hostname, ignoreErrors);
3072 #endif // PLATFORM(QT).
3075 void WebPageProxy::didFindZoomableArea(const IntPoint& target, const IntRect& area)
3077 m_pageClient->didFindZoomableArea(target, area);
3080 void WebPageProxy::findZoomableAreaForPoint(const IntPoint& point, const IntSize& area)
3085 process()->send(Messages::WebPage::FindZoomableAreaForPoint(point, area), m_pageID);
3087 #endif // #if OS(TIZEN)
3089 #if PLATFORM(QT) || PLATFORM(EFL)
3090 void WebPageProxy::handleDownloadRequest(DownloadProxy* download)
3092 m_pageClient->handleDownloadRequest(download);
3094 #endif // PLATFORM(QT) || PLATFORM(EFL)
3096 #if ENABLE(TOUCH_EVENTS)
3097 void WebPageProxy::needTouchEvents(bool needTouchEvents)
3099 m_needTouchEvents = needTouchEvents;
3100 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
3101 // We don't have to ask overflow if we need touch events,
3102 // because we will check overflow in the web process when touch event is processed.
3103 m_askOverflow = !m_needTouchEvents;
3108 #if ENABLE(INPUT_TYPE_COLOR)
3109 void WebPageProxy::showColorChooser(const WebCore::Color& initialColor)
3111 ASSERT(!m_colorChooser);
3113 #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
3114 if (m_colorPickerResultListener) {
3115 m_colorPickerResultListener->invalidate();
3116 m_colorPickerResultListener = nullptr;
3119 m_colorPickerResultListener = WebColorPickerResultListenerProxy::create(this);
3120 m_colorChooser = WebColorChooserProxy::create(this);
3122 if (m_uiClient.showColorPicker(this, initialColor.serialized(), m_colorPickerResultListener.get()))
3126 m_colorChooser = m_pageClient->createColorChooserProxy(this, initialColor);
3127 #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
3128 if (!m_colorChooser)
3129 didEndColorChooser();
3133 void WebPageProxy::setColorChooserColor(const WebCore::Color& color)
3135 ASSERT(m_colorChooser);
3137 m_colorChooser->setSelectedColor(color);
3140 void WebPageProxy::endColorChooser()
3142 ASSERT(m_colorChooser);
3144 m_colorChooser->endChooser();
3147 void WebPageProxy::didChooseColor(const WebCore::Color& color)
3152 process()->send(Messages::WebPage::DidChooseColor(color), m_pageID);
3155 void WebPageProxy::didEndColorChooser()
3160 #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
3161 if (m_colorChooser) {
3162 m_colorChooser->invalidate();
3163 m_colorChooser = nullptr;
3166 ASSERT(m_colorChooser);
3168 m_colorChooser->invalidate();
3169 m_colorChooser = nullptr;
3172 #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
3173 m_process->send(Messages::WebPage::DidEndColorChooser(), m_pageID);
3175 m_colorPickerResultListener->invalidate();
3176 m_colorPickerResultListener = nullptr;
3178 m_uiClient.hideColorPicker(this);
3180 process()->send(Messages::WebPage::DidEndColorChooser(), m_pageID);
3185 void WebPageProxy::didDraw()
3187 m_uiClient.didDraw(this);
3192 #if ENABLE(INSPECTOR)
3194 WebInspectorProxy* WebPageProxy::inspector()
3196 if (isClosed() || !isValid())
3199 m_inspector = WebInspectorProxy::create(this);
3200 return m_inspector.get();
3205 #if ENABLE(FULLSCREEN_API)
3206 WebFullScreenManagerProxy* WebPageProxy::fullScreenManager()
3208 if (!m_fullScreenManager)
3209 m_fullScreenManager = WebFullScreenManagerProxy::create(this);
3210 return m_fullScreenManager.get();
3216 void WebPageProxy::backForwardAddItem(uint64_t itemID)
3218 m_backForwardList->addItem(process()->webBackForwardItem(itemID));
3221 void WebPageProxy::backForwardGoToItem(uint64_t itemID, SandboxExtension::Handle& sandboxExtensionHandle)
3223 WebBackForwardListItem* item = process()->webBackForwardItem(itemID);
3227 bool createdExtension = maybeInitializeSandboxExtensionHandle(KURL(KURL(), item->url()), sandboxExtensionHandle);
3228 if (createdExtension)
3229 process()->willAcquireUniversalFileReadSandboxExtension();
3230 m_backForwardList->goToItem(item);
3233 void WebPageProxy::backForwardItemAtIndex(int32_t index, uint64_t& itemID)
3235 WebBackForwardListItem* item = m_backForwardList->itemAtIndex(index);
3236 itemID = item ? item->itemID() : 0;
3239 void WebPageProxy::backForwardBackListCount(int32_t& count)
3241 count = m_backForwardList->backListCount();
3244 void WebPageProxy::backForwardForwardListCount(int32_t& count)
3246 count = m_backForwardList->forwardListCount();
3249 void WebPageProxy::editorStateChanged(const EditorState& editorState)
3252 bool couldChangeSecureInputState = m_editorState.isInPasswordField != editorState.isInPasswordField || m_editorState.selectionIsNone;
3255 m_editorState = editorState;
3258 m_pageClient->updateTextInputState(couldChangeSecureInputState);
3259 #elif PLATFORM(QT) || ENABLE(TIZEN_ISF_PORT)
3260 m_pageClient->updateTextInputState();
3266 void WebPageProxy::registerEditCommandForUndo(uint64_t commandID, uint32_t editAction)
3268 registerEditCommand(WebEditCommandProxy::create(commandID, static_cast<EditAction>(editAction), this), Undo);
3271 void WebPageProxy::canUndoRedo(uint32_t action, bool& result)
3273 result = m_pageClient->canUndoRedo(static_cast<UndoOrRedo>(action));
3276 void WebPageProxy::executeUndoRedo(uint32_t action, bool& result)
3278 m_pageClient->executeUndoRedo(static_cast<UndoOrRedo>(action));
3282 void WebPageProxy::clearAllEditCommands()
3284 m_pageClient->clearAllEditCommands();
3287 void WebPageProxy::didCountStringMatches(const String& string, uint32_t matchCount)
3289 m_findClient.didCountStringMatches(this, string, matchCount);
3292 void WebPageProxy::didGetImageForFindMatch(const ShareableBitmap::Handle& contentImageHandle, uint32_t matchIndex)
3294 m_findMatchesClient.didGetImageForMatchResult(this, WebImage::create(ShareableBitmap::create(contentImageHandle)).get(), matchIndex);
3297 void WebPageProxy::setFindIndicator(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, const ShareableBitmap::Handle& contentImageHandle, bool fadeOut, bool animate)
3299 RefPtr<FindIndicator> findIndicator = FindIndicator::create(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, contentImageScaleFactor, contentImageHandle);
3300 m_pageClient->setFindIndicator(findIndicator.release(), fadeOut, animate);
3303 void WebPageProxy::didFindString(const String& string, uint32_t matchCount)
3305 m_findClient.didFindString(this, string, matchCount);
3308 void WebPageProxy::didFindStringMatches(const String& string, Vector<Vector<WebCore::IntRect> > matchRects, int32_t firstIndexAfterSelection)
3310 Vector<RefPtr<APIObject> > matches;
3311 matches.reserveInitialCapacity(matchRects.size());
3313 for (size_t i = 0; i < matchRects.size(); ++i) {
3314 const Vector<WebCore::IntRect>& rects = matchRects[i];
3315 size_t numRects = matchRects[i].size();
3316 Vector<RefPtr<APIObject> > apiRects;
3317 apiRects.reserveInitialCapacity(numRects);
3319 for (size_t i = 0; i < numRects; ++i)
3320 apiRects.uncheckedAppend(WebRect::create(toAPI(rects[i])));
3321 matches.uncheckedAppend(ImmutableArray::adopt(apiRects));
3323 m_findMatchesClient.didFindStringMatches(this, string, ImmutableArray::adopt(matches).get(), firstIndexAfterSelection);
3326 void WebPageProxy::didFailToFindString(const String& string)
3328 m_findClient.didFailToFindString(this, string);
3331 void WebPageProxy::valueChangedForPopupMenu(WebPopupMenuProxy*, int32_t newSelectedIndex)
3333 process()->send(Messages::WebPage::DidChangeSelectedIndexForActivePopupMenu(newSelectedIndex), m_pageID);
3336 void WebPageProxy::setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index)
3338 process()->send(Messages::WebPage::SetTextForActivePopupMenu(index), m_pageID);
3341 NativeWebMouseEvent* WebPageProxy::currentlyProcessedMouseDownEvent()
3343 return m_currentlyProcessedMouseDownEvent.get();
3347 void WebPageProxy::failedToShowPopupMenu()
3349 process()->send(Messages::WebPage::FailedToShowPopupMenu(), m_pageID);
3353 void WebPageProxy::showPopupMenu(const IntRect& rect, uint64_t textDirection, const Vector<WebPopupItem>& items, int32_t selectedIndex, const PlatformPopupMenuData& data)
3355 if (m_activePopupMenu) {
3356 m_activePopupMenu->hidePopupMenu();
3357 m_activePopupMenu->invalidate();
3358 m_activePopupMenu = 0;
3361 m_activePopupMenu = m_pageClient->createPopupMenuProxy(this);
3363 // Since showPopupMenu() can spin a nested run loop we need to turn off the responsiveness timer.
3364 process()->responsivenessTimer()->stop();
3366 RefPtr<WebPopupMenuProxy> protectedActivePopupMenu = m_activePopupMenu;
3368 protectedActivePopupMenu->showPopupMenu(rect, static_cast<TextDirection>(textDirection), m_pageScaleFactor, items, data, selectedIndex);
3370 // 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.
3371 #if !PLATFORM(QT) && !PLATFORM(EFL)
3372 protectedActivePopupMenu->invalidate();
3374 protectedActivePopupMenu = 0;
3377 void WebPageProxy::hidePopupMenu()
3379 if (!m_activePopupMenu)
3382 m_activePopupMenu->hidePopupMenu();
3383 m_activePopupMenu->invalidate();
3384 m_activePopupMenu = 0;
3387 #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
3388 void WebPageProxy::updatePopupMenu(uint64_t textDirection, const Vector<WebPopupItem>& items, int32_t selectedIndex)
3390 if (!m_activePopupMenu)
3393 m_activePopupMenu->updatePopupMenu(static_cast<TextDirection>(textDirection), items, selectedIndex);
3397 #if ENABLE(CONTEXT_MENUS)
3398 void WebPageProxy::showContextMenu(const IntPoint& menuLocation, const WebHitTestResult::Data& hitTestResultData, const Vector<WebContextMenuItemData>& proposedItems, CoreIPC::ArgumentDecoder* arguments)
3400 internalShowContextMenu(menuLocation, hitTestResultData, proposedItems, arguments);
3402 // No matter the result of internalShowContextMenu, always notify the WebProcess that the menu is hidden so it starts handling mouse events again.
3403 process()->send(Messages::WebPage::ContextMenuHidden(), m_pageID);
3406 void WebPageProxy::internalShowContextMenu(const IntPoint& menuLocation, const WebHitTestResult::Data& hitTestResultData, const Vector<WebContextMenuItemData>& proposedItems, CoreIPC::ArgumentDecoder* arguments)
3408 RefPtr<APIObject> userData;
3409 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
3410 if (!arguments->decode(messageDecoder))
3413 m_activeContextMenuHitTestResultData = hitTestResultData;
3415 if (m_activeContextMenu) {
3416 m_activeContextMenu->hideContextMenu();
3417 m_activeContextMenu = 0;
3420 m_activeContextMenu = m_pageClient->createContextMenuProxy(this);
3422 // Since showContextMenu() can spin a nested run loop we need to turn off the responsiveness timer.
3423 process()->responsivenessTimer()->stop();
3425 // Give the PageContextMenuClient one last swipe at changing the menu.
3426 Vector<WebContextMenuItemData> items;
3427 if (!m_contextMenuClient.getContextMenuFromProposedMenu(this, proposedItems, items, hitTestResultData, userData.get()))
3428 m_activeContextMenu->showContextMenu(menuLocation, proposedItems);
3430 m_activeContextMenu->showContextMenu(menuLocation, items);
3432 m_contextMenuClient.contextMenuDismissed(this);
3435 void WebPageProxy::contextMenuItemSelected(const WebContextMenuItemData& item)
3437 TIZEN_LOGI("selected item : action(%d), title(%s)", item.action(), item.title().utf8().data());
3438 // Application custom items don't need to round-trip through to WebCore in the WebProcess.
3439 if (item.action() >= ContextMenuItemBaseApplicationTag) {
3440 m_contextMenuClient.customContextMenuItemSelected(this, item);
3441 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
3442 m_pageClient->setIsTextSelectionMode(false);
3447 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
3448 if (item.action() == ContextMenuItemTagPaste)
3449 m_pageClient->setIsTextSelectionMode(false);
3453 if (item.action() == ContextMenuItemTagSmartCopyPaste) {
3454 setSmartInsertDeleteEnabled(!isSmartInsertDeleteEnabled());
3457 if (item.action() == ContextMenuItemTagSmartQuotes) {
3458 TextChecker::setAutomaticQuoteSubstitutionEnabled(!TextChecker::state().isAutomaticQuoteSubstitutionEnabled);
3459 process()->updateTextCheckerState();
3462 if (item.action() == ContextMenuItemTagSmartDashes) {
3463 TextChecker::setAutomaticDashSubstitutionEnabled(!TextChecker::state().isAutomaticDashSubstitutionEnabled);
3464 process()->updateTextCheckerState();
3467 if (item.action() == ContextMenuItemTagSmartLinks) {
3468 TextChecker::setAutomaticLinkDetectionEnabled(!TextChecker::state().isAutomaticLinkDetectionEnabled);
3469 process()->updateTextCheckerState();
3472 if (item.action() == ContextMenuItemTagTextReplacement) {
3473 TextChecker::setAutomaticTextReplacementEnabled(!TextChecker::state().isAutomaticTextReplacementEnabled);
3474 process()->updateTextCheckerState();
3477 if (item.action() == ContextMenuItemTagCorrectSpellingAutomatically) {
3478 TextChecker::setAutomaticSpellingCorrectionEnabled(!TextChecker::state().isAutomaticSpellingCorrectionEnabled);
3479 process()->updateTextCheckerState();
3482 if (item.action() == ContextMenuItemTagShowSubstitutions) {
3483 TextChecker::toggleSubstitutionsPanelIsShowing();
3487 if (item.action() == ContextMenuItemTagDownloadImageToDisk) {
3488 m_process->context()->download(this, KURL(KURL(), m_activeContextMenuHitTestResultData.absoluteImageURL));
3491 if (item.action() == ContextMenuItemTagDownloadLinkToDisk) {
3492 m_process->context()->download(this, KURL(KURL(), m_activeContextMenuHitTestResultData.absoluteLinkURL));
3495 if (item.action() == ContextMenuItemTagCheckSpellingWhileTyping) {
3496 TextChecker::setContinuousSpellCheckingEnabled(!TextChecker::state().isContinuousSpellCheckingEnabled);
3497 process()->updateTextCheckerState();
3500 if (item.action() == ContextMenuItemTagCheckGrammarWithSpelling) {
3501 TextChecker::setGrammarCheckingEnabled(!TextChecker::state().isGrammarCheckingEnabled);
3502 process()->updateTextCheckerState();
3505 if (item.action() == ContextMenuItemTagShowSpellingPanel) {
3506 if (!TextChecker::spellingUIIsShowing())
3507 advanceToNextMisspelling(true);
3508 TextChecker::toggleSpellingUIIsShowing();
3511 if (item.action() == ContextMenuItemTagLearnSpelling || item.action() == ContextMenuItemTagIgnoreSpelling)
3512 ++m_pendingLearnOrIgnoreWordMessageCount;
3514 #if ENABLE(TIZEN_WEBKIT2_CLIPBOARD_HELPER)
3515 if (item.action() == ContextMenuItemTagPaste) {
3516 pasteContextMenuSelected();
3521 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_TEXT_SELECTION_MODE)
3522 if (item.action() == ContextMenuItemTagTextSelectionMode) {
3523 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
3524 m_pageClient->setIsTextSelectionMode(true);
3527 evas_object_focus_set(viewWidget(), true);
3528 WebCore::IntPoint positionForSelection = m_activeContextMenu->positionForSelection();
3529 bool result = false;
3530 process()->sendSync(Messages::WebPage::SelectLink(positionForSelection), Messages::WebPage::SelectLink::Reply(result), m_pageID);
3531 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
3532 if (result == false)
3533 m_pageClient->setIsTextSelectionMode(false);
3540 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
3541 if (item.action() == ContextMenuItemTagClipboard) {
3542 clipboardContextMenuSelected();
3547 #if ENABLE(CONTEXT_MENUS)
3548 process()->send(Messages::WebPage::DidSelectItemFromActiveContextMenu(item), m_pageID);
3551 #endif // ENABLE(CONTEXT_MENUS)
3553 void WebPageProxy::didChooseFilesForOpenPanel(const Vector<String>& fileURLs)
3558 #if ENABLE(WEB_PROCESS_SANDBOX)
3559 // FIXME: The sandbox extensions should be sent with the DidChooseFilesForOpenPanel message. This
3560 // is gated on a way of passing SandboxExtension::Handles in a Vector.
3561 for (size_t i = 0; i < fileURLs.size(); ++i) {
3562 SandboxExtension::Handle sandboxExtensionHandle;
3563 SandboxExtension::createHandle(fileURLs[i], SandboxExtension::ReadOnly, sandboxExtensionHandle);
3564 process()->send(Messages::WebPage::ExtendSandboxForFileFromOpenPanel(sandboxExtensionHandle), m_pageID);
3568 process()->send(Messages::WebPage::DidChooseFilesForOpenPanel(fileURLs), m_pageID);
3570 m_openPanelResultListener->invalidate();
3571 m_openPanelResultListener = 0;
3574 void WebPageProxy::didCancelForOpenPanel()
3579 process()->send(Messages::WebPage::DidCancelForOpenPanel(), m_pageID);
3581 m_openPanelResultListener->invalidate();
3582 m_openPanelResultListener = 0;
3585 void WebPageProxy::advanceToNextMisspelling(bool startBeforeSelection) const
3587 process()->send(Messages::WebPage::AdvanceToNextMisspelling(startBeforeSelection), m_pageID);
3590 void WebPageProxy::changeSpellingToWord(const String& word) const
3595 process()->send(Messages::WebPage::ChangeSpellingToWord(word), m_pageID);
3598 void WebPageProxy::registerEditCommand(PassRefPtr<WebEditCommandProxy> commandProxy, UndoOrRedo undoOrRedo)
3600 m_pageClient->registerEditCommand(commandProxy, undoOrRedo);
3603 void WebPageProxy::addEditCommand(WebEditCommandProxy* command)
3605 m_editCommandSet.add(command);
3608 void WebPageProxy::removeEditCommand(WebEditCommandProxy* command)
3610 m_editCommandSet.remove(command);
3614 process()->send(Messages::WebPage::DidRemoveEditCommand(command->commandID()), m_pageID);
3617 bool WebPageProxy::isValidEditCommand(WebEditCommandProxy* command)
3619 return m_editCommandSet.find(command) != m_editCommandSet.end();
3622 int64_t WebPageProxy::spellDocumentTag()
3624 if (!m_hasSpellDocumentTag) {
3625 m_spellDocumentTag = TextChecker::uniqueSpellDocumentTag(this);
3626 m_hasSpellDocumentTag = true;
3629 return m_spellDocumentTag;
3632 #if USE(UNIFIED_TEXT_CHECKING)
3633 void WebPageProxy::checkTextOfParagraph(const String& text, uint64_t checkingTypes, Vector<TextCheckingResult>& results)
3635 results = TextChecker::checkTextOfParagraph(spellDocumentTag(), text.characters(), text.length(), checkingTypes);
3639 void WebPageProxy::checkSpellingOfString(const String& text, int32_t& misspellingLocation, int32_t& misspellingLength)
3641 TextChecker::checkSpellingOfString(spellDocumentTag(), text.characters(), text.length(), misspellingLocation, misspellingLength);
3644 void WebPageProxy::checkGrammarOfString(const String& text, Vector<GrammarDetail>& grammarDetails, int32_t& badGrammarLocation, int32_t& badGrammarLength)
3646 TextChecker::checkGrammarOfString(spellDocumentTag(), text.characters(), text.length(), grammarDetails, badGrammarLocation, badGrammarLength);
3649 void WebPageProxy::spellingUIIsShowing(bool& isShowing)
3651 isShowing = TextChecker::spellingUIIsShowing();
3654 void WebPageProxy::updateSpellingUIWithMisspelledWord(const String& misspelledWord)
3656 TextChecker::updateSpellingUIWithMisspelledWord(spellDocumentTag(), misspelledWord);
3659 void WebPageProxy::updateSpellingUIWithGrammarString(const String& badGrammarPhrase, const GrammarDetail& grammarDetail)
3661 TextChecker::updateSpellingUIWithGrammarString(spellDocumentTag(), badGrammarPhrase, grammarDetail);
3664 void WebPageProxy::getGuessesForWord(const String& word, const String& context, Vector<String>& guesses)
3666 TextChecker::getGuessesForWord(spellDocumentTag(), word, context, guesses);
3669 void WebPageProxy::learnWord(const String& word)
3671 MESSAGE_CHECK(m_pendingLearnOrIgnoreWordMessageCount);
3672 --m_pendingLearnOrIgnoreWordMessageCount;
3674 TextChecker::learnWord(spellDocumentTag(), word);
3677 void WebPageProxy::ignoreWord(const String& word)
3679 MESSAGE_CHECK(m_pendingLearnOrIgnoreWordMessageCount);
3680 --m_pendingLearnOrIgnoreWordMessageCount;
3682 TextChecker::ignoreWord(spellDocumentTag(), word);
3687 void WebPageProxy::setFocus(bool focused)
3690 m_uiClient.focus(this);
3692 m_uiClient.unfocus(this);
3695 void WebPageProxy::takeFocus(uint32_t direction)
3697 m_uiClient.takeFocus(this, (static_cast<FocusDirection>(direction) == FocusDirectionForward) ? kWKFocusDirectionForward : kWKFocusDirectionBackward);
3700 void WebPageProxy::setToolTip(const String& toolTip)
3702 String oldToolTip = m_toolTip;
3703 m_toolTip = toolTip;
3704 m_pageClient->toolTipChanged(oldToolTip, m_toolTip);
3707 void WebPageProxy::setCursor(const WebCore::Cursor& cursor)
3709 m_pageClient->setCursor(cursor);
3712 void WebPageProxy::setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves)
3714 m_pageClient->setCursorHiddenUntilMouseMoves(hiddenUntilMouseMoves);
3717 void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
3719 WebEvent::Type type = static_cast<WebEvent::Type>(opaqueType);
3722 case WebEvent::NoType:
3723 case WebEvent::MouseMove:
3726 case WebEvent::MouseDown:
3727 case WebEvent::MouseUp:
3728 case WebEvent::Wheel:
3729 case WebEvent::KeyDown:
3730 case WebEvent::KeyUp:
3731 case WebEvent::RawKeyDown:
3732 case WebEvent::Char:
3733 #if ENABLE(GESTURE_EVENTS)
3734 case WebEvent::GestureScrollBegin:
3735 case WebEvent::GestureScrollEnd:
3736 case WebEvent::GestureSingleTap:
3738 #if ENABLE(TOUCH_EVENTS)
3739 case WebEvent::TouchStart:
3740 case WebEvent::TouchMove:
3741 case WebEvent::TouchEnd:
3742 case WebEvent::TouchCancel:
3744 process()->responsivenessTimer()->stop();
3749 case WebEvent::NoType:
3751 case WebEvent::MouseMove:
3752 m_processingMouseMoveEvent = false;
3753 if (m_nextMouseMoveEvent) {
3754 handleMouseEvent(*m_nextMouseMoveEvent);
3755 m_nextMouseMoveEvent = nullptr;
3758 case WebEvent::MouseDown:
3760 #if ENABLE(GESTURE_EVENTS)
3761 case WebEvent::GestureScrollBegin:
3762 case WebEvent::GestureScrollEnd:
3763 case WebEvent::GestureSingleTap: {
3764 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
3765 QueuedUIEvents<WebGestureEvent> queuedEvents = m_gestureEventQueue.first();
3766 MESSAGE_CHECK(type == queuedEvents.forwardedEvent.type());
3767 m_gestureEventQueue.removeFirst();
3769 m_pageClient->doneWithGestureEvent(queuedEvents.forwardedEvent, handled);
3770 for (size_t i = 0; i < queuedEvents.deferredEvents.size(); ++i) {
3771 bool isEventHandled = false;
3772 m_pageClient->doneWithGestureEvent(queuedEvents.deferredEvents.at(i), isEventHandled);
3775 WebGestureEvent event = m_gestureEventQueue.first();
3776 MESSAGE_CHECK(type == event.type());
3778 m_gestureEventQueue.removeFirst();
3779 m_pageClient->doneWithGestureEvent(event, handled);
3784 case WebEvent::MouseUp:
3785 m_currentlyProcessedMouseDownEvent = nullptr;
3788 case WebEvent::Wheel: {
3789 ASSERT(!m_currentlyProcessedWheelEvents.isEmpty());
3791 OwnPtr<Vector<NativeWebWheelEvent> > oldestCoalescedEvent = m_currentlyProcessedWheelEvents.takeFirst();
3793 // FIXME: Dispatch additional events to the didNotHandleWheelEvent client function.
3794 if (!handled && m_uiClient.implementsDidNotHandleWheelEvent())
3795 m_uiClient.didNotHandleWheelEvent(this, oldestCoalescedEvent->last());
3797 if (!m_wheelEventQueue.isEmpty())
3798 processNextQueuedWheelEvent();
3802 case WebEvent::KeyDown:
3803 case WebEvent::KeyUp:
3804 case WebEvent::RawKeyDown:
3805 case WebEvent::Char: {
3806 LOG(KeyHandling, "WebPageProxy::didReceiveEvent: %s", webKeyboardEventTypeString(type));
3808 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
3809 QueuedUIEvents<NativeWebKeyboardEvent> queuedEvents = m_keyEventQueue.first();
3810 MESSAGE_CHECK(type == queuedEvents.forwardedEvent.type());
3811 m_keyEventQueue.removeFirst();
3813 m_pageClient->doneWithKeyEvent(queuedEvents.forwardedEvent, handled);
3816 if (m_uiClient.implementsDidNotHandleKeyEvent())
3817 m_uiClient.didNotHandleKeyEvent(this, queuedEvents.forwardedEvent);
3820 ::TranslateMessage(queuedEvents.forwardedEvent.nativeEvent());
3824 for (size_t i = 0; i < queuedEvents.deferredEvents.size(); ++i) {
3825 bool isEventHandled = false;
3826 m_pageClient->doneWithKeyEvent(queuedEvents.deferredEvents.at(i), isEventHandled);
3829 NativeWebKeyboardEvent event = m_keyEventQueue.first();
3830 MESSAGE_CHECK(type == event.type());
3832 m_keyEventQueue.removeFirst();
3834 if (!m_keyEventQueue.isEmpty())
3835 process()->send(Messages::WebPage::KeyEvent(m_keyEventQueue.first()), m_pageID);
3837 m_pageClient->doneWithKeyEvent(event, handled);
3841 if (m_uiClient.implementsDidNotHandleKeyEvent())
3842 m_uiClient.didNotHandleKeyEvent(this, event);
3845 ::TranslateMessage(event.nativeEvent());
3847 #endif // #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
3850 #if ENABLE(TOUCH_EVENTS)
3851 case WebEvent::TouchStart:
3852 case WebEvent::TouchMove:
3853 case WebEvent::TouchEnd:
3854 case WebEvent::TouchCancel: {
3855 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
3856 QueuedUIEvents<NativeWebTouchEvent> queuedEvents = m_touchEventQueue.first();
3857 MESSAGE_CHECK(type == queuedEvents.forwardedEvent.type());
3858 m_touchEventQueue.removeFirst();
3860 m_pageClient->doneWithTouchEvent(queuedEvents.forwardedEvent, handled);
3861 for (size_t i = 0; i < queuedEvents.deferredEvents.size(); ++i) {
3862 bool isEventHandled = false;
3863 m_pageClient->doneWithTouchEvent(queuedEvents.deferredEvents.at(i), isEventHandled);
3866 QueuedTouchEvents queuedEvents = m_touchEventQueue.first();
3867 MESSAGE_CHECK(type == queuedEvents.forwardedEvent.type());
3868 m_touchEventQueue.removeFirst();
3870 m_pageClient->doneWithTouchEvent(queuedEvents.forwardedEvent, handled);
3871 for (size_t i = 0; i < queuedEvents.deferredTouchEvents.size(); ++i) {
3872 bool isEventHandled = false;
3873 m_pageClient->doneWithTouchEvent(queuedEvents.deferredTouchEvents.at(i), isEventHandled);
3882 void WebPageProxy::stopResponsivenessTimer()
3884 process()->responsivenessTimer()->stop();
3887 void WebPageProxy::voidCallback(uint64_t callbackID)
3889 RefPtr<VoidCallback> callback = m_voidCallbacks.take(callbackID);
3891 // FIXME: Log error or assert.
3895 callback->performCallback();
3898 void WebPageProxy::dataCallback(const CoreIPC::DataReference& dataReference, uint64_t callbackID)
3900 RefPtr<DataCallback> callback = m_dataCallbacks.take(callbackID);
3902 // FIXME: Log error or assert.
3906 callback->performCallbackWithReturnValue(WebData::create(dataReference.data(), dataReference.size()).get());
3909 void WebPageProxy::stringCallback(const String& resultString, uint64_t callbackID)
3911 RefPtr<StringCallback> callback = m_stringCallbacks.take(callbackID);
3913 // FIXME: Log error or assert.
3914 // this can validly happen if a load invalidated the callback, though
3918 m_loadDependentStringCallbackIDs.remove(callbackID);
3920 callback->performCallbackWithReturnValue(resultString.impl());
3923 void WebPageProxy::scriptValueCallback(const CoreIPC::DataReference& dataReference, uint64_t callbackID)
3925 RefPtr<ScriptValueCallback> callback = m_scriptValueCallbacks.take(callbackID);
3927 // FIXME: Log error or assert.
3931 Vector<uint8_t> data;
3932 data.reserveInitialCapacity(dataReference.size());
3933 data.append(dataReference.data(), dataReference.size());
3935 callback->performCallbackWithReturnValue(data.size() ? WebSerializedScriptValue::adopt(data).get() : 0);
3938 void WebPageProxy::computedPagesCallback(const Vector<IntRect>& pageRects, double totalScaleFactorForPrinting, uint64_t callbackID)
3940 RefPtr<ComputedPagesCallback> callback = m_computedPagesCallbacks.take(callbackID);
3942 // FIXME: Log error or assert.
3946 callback->performCallbackWithReturnValue(pageRects, totalScaleFactorForPrinting);
3949 void WebPageProxy::validateCommandCallback(const String& commandName, bool isEnabled, int state, uint64_t callbackID)
3951 RefPtr<ValidateCommandCallback> callback = m_validateCommandCallbacks.take(callbackID);
3953 // FIXME: Log error or assert.
3957 callback->performCallbackWithReturnValue(commandName.impl(), isEnabled, state);
3961 void WebPageProxy::printFinishedCallback(const ResourceError& printError, uint64_t callbackID)
3963 RefPtr<PrintFinishedCallback> callback = m_printFinishedCallbacks.take(callbackID);
3965 // FIXME: Log error or assert.
3969 RefPtr<WebError> error = WebError::create(printError);
3970 callback->performCallbackWithReturnValue(error.get());
3974 void WebPageProxy::focusedFrameChanged(uint64_t frameID)
3981 WebFrameProxy* frame = process()->webFrame(frameID);
3982 MESSAGE_CHECK(frame);
3984 m_focusedFrame = frame;
3987 void WebPageProxy::frameSetLargestFrameChanged(uint64_t frameID)
3990 m_frameSetLargestFrame = 0;
3994 WebFrameProxy* frame = process()->webFrame(frameID);
3995 MESSAGE_CHECK(frame);
3997 m_frameSetLargestFrame = frame;
4000 void WebPageProxy::processDidBecomeUnresponsive()
4005 updateBackingStoreDiscardableState();
4007 m_loaderClient.processDidBecomeUnresponsive(this);
4010 void WebPageProxy::interactionOccurredWhileProcessUnresponsive()
4015 m_loaderClient.interactionOccurredWhileProcessUnresponsive(this);
4018 void WebPageProxy::processDidBecomeResponsive()
4023 updateBackingStoreDiscardableState();
4025 m_loaderClient.processDidBecomeResponsive(this);
4028 void WebPageProxy::processDidCrash()
4030 ASSERT(m_pageClient);
4033 m_isPageSuspended = false;
4036 m_urlAtProcessExit = m_mainFrame->url();
4037 m_loadStateAtProcessExit = m_mainFrame->loadState();
4040 m_mainFrame = nullptr;
4041 m_drawingArea = nullptr;
4043 #if ENABLE(INSPECTOR)
4045 m_inspector->invalidate();
4046 m_inspector = nullptr;
4050 #if ENABLE(FULLSCREEN_API)
4051 if (m_fullScreenManager) {
4052 m_fullScreenManager->invalidate();
4053 m_fullScreenManager = nullptr;
4057 if (m_openPanelResultListener) {
4058 m_openPanelResultListener->invalidate();
4059 m_openPanelResultListener = nullptr;
4062 #if ENABLE(INPUT_TYPE_COLOR)
4063 if (m_colorChooser) {
4064 m_colorChooser->invalidate();
4065 m_colorChooser = nullptr;
4068 #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
4069 if (m_colorPickerResultListener) {
4070 m_colorPickerResultListener->invalidate();
4071 m_colorPickerResultListener = nullptr;
4076 #if ENABLE(GEOLOCATION)
4077 m_geolocationPermissionRequestManager.invalidateRequests();
4080 m_notificationPermissionRequestManager.invalidateRequests();
4082 m_toolTip = String();
4084 m_mainFrameHasHorizontalScrollbar = false;
4085 m_mainFrameHasVerticalScrollbar = false;
4087 m_mainFrameIsPinnedToLeftSide = false;
4088 m_mainFrameIsPinnedToRightSide = false;
4090 m_visibleScrollerThumbRect = IntRect();
4092 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
4093 invalidateCallbackMap(m_booleanCallbacks);
4094 invalidateCallbackMap(m_dictionaryCallbacks);
4096 invalidateCallbackMap(m_voidCallbacks);
4097 invalidateCallbackMap(m_dataCallbacks);
4098 invalidateCallbackMap(m_stringCallbacks);
4099 m_loadDependentStringCallbackIDs.clear();
4100 invalidateCallbackMap(m_scriptValueCallbacks);
4101 invalidateCallbackMap(m_computedPagesCallbacks);
4102 invalidateCallbackMap(m_validateCommandCallbacks);
4104 invalidateCallbackMap(m_printFinishedCallbacks);
4107 Vector<WebEditCommandProxy*> editCommandVector;
4108 copyToVector(m_editCommandSet, editCommandVector);
4109 m_editCommandSet.clear();
4110 for (size_t i = 0, size = editCommandVector.size(); i < size; ++i)
4111 editCommandVector[i]->invalidate();
4112 m_pageClient->clearAllEditCommands();
4114 m_activePopupMenu = 0;
4116 m_estimatedProgress = 0.0;
4118 m_pendingLearnOrIgnoreWordMessageCount = 0;
4120 m_pageClient->processDidCrash();
4121 m_loaderClient.processDidCrash(this);
4124 // If the call out to the loader client didn't cause the web process to be relaunched,
4125 // we'll call setNeedsDisplay on the view so that we won't have the old contents showing.
4126 // If the call did cause the web process to be relaunched, we'll keep the old page contents showing
4127 // until the new web process has painted its contents.
4128 setViewNeedsDisplay(IntRect(IntPoint(), viewSize()));
4131 // Can't expect DidReceiveEvent notifications from a crashed web process.
4132 m_keyEventQueue.clear();
4134 m_wheelEventQueue.clear();
4135 m_currentlyProcessedWheelEvents.clear();
4137 m_nextMouseMoveEvent = nullptr;
4138 m_currentlyProcessedMouseDownEvent = nullptr;
4140 m_processingMouseMoveEvent = false;
4142 #if ENABLE(TOUCH_EVENTS)
4143 m_needTouchEvents = false;
4144 m_touchEventQueue.clear();
4147 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
4148 dismissCorrectionPanel(ReasonForDismissingAlternativeTextIgnored);
4149 m_pageClient->dismissDictionaryLookupPanel();
4153 WebPageCreationParameters WebPageProxy::creationParameters() const
4155 WebPageCreationParameters parameters;
4157 parameters.viewSize = m_pageClient->viewSize();
4158 parameters.isActive = m_pageClient->isViewWindowActive();
4159 parameters.isFocused = m_pageClient->isViewFocused();
4160 parameters.isVisible = m_pageClient->isViewVisible();
4161 parameters.isInWindow = m_pageClient->isViewInWindow();
4162 parameters.drawingAreaType = m_drawingArea->type();
4163 parameters.store = m_pageGroup->preferences()->store();
4164 parameters.pageGroupData = m_pageGroup->data();
4165 parameters.drawsBackground = m_drawsBackground;
4166 parameters.drawsTransparentBackground = m_drawsTransparentBackground;
4167 parameters.areMemoryCacheClientCallsEnabled = m_areMemoryCacheClientCallsEnabled;
4168 parameters.useFixedLayout = m_useFixedLayout;
4169 parameters.fixedLayoutSize = m_fixedLayoutSize;
4170 parameters.paginationMode = m_paginationMode;
4171 parameters.paginationBehavesLikeColumns = m_paginationBehavesLikeColumns;
4172 parameters.pageLength = m_pageLength;
4173 parameters.gapBetweenPages = m_gapBetweenPages;
4174 parameters.userAgent = userAgent();
4175 parameters.sessionState = SessionState(m_backForwardList->entries(), m_backForwardList->currentIndex());
4176 parameters.highestUsedBackForwardItemID = WebBackForwardListItem::highedUsedItemID();
4177 parameters.canRunBeforeUnloadConfirmPanel = m_uiClient.canRunBeforeUnloadConfirmPanel();
4178 parameters.canRunModal = m_canRunModal;
4179 parameters.deviceScaleFactor = m_intrinsicDeviceScaleFactor;
4180 parameters.mediaVolume = m_mediaVolume;
4183 parameters.isSmartInsertDeleteEnabled = m_isSmartInsertDeleteEnabled;
4184 parameters.layerHostingMode = m_layerHostingMode;
4185 parameters.colorSpace = m_pageClient->colorSpace();
4189 parameters.nativeWindow = m_pageClient->nativeWindow();
4194 #if USE(ACCELERATED_COMPOSITING)
4195 void WebPageProxy::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
4197 m_pageClient->enterAcceleratedCompositingMode(layerTreeContext);
4200 void WebPageProxy::exitAcceleratedCompositingMode()
4202 #if ENABLE(TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE)
4203 process()->platformSurfaceTexturePool()->removeAllPlatformSurfaceTextures();
4205 m_pageClient->exitAcceleratedCompositingMode();
4208 void WebPageProxy::updateAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
4210 m_pageClient->updateAcceleratedCompositingMode(layerTreeContext);
4212 #endif // USE(ACCELERATED_COMPOSITING)
4214 void WebPageProxy::backForwardClear()
4216 m_backForwardList->clear();
4219 void WebPageProxy::canAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, const ProtectionSpace& coreProtectionSpace, bool& canAuthenticate)
4221 WebFrameProxy* frame = process()->webFrame(frameID);
4222 MESSAGE_CHECK(frame);
4224 RefPtr<WebProtectionSpace> protectionSpace = WebProtectionSpace::create(coreProtectionSpace);
4226 canAuthenticate = m_loaderClient.canAuthenticateAgainstProtectionSpaceInFrame(this, frame, protectionSpace.get());
4229 void WebPageProxy::didReceiveAuthenticationChallenge(uint64_t frameID, const AuthenticationChallenge& coreChallenge, uint64_t challengeID)
4231 WebFrameProxy* frame = process()->webFrame(frameID);
4232 MESSAGE_CHECK(frame);
4234 #if ENABLE(TIZEN_ON_AUTHENTICATION_REQUESTED)
4235 RefPtr<AuthenticationChallengeProxy> authenticationChallenge = frame->setUpAuthenticationChallengeProxy(coreChallenge, challengeID, process());
4237 RefPtr<AuthenticationChallengeProxy> authenticationChallenge = AuthenticationChallengeProxy::create(coreChallenge, challengeID, process());
4240 m_loaderClient.didReceiveAuthenticationChallengeInFrame(this, frame, authenticationChallenge.get());
4243 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)
4245 WebFrameProxy* frame = process()->webFrame(frameID);
4246 MESSAGE_CHECK(frame);
4248 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
4250 newQuota = m_uiClient.exceededDatabaseQuota(this, frame, origin.get(), databaseName, displayName, currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage);
4253 void WebPageProxy::requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier)
4255 WebFrameProxy* frame = process()->webFrame(frameID);
4256 MESSAGE_CHECK(frame);
4258 // FIXME: Geolocation should probably be using toString() as its string representation instead of databaseIdentifier().
4259 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
4260 RefPtr<GeolocationPermissionRequestProxy> request = m_geolocationPermissionRequestManager.createRequest(geolocationID);
4262 if (!m_uiClient.decidePolicyForGeolocationPermissionRequest(this, frame, origin.get(), request.get()))
4266 void WebPageProxy::requestNotificationPermission(uint64_t requestID, const String& originString)
4268 if (!isRequestIDValid(requestID))
4271 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromString(originString);
4272 RefPtr<NotificationPermissionRequest> request = m_notificationPermissionRequestManager.createRequest(requestID);
4274 if (!m_uiClient.decidePolicyForNotificationPermissionRequest(this, origin.get(), request.get()))
4278 void WebPageProxy::showNotification(const String& title, const String& body, const String& iconURL, const String& tag, const String& originString, uint64_t notificationID)
4280 m_process->context()->notificationManagerProxy()->show(this, title, body, iconURL, tag, originString, notificationID);
4283 #if ENABLE(TIZEN_MEDIA_STREAM)
4284 void WebPageProxy::requestUserMediaPermission(uint64_t requestID)
4286 RefPtr<UserMediaPermissionRequest> request = m_userMediaPermissionRequestManager.createRequest(requestID);
4288 if (!m_tizenClient.decidePolicyForUserMediaPermissionRequest(this, request.get()))
4293 float WebPageProxy::headerHeight(WebFrameProxy* frame)
4295 if (frame->isDisplayingPDFDocument())
4297 return m_uiClient.headerHeight(this, frame);
4300 float WebPageProxy::footerHeight(WebFrameProxy* frame)
4302 if (frame->isDisplayingPDFDocument())
4304 return m_uiClient.footerHeight(this, frame);
4307 void WebPageProxy::drawHeader(WebFrameProxy* frame, const FloatRect& rect)
4309 if (frame->isDisplayingPDFDocument())
4311 m_uiClient.drawHeader(this, frame, rect);
4314 void WebPageProxy::drawFooter(WebFrameProxy* frame, const FloatRect& rect)
4316 if (frame->isDisplayingPDFDocument())
4318 m_uiClient.drawFooter(this, frame, rect);
4321 void WebPageProxy::runModal()
4323 // Since runModal() can (and probably will) spin a nested run loop we need to turn off the responsiveness timer.
4324 process()->responsivenessTimer()->stop();
4326 // Our Connection's run loop might have more messages waiting to be handled after this RunModal message.
4327 // To make sure they are handled inside of the the nested modal run loop we must first signal the Connection's
4328 // run loop so we're guaranteed that it has a chance to wake up.
4329 // See http://webkit.org/b/89590 for more discussion.
4330 process()->connection()->wakeUpRunLoop();
4332 m_uiClient.runModal(this);
4335 void WebPageProxy::notifyScrollerThumbIsVisibleInRect(const IntRect& scrollerThumb)
4337 m_visibleScrollerThumbRect = scrollerThumb;
4340 void WebPageProxy::recommendedScrollbarStyleDidChange(int32_t newStyle)
4343 m_pageClient->recommendedScrollbarStyleDidChange(newStyle);
4347 void WebPageProxy::didChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar)
4349 m_mainFrameHasHorizontalScrollbar = hasHorizontalScrollbar;
4350 m_mainFrameHasVerticalScrollbar = hasVerticalScrollbar;
4352 m_pageClient->didChangeScrollbarsForMainFrame();
4355 void WebPageProxy::didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide)
4357 m_mainFrameIsPinnedToLeftSide = pinnedToLeftSide;
4358 m_mainFrameIsPinnedToRightSide = pinnedToRightSide;
4361 void WebPageProxy::didChangePageCount(unsigned pageCount)
4363 m_pageCount = pageCount;
4366 void WebPageProxy::didFailToInitializePlugin(const String& mimeType)
4368 m_loaderClient.didFailToInitializePlugin(this, mimeType);
4371 void WebPageProxy::didBlockInsecurePluginVersion(const String& mimeType, const String& urlString)
4373 String pluginIdentifier;
4374 String pluginVersion;
4375 String newMimeType = mimeType;
4378 PluginModuleInfo plugin = m_process->context()->pluginInfoStore().findPlugin(newMimeType, KURL(KURL(), urlString));
4380 pluginIdentifier = plugin.bundleIdentifier;
4381 pluginVersion = plugin.versionString;
4384 m_loaderClient.didBlockInsecurePluginVersion(this, newMimeType, pluginIdentifier, pluginVersion);
4387 bool WebPageProxy::willHandleHorizontalScrollEvents() const
4389 return !m_canShortCircuitHorizontalWheelEvents;
4392 void WebPageProxy::didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference& dataReference)
4394 m_pageClient->didFinishLoadingDataForCustomRepresentation(suggestedFilename, dataReference);
4397 void WebPageProxy::backForwardRemovedItem(uint64_t itemID)
4399 process()->send(Messages::WebPage::DidRemoveBackForwardItem(itemID), m_pageID);
4402 void WebPageProxy::setCanRunModal(bool canRunModal)
4407 // It's only possible to change the state for a WebPage which
4408 // already qualifies for running modal child web pages, otherwise
4409 // there's no other possibility than not allowing it.
4410 m_canRunModal = m_uiClient.canRunModal() && canRunModal;
4411 process()->send(Messages::WebPage::SetCanRunModal(m_canRunModal), m_pageID);
4414 bool WebPageProxy::canRunModal()
4416 return isValid() ? m_canRunModal : false;
4419 void WebPageProxy::beginPrinting(WebFrameProxy* frame, const PrintInfo& printInfo)
4421 if (m_isInPrintingMode)
4424 m_isInPrintingMode = true;
4425 process()->send(Messages::WebPage::BeginPrinting(frame->frameID(), printInfo), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
4428 void WebPageProxy::endPrinting()
4430 if (!m_isInPrintingMode)
4433 m_isInPrintingMode = false;
4434 process()->send(Messages::WebPage::EndPrinting(), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
4437 void WebPageProxy::computePagesForPrinting(WebFrameProxy* frame, const PrintInfo& printInfo, PassRefPtr<ComputedPagesCallback> prpCallback)
4439 RefPtr<ComputedPagesCallback> callback = prpCallback;
4441 callback->invalidate();
4445 uint64_t callbackID = callback->callbackID();
4446 m_computedPagesCallbacks.set(callbackID, callback.get());
4447 m_isInPrintingMode = true;
4448 process()->send(Messages::WebPage::ComputePagesForPrinting(frame->frameID(), printInfo, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
4451 #if PLATFORM(MAC) || PLATFORM(WIN)
4452 void WebPageProxy::drawRectToPDF(WebFrameProxy* frame, const PrintInfo& printInfo, const IntRect& rect, PassRefPtr<DataCallback> prpCallback)
4454 RefPtr<DataCallback> callback = prpCallback;
4456 callback->invalidate();
4460 uint64_t callbackID = callback->callbackID();
4461 m_dataCallbacks.set(callbackID, callback.get());
4462 process()->send(Messages::WebPage::DrawRectToPDF(frame->frameID(), printInfo, rect, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
4465 void WebPageProxy::drawPagesToPDF(WebFrameProxy* frame, const PrintInfo& printInfo, uint32_t first, uint32_t count, PassRefPtr<DataCallback> prpCallback)
4467 RefPtr<DataCallback> callback = prpCallback;
4469 callback->invalidate();
4473 uint64_t callbackID = callback->callbackID();
4474 m_dataCallbacks.set(callbackID, callback.get());
4475 process()->send(Messages::WebPage::DrawPagesToPDF(frame->frameID(), printInfo, first, count, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
4478 void WebPageProxy::drawPagesForPrinting(WebFrameProxy* frame, const PrintInfo& printInfo, PassRefPtr<PrintFinishedCallback> didPrintCallback)
4480 RefPtr<PrintFinishedCallback> callback = didPrintCallback;
4482 callback->invalidate();
4486 uint64_t callbackID = callback->callbackID();
4487 m_printFinishedCallbacks.set(callbackID, callback.get());
4488 m_isInPrintingMode = true;
4489 process()->send(Messages::WebPage::DrawPagesForPrinting(frame->frameID(), printInfo, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
4493 void WebPageProxy::flashBackingStoreUpdates(const Vector<IntRect>& updateRects)
4495 m_pageClient->flashBackingStoreUpdates(updateRects);
4498 void WebPageProxy::updateBackingStoreDiscardableState()
4504 if (!process()->responsivenessTimer()->isResponsive())
4505 isDiscardable = false;
4507 isDiscardable = !m_pageClient->isViewWindowActive() || !isViewVisible();
4509 m_drawingArea->setBackingStoreIsDiscardable(isDiscardable);
4512 Color WebPageProxy::viewUpdatesFlashColor()
4514 return Color(0, 200, 255);
4517 Color WebPageProxy::backingStoreUpdatesFlashColor()
4519 return Color(200, 0, 255);
4522 void WebPageProxy::saveDataToFileInDownloadsFolder(const String& suggestedFilename, const String& mimeType, const String& originatingURLString, WebData* data)
4524 m_uiClient.saveDataToFileInDownloadsFolder(this, suggestedFilename, mimeType, originatingURLString, data);
4527 void WebPageProxy::linkClicked(const String& url, const WebMouseEvent& event)
4529 process()->send(Messages::WebPage::LinkClicked(url, event), m_pageID, 0);
4534 void WebPageProxy::substitutionsPanelIsShowing(bool& isShowing)
4536 isShowing = TextChecker::substitutionsPanelIsShowing();
4539 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
4540 void WebPageProxy::showCorrectionPanel(int32_t panelType, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings)
4542 m_pageClient->showCorrectionPanel((AlternativeTextType)panelType, boundingBoxOfReplacedString, replacedString, replacementString, alternativeReplacementStrings);
4545 void WebPageProxy::dismissCorrectionPanel(int32_t reason)
4547 m_pageClient->dismissCorrectionPanel((ReasonForDismissingAlternativeText)reason);
4550 void WebPageProxy::dismissCorrectionPanelSoon(int32_t reason, String& result)
4552 result = m_pageClient->dismissCorrectionPanelSoon((ReasonForDismissingAlternativeText)reason);
4555 void WebPageProxy::recordAutocorrectionResponse(int32_t responseType, const String& replacedString, const String& replacementString)
4557 m_pageClient->recordAutocorrectionResponse((AutocorrectionResponseType)responseType, replacedString, replacementString);
4559 #endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
4561 void WebPageProxy::handleAlternativeTextUIResult(const String& result)
4563 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
4565 process()->send(Messages::WebPage::HandleAlternativeTextUIResult(result), m_pageID, 0);
4569 #if USE(DICTATION_ALTERNATIVES)
4570 void WebPageProxy::showDictationAlternativeUI(const WebCore::FloatRect& boundingBoxOfDictatedText, uint64_t dictationContext)
4572 m_pageClient->showDictationAlternativeUI(boundingBoxOfDictatedText, dictationContext);
4575 void WebPageProxy::dismissDictationAlternativeUI()
4577 m_pageClient->dismissDictationAlternativeUI();
4580 void WebPageProxy::removeDictationAlternatives(uint64_t dictationContext)
4582 m_pageClient->removeDictationAlternatives(dictationContext);
4585 void WebPageProxy::dictationAlternatives(uint64_t dictationContext, Vector<String>& result)
4587 result = m_pageClient->dictationAlternatives(dictationContext);
4591 #endif // PLATFORM(MAC)
4593 #if ENABLE(TIZEN_PAGE_VISIBILITY_API)
4594 void WebPageProxy::setPageVisibility(WebCore::PageVisibilityState pageVisibilityState, bool isInitialState)
4596 process()->send(Messages::WebPage::SetVisibilityState(static_cast<uint32_t>(pageVisibilityState), isInitialState), m_pageID);
4600 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
4601 void WebPageProxy::decidePolicyForCertificateError(const String& url, const String& certificate, int error, PassRefPtr<Messages::WebPageProxy::DecidePolicyForCertificateError::DelayedReply> reply)
4603 m_allowedReply = reply;
4605 if (!m_tizenClient.decidePolicyForCertificateError(this, url, certificate, error))
4606 replyPolicyForCertificateError(true);
4610 #if ENABLE(TIZEN_NATIVE_MEMORY_SNAPSHOT)
4611 void WebPageProxy::dumpMemorySnapshot()
4613 process()->send(Messages::WebPage::DumpMemorySnapshot(), m_pageID);
4617 } // namespace WebKit