2 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Corporation. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
18 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
24 * THE POSSIBILITY OF SUCH DAMAGE.
28 #include "WebPageProxy.h"
30 #include "AuthenticationChallengeProxy.h"
31 #include "AuthenticationDecisionListener.h"
32 #include "DataReference.h"
33 #include "DownloadProxy.h"
34 #include "DrawingAreaProxy.h"
35 #include "EventDispatcherMessages.h"
36 #include "FindIndicator.h"
37 #include "ImmutableArray.h"
39 #include "MessageID.h"
40 #include "NativeWebKeyboardEvent.h"
41 #include "NativeWebMouseEvent.h"
42 #include "NativeWebWheelEvent.h"
43 #include "NotificationPermissionRequest.h"
44 #include "NotificationPermissionRequestManager.h"
45 #include "PageClient.h"
46 #include "PrintInfo.h"
47 #include "SessionState.h"
48 #include "StringPairVector.h"
49 #include "TextChecker.h"
50 #include "TextCheckerState.h"
51 #include "WKContextPrivate.h"
52 #include "WebBackForwardList.h"
53 #include "WebBackForwardListItem.h"
54 #include "WebCertificateInfo.h"
55 #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
56 #include "WebColorPickerResultListenerProxy.h"
58 #include "WebContext.h"
59 #include "WebContextMenuProxy.h"
60 #include "WebContextUserMessageCoders.h"
61 #include "WebCoreArgumentCoders.h"
63 #include "WebEditCommandProxy.h"
65 #include "WebFormSubmissionListenerProxy.h"
66 #include "WebFramePolicyListenerProxy.h"
67 #include "WebFullScreenManagerProxy.h"
68 #include "WebInspectorProxy.h"
69 #include "WebNotificationManagerProxy.h"
70 #include "WebOpenPanelResultListenerProxy.h"
71 #include "WebPageCreationParameters.h"
72 #include "WebPageGroup.h"
73 #include "WebPageGroupData.h"
74 #include "WebPageMessages.h"
75 #include "WebPopupItem.h"
76 #include "WebPopupMenuProxy.h"
77 #include "WebPreferences.h"
78 #include "WebProcessMessages.h"
79 #include "WebProcessProxy.h"
80 #include "WebProtectionSpace.h"
81 #include "WebSecurityOrigin.h"
82 #include "WebURLRequest.h"
83 #include <WebCore/DragController.h>
84 #include <WebCore/DragData.h>
85 #include <WebCore/DragSession.h>
86 #include <WebCore/FloatRect.h>
87 #include <WebCore/FocusDirection.h>
88 #include <WebCore/MIMETypeRegistry.h>
89 #include <WebCore/TextCheckerClient.h>
90 #include <WebCore/WindowFeatures.h>
93 #if ENABLE(WEB_INTENTS)
94 #include "IntentData.h"
95 #include "IntentServiceInfo.h"
96 #include "WebIntentData.h"
97 #include "WebIntentServiceInfo.h"
100 #if USE(UI_SIDE_COMPOSITING)
101 #include "LayerTreeCoordinatorProxyMessages.h"
105 #include "ArgumentCodersQt.h"
109 #include "ArgumentCodersGtk.h"
113 #include "WebSoupRequestManagerProxy.h"
116 #if ENABLE(TIZEN_DRAG_SUPPORT)
117 #include "ArgumentCodersTizen.h"
121 #include <wtf/RefCountedLeakCounter.h>
124 #if ENABLE(TIZEN_ISF_PORT) || ENABLE(TIZEN_GESTURE)
125 #include "EwkViewImpl.h"
126 #include "InputMethodContextEfl.h"
129 // This controls what strategy we use for mouse wheel coalescing.
130 #define MERGE_WHEEL_EVENTS 1
132 #define MESSAGE_CHECK(assertion) MESSAGE_CHECK_BASE(assertion, m_process->connection())
133 #define MESSAGE_CHECK_URL(url) MESSAGE_CHECK_BASE(m_process->checkURLReceivedFromWebProcess(url), m_process->connection())
135 using namespace WebCore;
137 // Represents the number of wheel events we can hold in the queue before we start pushing them preemptively.
138 static const unsigned wheelEventQueueSizeThreshold = 10;
142 WKPageDebugPaintFlags WebPageProxy::s_debugPaintFlags = 0;
144 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, webPageProxyCounter, ("WebPageProxy"));
147 static const char* webKeyboardEventTypeString(WebEvent::Type type)
150 case WebEvent::KeyDown:
153 case WebEvent::KeyUp:
156 case WebEvent::RawKeyDown:
163 ASSERT_NOT_REACHED();
167 #endif // !LOG_DISABLED
169 PassRefPtr<WebPageProxy> WebPageProxy::create(PageClient* pageClient, PassRefPtr<WebProcessProxy> process, WebPageGroup* pageGroup, uint64_t pageID)
171 return adoptRef(new WebPageProxy(pageClient, process, pageGroup, pageID));
174 WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> process, WebPageGroup* pageGroup, uint64_t pageID)
175 : m_pageClient(pageClient)
177 , m_pageGroup(pageGroup)
179 , m_userAgent(standardUserAgent())
180 , m_geolocationPermissionRequestManager(this)
181 , m_notificationPermissionRequestManager(this)
182 #if ENABLE(TIZEN_MEDIA_STREAM)
183 , m_userMediaPermissionRequestManager(this)
185 , m_estimatedProgress(0)
186 , m_isInWindow(m_pageClient->isViewInWindow())
187 , m_isVisible(m_pageClient->isViewVisible())
188 , m_backForwardList(WebBackForwardList::create(this))
189 , m_loadStateAtProcessExit(WebFrameProxy::LoadStateFinished)
190 , m_textZoomFactor(1)
191 , m_pageZoomFactor(1)
192 , m_pageScaleFactor(1)
193 , m_intrinsicDeviceScaleFactor(1)
194 , m_customDeviceScaleFactor(0)
195 #if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
196 , m_layerHostingMode(LayerHostingModeInWindowServer)
198 , m_layerHostingMode(LayerHostingModeDefault)
200 , m_drawsBackground(true)
201 , m_drawsTransparentBackground(false)
202 , m_areMemoryCacheClientCallsEnabled(true)
203 , m_useFixedLayout(false)
204 , m_paginationMode(Page::Pagination::Unpaginated)
205 , m_paginationBehavesLikeColumns(false)
207 , m_gapBetweenPages(0)
210 , m_canRunModal(false)
211 , m_isInPrintingMode(false)
212 , m_isPerformingDOMPrintOperation(false)
213 , m_inDecidePolicyForResponse(false)
214 , m_syncMimeTypePolicyActionIsValid(false)
215 , m_syncMimeTypePolicyAction(PolicyUse)
216 , m_syncMimeTypePolicyDownloadID(0)
217 , m_inDecidePolicyForNavigationAction(false)
218 , m_syncNavigationActionPolicyActionIsValid(false)
219 , m_syncNavigationActionPolicyAction(PolicyUse)
220 , m_syncNavigationActionPolicyDownloadID(0)
221 , m_processingMouseMoveEvent(false)
222 #if ENABLE(TOUCH_EVENTS)
223 , m_needTouchEvents(false)
225 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
226 , m_askOverflow(true)
229 , m_isPageSuspended(false)
231 , m_isSmartInsertDeleteEnabled(TextChecker::isSmartInsertDeleteEnabled())
233 , m_spellDocumentTag(0)
234 , m_hasSpellDocumentTag(false)
235 , m_pendingLearnOrIgnoreWordMessageCount(0)
236 , m_mainFrameHasCustomRepresentation(false)
237 , m_mainFrameHasHorizontalScrollbar(false)
238 , m_mainFrameHasVerticalScrollbar(false)
239 , m_canShortCircuitHorizontalWheelEvents(true)
240 , m_mainFrameIsPinnedToLeftSide(false)
241 , m_mainFrameIsPinnedToRightSide(false)
243 , m_renderTreeSize(0)
244 , m_shouldSendEventsSynchronously(false)
245 , m_suppressVisibilityUpdates(false)
247 #if ENABLE(PAGE_VISIBILITY_API)
248 , m_visibilityState(PageVisibilityStateVisible)
250 #if ENABLE(TIZEN_REDUCE_KEY_LAGGING)
251 , m_pageContentResumeTimer(0)
253 #if ENABLE(TIZEN_ISF_PORT)
254 , m_didCancelCompositionFromWebProcess(false)
258 webPageProxyCounter.increment();
261 WebContext::statistics().wkPageCount++;
263 m_pageGroup->addPage(this);
266 WebPageProxy::~WebPageProxy()
271 WebContext::statistics().wkPageCount--;
273 if (m_hasSpellDocumentTag)
274 TextChecker::closeSpellDocumentWithTag(m_spellDocumentTag);
276 m_pageGroup->removePage(this);
279 webPageProxyCounter.decrement();
281 #if ENABLE(TIZEN_REDUCE_KEY_LAGGING)
282 if (m_pageContentResumeTimer)
283 ecore_timer_del(m_pageContentResumeTimer);
287 WebProcessProxy* WebPageProxy::process() const
289 return m_process.get();
292 PlatformProcessIdentifier WebPageProxy::processIdentifier() const
297 return m_process->processIdentifier();
300 bool WebPageProxy::isValid()
302 // A page that has been explicitly closed is never valid.
309 void WebPageProxy::initializeLoaderClient(const WKPageLoaderClient* loadClient)
311 m_loaderClient.initialize(loadClient);
316 process()->send(Messages::WebPage::SetWillGoToBackForwardItemCallbackEnabled(loadClient->version > 0), m_pageID);
319 void WebPageProxy::initializePolicyClient(const WKPagePolicyClient* policyClient)
321 m_policyClient.initialize(policyClient);
324 void WebPageProxy::initializeFormClient(const WKPageFormClient* formClient)
326 m_formClient.initialize(formClient);
329 void WebPageProxy::initializeResourceLoadClient(const WKPageResourceLoadClient* client)
331 m_resourceLoadClient.initialize(client);
334 void WebPageProxy::initializeUIClient(const WKPageUIClient* client)
339 m_uiClient.initialize(client);
341 process()->send(Messages::WebPage::SetCanRunBeforeUnloadConfirmPanel(m_uiClient.canRunBeforeUnloadConfirmPanel()), m_pageID);
342 setCanRunModal(m_uiClient.canRunModal());
345 void WebPageProxy::initializeFindClient(const WKPageFindClient* client)
347 m_findClient.initialize(client);
350 void WebPageProxy::initializeFindMatchesClient(const WKPageFindMatchesClient* client)
352 m_findMatchesClient.initialize(client);
355 #if ENABLE(CONTEXT_MENUS)
356 void WebPageProxy::initializeContextMenuClient(const WKPageContextMenuClient* client)
358 m_contextMenuClient.initialize(client);
362 void WebPageProxy::reattachToWebProcess()
368 m_process = m_process->context()->relaunchProcessIfNecessary();
369 process()->addExistingWebPage(this, m_pageID);
373 m_pageClient->didRelaunchProcess();
374 m_drawingArea->waitForBackingStoreUpdateOnNextPaint();
377 void WebPageProxy::reattachToWebProcessWithItem(WebBackForwardListItem* item)
379 if (item && item != m_backForwardList->currentItem())
380 m_backForwardList->goToItem(item);
382 reattachToWebProcess();
387 process()->send(Messages::WebPage::GoToBackForwardItem(item->itemID()), m_pageID);
388 process()->responsivenessTimer()->start();
391 void WebPageProxy::initializeWebPage()
395 BackForwardListItemVector items = m_backForwardList->entries();
396 for (size_t i = 0; i < items.size(); ++i)
397 process()->registerNewWebBackForwardListItem(items[i].get());
399 m_drawingArea = m_pageClient->createDrawingAreaProxy();
400 ASSERT(m_drawingArea);
402 #if ENABLE(INSPECTOR_SERVER)
403 if (m_pageGroup->preferences()->developerExtrasEnabled())
404 inspector()->enableRemoteInspection();
407 process()->send(Messages::WebProcess::CreateWebPage(m_pageID, creationParameters()), 0);
409 #if ENABLE(PAGE_VISIBILITY_API)
410 process()->send(Messages::WebPage::SetVisibilityState(m_visibilityState, /* isInitialState */ true), m_pageID);
414 void WebPageProxy::close()
421 m_backForwardList->pageClosed();
422 m_pageClient->pageClosed();
424 process()->disconnectFramesFromPage(this);
427 #if ENABLE(INSPECTOR)
429 m_inspector->invalidate();
434 #if ENABLE(FULLSCREEN_API)
435 if (m_fullScreenManager) {
436 m_fullScreenManager->invalidate();
437 m_fullScreenManager = 0;
441 if (m_openPanelResultListener) {
442 m_openPanelResultListener->invalidate();
443 m_openPanelResultListener = 0;
446 #if ENABLE(INPUT_TYPE_COLOR)
447 if (m_colorChooser) {
448 m_colorChooser->invalidate();
449 m_colorChooser = nullptr;
452 #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
453 if (m_colorPickerResultListener) {
454 m_colorPickerResultListener->invalidate();
455 m_colorPickerResultListener = nullptr;
460 #if ENABLE(GEOLOCATION)
461 m_geolocationPermissionRequestManager.invalidateRequests();
464 m_notificationPermissionRequestManager.invalidateRequests();
465 #if ENABLE(TIZEN_MEDIA_STREAM)
466 m_userMediaPermissionRequestManager.invalidateRequests();
469 m_toolTip = String();
471 m_mainFrameHasHorizontalScrollbar = false;
472 m_mainFrameHasVerticalScrollbar = false;
474 m_mainFrameIsPinnedToLeftSide = false;
475 m_mainFrameIsPinnedToRightSide = false;
477 m_visibleScrollerThumbRect = IntRect();
479 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
480 invalidateCallbackMap(m_booleanCallbacks);
481 invalidateCallbackMap(m_dictionaryCallbacks);
483 invalidateCallbackMap(m_voidCallbacks);
484 invalidateCallbackMap(m_dataCallbacks);
485 invalidateCallbackMap(m_stringCallbacks);
486 m_loadDependentStringCallbackIDs.clear();
487 invalidateCallbackMap(m_scriptValueCallbacks);
488 invalidateCallbackMap(m_computedPagesCallbacks);
490 invalidateCallbackMap(m_printFinishedCallbacks);
493 Vector<WebEditCommandProxy*> editCommandVector;
494 copyToVector(m_editCommandSet, editCommandVector);
495 m_editCommandSet.clear();
496 for (size_t i = 0, size = editCommandVector.size(); i < size; ++i)
497 editCommandVector[i]->invalidate();
499 m_activePopupMenu = 0;
501 m_estimatedProgress = 0.0;
503 m_loaderClient.initialize(0);
504 m_policyClient.initialize(0);
505 m_uiClient.initialize(0);
507 m_drawingArea = nullptr;
509 process()->send(Messages::WebPage::Close(), m_pageID);
510 process()->removeWebPage(m_pageID);
513 bool WebPageProxy::tryClose()
518 process()->send(Messages::WebPage::TryClose(), m_pageID);
519 process()->responsivenessTimer()->start();
523 bool WebPageProxy::maybeInitializeSandboxExtensionHandle(const KURL& url, SandboxExtension::Handle& sandboxExtensionHandle)
525 if (!url.isLocalFile())
528 #if ENABLE(INSPECTOR)
529 // Don't give the inspector full access to the file system.
530 if (WebInspectorProxy::isInspectorPage(this))
534 SandboxExtension::createHandle("/", SandboxExtension::ReadOnly, sandboxExtensionHandle);
538 void WebPageProxy::loadURL(const String& url)
540 setPendingAPIRequestURL(url);
543 reattachToWebProcess();
545 SandboxExtension::Handle sandboxExtensionHandle;
546 bool createdExtension = maybeInitializeSandboxExtensionHandle(KURL(KURL(), url), sandboxExtensionHandle);
547 if (createdExtension)
548 process()->willAcquireUniversalFileReadSandboxExtension();
549 process()->send(Messages::WebPage::LoadURL(url, sandboxExtensionHandle), m_pageID);
550 process()->responsivenessTimer()->start();
553 void WebPageProxy::loadURLRequest(WebURLRequest* urlRequest)
555 setPendingAPIRequestURL(urlRequest->resourceRequest().url());
558 reattachToWebProcess();
560 SandboxExtension::Handle sandboxExtensionHandle;
561 bool createdExtension = maybeInitializeSandboxExtensionHandle(urlRequest->resourceRequest().url(), sandboxExtensionHandle);
562 if (createdExtension)
563 process()->willAcquireUniversalFileReadSandboxExtension();
564 process()->send(Messages::WebPage::LoadURLRequest(urlRequest->resourceRequest(), sandboxExtensionHandle), m_pageID);
565 process()->responsivenessTimer()->start();
568 void WebPageProxy::loadHTMLString(const String& htmlString, const String& baseURL)
571 reattachToWebProcess();
573 process()->assumeReadAccessToBaseURL(baseURL);
574 process()->send(Messages::WebPage::LoadHTMLString(htmlString, baseURL), m_pageID);
575 process()->responsivenessTimer()->start();
578 void WebPageProxy::loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL)
581 reattachToWebProcess();
584 m_mainFrame->setUnreachableURL(unreachableURL);
586 process()->assumeReadAccessToBaseURL(baseURL);
587 process()->send(Messages::WebPage::LoadAlternateHTMLString(htmlString, baseURL, unreachableURL), m_pageID);
588 process()->responsivenessTimer()->start();
591 void WebPageProxy::loadPlainTextString(const String& string)
594 reattachToWebProcess();
596 process()->send(Messages::WebPage::LoadPlainTextString(string), m_pageID);
597 process()->responsivenessTimer()->start();
600 void WebPageProxy::loadWebArchiveData(const WebData* webArchiveData)
603 reattachToWebProcess();
605 process()->send(Messages::WebPage::LoadWebArchiveData(webArchiveData->dataReference()), m_pageID);
606 process()->responsivenessTimer()->start();
610 void WebPageProxy::loadContentsbyMimeType(const WebData* contents, const String& mimeType, const String& encoding, const String& baseURL)
613 reattachToWebProcess();
615 process()->assumeReadAccessToBaseURL(baseURL);
616 process()->send(Messages::WebPage::LoadContentsbyMimeType(contents->dataReference(), mimeType, encoding, baseURL), m_pageID);
617 process()->responsivenessTimer()->start();
621 void WebPageProxy::stopLoading()
626 process()->send(Messages::WebPage::StopLoading(), m_pageID);
627 process()->responsivenessTimer()->start();
630 void WebPageProxy::reload(bool reloadFromOrigin)
632 SandboxExtension::Handle sandboxExtensionHandle;
634 if (m_backForwardList->currentItem()) {
635 String url = m_backForwardList->currentItem()->url();
636 setPendingAPIRequestURL(url);
638 // We may not have an extension yet if back/forward list was reinstated after a WebProcess crash or a browser relaunch
639 bool createdExtension = maybeInitializeSandboxExtensionHandle(KURL(KURL(), url), sandboxExtensionHandle);
640 if (createdExtension)
641 process()->willAcquireUniversalFileReadSandboxExtension();
645 reattachToWebProcessWithItem(m_backForwardList->currentItem());
649 process()->send(Messages::WebPage::Reload(reloadFromOrigin, sandboxExtensionHandle), m_pageID);
650 process()->responsivenessTimer()->start();
653 void WebPageProxy::goForward()
655 if (isValid() && !canGoForward())
658 WebBackForwardListItem* forwardItem = m_backForwardList->forwardItem();
662 setPendingAPIRequestURL(forwardItem->url());
665 reattachToWebProcessWithItem(forwardItem);
669 process()->send(Messages::WebPage::GoForward(forwardItem->itemID()), m_pageID);
670 process()->responsivenessTimer()->start();
673 bool WebPageProxy::canGoForward() const
675 return m_backForwardList->forwardItem();
678 void WebPageProxy::goBack()
680 if (isValid() && !canGoBack())
683 WebBackForwardListItem* backItem = m_backForwardList->backItem();
687 setPendingAPIRequestURL(backItem->url());
690 reattachToWebProcessWithItem(backItem);
694 process()->send(Messages::WebPage::GoBack(backItem->itemID()), m_pageID);
695 process()->responsivenessTimer()->start();
698 bool WebPageProxy::canGoBack() const
700 return m_backForwardList->backItem();
703 void WebPageProxy::goToBackForwardItem(WebBackForwardListItem* item)
706 reattachToWebProcessWithItem(item);
710 setPendingAPIRequestURL(item->url());
712 process()->send(Messages::WebPage::GoToBackForwardItem(item->itemID()), m_pageID);
713 process()->responsivenessTimer()->start();
716 void WebPageProxy::tryRestoreScrollPosition()
721 process()->send(Messages::WebPage::TryRestoreScrollPosition(), m_pageID);
724 void WebPageProxy::didChangeBackForwardList(WebBackForwardListItem* added, Vector<RefPtr<APIObject> >* removed)
726 m_loaderClient.didChangeBackForwardList(this, added, removed);
729 void WebPageProxy::shouldGoToBackForwardListItem(uint64_t itemID, bool& shouldGoToBackForwardItem)
731 WebBackForwardListItem* item = process()->webBackForwardItem(itemID);
732 shouldGoToBackForwardItem = item && m_loaderClient.shouldGoToBackForwardListItem(this, item);
735 void WebPageProxy::willGoToBackForwardListItem(uint64_t itemID, CoreIPC::ArgumentDecoder* arguments)
737 RefPtr<APIObject> userData;
738 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
739 if (!arguments->decode(messageDecoder))
742 if (WebBackForwardListItem* item = process()->webBackForwardItem(itemID))
743 m_loaderClient.willGoToBackForwardListItem(this, item, userData.get());
746 String WebPageProxy::activeURL() const
748 // If there is a currently pending url, it is the active URL,
749 // even when there's no main frame yet, as it might be the
750 // first API request.
751 if (!m_pendingAPIRequestURL.isNull())
752 return m_pendingAPIRequestURL;
757 if (!m_mainFrame->unreachableURL().isEmpty())
758 return m_mainFrame->unreachableURL();
760 switch (m_mainFrame->loadState()) {
761 case WebFrameProxy::LoadStateProvisional:
762 return m_mainFrame->provisionalURL();
763 case WebFrameProxy::LoadStateCommitted:
764 case WebFrameProxy::LoadStateFinished:
765 return m_mainFrame->url();
768 ASSERT_NOT_REACHED();
772 String WebPageProxy::provisionalURL() const
776 return m_mainFrame->provisionalURL();
779 String WebPageProxy::committedURL() const
784 return m_mainFrame->url();
787 bool WebPageProxy::canShowMIMEType(const String& mimeType) const
789 if (MIMETypeRegistry::canShowMIMEType(mimeType))
792 String newMimeType = mimeType;
793 PluginModuleInfo plugin = m_process->context()->pluginInfoStore().findPlugin(newMimeType, KURL());
794 if (!plugin.path.isNull() && m_pageGroup->preferences()->pluginsEnabled())
800 void WebPageProxy::setDrawsBackground(bool drawsBackground)
802 if (m_drawsBackground == drawsBackground)
805 m_drawsBackground = drawsBackground;
808 process()->send(Messages::WebPage::SetDrawsBackground(drawsBackground), m_pageID);
811 void WebPageProxy::setDrawsTransparentBackground(bool drawsTransparentBackground)
813 if (m_drawsTransparentBackground == drawsTransparentBackground)
816 m_drawsTransparentBackground = drawsTransparentBackground;
819 process()->send(Messages::WebPage::SetDrawsTransparentBackground(drawsTransparentBackground), m_pageID);
822 void WebPageProxy::viewWillStartLiveResize()
826 process()->send(Messages::WebPage::ViewWillStartLiveResize(), m_pageID);
829 void WebPageProxy::viewWillEndLiveResize()
833 process()->send(Messages::WebPage::ViewWillEndLiveResize(), m_pageID);
836 void WebPageProxy::setViewNeedsDisplay(const IntRect& rect)
838 m_pageClient->setViewNeedsDisplay(rect);
841 void WebPageProxy::displayView()
843 m_pageClient->displayView();
846 void WebPageProxy::scrollView(const IntRect& scrollRect, const IntSize& scrollOffset)
848 m_pageClient->scrollView(scrollRect, scrollOffset);
851 void WebPageProxy::viewStateDidChange(ViewStateFlags flags)
856 if (flags & ViewIsFocused)
857 process()->send(Messages::WebPage::SetFocused(m_pageClient->isViewFocused()), m_pageID);
859 if (flags & ViewWindowIsActive)
860 process()->send(Messages::WebPage::SetActive(m_pageClient->isViewWindowActive()), m_pageID);
862 if (flags & ViewIsVisible) {
863 bool isVisible = m_pageClient->isViewVisible();
864 if (isVisible != m_isVisible) {
865 m_isVisible = isVisible;
866 m_drawingArea->visibilityDidChange();
869 // If we've started the responsiveness timer as part of telling the web process to update the backing store
870 // state, it might not send back a reply (since it won't paint anything if the web page is hidden) so we
871 // stop the unresponsiveness timer here.
872 process()->responsivenessTimer()->stop();
877 if (flags & ViewIsInWindow) {
878 bool isInWindow = m_pageClient->isViewInWindow();
879 if (m_isInWindow != isInWindow) {
880 m_isInWindow = isInWindow;
881 process()->send(Messages::WebPage::SetIsInWindow(isInWindow), m_pageID);
885 LayerHostingMode layerHostingMode = m_pageClient->viewLayerHostingMode();
886 if (m_layerHostingMode != layerHostingMode) {
887 m_layerHostingMode = layerHostingMode;
888 m_drawingArea->layerHostingModeDidChange();
893 #if ENABLE(PAGE_VISIBILITY_API)
894 PageVisibilityState visibilityState = PageVisibilityStateHidden;
896 if (m_pageClient->isViewVisible())
897 visibilityState = PageVisibilityStateVisible;
899 if (visibilityState != m_visibilityState) {
900 m_visibilityState = visibilityState;
901 process()->send(Messages::WebPage::SetVisibilityState(visibilityState, false), m_pageID);
905 updateBackingStoreDiscardableState();
908 IntSize WebPageProxy::viewSize() const
910 return m_pageClient->viewSize();
913 void WebPageProxy::setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent& keyboardEvent)
917 process()->send(Messages::WebPage::SetInitialFocus(forward, isKeyboardEventValid, keyboardEvent), m_pageID);
920 void WebPageProxy::setWindowResizerSize(const IntSize& windowResizerSize)
924 process()->send(Messages::WebPage::SetWindowResizerSize(windowResizerSize), m_pageID);
927 void WebPageProxy::clearSelection()
931 process()->send(Messages::WebPage::ClearSelection(), m_pageID);
934 void WebPageProxy::validateCommand(const String& commandName, PassRefPtr<ValidateCommandCallback> callback)
937 callback->invalidate();
941 uint64_t callbackID = callback->callbackID();
942 m_validateCommandCallbacks.set(callbackID, callback.get());
943 process()->send(Messages::WebPage::ValidateCommand(commandName, callbackID), m_pageID);
946 void WebPageProxy::setMaintainsInactiveSelection(bool newValue)
948 m_maintainsInactiveSelection = newValue;
951 void WebPageProxy::executeEditCommand(const String& commandName)
956 DEFINE_STATIC_LOCAL(String, ignoreSpellingCommandName, ("ignoreSpelling"));
957 if (commandName == ignoreSpellingCommandName)
958 ++m_pendingLearnOrIgnoreWordMessageCount;
960 process()->send(Messages::WebPage::ExecuteEditCommand(commandName), m_pageID);
963 #if USE(TILED_BACKING_STORE)
964 void WebPageProxy::setViewportSize(const IntSize& size)
969 process()->send(Messages::WebPage::SetViewportSize(size), m_pageID);
973 #if ENABLE(DRAG_SUPPORT)
974 void WebPageProxy::dragEntered(DragData* dragData, const String& dragStorageName)
976 SandboxExtension::Handle sandboxExtensionHandle;
977 SandboxExtension::HandleArray sandboxExtensionHandleEmptyArray;
978 performDragControllerAction(DragControllerActionEntered, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionHandleEmptyArray);
981 void WebPageProxy::dragUpdated(DragData* dragData, const String& dragStorageName)
983 SandboxExtension::Handle sandboxExtensionHandle;
984 SandboxExtension::HandleArray sandboxExtensionHandleEmptyArray;
985 performDragControllerAction(DragControllerActionUpdated, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionHandleEmptyArray);
988 void WebPageProxy::dragExited(DragData* dragData, const String& dragStorageName)
990 SandboxExtension::Handle sandboxExtensionHandle;
991 SandboxExtension::HandleArray sandboxExtensionHandleEmptyArray;
992 performDragControllerAction(DragControllerActionExited, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionHandleEmptyArray);
995 #if ENABLE(TIZEN_DRAG_SUPPORT)
996 void WebPageProxy::performDrag(DragData* dragData, const String& dragStorageName)
998 void WebPageProxy::performDrag(DragData* dragData, const String& dragStorageName, const SandboxExtension::Handle& sandboxExtensionHandle, const SandboxExtension::HandleArray& sandboxExtensionsForUpload)
1001 #if ENABLE(TIZEN_DRAG_SUPPORT)
1002 TIZEN_LOGI("dragData (%p)", dragData);
1003 SandboxExtension::Handle sandboxExtensionHandle;
1004 SandboxExtension::HandleArray sandboxExtensionHandleEmptyArray;
1005 performDragControllerAction(DragControllerActionPerformDrag, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionHandleEmptyArray);
1007 performDragControllerAction(DragControllerActionPerformDrag, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionsForUpload);
1011 void WebPageProxy::performDragControllerAction(DragControllerAction action, DragData* dragData, const String& dragStorageName, const SandboxExtension::Handle& sandboxExtensionHandle, const SandboxExtension::HandleArray& sandboxExtensionsForUpload)
1016 // FIXME: We should pass the drag data map only on DragEnter.
1017 process()->send(Messages::WebPage::PerformDragControllerAction(action, dragData->clientPosition(), dragData->globalPosition(),
1018 dragData->draggingSourceOperationMask(), dragData->dragDataMap(), dragData->flags()), m_pageID);
1019 #elif PLATFORM(QT) || PLATFORM(GTK) || ENABLE(TIZEN_DRAG_SUPPORT)
1020 process()->send(Messages::WebPage::PerformDragControllerAction(action, *dragData), m_pageID);
1022 process()->send(Messages::WebPage::PerformDragControllerAction(action, dragData->clientPosition(), dragData->globalPosition(), dragData->draggingSourceOperationMask(), dragStorageName, dragData->flags(), sandboxExtensionHandle, sandboxExtensionsForUpload), m_pageID);
1026 void WebPageProxy::didPerformDragControllerAction(WebCore::DragSession dragSession)
1028 m_currentDragSession = dragSession;
1031 #if PLATFORM(QT) || PLATFORM(GTK) || ENABLE(TIZEN_DRAG_SUPPORT)
1032 void WebPageProxy::startDrag(const DragData& dragData, const ShareableBitmap::Handle& dragImageHandle)
1034 TIZEN_LOGI("dragData (%p)", dragData);
1035 RefPtr<ShareableBitmap> dragImage = 0;
1036 if (!dragImageHandle.isNull()) {
1037 dragImage = ShareableBitmap::create(dragImageHandle);
1042 m_pageClient->startDrag(dragData, dragImage.release());
1046 void WebPageProxy::dragEnded(const IntPoint& clientPosition, const IntPoint& globalPosition, uint64_t operation)
1048 TIZEN_LOGI("clientPosition (%p)", clientPosition);
1051 process()->send(Messages::WebPage::DragEnded(clientPosition, globalPosition, operation), m_pageID);
1053 #endif // ENABLE(DRAG_SUPPORT)
1055 void WebPageProxy::handleMouseEvent(const NativeWebMouseEvent& event)
1060 // NOTE: This does not start the responsiveness timer because mouse move should not indicate interaction.
1061 if (event.type() != WebEvent::MouseMove)
1062 process()->responsivenessTimer()->start();
1064 if (m_processingMouseMoveEvent) {
1065 m_nextMouseMoveEvent = adoptPtr(new NativeWebMouseEvent(event));
1069 m_processingMouseMoveEvent = true;
1072 // <https://bugs.webkit.org/show_bug.cgi?id=57904> We need to keep track of the mouse down event in the case where we
1073 // display a popup menu for select elements. When the user changes the selected item,
1074 // we fake a mouse up event by using this stored down event. This event gets cleared
1075 // when the mouse up message is received from WebProcess.
1076 if (event.type() == WebEvent::MouseDown)
1077 m_currentlyProcessedMouseDownEvent = adoptPtr(new NativeWebMouseEvent(event));
1079 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
1080 // We have to hide text-selection's context menu when other area is clicked.
1081 // In case of normal context menu, it is hided by elm_ctxpopup's logic.
1082 if (event.type() == WebEvent::MouseDown)
1086 if (m_shouldSendEventsSynchronously) {
1087 bool handled = false;
1088 process()->sendSync(Messages::WebPage::MouseEventSyncForTesting(event), Messages::WebPage::MouseEventSyncForTesting::Reply(handled), m_pageID);
1089 didReceiveEvent(event.type(), handled);
1091 process()->send(Messages::WebPage::MouseEvent(event), m_pageID);
1094 #if MERGE_WHEEL_EVENTS
1095 static bool canCoalesce(const WebWheelEvent& a, const WebWheelEvent& b)
1097 if (a.position() != b.position())
1099 if (a.globalPosition() != b.globalPosition())
1101 if (a.modifiers() != b.modifiers())
1103 if (a.granularity() != b.granularity())
1106 if (a.phase() != b.phase())
1108 if (a.momentumPhase() != b.momentumPhase())
1110 if (a.hasPreciseScrollingDeltas() != b.hasPreciseScrollingDeltas())
1117 static WebWheelEvent coalesce(const WebWheelEvent& a, const WebWheelEvent& b)
1119 ASSERT(canCoalesce(a, b));
1121 FloatSize mergedDelta = a.delta() + b.delta();
1122 FloatSize mergedWheelTicks = a.wheelTicks() + b.wheelTicks();
1125 FloatSize mergedUnacceleratedScrollingDelta = a.unacceleratedScrollingDelta() + b.unacceleratedScrollingDelta();
1127 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());
1129 return WebWheelEvent(WebEvent::Wheel, b.position(), b.globalPosition(), mergedDelta, mergedWheelTicks, b.granularity(), b.modifiers(), b.timestamp());
1132 #endif // MERGE_WHEEL_EVENTS
1134 static WebWheelEvent coalescedWheelEvent(Deque<NativeWebWheelEvent>& queue, Vector<NativeWebWheelEvent>& coalescedEvents)
1136 ASSERT(!queue.isEmpty());
1137 ASSERT(coalescedEvents.isEmpty());
1139 #if MERGE_WHEEL_EVENTS
1140 NativeWebWheelEvent firstEvent = queue.takeFirst();
1141 coalescedEvents.append(firstEvent);
1143 WebWheelEvent event = firstEvent;
1144 while (!queue.isEmpty() && canCoalesce(event, queue.first())) {
1145 NativeWebWheelEvent firstEvent = queue.takeFirst();
1146 coalescedEvents.append(firstEvent);
1147 event = coalesce(event, firstEvent);
1152 while (!queue.isEmpty())
1153 coalescedEvents.append(queue.takeFirst());
1154 return coalescedEvents.last();
1158 void WebPageProxy::handleWheelEvent(const NativeWebWheelEvent& event)
1163 if (!m_currentlyProcessedWheelEvents.isEmpty()) {
1164 m_wheelEventQueue.append(event);
1165 if (m_wheelEventQueue.size() < wheelEventQueueSizeThreshold)
1167 // The queue has too many wheel events, so push a new event.
1170 if (!m_wheelEventQueue.isEmpty()) {
1171 processNextQueuedWheelEvent();
1175 OwnPtr<Vector<NativeWebWheelEvent> > coalescedWheelEvent = adoptPtr(new Vector<NativeWebWheelEvent>);
1176 coalescedWheelEvent->append(event);
1177 m_currentlyProcessedWheelEvents.append(coalescedWheelEvent.release());
1178 sendWheelEvent(event);
1181 void WebPageProxy::processNextQueuedWheelEvent()
1183 OwnPtr<Vector<NativeWebWheelEvent> > nextCoalescedEvent = adoptPtr(new Vector<NativeWebWheelEvent>);
1184 WebWheelEvent nextWheelEvent = coalescedWheelEvent(m_wheelEventQueue, *nextCoalescedEvent.get());
1185 m_currentlyProcessedWheelEvents.append(nextCoalescedEvent.release());
1186 sendWheelEvent(nextWheelEvent);
1189 void WebPageProxy::sendWheelEvent(const WebWheelEvent& event)
1191 process()->responsivenessTimer()->start();
1193 if (m_shouldSendEventsSynchronously) {
1194 bool handled = false;
1195 process()->sendSync(Messages::WebPage::WheelEventSyncForTesting(event), Messages::WebPage::WheelEventSyncForTesting::Reply(handled), m_pageID);
1196 didReceiveEvent(event.type(), handled);
1200 process()->send(Messages::EventDispatcher::WheelEvent(m_pageID, event, canGoBack(), canGoForward()), 0);
1203 void WebPageProxy::handleKeyboardEvent(const NativeWebKeyboardEvent& event)
1208 LOG(KeyHandling, "WebPageProxy::handleKeyboardEvent: %s", webKeyboardEventTypeString(event.type()));
1210 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1211 if (!isWaitingForJavaScriptPopupReply()) {
1212 m_keyEventQueue.append(event);
1214 process()->responsivenessTimer()->start();
1215 if (m_shouldSendEventsSynchronously) {
1216 bool handled = false;
1217 process()->sendSync(Messages::WebPage::KeyEventSyncForTesting(event), Messages::WebPage::KeyEventSyncForTesting::Reply(handled), m_pageID);
1218 didReceiveEvent(event.type(), handled);
1220 process()->send(Messages::WebPage::KeyEvent(event), m_pageID);
1222 if (m_keyEventQueue.isEmpty()) {
1223 bool handled = false;
1224 m_pageClient->doneWithKeyEvent(event, handled);
1226 QueuedUIEvents<NativeWebKeyboardEvent>& lastEvent = m_keyEventQueue.last();
1227 lastEvent.deferredEvents.append(event);
1231 m_keyEventQueue.append(event);
1233 process()->responsivenessTimer()->start();
1234 if (m_shouldSendEventsSynchronously) {
1235 bool handled = false;
1236 process()->sendSync(Messages::WebPage::KeyEventSyncForTesting(event), Messages::WebPage::KeyEventSyncForTesting::Reply(handled), m_pageID);
1237 didReceiveEvent(event.type(), handled);
1238 } else if (m_keyEventQueue.size() == 1) // Otherwise, sent from DidReceiveEvent message handler.
1239 process()->send(Messages::WebPage::KeyEvent(event), m_pageID);
1243 #if ENABLE(GESTURE_EVENTS)
1244 void WebPageProxy::handleGestureEvent(const WebGestureEvent& event)
1249 #if ENABLE(TIZEN_ISF_PORT)
1250 if (event.type() == WebEvent::GestureSingleTap)
1251 EwkViewImpl::fromEvasObject(viewWidget())->inputMethodContext()->resetIMFContext();
1254 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1255 if (!isWaitingForJavaScriptPopupReply()) {
1256 m_gestureEventQueue.append(event);
1258 process()->responsivenessTimer()->start();
1259 process()->send(Messages::EventDispatcher::GestureEvent(m_pageID, event), 0);
1261 if (m_gestureEventQueue.isEmpty()) {
1262 bool isEventHandled = false;
1263 m_pageClient->doneWithGestureEvent(event, isEventHandled);
1265 QueuedUIEvents<WebGestureEvent>& lastEvent = m_gestureEventQueue.last();
1266 lastEvent.deferredEvents.append(event);
1270 m_gestureEventQueue.append(event);
1272 process()->responsivenessTimer()->start();
1273 process()->send(Messages::EventDispatcher::GestureEvent(m_pageID, event), 0);
1278 #if ENABLE(TOUCH_EVENTS)
1280 void WebPageProxy::handlePotentialActivation(const IntPoint& touchPoint, const IntSize& touchArea)
1282 process()->send(Messages::WebPage::HighlightPotentialActivation(touchPoint, touchArea), m_pageID);
1286 void WebPageProxy::handleTouchEvent(const NativeWebTouchEvent& event)
1291 // If the page is suspended, which should be the case during panning, pinching
1292 // and animation on the page itself (kinetic scrolling, tap to zoom) etc, then
1293 // we do not send any of the events to the page even if is has listeners.
1294 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1295 if (m_needTouchEvents && !m_isPageSuspended && !isWaitingForJavaScriptPopupReply()) {
1297 if (m_needTouchEvents && !m_isPageSuspended) {
1300 // Do not send the TouchMove event if last TouchMove is not processed yet.
1301 // TouchMove event will be sent too many times without below codes,
1302 // and it will affect Web Applications' performance.
1303 if (event.type() == WebEvent::TouchMove
1304 && !m_touchEventQueue.isEmpty()
1305 && m_touchEventQueue.last().forwardedEvent.type() == event.type())
1308 m_touchEventQueue.append(event);
1309 process()->responsivenessTimer()->start();
1310 if (m_shouldSendEventsSynchronously) {
1311 bool handled = false;
1312 process()->sendSync(Messages::WebPage::TouchEventSyncForTesting(event), Messages::WebPage::TouchEventSyncForTesting::Reply(handled), m_pageID);
1313 didReceiveEvent(event.type(), handled);
1315 process()->send(Messages::WebPage::TouchEvent(event), m_pageID);
1317 if (m_touchEventQueue.isEmpty()) {
1318 bool isEventHandled = false;
1319 m_pageClient->doneWithTouchEvent(event, isEventHandled);
1321 // We attach the incoming events to the newest queued event so that all
1322 // the events are delivered in the correct order when the event is dequed.
1323 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1324 QueuedUIEvents<NativeWebTouchEvent>& lastEvent = m_touchEventQueue.last();
1325 lastEvent.deferredEvents.append(event);
1327 QueuedTouchEvents& lastEvent = m_touchEventQueue.last();
1328 lastEvent.deferredTouchEvents.append(event);
1335 #if ENABLE(SCREEN_ORIENTATION_SUPPORT) && ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT)
1336 void WebPageProxy::lockOrientation(int willLockOrientation, bool& result)
1338 result = m_pageClient->lockOrientation(willLockOrientation);
1340 void WebPageProxy::unlockOrientation()
1342 m_pageClient->unlockOrientation();
1346 void WebPageProxy::scrollBy(ScrollDirection direction, ScrollGranularity granularity)
1351 process()->send(Messages::WebPage::ScrollBy(direction, granularity), m_pageID);
1354 void WebPageProxy::centerSelectionInVisibleArea()
1359 process()->send(Messages::WebPage::CenterSelectionInVisibleArea(), m_pageID);
1362 #if ENABLE(TIZEN_DOWNLOAD_ATTRIBUTE)
1363 void WebPageProxy::startDownload(const ResourceRequest& request, const String& /*suggestedName*/)
1365 // FIXME: suggestedName need to be passed to provide a suggested destination file name
1366 m_process->context()->download(this, request);
1370 void WebPageProxy::receivedPolicyDecision(PolicyAction action, WebFrameProxy* frame, uint64_t listenerID)
1375 if (action == PolicyIgnore)
1376 clearPendingAPIRequestURL();
1378 uint64_t downloadID = 0;
1379 if (action == PolicyDownload) {
1380 // Create a download proxy.
1381 DownloadProxy* download = m_process->context()->createDownloadProxy();
1382 downloadID = download->downloadID();
1383 #if PLATFORM(QT) || PLATFORM(EFL)
1384 // Our design does not suppport downloads without a WebPage.
1385 handleDownloadRequest(download);
1389 // If we received a policy decision while in decidePolicyForResponse the decision will
1390 // be sent back to the web process by decidePolicyForResponse.
1391 if (m_inDecidePolicyForResponse) {
1392 m_syncMimeTypePolicyActionIsValid = true;
1393 m_syncMimeTypePolicyAction = action;
1394 m_syncMimeTypePolicyDownloadID = downloadID;
1398 // If we received a policy decision while in decidePolicyForNavigationAction the decision will
1399 // be sent back to the web process by decidePolicyForNavigationAction.
1400 if (m_inDecidePolicyForNavigationAction) {
1401 m_syncNavigationActionPolicyActionIsValid = true;
1402 m_syncNavigationActionPolicyAction = action;
1403 m_syncNavigationActionPolicyDownloadID = downloadID;
1407 process()->send(Messages::WebPage::DidReceivePolicyDecision(frame->frameID(), listenerID, action, downloadID), m_pageID);
1410 String WebPageProxy::pageTitle() const
1412 // Return the null string if there is no main frame (e.g. nothing has been loaded in the page yet, WebProcess has
1413 // crashed, page has been closed).
1417 return m_mainFrame->title();
1420 void WebPageProxy::setUserAgent(const String& userAgent)
1422 if (m_userAgent == userAgent)
1424 m_userAgent = userAgent;
1428 process()->send(Messages::WebPage::SetUserAgent(m_userAgent), m_pageID);
1431 void WebPageProxy::setApplicationNameForUserAgent(const String& applicationName)
1433 if (m_applicationNameForUserAgent == applicationName)
1436 m_applicationNameForUserAgent = applicationName;
1437 if (!m_customUserAgent.isEmpty())
1440 setUserAgent(standardUserAgent(m_applicationNameForUserAgent));
1443 void WebPageProxy::setCustomUserAgent(const String& customUserAgent)
1445 if (m_customUserAgent == customUserAgent)
1448 m_customUserAgent = customUserAgent;
1450 if (m_customUserAgent.isEmpty()) {
1451 setUserAgent(standardUserAgent(m_applicationNameForUserAgent));
1455 setUserAgent(m_customUserAgent);
1458 void WebPageProxy::resumeActiveDOMObjectsAndAnimations()
1460 if (!isValid() || !m_isPageSuspended)
1463 m_isPageSuspended = false;
1465 process()->send(Messages::WebPage::ResumeActiveDOMObjectsAndAnimations(), m_pageID);
1468 void WebPageProxy::suspendActiveDOMObjectsAndAnimations()
1470 if (!isValid() || m_isPageSuspended)
1473 m_isPageSuspended = true;
1475 process()->send(Messages::WebPage::SuspendActiveDOMObjectsAndAnimations(), m_pageID);
1478 bool WebPageProxy::supportsTextEncoding() const
1480 return !m_mainFrameHasCustomRepresentation && m_mainFrame && !m_mainFrame->isDisplayingStandaloneImageDocument();
1483 void WebPageProxy::setCustomTextEncodingName(const String& encodingName)
1485 if (m_customTextEncodingName == encodingName)
1487 m_customTextEncodingName = encodingName;
1491 process()->send(Messages::WebPage::SetCustomTextEncodingName(encodingName), m_pageID);
1494 void WebPageProxy::terminateProcess()
1496 // NOTE: This uses a check of m_isValid rather than calling isValid() since
1497 // we want this to run even for pages being closed or that already closed.
1501 process()->terminate();
1504 #if !USE(CF) || defined(BUILDING_QT__)
1505 PassRefPtr<WebData> WebPageProxy::sessionStateData(WebPageProxySessionStateFilterCallback, void* context) const
1507 // FIXME: Return session state data for saving Page state.
1511 void WebPageProxy::restoreFromSessionStateData(WebData*)
1513 // FIXME: Restore the Page from the passed in session state data.
1517 bool WebPageProxy::supportsTextZoom() const
1519 if (m_mainFrameHasCustomRepresentation)
1522 // FIXME: This should also return false for standalone media and plug-in documents.
1523 if (!m_mainFrame || m_mainFrame->isDisplayingStandaloneImageDocument())
1529 void WebPageProxy::setTextZoomFactor(double zoomFactor)
1534 if (m_mainFrameHasCustomRepresentation)
1537 if (m_textZoomFactor == zoomFactor)
1540 m_textZoomFactor = zoomFactor;
1541 process()->send(Messages::WebPage::SetTextZoomFactor(m_textZoomFactor), m_pageID);
1544 double WebPageProxy::pageZoomFactor() const
1546 return m_mainFrameHasCustomRepresentation ? m_pageClient->customRepresentationZoomFactor() : m_pageZoomFactor;
1549 void WebPageProxy::setPageZoomFactor(double zoomFactor)
1554 if (m_mainFrameHasCustomRepresentation) {
1555 m_pageClient->setCustomRepresentationZoomFactor(zoomFactor);
1559 if (m_pageZoomFactor == zoomFactor)
1562 m_pageZoomFactor = zoomFactor;
1563 process()->send(Messages::WebPage::SetPageZoomFactor(m_pageZoomFactor), m_pageID);
1566 void WebPageProxy::setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor)
1571 if (m_mainFrameHasCustomRepresentation) {
1572 m_pageClient->setCustomRepresentationZoomFactor(pageZoomFactor);
1576 if (m_pageZoomFactor == pageZoomFactor && m_textZoomFactor == textZoomFactor)
1579 m_pageZoomFactor = pageZoomFactor;
1580 m_textZoomFactor = textZoomFactor;
1581 process()->send(Messages::WebPage::SetPageAndTextZoomFactors(m_pageZoomFactor, m_textZoomFactor), m_pageID);
1584 void WebPageProxy::scalePage(double scale, const IntPoint& origin)
1589 process()->send(Messages::WebPage::ScalePage(scale, origin), m_pageID);
1592 void WebPageProxy::setIntrinsicDeviceScaleFactor(float scaleFactor)
1594 if (m_intrinsicDeviceScaleFactor == scaleFactor)
1597 m_intrinsicDeviceScaleFactor = scaleFactor;
1600 m_drawingArea->deviceScaleFactorDidChange();
1603 void WebPageProxy::windowScreenDidChange(PlatformDisplayID displayID)
1608 process()->send(Messages::WebPage::WindowScreenDidChange(displayID), m_pageID);
1611 float WebPageProxy::deviceScaleFactor() const
1613 if (m_customDeviceScaleFactor)
1614 return m_customDeviceScaleFactor;
1615 return m_intrinsicDeviceScaleFactor;
1618 void WebPageProxy::setCustomDeviceScaleFactor(float customScaleFactor)
1623 if (m_customDeviceScaleFactor == customScaleFactor)
1626 float oldScaleFactor = deviceScaleFactor();
1628 m_customDeviceScaleFactor = customScaleFactor;
1630 if (deviceScaleFactor() != oldScaleFactor)
1631 m_drawingArea->deviceScaleFactorDidChange();
1634 void WebPageProxy::setUseFixedLayout(bool fixed)
1639 // This check is fine as the value is initialized in the web
1640 // process as part of the creation parameters.
1641 if (fixed == m_useFixedLayout)
1644 m_useFixedLayout = fixed;
1646 m_fixedLayoutSize = IntSize();
1647 process()->send(Messages::WebPage::SetUseFixedLayout(fixed), m_pageID);
1650 void WebPageProxy::setFixedLayoutSize(const IntSize& size)
1655 if (size == m_fixedLayoutSize)
1658 m_fixedLayoutSize = size;
1659 process()->send(Messages::WebPage::SetFixedLayoutSize(size), m_pageID);
1662 void WebPageProxy::setPaginationMode(WebCore::Page::Pagination::Mode mode)
1664 if (mode == m_paginationMode)
1667 m_paginationMode = mode;
1671 process()->send(Messages::WebPage::SetPaginationMode(mode), m_pageID);
1674 void WebPageProxy::setPaginationBehavesLikeColumns(bool behavesLikeColumns)
1676 if (behavesLikeColumns == m_paginationBehavesLikeColumns)
1679 m_paginationBehavesLikeColumns = behavesLikeColumns;
1683 process()->send(Messages::WebPage::SetPaginationBehavesLikeColumns(behavesLikeColumns), m_pageID);
1686 void WebPageProxy::setPageLength(double pageLength)
1688 if (pageLength == m_pageLength)
1691 m_pageLength = pageLength;
1695 process()->send(Messages::WebPage::SetPageLength(pageLength), m_pageID);
1698 void WebPageProxy::setGapBetweenPages(double gap)
1700 if (gap == m_gapBetweenPages)
1703 m_gapBetweenPages = gap;
1707 process()->send(Messages::WebPage::SetGapBetweenPages(gap), m_pageID);
1710 void WebPageProxy::pageScaleFactorDidChange(double scaleFactor)
1712 m_pageScaleFactor = scaleFactor;
1713 m_pageClient->pageScaleFactorDidChange();
1716 void WebPageProxy::setMemoryCacheClientCallsEnabled(bool memoryCacheClientCallsEnabled)
1721 if (m_areMemoryCacheClientCallsEnabled == memoryCacheClientCallsEnabled)
1724 m_areMemoryCacheClientCallsEnabled = memoryCacheClientCallsEnabled;
1725 process()->send(Messages::WebPage::SetMemoryCacheMessagesEnabled(memoryCacheClientCallsEnabled), m_pageID);
1728 void WebPageProxy::findStringMatches(const String& string, FindOptions options, unsigned maxMatchCount)
1730 if (string.isEmpty()) {
1731 didFindStringMatches(string, Vector<Vector<WebCore::IntRect> > (), 0);
1735 m_process->send(Messages::WebPage::FindStringMatches(string, options, maxMatchCount), m_pageID);
1738 void WebPageProxy::findString(const String& string, FindOptions options, unsigned maxMatchCount)
1740 if (m_mainFrameHasCustomRepresentation)
1741 m_pageClient->findStringInCustomRepresentation(string, options, maxMatchCount);
1743 process()->send(Messages::WebPage::FindString(string, options, maxMatchCount), m_pageID);
1746 void WebPageProxy::getImageForFindMatch(int32_t matchIndex)
1748 m_process->send(Messages::WebPage::GetImageForFindMatch(matchIndex), m_pageID);
1751 void WebPageProxy::selectFindMatch(int32_t matchIndex)
1753 m_process->send(Messages::WebPage::SelectFindMatch(matchIndex), m_pageID);
1756 void WebPageProxy::hideFindUI()
1758 process()->send(Messages::WebPage::HideFindUI(), m_pageID);
1761 void WebPageProxy::countStringMatches(const String& string, FindOptions options, unsigned maxMatchCount)
1763 if (m_mainFrameHasCustomRepresentation) {
1764 m_pageClient->countStringMatchesInCustomRepresentation(string, options, maxMatchCount);
1771 process()->send(Messages::WebPage::CountStringMatches(string, options, maxMatchCount), m_pageID);
1774 void WebPageProxy::runJavaScriptInMainFrame(const String& script, PassRefPtr<ScriptValueCallback> prpCallback)
1776 RefPtr<ScriptValueCallback> callback = prpCallback;
1778 callback->invalidate();
1782 uint64_t callbackID = callback->callbackID();
1783 m_scriptValueCallbacks.set(callbackID, callback.get());
1784 process()->send(Messages::WebPage::RunJavaScriptInMainFrame(script, callbackID), m_pageID);
1787 void WebPageProxy::getRenderTreeExternalRepresentation(PassRefPtr<StringCallback> prpCallback)
1789 RefPtr<StringCallback> callback = prpCallback;
1791 callback->invalidate();
1795 uint64_t callbackID = callback->callbackID();
1796 m_stringCallbacks.set(callbackID, callback.get());
1797 process()->send(Messages::WebPage::GetRenderTreeExternalRepresentation(callbackID), m_pageID);
1800 void WebPageProxy::getSourceForFrame(WebFrameProxy* frame, PassRefPtr<StringCallback> prpCallback)
1802 RefPtr<StringCallback> callback = prpCallback;
1804 callback->invalidate();
1808 uint64_t callbackID = callback->callbackID();
1809 m_loadDependentStringCallbackIDs.add(callbackID);
1810 m_stringCallbacks.set(callbackID, callback.get());
1811 process()->send(Messages::WebPage::GetSourceForFrame(frame->frameID(), callbackID), m_pageID);
1814 #if ENABLE(WEB_INTENTS)
1815 void WebPageProxy::deliverIntentToFrame(WebFrameProxy* frame, WebIntentData* webIntentData)
1820 process()->send(Messages::WebPage::DeliverIntentToFrame(frame->frameID(), webIntentData->store()), m_pageID);
1824 void WebPageProxy::getContentsAsString(PassRefPtr<StringCallback> prpCallback)
1826 RefPtr<StringCallback> callback = prpCallback;
1828 callback->invalidate();
1832 uint64_t callbackID = callback->callbackID();
1833 m_loadDependentStringCallbackIDs.add(callbackID);
1834 m_stringCallbacks.set(callbackID, callback.get());
1835 process()->send(Messages::WebPage::GetContentsAsString(callbackID), m_pageID);
1839 void WebPageProxy::getContentsAsMHTMLData(PassRefPtr<DataCallback> prpCallback, bool useBinaryEncoding)
1841 RefPtr<DataCallback> callback = prpCallback;
1843 callback->invalidate();
1847 uint64_t callbackID = callback->callbackID();
1848 m_dataCallbacks.set(callbackID, callback.get());
1849 process()->send(Messages::WebPage::GetContentsAsMHTMLData(callbackID, useBinaryEncoding), m_pageID);
1853 void WebPageProxy::getSelectionOrContentsAsString(PassRefPtr<StringCallback> prpCallback)
1855 RefPtr<StringCallback> callback = prpCallback;
1857 callback->invalidate();
1861 uint64_t callbackID = callback->callbackID();
1862 m_stringCallbacks.set(callbackID, callback.get());
1863 process()->send(Messages::WebPage::GetSelectionOrContentsAsString(callbackID), m_pageID);
1866 void WebPageProxy::getMainResourceDataOfFrame(WebFrameProxy* frame, PassRefPtr<DataCallback> prpCallback)
1868 RefPtr<DataCallback> callback = prpCallback;
1870 callback->invalidate();
1874 uint64_t callbackID = callback->callbackID();
1875 m_dataCallbacks.set(callbackID, callback.get());
1876 process()->send(Messages::WebPage::GetMainResourceDataOfFrame(frame->frameID(), callbackID), m_pageID);
1879 void WebPageProxy::getResourceDataFromFrame(WebFrameProxy* frame, WebURL* resourceURL, PassRefPtr<DataCallback> prpCallback)
1881 RefPtr<DataCallback> callback = prpCallback;
1883 callback->invalidate();
1887 uint64_t callbackID = callback->callbackID();
1888 m_dataCallbacks.set(callbackID, callback.get());
1889 process()->send(Messages::WebPage::GetResourceDataFromFrame(frame->frameID(), resourceURL->string(), callbackID), m_pageID);
1892 void WebPageProxy::getWebArchiveOfFrame(WebFrameProxy* frame, PassRefPtr<DataCallback> prpCallback)
1894 RefPtr<DataCallback> callback = prpCallback;
1896 callback->invalidate();
1900 uint64_t callbackID = callback->callbackID();
1901 m_dataCallbacks.set(callbackID, callback.get());
1902 process()->send(Messages::WebPage::GetWebArchiveOfFrame(frame->frameID(), callbackID), m_pageID);
1905 void WebPageProxy::forceRepaint(PassRefPtr<VoidCallback> prpCallback)
1907 RefPtr<VoidCallback> callback = prpCallback;
1909 callback->invalidate();
1913 uint64_t callbackID = callback->callbackID();
1914 m_voidCallbacks.set(callbackID, callback.get());
1915 m_drawingArea->waitForBackingStoreUpdateOnNextPaint();
1916 process()->send(Messages::WebPage::ForceRepaint(callbackID), m_pageID);
1919 void WebPageProxy::preferencesDidChange()
1924 #if ENABLE(INSPECTOR_SERVER)
1925 if (m_pageGroup->preferences()->developerExtrasEnabled())
1926 inspector()->enableRemoteInspection();
1929 // FIXME: It probably makes more sense to send individual preference changes.
1930 // However, WebKitTestRunner depends on getting a preference change notification
1931 // even if nothing changed in UI process, so that overrides get removed.
1933 // Preferences need to be updated during synchronous printing to make "print backgrounds" preference work when toggled from a print dialog checkbox.
1934 process()->send(Messages::WebPage::PreferencesDidChange(pageGroup()->preferences()->store()), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
1937 void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
1939 if (messageID.is<CoreIPC::MessageClassDrawingAreaProxy>()) {
1940 m_drawingArea->didReceiveDrawingAreaProxyMessage(connection, messageID, arguments);
1944 #if USE(UI_SIDE_COMPOSITING)
1945 if (messageID.is<CoreIPC::MessageClassLayerTreeCoordinatorProxy>()) {
1946 m_drawingArea->didReceiveLayerTreeCoordinatorProxyMessage(connection, messageID, arguments);
1951 #if ENABLE(INSPECTOR)
1952 if (messageID.is<CoreIPC::MessageClassWebInspectorProxy>()) {
1953 if (WebInspectorProxy* inspector = this->inspector())
1954 inspector->didReceiveWebInspectorProxyMessage(connection, messageID, arguments);
1959 #if ENABLE(FULLSCREEN_API)
1960 if (messageID.is<CoreIPC::MessageClassWebFullScreenManagerProxy>()) {
1961 fullScreenManager()->didReceiveMessage(connection, messageID, arguments);
1966 didReceiveWebPageProxyMessage(connection, messageID, arguments);
1969 void WebPageProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, OwnPtr<CoreIPC::ArgumentEncoder>& reply)
1971 #if ENABLE(INSPECTOR)
1972 if (messageID.is<CoreIPC::MessageClassWebInspectorProxy>()) {
1973 if (WebInspectorProxy* inspector = this->inspector())
1974 inspector->didReceiveSyncWebInspectorProxyMessage(connection, messageID, arguments, reply);
1979 #if ENABLE(FULLSCREEN_API)
1980 if (messageID.is<CoreIPC::MessageClassWebFullScreenManagerProxy>()) {
1981 fullScreenManager()->didReceiveSyncMessage(connection, messageID, arguments, reply);
1986 // FIXME: Do something with reply.
1987 didReceiveSyncWebPageProxyMessage(connection, messageID, arguments, reply);
1990 void WebPageProxy::didCreateMainFrame(uint64_t frameID)
1992 MESSAGE_CHECK(!m_mainFrame);
1993 MESSAGE_CHECK(process()->canCreateFrame(frameID));
1995 m_mainFrame = WebFrameProxy::create(this, frameID);
1997 // Add the frame to the process wide map.
1998 process()->frameCreated(frameID, m_mainFrame.get());
2001 void WebPageProxy::didCreateSubframe(uint64_t frameID, uint64_t parentFrameID)
2003 MESSAGE_CHECK(m_mainFrame);
2005 WebFrameProxy* parentFrame = process()->webFrame(parentFrameID);
2006 MESSAGE_CHECK(parentFrame);
2007 MESSAGE_CHECK(parentFrame->isDescendantOf(m_mainFrame.get()));
2009 MESSAGE_CHECK(process()->canCreateFrame(frameID));
2011 RefPtr<WebFrameProxy> subFrame = WebFrameProxy::create(this, frameID);
2013 // Add the frame to the process wide map.
2014 process()->frameCreated(frameID, subFrame.get());
2016 // Insert the frame into the frame hierarchy.
2017 parentFrame->appendChild(subFrame.get());
2020 static bool isDisconnectedFrame(WebFrameProxy* frame)
2022 return !frame->page() || !frame->page()->mainFrame() || !frame->isDescendantOf(frame->page()->mainFrame());
2025 void WebPageProxy::didSaveFrameToPageCache(uint64_t frameID)
2027 MESSAGE_CHECK(m_mainFrame);
2029 WebFrameProxy* subframe = process()->webFrame(frameID);
2030 MESSAGE_CHECK(subframe);
2032 if (isDisconnectedFrame(subframe))
2035 MESSAGE_CHECK(subframe->isDescendantOf(m_mainFrame.get()));
2037 subframe->didRemoveFromHierarchy();
2040 void WebPageProxy::didRestoreFrameFromPageCache(uint64_t frameID, uint64_t parentFrameID)
2042 MESSAGE_CHECK(m_mainFrame);
2044 WebFrameProxy* subframe = process()->webFrame(frameID);
2045 MESSAGE_CHECK(subframe);
2046 MESSAGE_CHECK(!subframe->parentFrame());
2047 MESSAGE_CHECK(subframe->page() == m_mainFrame->page());
2049 WebFrameProxy* parentFrame = process()->webFrame(parentFrameID);
2050 MESSAGE_CHECK(parentFrame);
2051 MESSAGE_CHECK(parentFrame->isDescendantOf(m_mainFrame.get()));
2053 // Insert the frame into the frame hierarchy.
2054 parentFrame->appendChild(subframe);
2058 // Always start progress at initialProgressValue. This helps provide feedback as
2059 // soon as a load starts.
2061 static const double initialProgressValue = 0.1;
2063 double WebPageProxy::estimatedProgress() const
2065 if (!pendingAPIRequestURL().isNull())
2066 return initialProgressValue;
2067 return m_estimatedProgress;
2070 void WebPageProxy::didStartProgress()
2072 m_estimatedProgress = initialProgressValue;
2074 m_loaderClient.didStartProgress(this);
2077 void WebPageProxy::didChangeProgress(double value)
2079 m_estimatedProgress = value;
2081 m_loaderClient.didChangeProgress(this);
2084 void WebPageProxy::didFinishProgress()
2086 m_estimatedProgress = 1.0;
2088 m_loaderClient.didFinishProgress(this);
2091 #if ENABLE(WEB_INTENTS_TAG)
2092 void WebPageProxy::registerIntentServiceForFrame(uint64_t frameID, const IntentServiceInfo& serviceInfo, CoreIPC::ArgumentDecoder* arguments)
2094 RefPtr<APIObject> userData;
2095 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2096 if (!arguments->decode(messageDecoder))
2099 WebFrameProxy* frame = process()->webFrame(frameID);
2100 MESSAGE_CHECK(frame);
2102 RefPtr<WebIntentServiceInfo> webIntentServiceInfo = WebIntentServiceInfo::create(serviceInfo);
2103 m_loaderClient.registerIntentServiceForFrame(this, frame, webIntentServiceInfo.get(), userData.get());
2107 void WebPageProxy::didStartProvisionalLoadForFrame(uint64_t frameID, const String& url, const String& unreachableURL, CoreIPC::ArgumentDecoder* arguments)
2109 clearPendingAPIRequestURL();
2111 RefPtr<APIObject> userData;
2112 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2113 if (!arguments->decode(messageDecoder))
2116 WebFrameProxy* frame = process()->webFrame(frameID);
2117 MESSAGE_CHECK(frame);
2118 MESSAGE_CHECK_URL(url);
2120 frame->setUnreachableURL(unreachableURL);
2122 frame->didStartProvisionalLoad(url);
2123 m_loaderClient.didStartProvisionalLoadForFrame(this, frame, userData.get());
2126 void WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, const String& url, CoreIPC::ArgumentDecoder* arguments)
2128 RefPtr<APIObject> userData;
2129 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2130 if (!arguments->decode(messageDecoder))
2133 WebFrameProxy* frame = process()->webFrame(frameID);
2134 MESSAGE_CHECK(frame);
2135 MESSAGE_CHECK_URL(url);
2137 frame->didReceiveServerRedirectForProvisionalLoad(url);
2139 m_loaderClient.didReceiveServerRedirectForProvisionalLoadForFrame(this, frame, userData.get());
2142 void WebPageProxy::didFailProvisionalLoadForFrame(uint64_t frameID, const ResourceError& error, CoreIPC::ArgumentDecoder* arguments)
2144 RefPtr<APIObject> userData;
2145 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2146 if (!arguments->decode(messageDecoder))
2149 WebFrameProxy* frame = process()->webFrame(frameID);
2150 MESSAGE_CHECK(frame);
2152 frame->didFailProvisionalLoad();
2154 m_loaderClient.didFailProvisionalLoadWithErrorForFrame(this, frame, error, userData.get());
2157 void WebPageProxy::clearLoadDependentCallbacks()
2159 Vector<uint64_t> callbackIDsCopy;
2160 copyToVector(m_loadDependentStringCallbackIDs, callbackIDsCopy);
2161 m_loadDependentStringCallbackIDs.clear();
2163 for (size_t i = 0; i < callbackIDsCopy.size(); ++i) {
2164 RefPtr<StringCallback> callback = m_stringCallbacks.take(callbackIDsCopy[i]);
2166 callback->invalidate();
2170 void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, const String& mimeType, bool frameHasCustomRepresentation, const PlatformCertificateInfo& certificateInfo, CoreIPC::ArgumentDecoder* arguments)
2172 RefPtr<APIObject> userData;
2173 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2174 if (!arguments->decode(messageDecoder))
2177 WebFrameProxy* frame = process()->webFrame(frameID);
2178 MESSAGE_CHECK(frame);
2181 // FIXME (bug 59111): didCommitLoadForFrame comes too late when restoring a page from b/f cache, making us disable secure event mode in password fields.
2182 // FIXME (bug 59121): A load going on in one frame shouldn't affect typing in sibling frames.
2183 m_pageClient->resetTextInputState();
2184 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
2185 // FIXME: Should this be moved inside resetTextInputState()?
2186 dismissCorrectionPanel(ReasonForDismissingAlternativeTextIgnored);
2187 m_pageClient->dismissDictionaryLookupPanel();
2191 clearLoadDependentCallbacks();
2193 frame->didCommitLoad(mimeType, certificateInfo);
2195 if (frame->isMainFrame()) {
2196 m_mainFrameHasCustomRepresentation = frameHasCustomRepresentation;
2198 if (m_mainFrameHasCustomRepresentation) {
2199 // Always assume that the main frame is pinned here, since the custom representation view will handle
2200 // any wheel events and dispatch them to the WKView when necessary.
2201 m_mainFrameIsPinnedToLeftSide = true;
2202 m_mainFrameIsPinnedToRightSide = true;
2204 m_pageClient->didCommitLoadForMainFrame(frameHasCustomRepresentation);
2207 m_loaderClient.didCommitLoadForFrame(this, frame, userData.get());
2210 void WebPageProxy::didFinishDocumentLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2212 RefPtr<APIObject> userData;
2213 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2214 if (!arguments->decode(messageDecoder))
2217 WebFrameProxy* frame = process()->webFrame(frameID);
2218 MESSAGE_CHECK(frame);
2220 m_loaderClient.didFinishDocumentLoadForFrame(this, frame, userData.get());
2223 #if ENABLE(TIZEN_NATIVE_MEMORY_SNAPSHOT)
2224 const char* isMemorySnapshot = getenv("TIZEN_MEMORY_SNAPSHOT");
2226 void WebPageProxy::didFinishLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2228 RefPtr<APIObject> userData;
2229 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2230 if (!arguments->decode(messageDecoder))
2233 WebFrameProxy* frame = process()->webFrame(frameID);
2234 MESSAGE_CHECK(frame);
2236 frame->didFinishLoad();
2238 m_loaderClient.didFinishLoadForFrame(this, frame, userData.get());
2239 #if ENABLE(TIZEN_NATIVE_MEMORY_SNAPSHOT)
2240 if (isMemorySnapshot && isMemorySnapshot[0] != '0')
2241 dumpMemorySnapshot();
2245 void WebPageProxy::didFailLoadForFrame(uint64_t frameID, const ResourceError& error, CoreIPC::ArgumentDecoder* arguments)
2247 RefPtr<APIObject> userData;
2248 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2249 if (!arguments->decode(messageDecoder))
2252 WebFrameProxy* frame = process()->webFrame(frameID);
2253 MESSAGE_CHECK(frame);
2255 clearLoadDependentCallbacks();
2257 frame->didFailLoad();
2259 m_loaderClient.didFailLoadWithErrorForFrame(this, frame, error, userData.get());
2262 void WebPageProxy::didSameDocumentNavigationForFrame(uint64_t frameID, uint32_t opaqueSameDocumentNavigationType, const String& url, CoreIPC::ArgumentDecoder* arguments)
2264 RefPtr<APIObject> userData;
2265 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2266 if (!arguments->decode(messageDecoder))
2269 WebFrameProxy* frame = process()->webFrame(frameID);
2270 MESSAGE_CHECK(frame);
2271 MESSAGE_CHECK_URL(url);
2273 clearPendingAPIRequestURL();
2274 frame->didSameDocumentNavigation(url);
2276 m_loaderClient.didSameDocumentNavigationForFrame(this, frame, static_cast<SameDocumentNavigationType>(opaqueSameDocumentNavigationType), userData.get());
2279 void WebPageProxy::didReceiveTitleForFrame(uint64_t frameID, const String& title, CoreIPC::ArgumentDecoder* arguments)
2281 RefPtr<APIObject> userData;
2282 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2283 if (!arguments->decode(messageDecoder))
2286 WebFrameProxy* frame = process()->webFrame(frameID);
2287 MESSAGE_CHECK(frame);
2289 frame->didChangeTitle(title);
2291 m_loaderClient.didReceiveTitleForFrame(this, title, frame, userData.get());
2294 void WebPageProxy::didFirstLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2296 RefPtr<APIObject> userData;
2297 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2298 if (!arguments->decode(messageDecoder))
2301 WebFrameProxy* frame = process()->webFrame(frameID);
2302 MESSAGE_CHECK(frame);
2304 m_loaderClient.didFirstLayoutForFrame(this, frame, userData.get());
2307 void WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2309 RefPtr<APIObject> userData;
2310 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2311 if (!arguments->decode(messageDecoder))
2314 WebFrameProxy* frame = process()->webFrame(frameID);
2315 MESSAGE_CHECK(frame);
2318 if (frame->isMainFrame())
2319 m_pageClient->didFirstVisuallyNonEmptyLayoutForMainFrame();
2322 m_loaderClient.didFirstVisuallyNonEmptyLayoutForFrame(this, frame, userData.get());
2325 void WebPageProxy::didNewFirstVisuallyNonEmptyLayout(CoreIPC::ArgumentDecoder* arguments)
2327 RefPtr<APIObject> userData;
2328 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2329 if (!arguments->decode(messageDecoder))
2332 m_loaderClient.didNewFirstVisuallyNonEmptyLayout(this, userData.get());
2335 void WebPageProxy::didRemoveFrameFromHierarchy(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2337 RefPtr<APIObject> userData;
2338 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2339 if (!arguments->decode(messageDecoder))
2342 WebFrameProxy* frame = process()->webFrame(frameID);
2343 MESSAGE_CHECK(frame);
2345 frame->didRemoveFromHierarchy();
2347 m_loaderClient.didRemoveFrameFromHierarchy(this, frame, userData.get());
2350 void WebPageProxy::didDisplayInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2352 RefPtr<APIObject> userData;
2353 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2354 if (!arguments->decode(messageDecoder))
2357 WebFrameProxy* frame = process()->webFrame(frameID);
2358 MESSAGE_CHECK(frame);
2360 m_loaderClient.didDisplayInsecureContentForFrame(this, frame, userData.get());
2363 void WebPageProxy::didRunInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2365 RefPtr<APIObject> userData;
2366 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2367 if (!arguments->decode(messageDecoder))
2370 WebFrameProxy* frame = process()->webFrame(frameID);
2371 MESSAGE_CHECK(frame);
2373 m_loaderClient.didRunInsecureContentForFrame(this, frame, userData.get());
2376 void WebPageProxy::didDetectXSSForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
2378 RefPtr<APIObject> userData;
2379 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2380 if (!arguments->decode(messageDecoder))
2383 WebFrameProxy* frame = process()->webFrame(frameID);
2384 MESSAGE_CHECK(frame);
2386 m_loaderClient.didDetectXSSForFrame(this, frame, userData.get());
2389 #if ENABLE(WEB_INTENTS)
2390 void WebPageProxy::didReceiveIntentForFrame(uint64_t frameID, const IntentData& intentData, CoreIPC::ArgumentDecoder* arguments)
2392 RefPtr<APIObject> userData;
2393 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2394 if (!arguments->decode(messageDecoder))
2397 WebFrameProxy* frame = process()->webFrame(frameID);
2398 MESSAGE_CHECK(frame);
2400 RefPtr<WebIntentData> webIntentData = WebIntentData::create(intentData);
2401 m_loaderClient.didReceiveIntentForFrame(this, frame, webIntentData.get(), userData.get());
2405 void WebPageProxy::frameDidBecomeFrameSet(uint64_t frameID, bool value)
2407 WebFrameProxy* frame = process()->webFrame(frameID);
2408 MESSAGE_CHECK(frame);
2410 frame->setIsFrameSet(value);
2411 if (frame->isMainFrame())
2412 m_frameSetLargestFrame = value ? m_mainFrame : 0;
2416 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)
2418 RefPtr<APIObject> userData;
2419 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2420 if (!arguments->decode(messageDecoder))
2423 if (request.url() != pendingAPIRequestURL())
2424 clearPendingAPIRequestURL();
2426 WebFrameProxy* frame = process()->webFrame(frameID);
2427 MESSAGE_CHECK(frame);
2428 MESSAGE_CHECK_URL(request.url());
2430 NavigationType navigationType = static_cast<NavigationType>(opaqueNavigationType);
2431 WebEvent::Modifiers modifiers = static_cast<WebEvent::Modifiers>(opaqueModifiers);
2432 WebMouseEvent::Button mouseButton = static_cast<WebMouseEvent::Button>(opaqueMouseButton);
2434 RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID);
2436 ASSERT(!m_inDecidePolicyForNavigationAction);
2438 m_inDecidePolicyForNavigationAction = true;
2439 m_syncNavigationActionPolicyActionIsValid = false;
2441 if (!m_policyClient.decidePolicyForNavigationAction(this, frame, navigationType, modifiers, mouseButton, request, listener.get(), userData.get()))
2444 m_inDecidePolicyForNavigationAction = false;
2446 // Check if we received a policy decision already. If we did, we can just pass it back.
2447 receivedPolicyAction = m_syncNavigationActionPolicyActionIsValid;
2448 if (m_syncNavigationActionPolicyActionIsValid) {
2449 policyAction = m_syncNavigationActionPolicyAction;
2450 downloadID = m_syncNavigationActionPolicyDownloadID;
2454 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)
2456 RefPtr<APIObject> userData;
2457 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2458 if (!arguments->decode(messageDecoder))
2461 WebFrameProxy* frame = process()->webFrame(frameID);
2462 MESSAGE_CHECK(frame);
2463 MESSAGE_CHECK_URL(request.url());
2465 NavigationType navigationType = static_cast<NavigationType>(opaqueNavigationType);
2466 WebEvent::Modifiers modifiers = static_cast<WebEvent::Modifiers>(opaqueModifiers);
2467 WebMouseEvent::Button mouseButton = static_cast<WebMouseEvent::Button>(opaqueMouseButton);
2469 RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID);
2470 if (!m_policyClient.decidePolicyForNewWindowAction(this, frame, navigationType, modifiers, mouseButton, request, frameName, listener.get(), userData.get()))
2474 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)
2476 RefPtr<APIObject> userData;
2477 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2478 if (!arguments->decode(messageDecoder))
2481 WebFrameProxy* frame = process()->webFrame(frameID);
2482 MESSAGE_CHECK(frame);
2483 MESSAGE_CHECK_URL(request.url());
2484 MESSAGE_CHECK_URL(response.url());
2486 RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID);
2488 ASSERT(!m_inDecidePolicyForResponse);
2490 m_inDecidePolicyForResponse = true;
2491 m_syncMimeTypePolicyActionIsValid = false;
2493 if (!m_policyClient.decidePolicyForResponse(this, frame, response, request, listener.get(), userData.get()))
2496 m_inDecidePolicyForResponse = false;
2498 // Check if we received a policy decision already. If we did, we can just pass it back.
2499 receivedPolicyAction = m_syncMimeTypePolicyActionIsValid;
2500 if (m_syncMimeTypePolicyActionIsValid) {
2501 policyAction = m_syncMimeTypePolicyAction;
2502 downloadID = m_syncMimeTypePolicyDownloadID;
2506 void WebPageProxy::unableToImplementPolicy(uint64_t frameID, const ResourceError& error, CoreIPC::ArgumentDecoder* arguments)
2508 RefPtr<APIObject> userData;
2509 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2510 if (!arguments->decode(messageDecoder))
2513 WebFrameProxy* frame = process()->webFrame(frameID);
2514 MESSAGE_CHECK(frame);
2516 m_policyClient.unableToImplementPolicy(this, frame, error, userData.get());
2521 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
2522 void WebPageProxy::willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, bool containsPasswordData, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments)
2524 void WebPageProxy::willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments)
2527 RefPtr<APIObject> userData;
2528 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2529 if (!arguments->decode(messageDecoder))
2532 WebFrameProxy* frame = process()->webFrame(frameID);
2533 MESSAGE_CHECK(frame);
2535 WebFrameProxy* sourceFrame = process()->webFrame(sourceFrameID);
2536 MESSAGE_CHECK(sourceFrame);
2538 RefPtr<WebFormSubmissionListenerProxy> listener = frame->setUpFormSubmissionListenerProxy(listenerID);
2539 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
2540 if (!m_formClient.willSubmitForm(this, frame, sourceFrame, textFieldValues.stringPairVector(), containsPasswordData, userData.get(), listener.get()))
2542 if (!m_formClient.willSubmitForm(this, frame, sourceFrame, textFieldValues.stringPairVector(), userData.get(), listener.get()))
2544 listener->continueSubmission();
2547 // ResourceLoad Client
2549 void WebPageProxy::didInitiateLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceRequest& request, bool pageIsProvisionallyLoading)
2551 WebFrameProxy* frame = process()->webFrame(frameID);
2552 MESSAGE_CHECK(frame);
2553 MESSAGE_CHECK_URL(request.url());
2555 m_resourceLoadClient.didInitiateLoadForResource(this, frame, resourceIdentifier, request, pageIsProvisionallyLoading);
2558 void WebPageProxy::didSendRequestForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceRequest& request, const ResourceResponse& redirectResponse)
2560 WebFrameProxy* frame = process()->webFrame(frameID);
2561 MESSAGE_CHECK(frame);
2562 MESSAGE_CHECK_URL(request.url());
2564 m_resourceLoadClient.didSendRequestForResource(this, frame, resourceIdentifier, request, redirectResponse);
2567 void WebPageProxy::didReceiveResponseForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceResponse& response)
2569 WebFrameProxy* frame = process()->webFrame(frameID);
2570 MESSAGE_CHECK(frame);
2571 MESSAGE_CHECK_URL(response.url());
2573 m_resourceLoadClient.didReceiveResponseForResource(this, frame, resourceIdentifier, response);
2576 void WebPageProxy::didReceiveContentLengthForResource(uint64_t frameID, uint64_t resourceIdentifier, uint64_t contentLength)
2578 WebFrameProxy* frame = process()->webFrame(frameID);
2579 MESSAGE_CHECK(frame);
2581 m_resourceLoadClient.didReceiveContentLengthForResource(this, frame, resourceIdentifier, contentLength);
2584 void WebPageProxy::didFinishLoadForResource(uint64_t frameID, uint64_t resourceIdentifier)
2586 WebFrameProxy* frame = process()->webFrame(frameID);
2587 MESSAGE_CHECK(frame);
2589 m_resourceLoadClient.didFinishLoadForResource(this, frame, resourceIdentifier);
2592 void WebPageProxy::didFailLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceError& error)
2594 WebFrameProxy* frame = process()->webFrame(frameID);
2595 MESSAGE_CHECK(frame);
2597 m_resourceLoadClient.didFailLoadForResource(this, frame, resourceIdentifier, error);
2602 void WebPageProxy::createNewPage(const ResourceRequest& request, const WindowFeatures& windowFeatures, uint32_t opaqueModifiers, int32_t opaqueMouseButton, uint64_t& newPageID, WebPageCreationParameters& newPageParameters)
2604 RefPtr<WebPageProxy> newPage = m_uiClient.createNewPage(this, request, windowFeatures, static_cast<WebEvent::Modifiers>(opaqueModifiers), static_cast<WebMouseEvent::Button>(opaqueMouseButton));
2606 newPageID = newPage->pageID();
2607 newPageParameters = newPage->creationParameters();
2612 void WebPageProxy::showPage()
2614 m_uiClient.showPage(this);
2617 void WebPageProxy::closePage(bool stopResponsivenessTimer)
2619 if (stopResponsivenessTimer)
2620 process()->responsivenessTimer()->stop();
2622 m_pageClient->clearAllEditCommands();
2623 m_uiClient.close(this);
2626 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
2627 bool WebPageProxy::isWaitingForJavaScriptPopupReply()
2629 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
2630 return m_alertReply || m_confirmReply || m_promptReply || m_beforeUnloadConfirmPanelReply;
2632 return m_alertReply || m_confirmReply || m_promptReply;
2638 void WebPageProxy::runJavaScriptAlert(uint64_t frameID, const String& message, PassRefPtr<Messages::WebPageProxy::RunJavaScriptAlert::DelayedReply> reply)
2640 WebFrameProxy* frame = process()->webFrame(frameID);
2641 MESSAGE_CHECK(frame);
2643 // Since runJavaScriptAlert() can spin a nested run loop we need to turn off the responsiveness timer.
2644 process()->responsivenessTimer()->stop();
2646 m_alertReply = reply;
2647 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
2648 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
2650 if (!m_uiClient.runJavaScriptAlert(this, message, frame))
2651 replyJavaScriptAlert();
2654 void WebPageProxy::runJavaScriptConfirm(uint64_t frameID, const String& message, PassRefPtr<Messages::WebPageProxy::RunJavaScriptConfirm::DelayedReply> reply)
2656 WebFrameProxy* frame = process()->webFrame(frameID);
2657 MESSAGE_CHECK(frame);
2659 // Since runJavaScriptConfirm() can spin a nested run loop we need to turn off the responsiveness timer.
2660 process()->responsivenessTimer()->stop();
2662 m_confirmReply = reply;
2663 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
2664 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
2666 if (!m_uiClient.runJavaScriptConfirm(this, message, frame))
2667 replyJavaScriptConfirm(false);
2670 void WebPageProxy::runJavaScriptPrompt(uint64_t frameID, const String& message, const String& defaultValue, PassRefPtr<Messages::WebPageProxy::RunJavaScriptPrompt::DelayedReply> reply)
2672 WebFrameProxy* frame = process()->webFrame(frameID);
2673 MESSAGE_CHECK(frame);
2675 // Since runJavaScriptPrompt() can spin a nested run loop we need to turn off the responsiveness timer.
2676 process()->responsivenessTimer()->stop();
2678 m_promptReply = reply;
2679 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
2680 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
2682 if (!m_uiClient.runJavaScriptPrompt(this, message, defaultValue, frame))
2683 replyJavaScriptPrompt(String());
2686 void WebPageProxy::runJavaScriptAlert(uint64_t frameID, const String& message)
2688 WebFrameProxy* frame = process()->webFrame(frameID);
2689 MESSAGE_CHECK(frame);
2691 // Since runJavaScriptAlert() can spin a nested run loop we need to turn off the responsiveness timer.
2692 process()->responsivenessTimer()->stop();
2694 m_uiClient.runJavaScriptAlert(this, message, frame);
2697 void WebPageProxy::runJavaScriptConfirm(uint64_t frameID, const String& message, bool& result)
2699 WebFrameProxy* frame = process()->webFrame(frameID);
2700 MESSAGE_CHECK(frame);
2702 // Since runJavaScriptConfirm() can spin a nested run loop we need to turn off the responsiveness timer.
2703 process()->responsivenessTimer()->stop();
2705 result = m_uiClient.runJavaScriptConfirm(this, message, frame);
2708 void WebPageProxy::runJavaScriptPrompt(uint64_t frameID, const String& message, const String& defaultValue, String& result)
2710 WebFrameProxy* frame = process()->webFrame(frameID);
2711 MESSAGE_CHECK(frame);
2713 // Since runJavaScriptPrompt() can spin a nested run loop we need to turn off the responsiveness timer.
2714 process()->responsivenessTimer()->stop();
2716 result = m_uiClient.runJavaScriptPrompt(this, message, defaultValue, frame);
2720 void WebPageProxy::shouldInterruptJavaScript(bool& result)
2722 // Since shouldInterruptJavaScript() can spin a nested run loop we need to turn off the responsiveness timer.
2723 process()->responsivenessTimer()->stop();
2725 result = m_uiClient.shouldInterruptJavaScript(this);
2728 void WebPageProxy::setStatusText(const String& text)
2730 m_uiClient.setStatusText(this, text);
2733 void WebPageProxy::mouseDidMoveOverElement(const WebHitTestResult::Data& hitTestResultData, uint32_t opaqueModifiers, CoreIPC::ArgumentDecoder* arguments)
2735 RefPtr<APIObject> userData;
2736 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
2737 if (!arguments->decode(messageDecoder))
2740 WebEvent::Modifiers modifiers = static_cast<WebEvent::Modifiers>(opaqueModifiers);
2742 m_uiClient.mouseDidMoveOverElement(this, hitTestResultData, modifiers, userData.get());
2745 void WebPageProxy::unavailablePluginButtonClicked(uint32_t opaquePluginUnavailabilityReason, const String& mimeType, const String& url, const String& pluginsPageURL)
2747 MESSAGE_CHECK_URL(url);
2748 MESSAGE_CHECK_URL(pluginsPageURL);
2750 WKPluginUnavailabilityReason pluginUnavailabilityReason = static_cast<WKPluginUnavailabilityReason>(opaquePluginUnavailabilityReason);
2751 m_uiClient.unavailablePluginButtonClicked(this, pluginUnavailabilityReason, mimeType, url, pluginsPageURL);
2754 void WebPageProxy::setToolbarsAreVisible(bool toolbarsAreVisible)
2756 m_uiClient.setToolbarsAreVisible(this, toolbarsAreVisible);
2759 void WebPageProxy::getToolbarsAreVisible(bool& toolbarsAreVisible)
2761 toolbarsAreVisible = m_uiClient.toolbarsAreVisible(this);
2764 void WebPageProxy::setMenuBarIsVisible(bool menuBarIsVisible)
2766 m_uiClient.setMenuBarIsVisible(this, menuBarIsVisible);
2769 void WebPageProxy::getMenuBarIsVisible(bool& menuBarIsVisible)
2771 menuBarIsVisible = m_uiClient.menuBarIsVisible(this);
2774 void WebPageProxy::setStatusBarIsVisible(bool statusBarIsVisible)
2776 m_uiClient.setStatusBarIsVisible(this, statusBarIsVisible);
2779 void WebPageProxy::getStatusBarIsVisible(bool& statusBarIsVisible)
2781 statusBarIsVisible = m_uiClient.statusBarIsVisible(this);
2784 void WebPageProxy::setIsResizable(bool isResizable)
2786 m_uiClient.setIsResizable(this, isResizable);
2789 void WebPageProxy::getIsResizable(bool& isResizable)
2791 isResizable = m_uiClient.isResizable(this);
2794 void WebPageProxy::setWindowFrame(const FloatRect& newWindowFrame)
2796 m_uiClient.setWindowFrame(this, m_pageClient->convertToDeviceSpace(newWindowFrame));
2799 void WebPageProxy::getWindowFrame(FloatRect& newWindowFrame)
2801 newWindowFrame = m_pageClient->convertToUserSpace(m_uiClient.windowFrame(this));
2804 void WebPageProxy::screenToWindow(const IntPoint& screenPoint, IntPoint& windowPoint)
2806 windowPoint = m_pageClient->screenToWindow(screenPoint);
2809 void WebPageProxy::windowToScreen(const IntRect& viewRect, IntRect& result)
2811 result = m_pageClient->windowToScreen(viewRect);
2814 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
2815 void WebPageProxy::runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, PassRefPtr<Messages::WebPageProxy::RunBeforeUnloadConfirmPanel::DelayedReply> reply)
2817 WebFrameProxy* frame = process()->webFrame(frameID);
2818 MESSAGE_CHECK(frame);
2820 // Since runBeforeUnloadConfirmPanel() can spin a nested run loop we need to turn off the responsiveness timer.
2821 process()->responsivenessTimer()->stop();
2823 m_beforeUnloadConfirmPanelReply = reply;
2824 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
2825 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
2827 if (!m_uiClient.runBeforeUnloadConfirmPanel(this, message, frame))
2828 replyBeforeUnloadConfirmPanel(false);
2831 void WebPageProxy::runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose)
2833 WebFrameProxy* frame = process()->webFrame(frameID);
2834 MESSAGE_CHECK(frame);
2836 // Since runBeforeUnloadConfirmPanel() can spin a nested run loop we need to turn off the responsiveness timer.
2837 process()->responsivenessTimer()->stop();
2839 shouldClose = m_uiClient.runBeforeUnloadConfirmPanel(this, message, frame);
2843 #if USE(TILED_BACKING_STORE)
2844 void WebPageProxy::pageDidRequestScroll(const IntPoint& point)
2846 m_pageClient->pageDidRequestScroll(point);
2850 void WebPageProxy::didChangeViewportProperties(const ViewportAttributes& attr)
2852 m_pageClient->didChangeViewportProperties(attr);
2855 void WebPageProxy::pageDidScroll()
2857 m_uiClient.pageDidScroll(this);
2858 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
2859 dismissCorrectionPanel(ReasonForDismissingAlternativeTextIgnored);
2863 void WebPageProxy::runOpenPanel(uint64_t frameID, const FileChooserSettings& settings)
2865 if (m_openPanelResultListener) {
2866 m_openPanelResultListener->invalidate();
2867 m_openPanelResultListener = 0;
2870 WebFrameProxy* frame = process()->webFrame(frameID);
2871 MESSAGE_CHECK(frame);
2873 RefPtr<WebOpenPanelParameters> parameters = WebOpenPanelParameters::create(settings);
2874 m_openPanelResultListener = WebOpenPanelResultListenerProxy::create(this);
2876 // Since runOpenPanel() can spin a nested run loop we need to turn off the responsiveness timer.
2877 process()->responsivenessTimer()->stop();
2879 if (!m_uiClient.runOpenPanel(this, frame, parameters.get(), m_openPanelResultListener.get()))
2880 didCancelForOpenPanel();
2883 void WebPageProxy::printFrame(uint64_t frameID)
2885 ASSERT(!m_isPerformingDOMPrintOperation);
2886 m_isPerformingDOMPrintOperation = true;
2888 WebFrameProxy* frame = process()->webFrame(frameID);
2889 MESSAGE_CHECK(frame);
2891 m_uiClient.printFrame(this, frame);
2893 endPrinting(); // Send a message synchronously while m_isPerformingDOMPrintOperation is still true.
2894 m_isPerformingDOMPrintOperation = false;
2897 void WebPageProxy::printMainFrame()
2899 printFrame(m_mainFrame->frameID());
2902 #if ENABLE(TIZEN_REGISTER_PROTOCOL_HANDLER)
2903 void WebPageProxy::registerProtocolHandler(const String& scheme, const String& baseURL, const String& url, const String& title)
2905 m_pageClient->registerProtocolHandler(scheme, baseURL, url, title);
2909 #if ENABLE(TIZEN_CUSTOM_SCHEME_HANDLER)
2910 void WebPageProxy::isProtocolHandlerRegistered(const String& scheme, const String& baseURL, const String& url, unsigned int& result)
2912 result = m_pageClient->isProtocolHandlerRegistered(scheme, baseURL, url);
2914 void WebPageProxy::unregisterProtocolHandler(const String& scheme, const String& baseURL, const String& url)
2916 m_pageClient->unregisterProtocolHandler(scheme, baseURL, url);
2920 #if ENABLE(TIZEN_REGISTER_CONTENT_HANDLER)
2921 void WebPageProxy::registerContentHandler(const String& mimeType, const String& baseURL, const String& url, const String& title)
2923 m_pageClient->registerContentHandler(mimeType, baseURL, url, title);
2926 void WebPageProxy::isContentHandlerRegistered(const String& mimeType, const String& baseURL, const String& url, unsigned int& result)
2928 result = m_pageClient->isContentHandlerRegistered(mimeType, baseURL, url);
2931 void WebPageProxy::unregisterContentHandler(const String& mimeType, const String& baseURL, const String& url)
2933 m_pageClient->unregisterContentHandler(mimeType, baseURL, url);
2937 #if ENABLE(TIZEN_SEARCH_PROVIDER)
2938 void WebPageProxy::addSearchProvider(const String& baseURL, const String& engineURL)
2940 m_pageClient->addSearchProvider(baseURL, engineURL);
2943 void WebPageProxy::isSearchProviderInstalled(const String& baseURL, const String& engineURL, uint64_t& result)
2945 result = m_pageClient->isSearchProviderInstalled(baseURL, engineURL);
2949 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
2950 void WebPageProxy::getStandaloneStatus(bool& standalone)
2952 standalone = m_pageClient->getStandaloneStatus();
2955 void WebPageProxy::getWebAppCapable(PassRefPtr<BooleanCallback> prpCallback)
2957 RefPtr<BooleanCallback> callback = prpCallback;
2959 callback->invalidate();
2963 uint64_t callbackID = callback->callbackID();
2964 m_booleanCallbacks.set(callbackID, callback.get());
2965 process()->send(Messages::WebPage::GetWebAppCapable(callbackID), m_pageID);
2968 void WebPageProxy::didGetWebAppCapable(const bool capable, uint64_t callbackID)
2970 RefPtr<BooleanCallback> callback = m_booleanCallbacks.take(callbackID);
2971 m_booleanCallbacks.remove(callbackID);
2972 callback->performCallbackWithReturnValue(WebBoolean::create(capable).leakRef());
2975 void WebPageProxy::getWebAppIconURL(PassRefPtr<StringCallback> prpCallback)
2977 RefPtr<StringCallback> callback = prpCallback;
2979 callback->invalidate();
2983 uint64_t callbackID = callback->callbackID();
2984 m_stringCallbacks.set(callbackID, callback.get());
2985 process()->send(Messages::WebPage::GetWebAppIconURL(callbackID), m_pageID);
2988 void WebPageProxy::didGetWebAppIconURL(const String& iconURL, uint64_t callbackID)
2990 RefPtr<StringCallback> callback = m_stringCallbacks.take(callbackID);
2992 // FIXME: Log error or assert.
2993 // this can validly happen if a load invalidated the callback, though
2997 m_stringCallbacks.remove(callbackID);
2998 callback->performCallbackWithReturnValue(iconURL.impl());
3001 void WebPageProxy::getWebAppIconURLs(PassRefPtr<DictionaryCallback> prpCallback)
3003 RefPtr<DictionaryCallback> callback = prpCallback;
3005 callback->invalidate();
3009 uint64_t callbackID = callback->callbackID();
3010 m_dictionaryCallbacks.set(callbackID, callback.get());
3011 process()->send(Messages::WebPage::GetWebAppIconURLs(callbackID), m_pageID);
3014 void WebPageProxy::didGetWebAppIconURLs(const StringPairVector& iconURLs, uint64_t callbackID)
3016 RefPtr<DictionaryCallback> callback = m_dictionaryCallbacks.take(callbackID);
3017 ImmutableDictionary::MapType iconURLList;
3018 size_t iconURLCount = iconURLs.stringPairVector().size();
3019 for (size_t i = 0; i < iconURLCount; ++i)
3020 iconURLList.set(iconURLs.stringPairVector()[i].first, WebString::create(iconURLs.stringPairVector()[i].second));
3022 callback->performCallbackWithReturnValue(ImmutableDictionary::adopt(iconURLList).get());
3026 void WebPageProxy::setMediaVolume(float volume)
3028 if (volume == m_mediaVolume)
3031 m_mediaVolume = volume;
3036 process()->send(Messages::WebPage::SetMediaVolume(volume), m_pageID);
3040 void WebPageProxy::didChangeContentsSize(const IntSize& size)
3042 m_pageClient->didChangeContentsSize(size);
3045 void WebPageProxy::didFindZoomableArea(const IntPoint& target, const IntRect& area)
3047 m_pageClient->didFindZoomableArea(target, area);
3050 void WebPageProxy::findZoomableAreaForPoint(const IntPoint& point, const IntSize& area)
3055 process()->send(Messages::WebPage::FindZoomableAreaForPoint(point, area), m_pageID);
3058 void WebPageProxy::didReceiveMessageFromNavigatorQtObject(const String& contents)
3060 m_pageClient->didReceiveMessageFromNavigatorQtObject(contents);
3063 void WebPageProxy::authenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password)
3065 m_pageClient->handleAuthenticationRequiredRequest(hostname, realm, prefilledUsername, username, password);
3068 void WebPageProxy::proxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password)
3070 m_pageClient->handleProxyAuthenticationRequiredRequest(hostname, port, prefilledUsername, username, password);
3073 void WebPageProxy::certificateVerificationRequest(const String& hostname, bool& ignoreErrors)
3075 m_pageClient->handleCertificateVerificationRequest(hostname, ignoreErrors);
3077 #endif // PLATFORM(QT).
3080 void WebPageProxy::didFindZoomableArea(const IntPoint& target, const IntRect& area)
3082 m_pageClient->didFindZoomableArea(target, area);
3085 void WebPageProxy::findZoomableAreaForPoint(const IntPoint& point, const IntSize& area)
3090 process()->send(Messages::WebPage::FindZoomableAreaForPoint(point, area), m_pageID);
3092 #endif // #if OS(TIZEN)
3094 #if PLATFORM(QT) || PLATFORM(EFL)
3095 void WebPageProxy::handleDownloadRequest(DownloadProxy* download)
3097 m_pageClient->handleDownloadRequest(download);
3099 #endif // PLATFORM(QT) || PLATFORM(EFL)
3101 #if ENABLE(TOUCH_EVENTS)
3102 void WebPageProxy::needTouchEvents(bool needTouchEvents)
3104 m_needTouchEvents = needTouchEvents;
3105 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
3106 // We don't have to ask overflow if we need touch events,
3107 // because we will check overflow in the web process when touch event is processed.
3108 m_askOverflow = !m_needTouchEvents;
3113 #if ENABLE(INPUT_TYPE_COLOR)
3114 void WebPageProxy::showColorChooser(const WebCore::Color& initialColor)
3116 ASSERT(!m_colorChooser);
3118 #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
3119 if (m_colorPickerResultListener) {
3120 m_colorPickerResultListener->invalidate();
3121 m_colorPickerResultListener = nullptr;
3124 m_colorPickerResultListener = WebColorPickerResultListenerProxy::create(this);
3125 m_colorChooser = WebColorChooserProxy::create(this);
3127 if (m_uiClient.showColorPicker(this, initialColor.serialized(), m_colorPickerResultListener.get()))
3131 m_colorChooser = m_pageClient->createColorChooserProxy(this, initialColor);
3132 #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
3133 if (!m_colorChooser)
3134 didEndColorChooser();
3138 void WebPageProxy::setColorChooserColor(const WebCore::Color& color)
3140 ASSERT(m_colorChooser);
3142 m_colorChooser->setSelectedColor(color);
3145 void WebPageProxy::endColorChooser()
3147 ASSERT(m_colorChooser);
3149 m_colorChooser->endChooser();
3152 void WebPageProxy::didChooseColor(const WebCore::Color& color)
3157 process()->send(Messages::WebPage::DidChooseColor(color), m_pageID);
3160 void WebPageProxy::didEndColorChooser()
3165 #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
3166 if (m_colorChooser) {
3167 m_colorChooser->invalidate();
3168 m_colorChooser = nullptr;
3171 ASSERT(m_colorChooser);
3173 m_colorChooser->invalidate();
3174 m_colorChooser = nullptr;
3177 #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
3178 m_process->send(Messages::WebPage::DidEndColorChooser(), m_pageID);
3180 m_colorPickerResultListener->invalidate();
3181 m_colorPickerResultListener = nullptr;
3183 m_uiClient.hideColorPicker(this);
3185 process()->send(Messages::WebPage::DidEndColorChooser(), m_pageID);
3190 void WebPageProxy::didDraw()
3192 m_uiClient.didDraw(this);
3197 #if ENABLE(INSPECTOR)
3199 WebInspectorProxy* WebPageProxy::inspector()
3201 if (isClosed() || !isValid())
3204 m_inspector = WebInspectorProxy::create(this);
3205 return m_inspector.get();
3210 #if ENABLE(FULLSCREEN_API)
3211 WebFullScreenManagerProxy* WebPageProxy::fullScreenManager()
3213 if (!m_fullScreenManager)
3214 m_fullScreenManager = WebFullScreenManagerProxy::create(this);
3215 return m_fullScreenManager.get();
3221 void WebPageProxy::backForwardAddItem(uint64_t itemID)
3223 m_backForwardList->addItem(process()->webBackForwardItem(itemID));
3226 void WebPageProxy::backForwardGoToItem(uint64_t itemID, SandboxExtension::Handle& sandboxExtensionHandle)
3228 WebBackForwardListItem* item = process()->webBackForwardItem(itemID);
3232 bool createdExtension = maybeInitializeSandboxExtensionHandle(KURL(KURL(), item->url()), sandboxExtensionHandle);
3233 if (createdExtension)
3234 process()->willAcquireUniversalFileReadSandboxExtension();
3235 m_backForwardList->goToItem(item);
3238 void WebPageProxy::backForwardItemAtIndex(int32_t index, uint64_t& itemID)
3240 WebBackForwardListItem* item = m_backForwardList->itemAtIndex(index);
3241 itemID = item ? item->itemID() : 0;
3244 void WebPageProxy::backForwardBackListCount(int32_t& count)
3246 count = m_backForwardList->backListCount();
3249 void WebPageProxy::backForwardForwardListCount(int32_t& count)
3251 count = m_backForwardList->forwardListCount();
3254 void WebPageProxy::editorStateChanged(const EditorState& editorState)
3257 bool couldChangeSecureInputState = m_editorState.isInPasswordField != editorState.isInPasswordField || m_editorState.selectionIsNone;
3260 m_editorState = editorState;
3263 m_pageClient->updateTextInputState(couldChangeSecureInputState);
3264 #elif PLATFORM(QT) || PLATFORM(EFL)
3265 m_pageClient->updateTextInputState();
3271 void WebPageProxy::registerEditCommandForUndo(uint64_t commandID, uint32_t editAction)
3273 registerEditCommand(WebEditCommandProxy::create(commandID, static_cast<EditAction>(editAction), this), Undo);
3276 void WebPageProxy::canUndoRedo(uint32_t action, bool& result)
3278 result = m_pageClient->canUndoRedo(static_cast<UndoOrRedo>(action));
3281 void WebPageProxy::executeUndoRedo(uint32_t action, bool& result)
3283 m_pageClient->executeUndoRedo(static_cast<UndoOrRedo>(action));
3287 void WebPageProxy::clearAllEditCommands()
3289 m_pageClient->clearAllEditCommands();
3292 void WebPageProxy::didCountStringMatches(const String& string, uint32_t matchCount)
3294 m_findClient.didCountStringMatches(this, string, matchCount);
3297 void WebPageProxy::didGetImageForFindMatch(const ShareableBitmap::Handle& contentImageHandle, uint32_t matchIndex)
3299 m_findMatchesClient.didGetImageForMatchResult(this, WebImage::create(ShareableBitmap::create(contentImageHandle)).get(), matchIndex);
3302 void WebPageProxy::setFindIndicator(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, const ShareableBitmap::Handle& contentImageHandle, bool fadeOut, bool animate)
3304 RefPtr<FindIndicator> findIndicator = FindIndicator::create(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, contentImageScaleFactor, contentImageHandle);
3305 m_pageClient->setFindIndicator(findIndicator.release(), fadeOut, animate);
3308 void WebPageProxy::didFindString(const String& string, uint32_t matchCount)
3310 m_findClient.didFindString(this, string, matchCount);
3313 void WebPageProxy::didFindStringMatches(const String& string, Vector<Vector<WebCore::IntRect> > matchRects, int32_t firstIndexAfterSelection)
3315 Vector<RefPtr<APIObject> > matches;
3316 matches.reserveInitialCapacity(matchRects.size());
3318 for (size_t i = 0; i < matchRects.size(); ++i) {
3319 const Vector<WebCore::IntRect>& rects = matchRects[i];
3320 size_t numRects = matchRects[i].size();
3321 Vector<RefPtr<APIObject> > apiRects;
3322 apiRects.reserveInitialCapacity(numRects);
3324 for (size_t i = 0; i < numRects; ++i)
3325 apiRects.uncheckedAppend(WebRect::create(toAPI(rects[i])));
3326 matches.uncheckedAppend(ImmutableArray::adopt(apiRects));
3328 m_findMatchesClient.didFindStringMatches(this, string, ImmutableArray::adopt(matches).get(), firstIndexAfterSelection);
3331 void WebPageProxy::didFailToFindString(const String& string)
3333 m_findClient.didFailToFindString(this, string);
3336 void WebPageProxy::valueChangedForPopupMenu(WebPopupMenuProxy*, int32_t newSelectedIndex)
3338 process()->send(Messages::WebPage::DidChangeSelectedIndexForActivePopupMenu(newSelectedIndex), m_pageID);
3341 void WebPageProxy::setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index)
3343 process()->send(Messages::WebPage::SetTextForActivePopupMenu(index), m_pageID);
3346 NativeWebMouseEvent* WebPageProxy::currentlyProcessedMouseDownEvent()
3348 return m_currentlyProcessedMouseDownEvent.get();
3352 void WebPageProxy::failedToShowPopupMenu()
3354 process()->send(Messages::WebPage::FailedToShowPopupMenu(), m_pageID);
3358 void WebPageProxy::showPopupMenu(const IntRect& rect, uint64_t textDirection, const Vector<WebPopupItem>& items, int32_t selectedIndex, const PlatformPopupMenuData& data)
3360 if (m_activePopupMenu) {
3361 m_activePopupMenu->hidePopupMenu();
3362 m_activePopupMenu->invalidate();
3363 m_activePopupMenu = 0;
3366 m_activePopupMenu = m_pageClient->createPopupMenuProxy(this);
3368 // Since showPopupMenu() can spin a nested run loop we need to turn off the responsiveness timer.
3369 process()->responsivenessTimer()->stop();
3371 RefPtr<WebPopupMenuProxy> protectedActivePopupMenu = m_activePopupMenu;
3373 protectedActivePopupMenu->showPopupMenu(rect, static_cast<TextDirection>(textDirection), m_pageScaleFactor, items, data, selectedIndex);
3375 // 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.
3376 #if !PLATFORM(QT) && !PLATFORM(EFL)
3377 protectedActivePopupMenu->invalidate();
3379 protectedActivePopupMenu = 0;
3382 void WebPageProxy::hidePopupMenu()
3384 if (!m_activePopupMenu)
3387 m_activePopupMenu->hidePopupMenu();
3388 m_activePopupMenu->invalidate();
3389 m_activePopupMenu = 0;
3392 #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
3393 void WebPageProxy::updatePopupMenu(uint64_t textDirection, const Vector<WebPopupItem>& items, int32_t selectedIndex)
3395 if (!m_activePopupMenu)
3398 m_activePopupMenu->updatePopupMenu(static_cast<TextDirection>(textDirection), items, selectedIndex);
3402 #if ENABLE(CONTEXT_MENUS)
3403 void WebPageProxy::showContextMenu(const IntPoint& menuLocation, const WebHitTestResult::Data& hitTestResultData, const Vector<WebContextMenuItemData>& proposedItems, CoreIPC::ArgumentDecoder* arguments)
3405 internalShowContextMenu(menuLocation, hitTestResultData, proposedItems, arguments);
3407 // No matter the result of internalShowContextMenu, always notify the WebProcess that the menu is hidden so it starts handling mouse events again.
3408 process()->send(Messages::WebPage::ContextMenuHidden(), m_pageID);
3411 void WebPageProxy::internalShowContextMenu(const IntPoint& menuLocation, const WebHitTestResult::Data& hitTestResultData, const Vector<WebContextMenuItemData>& proposedItems, CoreIPC::ArgumentDecoder* arguments)
3413 RefPtr<APIObject> userData;
3414 WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
3415 if (!arguments->decode(messageDecoder))
3418 m_activeContextMenuHitTestResultData = hitTestResultData;
3420 if (m_activeContextMenu) {
3421 m_activeContextMenu->hideContextMenu();
3422 m_activeContextMenu = 0;
3425 m_activeContextMenu = m_pageClient->createContextMenuProxy(this);
3427 // Since showContextMenu() can spin a nested run loop we need to turn off the responsiveness timer.
3428 process()->responsivenessTimer()->stop();
3430 // Give the PageContextMenuClient one last swipe at changing the menu.
3431 Vector<WebContextMenuItemData> items;
3432 if (!m_contextMenuClient.getContextMenuFromProposedMenu(this, proposedItems, items, hitTestResultData, userData.get()))
3433 m_activeContextMenu->showContextMenu(menuLocation, proposedItems);
3435 m_activeContextMenu->showContextMenu(menuLocation, items);
3437 m_contextMenuClient.contextMenuDismissed(this);
3440 void WebPageProxy::contextMenuItemSelected(const WebContextMenuItemData& item)
3442 TIZEN_LOGI("selected item : action(%d), title(%s)", item.action(), item.title().utf8().data());
3443 // Application custom items don't need to round-trip through to WebCore in the WebProcess.
3444 if (item.action() >= ContextMenuItemBaseApplicationTag) {
3445 m_contextMenuClient.customContextMenuItemSelected(this, item);
3446 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
3447 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)
4594 void WebPageProxy::didReceiveURIRequest(String uriString, uint64_t requestID)
4596 m_process->context()->soupRequestManagerProxy()->didReceiveURIRequest(uriString, this, requestID);
4600 #if ENABLE(TIZEN_PAGE_VISIBILITY_API)
4601 void WebPageProxy::setPageVisibility(WebCore::PageVisibilityState pageVisibilityState, bool isInitialState)
4603 process()->send(Messages::WebPage::SetVisibilityState(static_cast<uint32_t>(pageVisibilityState), isInitialState), m_pageID);
4607 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
4608 void WebPageProxy::decidePolicyForCertificateError(const String& url, const String& certificate, int error, PassRefPtr<Messages::WebPageProxy::DecidePolicyForCertificateError::DelayedReply> reply)
4610 m_allowedReply = reply;
4612 if (!m_tizenClient.decidePolicyForCertificateError(this, url, certificate, error))
4613 replyPolicyForCertificateError(true);
4617 #if ENABLE(TIZEN_NATIVE_MEMORY_SNAPSHOT)
4618 void WebPageProxy::dumpMemorySnapshot()
4620 process()->send(Messages::WebPage::DumpMemorySnapshot(), m_pageID);
4624 } // namespace WebKit