2 * Copyright (C) 2011 Samsung Electronics
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
27 #include "WebPageProxy.h"
29 #include "EwkViewImpl.h"
30 #include "NativeWebKeyboardEvent.h"
31 #include "NotImplemented.h"
32 #include "PageClientImpl.h"
33 #include "WebPageMessages.h"
34 #include "WebProcessProxy.h"
36 #include <sys/utsname.h>
39 #include "DrawingAreaMessages.h"
41 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION_ON_UI_SIDE)
42 #include "LayerTreeCoordinatorProxy.h"
44 #include "NativeWebKeyboardEvent.h"
46 #include "WebPageMessages.h"
47 #include "WebProcessProxy.h"
48 #include <WebCore/IntSize.h>
49 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
50 #include "WebContextMenuProxy.h"
51 #include "ewk_view_private.h"
54 #define MESSAGE_CHECK(assertion) MESSAGE_CHECK_BASE(assertion, m_process->connection())
56 #if ENABLE(TIZEN_LINK_MAGNIFIER)
57 #include "LinkMagnifierProxy.h"
60 #if ENABLE(TIZEN_SCREEN_READER)
61 #include "ScreenReaderProxy.h"
62 #include "ewk_view_private.h"
66 #include <WebCore/ContentSecurityPolicy.h>
69 #include <system_info.h>
70 #include "WebKitVersion.h"
72 using namespace WebCore;
77 Evas_Object* WebPageProxy::viewWidget()
79 return static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->view();
82 String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent)
85 WTF::String appleWebkitVer = makeString(String::number(WEBKIT_MAJOR_VERSION), '.', String::number(WEBKIT_MINOR_VERSION));
87 char* versionName = NULL;
88 WTF::String platformVer;
89 int ret = system_info_get_value_string(SYSTEM_INFO_KEY_TIZEN_VERSION, &versionName);
90 if (ret == SYSTEM_INFO_ERROR_NONE) {
91 char* versionNameCopy = NULL;
92 versionNameCopy = strdup(versionName);
94 char* majorVersion = NULL;
95 char* minorVersion = NULL;
96 majorVersion = strtok(versionNameCopy, ".");
97 minorVersion = strtok(NULL, ".");
99 if (majorVersion == NULL || minorVersion == NULL) {
100 platformVer = String("2.2");
102 WTF::String platformVerMajor;
103 WTF::String platformVerMinor;
104 platformVerMajor = String(majorVersion);
105 platformVerMinor = String(minorVersion);
106 platformVer = makeString(platformVerMajor, ".", platformVerMinor);
108 free(versionNameCopy);
114 WTF::String userAgentString = makeString("Mozilla/5.0 (Linux; Tizen ", platformVer, "; sdk) AppleWebKit/", appleWebkitVer, " (KHTML, like Gecko)");
115 if (applicationNameForUserAgent.isEmpty())
116 userAgentString.append(makeString("Version/", platformVer));
118 userAgentString.append(applicationNameForUserAgent);
119 userAgentString.append(makeString(" Mobile Safari/", appleWebkitVer));
121 return userAgentString;
124 WTF::String platform;
126 WTF::String osVersion;
131 platform = "Unknown";
133 version = makeString(String::number(WEBKIT_USER_AGENT_MAJOR_VERSION), '.',
134 String::number(WEBKIT_USER_AGENT_MINOR_VERSION), '+');
136 if (uname(&name) != -1)
137 osVersion = WTF::String(name.sysname) + " " + WTF::String(name.machine);
139 osVersion = "Unknown";
141 if (applicationNameForUserAgent.isEmpty())
142 return makeString("Mozilla/5.0 (", platform, "; ", osVersion, ") AppleWebKit/", version,
143 " (KHTML, like Gecko) Version/5.0 Safari/", version);
145 return makeString("Mozilla/5.0 (", platform, "; ", osVersion, ") AppleWebKit/", version,
146 " (KHTML, like Gecko) Version/5.0 Safari/", version, applicationNameForUserAgent);
149 void WebPageProxy::getEditorCommandsForKeyEvent(Vector<WTF::String>& commandsList)
154 void WebPageProxy::saveRecentSearches(const String&, const Vector<String>&)
159 void WebPageProxy::loadRecentSearches(const String&, Vector<String>&)
164 void WebPageProxy::setThemePath(const String& themePath)
166 process()->send(Messages::WebPage::SetThemePath(themePath), m_pageID, 0);
169 #if ENABLE(TIZEN_CUSTOM_HEADERS)
170 void WebPageProxy::addCustomHeader(const String& name, const String& value)
181 process()->send(Messages::WebPage::AddCustomHeader(name, value), m_pageID);
184 void WebPageProxy::removeCustomHeader(const String& name)
192 process()->send(Messages::WebPage::RemoveCustomHeader(name), m_pageID);
195 void WebPageProxy::clearCustomHeaders()
200 process()->send(Messages::WebPage::ClearCustomHeaders(), m_pageID);
205 bool WebPageProxy::scrollMainFrameBy(const IntSize& scrollOffset)
207 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
208 return static_cast<PageClientImpl*>(m_pageClient)->scrollBy(scrollOffset);
213 process()->send(Messages::WebPage::ScrollMainFrameBy(scrollOffset), m_pageID);
218 void WebPageProxy::scrollMainFrameTo(const IntPoint& scrollPosition)
220 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
221 static_cast<PageClientImpl*>(m_pageClient)->scrollTo(scrollPosition);
226 process()->send(Messages::WebPage::ScrollMainFrameTo(scrollPosition), m_pageID);
230 void WebPageProxy::didChangeScrollPositionForMainFrame(const IntPoint& scrollPosition)
232 #if !ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
233 m_scrollPosition = scrollPosition;
237 void WebPageProxy::didChangeContentsSize(const IntSize& size)
239 if (m_contentsSize == size)
242 m_contentsSize = size;
243 m_pageClient->didChangeContentsSize(size);
246 PassRefPtr<WebImage> WebPageProxy::createSnapshot(const IntRect& rect, float scaleFactor)
251 ShareableBitmap::Handle snapshotHandle;
252 // Do not wait for more than a second (arbitrary) for the WebProcess to get the snapshot so
253 // that the UI Process is not permanently stuck waiting on a potentially crashing Web Process.
254 static const double createSnapshotSyncMessageTimeout = 1.0;
255 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
256 float baseScaleFactor = static_cast<PageClientImpl*>(m_pageClient)->scaleFactor();
257 scaleFactor = scaleFactor * baseScaleFactor;
259 IntRect visibleContentRect = static_cast<PageClientImpl*>(m_pageClient)->visibleContentRect();
260 IntRect scaledRect = rect;
261 scaledRect.move(visibleContentRect.x(), visibleContentRect.y());
262 scaledRect.scale(1/baseScaleFactor);
263 process()->sendSync(Messages::WebPage::CreateSnapshot(scaledRect, scaleFactor), Messages::WebPage::CreateSnapshot::Reply(snapshotHandle), m_pageID, createSnapshotSyncMessageTimeout);
265 process()->sendSync(Messages::WebPage::CreateSnapshot(rect, scaleFactor), Messages::WebPage::CreateSnapshot::Reply(snapshotHandle), m_pageID, createSnapshotSyncMessageTimeout);
267 if (snapshotHandle.isNull())
269 return WebImage::create(ShareableBitmap::create(snapshotHandle));
272 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
273 void WebPageProxy::textChangeInTextField(const String& name, const String& value)
275 static_cast<PageClientImpl*>(m_pageClient)->textChangeInTextField(name, value);
279 #if ENABLE(TIZEN_ISF_PORT)
280 void WebPageProxy::prepareKeyDownEvent()
285 process()->send(Messages::WebPage::PrepareKeyDownEvent(), m_pageID);
288 void WebPageProxy::deleteSurroundingText(int offset, int count)
293 process()->send(Messages::WebPage::DeleteSurroundingText(offset, count), m_pageID);
296 void WebPageProxy::didCancelComposition()
298 m_didCancelCompositionFromWebProcess = true;
299 InputMethodContextEfl* inputMethodContext = static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->inputMethodContext();
300 if (inputMethodContext)
301 inputMethodContext->resetIMFContext();
302 m_didCancelCompositionFromWebProcess = false;
305 void WebPageProxy::removeInputMethodContext(uintptr_t id)
307 if (m_editorState.inputMethodContextID == id) {
308 m_editorState.inputMethodContextID = 0;
309 m_editorState.isContentEditable = false;
312 InputMethodContextEfl* inputMethodContext = static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->inputMethodContext();
313 if (!inputMethodContext)
316 inputMethodContext->removeIMFContext(id);
319 void WebPageProxy::recalcFilterEvent(const EditorState& editorState, bool isStart, bool& isFiltered)
322 process()->send(Messages::WebPage::EndRecalcFilterEvent(), m_pageID);
324 editorStateChanged(editorState);
327 InputMethodContextEfl* inputMethodContext = static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->inputMethodContext();
328 if (!inputMethodContext || m_keyEventQueue.isEmpty())
331 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
332 NativeWebKeyboardEvent event = m_keyEventQueue.first().forwardedEvent;
334 NativeWebKeyboardEvent event = m_keyEventQueue.first();
336 if (!event.nativeEvent() || event.nativeEvent()->type() != ECORE_IMF_EVENT_KEY_DOWN)
339 isFiltered = inputMethodContext->recalcFilterEvent(event.nativeEvent()->event());
341 #endif // #if ENABLE(TIZEN_ISF_PORT)
343 void WebPageProxy::requestUpdateFormNavigation()
348 process()->send(Messages::WebPage::RequestUpdateFormNavigation(), m_pageID);
351 void WebPageProxy::moveFocus(int newIndex)
356 process()->send(Messages::WebPage::MoveFocus(newIndex), m_pageID);
359 void WebPageProxy::updateFormNavigation(int length, int offset)
361 static_cast<PageClientImpl*>(m_pageClient)->updateFormNavigation(length, offset);
364 #if ENABLE(TIZEN_REDUCE_KEY_LAGGING)
365 Eina_Bool WebPageProxy::pageContentResumeTimerFired(void* data)
367 static_cast<WebPageProxy*>(data)->resumeActiveDOMObjectsAndAnimations();
368 static_cast<WebPageProxy*>(data)->m_pageContentResumeTimer = 0;
369 return ECORE_CALLBACK_CANCEL;
373 #if ENABLE(TIZEN_TEXT_CARET_HANDLING_WK2)
374 void WebPageProxy::setCaretPosition(const WebCore::IntPoint& pos)
379 process()->send(Messages::WebPage::SetCaretPosition(pos), m_pageID);
383 #if ENABLE(TIZEN_PLUGIN_CUSTOM_REQUEST)
384 void WebPageProxy::processPluginCustomRequest(const String& request, const String& msg)
386 if (String("requestKeyboard,plugin") == request) {
388 if (String("show") == msg)
390 #if ENABLE(TIZEN_ISF_PORT)
391 m_editorState = EditorState();
392 m_editorState.isContentEditable = active;
393 m_pageClient->updateTextInputState();
396 #if ENABLE(TIZEN_JSBRIDGE_PLUGIN)
397 else if (String("requestToNative,json") == request)
398 m_tizenClient.processJSBridgePlugin(this, request, msg);
404 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION) || ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
405 void WebPageProxy::setCurrentTargetInputElementValue(const String& inputValue)
410 process()->send(Messages::WebPage::SetCurrentTargetInputElementValue(inputValue), m_pageID);
413 void WebPageProxy::setFocusedInputElementValue(const String& inputValue)
418 process()->send(Messages::WebPage::SetFocusedInputElementValue(inputValue), m_pageID);
421 String WebPageProxy::getFocusedInputElementValue()
427 process()->sendSync(Messages::WebPage::GetFocusedInputElementValue(), Messages::WebPage::GetFocusedInputElementValue::Reply(inputValue), m_pageID);
432 #if ENABLE(TIZEN_DATALIST_ELEMENT)
433 Vector<String> WebPageProxy::getFocusedInputElementDataList()
436 return Vector<String>();
438 Vector<String> optionList;
439 process()->sendSync(Messages::WebPage::GetFocusedInputElementDataList(), Messages::WebPage::GetFocusedInputElementDataList::Reply(optionList), m_pageID);
444 void WebPageProxy::focusedNodeChanged(const IntRect& focusedNodeRect)
446 static_cast<PageClientImpl*>(m_pageClient)->setFocusedNodeRect(focusedNodeRect);
449 void WebPageProxy::initializeTizenClient(const WKPageTizenClient* client)
451 m_tizenClient.initialize(client);
454 #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
455 #if ENABLE(TOUCH_ADJUSTMENT)
456 WebHitTestResult::Data WebPageProxy::hitTestResultAtPoint(const IntPoint& point, int hitTestMode, const IntSize& area)
458 WebHitTestResult::Data WebPageProxy::hitTestResultAtPoint(const IntPoint& point, int hitTestMode)
461 WebHitTestResult::Data hitTestResultData;
463 return hitTestResultData;
465 #if ENABLE(TOUCH_ADJUSTMENT)
466 process()->sendSync(Messages::WebPage::HitTestResultAtPoint(point, hitTestMode, area),
467 Messages::WebPage::HitTestResultAtPoint::Reply(hitTestResultData), m_pageID);
469 process()->sendSync(Messages::WebPage::HitTestResultAtPoint(point, hitTestMode),
470 Messages::WebPage::HitTestResultAtPoint::Reply(hitTestResultData), m_pageID);
473 return hitTestResultData;
477 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
478 void WebPageProxy::hideContextMenu()
480 if (m_activeContextMenu)
481 m_activeContextMenu->hideContextMenu();
484 String WebPageProxy::contextMenuAbsoluteLinkURLString()
486 if (!m_activeContextMenu)
489 return m_activeContextMenuHitTestResultData.absoluteLinkURL;
492 String WebPageProxy::contextMenuAbsoluteImageURLString()
494 if (!m_activeContextMenu)
497 return m_activeContextMenuHitTestResultData.absoluteImageURL;
501 #if ENABLE(TIZEN_WEBKIT2_CLIPBOARD_HELPER)
502 void WebPageProxy::pasteContextMenuSelected()
504 static_cast<PageClientImpl*>(m_pageClient)->pasteContextMenuSelected();
507 void WebPageProxy::didSelectPasteMenuFromContextMenu(const String& data, const String& type)
512 #if ENABLE(TIZEN_CLIPBOARD) || ENABLE(TIZEN_PASTEBOARD)
513 process()->send(Messages::WebPage::SetClipboardDataForPaste(data, type), m_pageID);
515 WebContextMenuItemData item(ActionType, ContextMenuItemTagPaste, String("Paste"), true, false);
516 process()->send(Messages::WebPage::DidSelectItemFromActiveContextMenu(item), m_pageID);
520 #if ENABLE(TIZEN_CLIPBOARD) || ENABLE(TIZEN_PASTEBOARD)
521 void WebPageProxy::setClipboardData(const String& data, const String& type)
523 static_cast<PageClientImpl*>(m_pageClient)->setClipboardData(data, type);
526 void WebPageProxy::clearClipboardData()
528 static_cast<PageClientImpl*>(m_pageClient)->clearClipboardData();
532 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
533 void WebPageProxy::executePasteFromClipboardItem(const String& data, const String& type)
538 #if ENABLE(TIZEN_CLIPBOARD) || ENABLE(TIZEN_PASTEBOARD)
539 process()->send(Messages::WebPage::SetClipboardDataForPaste(data, type), m_pageID);
541 process()->send(Messages::WebPage::ExecuteEditCommandWithArgument("Paste", data), m_pageID);
544 void WebPageProxy::clipboardContextMenuSelected()
546 static_cast<PageClientImpl*>(m_pageClient)->clipboardContextMenuSelected();
550 #if ENABLE(TIZEN_REMOTE_WEB_INSPECTOR)
551 uint32_t WebPageProxy::startInspectorServer(uint32_t port)
556 uint32_t assignedPort = 0;
557 process()->sendSync(Messages::WebPage::StartInspectorServer(port), Messages::WebPage::StartInspectorServer::Reply(assignedPort), m_pageID);
561 bool WebPageProxy::stopInspectorServer()
567 process()->sendSync(Messages::WebPage::StopInspectorServer(), Messages::WebPage::StopInspectorServer::Reply(result), m_pageID);
572 #if ENABLE(TIZEN_MOBILE_WEB_PRINT)
573 void WebPageProxy::createPagesToPDF(const IntSize& surfaceSize, const IntSize& contentsSize, const String& fileName)
575 process()->send(Messages::WebPage::CreatePagesToPDF(surfaceSize, contentsSize, fileName), m_pageID);
579 #if ENABLE(TIZEN_WEB_STORAGE)
580 #if ENABLE(TIZEN_WEBKIT2_NUMBER_TYPE_SUPPORT)
581 void WebPageProxy::getWebStorageQuotaBytes(PassRefPtr<WebStorageQuotaCallback> prpCallback)
583 RefPtr<WebStorageQuotaCallback> callback = prpCallback;
585 callback->invalidate();
589 uint64_t callbackID = callback->callbackID();
590 m_quotaCallbacks.set(callbackID, callback.get());
591 process()->send(Messages::WebPage::GetStorageQuotaBytes(callbackID), m_pageID);
594 void WebPageProxy::didGetWebStorageQuotaBytes(const uint32_t quota, uint64_t callbackID)
596 RefPtr<WebStorageQuotaCallback> callback = m_quotaCallbacks.take(callbackID);
598 // FIXME: Log error or assert.
599 // this can validly happen if a load invalidated the callback, though
603 m_quotaCallbacks.remove(callbackID);
605 RefPtr<WebUInt32> uint32Object = WebUInt32::create(quota);
606 callback->performCallbackWithReturnValue(uint32Object.release().leakRef());
610 void WebPageProxy::setWebStorageQuotaBytes(uint32_t quota)
615 process()->send(Messages::WebPage::SetStorageQuotaBytes(quota), m_pageID, 0);
619 void WebPageProxy::scale(double scaleFactor, const IntPoint& origin)
621 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
622 static_cast<PageClientImpl*>(m_pageClient)->scaleContents(scaleFactor, origin);
624 scalePage(scaleFactor, origin);
628 void WebPageProxy::scaleImage(double scaleFactor, const IntPoint& origin)
630 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
631 static_cast<PageClientImpl*>(m_pageClient)->scaleImage(scaleFactor, origin);
633 scalePage(scaleFactor, origin);
637 double WebPageProxy::scaleFactor()
639 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
640 return static_cast<PageClientImpl*>(m_pageClient)->scaleFactor();
642 return pageScaleFactor();
646 #if ENABLE(TIZEN_ORIENTATION_EVENTS)
647 void WebPageProxy::sendOrientationChangeEvent(int orientation)
649 process()->send(Messages::WebPage::SendOrientationChangeEvent(orientation), m_pageID, 0);
653 void WebPageProxy::suspendPainting()
658 process()->send(Messages::DrawingArea::SuspendPainting(), m_pageID);
661 void WebPageProxy::resumePainting()
666 process()->send(Messages::DrawingArea::ResumePainting(), m_pageID);
669 void WebPageProxy::suspendJavaScriptAndResource()
674 process()->send(Messages::WebPage::SuspendJavaScriptAndResources(), m_pageID);
677 void WebPageProxy::resumeJavaScriptAndResource()
682 process()->send(Messages::WebPage::ResumeJavaScriptAndResources(), m_pageID);
685 void WebPageProxy::suspendAnimations()
690 process()->send(Messages::WebPage::SuspendAnimations(), m_pageID);
693 void WebPageProxy::resumeAnimations()
698 process()->send(Messages::WebPage::ResumeAnimations(), m_pageID);
701 #if ENABLE(TIZEN_PLUGIN_SUSPEND_RESUME)
702 void WebPageProxy::suspendPlugin()
707 process()->send(Messages::WebPage::SuspendPlugin(), m_pageID);
710 void WebPageProxy::resumePlugin()
715 process()->send(Messages::WebPage::ResumePlugin(), m_pageID);
719 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
720 void WebPageProxy::purgeBackingStoresOfInactiveView()
722 if (!isValid() || isViewVisible())
725 process()->send(Messages::LayerTreeCoordinator::PurgeBackingStores(), m_pageID);
729 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
730 bool WebPageProxy::scrollOverflow(const FloatPoint& offset)
735 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION_ON_UI_SIDE)
736 if (static_cast<PageClientImpl*>(m_pageClient)->isScrollableLayerFocused())
737 return drawingArea()->layerTreeCoordinatorProxy()->setOffsetForFocusedScrollingContentsLayer(offset);
739 if (static_cast<PageClientImpl*>(m_pageClient)->isScrollableNodeFocused()) {
740 bool scrolled = false;
741 process()->sendSync(Messages::WebPage::ScrollOverflow(offset), Messages::WebPage::ScrollOverflow::Reply(scrolled), m_pageID);
748 bool WebPageProxy::setPressedNodeAtPoint(const IntPoint& point, bool checkOverflowLayer, WebLayerID& webLayerID)
753 bool pressed = false;
754 process()->sendSync(Messages::WebPage::SetPressedNodeAtPoint(point, checkOverflowLayer), Messages::WebPage::SetPressedNodeAtPoint::Reply(pressed, webLayerID), m_pageID);
759 void WebPageProxy::setOverflowResult(bool pressed, uint32_t webLayerID)
761 static_cast<PageClientImpl*>(m_pageClient)->setOverflowResult(pressed, webLayerID);
765 void WebPageProxy::executeEditCommandWithArgument(const String& commandName, const String& argument)
770 DEFINE_STATIC_LOCAL(String, ignoreSpellingCommandName, ("ignoreSpelling"));
771 if (commandName == ignoreSpellingCommandName)
772 ++m_pendingLearnOrIgnoreWordMessageCount;
774 process()->send(Messages::WebPage::ExecuteEditCommandWithArgument(commandName, argument), m_pageID);
777 void WebPageProxy::replyJavaScriptAlert()
782 m_alertReply->send();
783 m_alertReply = nullptr;
784 #if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
785 m_uiClient.notifyPopupReplyWaitingState(this, false);
787 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
788 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
792 void WebPageProxy::replyJavaScriptConfirm(bool result)
797 m_confirmReply->send(result);
798 m_confirmReply = nullptr;
799 #if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
800 m_uiClient.notifyPopupReplyWaitingState(this, false);
802 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
803 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
807 void WebPageProxy::replyJavaScriptPrompt(const String& result)
812 m_promptReply->send(result);
813 m_promptReply = nullptr;
814 #if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
815 m_uiClient.notifyPopupReplyWaitingState(this, false);
817 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
818 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
822 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
823 void WebPageProxy::replyBeforeUnloadConfirmPanel(bool result)
825 if (!m_beforeUnloadConfirmPanelReply)
828 m_beforeUnloadConfirmPanelReply->send(result);
829 m_beforeUnloadConfirmPanelReply = nullptr;
830 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
831 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
836 #if ENABLE(TIZEN_ON_AUTHENTICATION_REQUESTED)
837 void WebPageProxy::replyReceiveAuthenticationChallengeInFrame(bool result)
842 m_AuthReply->send(result);
843 m_AuthReply = nullptr;
847 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
848 void WebPageProxy::replyPolicyForCertificateError(bool result)
853 m_allowedReply->send(result);
854 m_allowedReply = nullptr;
858 #if PLUGIN_ARCHITECTURE(X11)
859 void WebPageProxy::createPluginContainer(uint64_t& windowID)
864 void WebPageProxy::windowedPluginGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect, uint64_t windowID)
870 void WebPageProxy::didRenderFrame()
872 static_cast<PageClientImpl*>(m_pageClient)->didRenderFrame();
875 void WebPageProxy::setBackgroundColor(double red, double green, double blue, double alpha)
877 static_cast<PageClientImpl*>(m_pageClient)->setBackgroundColor(red, green, blue, alpha);
880 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
881 bool WebPageProxy::makeContextCurrent()
883 return static_cast<PageClientImpl*>(m_pageClient)->makeContextCurrent();
887 #if ENABLE(TIZEN_ICON_DATABASE)
888 void WebPageProxy::didReceiveIcon()
890 static_cast<PageClientImpl*>(m_pageClient)->didReceiveIcon();
894 #if ENABLE(TIZEN_MULTIPLE_SELECT)
895 void WebPageProxy::valueChangedForPopupMenuMultiple(WebPopupMenuProxy*, Vector<int32_t> newSelectedIndex)
897 process()->send(Messages::WebPage::DidChangeSelectedIndexForActivePopupMenuMultiple(newSelectedIndex), m_pageID);
901 #if ENABLE(TIZEN_WEBKIT2_HISTORICAL_RESTORE_VISIBLE_CONTENT_RECT)
902 void WebPageProxy::pageDidRequestRestoreVisibleContentRect(const IntPoint& point, float scale)
904 m_pageClient->pageDidRequestRestoreVisibleContentRect(point, scale);
908 #if ENABLE(TIZEN_OFFLINE_PAGE_SAVE)
909 void WebPageProxy::saveSerializedHTMLDataForMainPage(const String& serializedData, const String& fileName)
911 static_cast<PageClientImpl*>(m_pageClient)->saveSerializedHTMLDataForMainPage(serializedData, fileName);
914 void WebPageProxy::saveSubresourcesData(Vector<WebSubresourceTizen> subresourceData)
916 static_cast<PageClientImpl*>(m_pageClient)->saveSubresourcesData(subresourceData);
919 void WebPageProxy::startOfflinePageSave(String subresourceFolderName)
924 process()->send(Messages::WebPage::StartOfflinePageSave(subresourceFolderName), m_pageID);
928 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
929 bool WebPageProxy::selectClosestWord(const IntPoint& point, bool isAutoWordSelection)
935 process()->sendSync(Messages::WebPage::SelectClosestWord(point, isAutoWordSelection), Messages::WebPage::SelectClosestWord::Reply(result), m_pageID);
939 int WebPageProxy::setLeftSelection(const IntPoint& point, const int direction)
945 process()->sendSync(Messages::WebPage::SetLeftSelection(point, direction), Messages::WebPage::SetLeftSelection::Reply(result), m_pageID);
949 int WebPageProxy::setRightSelection(const IntPoint& point, const int direction)
955 process()->sendSync(Messages::WebPage::SetRightSelection(point, direction), Messages::WebPage::SetRightSelection::Reply(result), m_pageID);
959 bool WebPageProxy::getSelectionHandlers(IntRect& leftRect, IntRect& rightRect, int& selectionDirection)
965 IntRect updateEditorRect(0, 0, 0, 0);
966 process()->sendSync(Messages::WebPage::GetSelectionHandlers(), Messages::WebPage::GetSelectionHandlers::Reply(leftRect, rightRect, selectionDirection, updateEditorRect), m_pageID);
967 if (!leftRect.size().isZero() || !rightRect.size().isZero())
969 if(m_editorState.editorRect != updateEditorRect) {
970 m_editorState.editorRect = updateEditorRect;
971 m_editorState.updateEditorRectOnly = true;
976 bool WebPageProxy::getFocusedSubFrameRect(IntRect& focusedFrameViewRect) {
980 bool isSubFrameFocused = false;
982 process()->sendSync(Messages::WebPage::GetFocusedSubFrameRect(), Messages::WebPage::GetFocusedSubFrameRect::Reply(focusedFrameViewRect, isSubFrameFocused), m_pageID);
983 return isSubFrameFocused;
986 String WebPageProxy::getSelectionText()
992 process()->sendSync(Messages::WebPage::GetSelectionText(), Messages::WebPage::GetSelectionText::Reply(ret), m_pageID);
996 bool WebPageProxy::selectionRangeClear()
1001 bool result = false;
1002 process()->sendSync(Messages::WebPage::SelectionRangeClear(), Messages::WebPage::SelectionRangeClear::Reply(result), m_pageID);
1006 bool WebPageProxy::scrollContentByCharacter(const IntPoint& point, SelectionDirection direction)
1011 bool result = false;
1012 process()->sendSync(Messages::WebPage::ScrollContentByCharacter(point, direction), Messages::WebPage::ScrollContentByCharacter::Reply(result), m_pageID);
1016 bool WebPageProxy::scrollContentByLine(const IntPoint& point, SelectionDirection direction)
1021 bool result = false;
1022 process()->sendSync(Messages::WebPage::ScrollContentByLine(point, direction), Messages::WebPage::ScrollContentByLine::Reply(result), m_pageID);
1027 #if ENABLE(TIZEN_LINK_MAGNIFIER)
1028 void WebPageProxy::getLinkMagnifierRect(const WebCore::IntPoint& position, const WebCore::IntSize& size)
1030 process()->send(Messages::WebPage::GetLinkMagnifierRect(position, size), m_pageID);
1033 void WebPageProxy::didGetLinkMagnifierRect(const IntPoint& position, const IntRect& rect)
1035 if (!rect.isEmpty())
1036 LinkMagnifierProxy::linkMagnifier().show(EwkViewImpl::fromEvasObject(viewWidget()), position, rect);
1041 void WebPageProxy::openLink(const IntPoint& position)
1043 #if ENABLE(GESTURE_EVENTS)
1044 IntPoint globalPosition(static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->transformToScreen().mapPoint(position));
1045 WebGestureEvent gesture(WebEvent::GestureSingleTap, position, globalPosition, WebEvent::Modifiers(0), ecore_time_get());
1046 handleGestureEvent(gesture);
1051 #if ENABLE(TIZEN_SCREEN_READER)
1052 bool WebPageProxy::moveScreenReaderFocus(bool forward)
1055 process()->sendSync(Messages::WebPage::MoveScreenReaderFocus(forward), Messages::WebPage::MoveScreenReaderFocus::Reply(result), m_pageID);
1059 void WebPageProxy::moveScreenReaderFocusByPoint(const IntPoint& point)
1061 process()->send(Messages::WebPage::MoveScreenReaderFocusByPoint(point), m_pageID);
1064 void WebPageProxy::clearScreenReaderFocus()
1066 process()->send(Messages::WebPage::ClearScreenReaderFocus(), m_pageID);
1069 bool WebPageProxy::raiseTapEvent(const IntPoint& position)
1071 IntPoint globalPosition = static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->transformToScreen().mapPoint(position);
1073 process()->sendSync(Messages::WebPage::RaiseTapEvent(position, globalPosition), Messages::WebPage::RaiseTapEvent::Reply(result), m_pageID);
1078 void WebPageProxy::adjustScreenReaderFocusedObjectValue(bool up)
1080 process()->send(Messages::WebPage::AdjustScreenReaderFocusedObjectValue(up), m_pageID);
1083 void WebPageProxy::clearScreenReader()
1085 process()->send(Messages::WebPage::ClearScreenReader(), m_pageID);
1088 void WebPageProxy::didScreenReaderTextChanged(const String& text)
1090 ScreenReaderProxy::screenReader().setText(text);
1094 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
1095 void WebPageProxy::didChangeFocusedRects(const Vector<IntRect>& rects)
1097 EwkViewImpl* viewImpl = static_cast<PageClientImpl*>(m_pageClient)->viewImpl();
1098 FocusRing* focusRing = viewImpl->focusRing();
1102 if (!rects.isEmpty()) {
1103 bool canUpdate = focusRing->canUpdate();
1104 #if ENABLE(TIZEN_SCREEN_READER)
1105 canUpdate |= ScreenReaderProxy::screenReader().isActive(viewImpl);
1107 #if ENABLE(TIZEN_FOCUS_UI)
1108 canUpdate |= m_focusUIEnabled;
1112 focusRing->show(rects);
1114 focusRing->hide(false);
1117 void WebPageProxy::recalcFocusedRects()
1119 process()->send(Messages::WebPage::RecalcFocusedRects(), m_pageID);
1123 #if ENABLE(TIZEN_CSP)
1124 void WebPageProxy::setContentSecurityPolicy(const String& policy, WebCore::ContentSecurityPolicy::HeaderType type)
1126 process()->send(Messages::WebPage::SetContentSecurityPolicy(policy, type), m_pageID);
1130 #if ENABLE(TIZEN_APPLICATION_CACHE)
1131 void WebPageProxy::requestApplicationCachePermission(uint64_t frameID, const String& originIdentifier, PassRefPtr<Messages::WebPageProxy::RequestApplicationCachePermission::DelayedReply> allow)
1133 WebFrameProxy* frame = process()->webFrame(frameID);
1134 MESSAGE_CHECK(frame);
1136 // Since requestApplicationCachePermission() can spin a nested run loop we need to turn off the responsiveness timer.
1137 process()->responsivenessTimer()->stop();
1139 m_applicationCacheReply = allow;
1140 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1141 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
1143 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
1145 if (!m_tizenClient.decidePolicyForApplicationCachePermissionRequest(this, origin.get(), frame))
1146 replyApplicationCachePermission(true);
1149 void WebPageProxy::replyApplicationCachePermission(bool allow)
1151 if (!m_applicationCacheReply)
1154 m_applicationCacheReply->send(allow);
1155 m_applicationCacheReply = nullptr;
1156 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1157 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
1162 #if ENABLE(TIZEN_INDEXED_DATABASE)
1163 void WebPageProxy::exceededIndexedDatabaseQuota(uint64_t frameID, const String& originIdentifier, int64_t currentUsage, PassRefPtr<Messages::WebPageProxy::ExceededIndexedDatabaseQuota::DelayedReply> reply)
1165 WebFrameProxy* frame = process()->webFrame(frameID);
1166 MESSAGE_CHECK(frame);
1168 // Since exceededIndexedDatabaseQuota() can spin a nested run loop we need to turn off the responsiveness timer.
1169 process()->responsivenessTimer()->stop();
1171 m_exceededIndexedDatabaseQuotaReply = reply;
1172 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1173 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
1176 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
1178 if (!m_tizenClient.exceededIndexedDatabaseQuota(this, origin.get(), currentUsage, frame))
1179 replyExceededIndexedDatabaseQuota(false);
1182 void WebPageProxy::replyExceededIndexedDatabaseQuota(bool allow)
1184 if (!m_exceededIndexedDatabaseQuotaReply)
1187 m_exceededIndexedDatabaseQuotaReply->send(allow);
1188 m_exceededIndexedDatabaseQuotaReply = nullptr;
1189 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1190 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
1195 #if ENABLE(TIZEN_SQL_DATABASE)
1196 void WebPageProxy::replyExceededDatabaseQuota(bool allow)
1198 if (!m_exceededDatabaseQuotaReply) {
1199 TIZEN_LOGE("m_exceededDatabaseQuotaReply does not exist");
1203 m_exceededDatabaseQuotaReply->send(allow);
1204 m_exceededDatabaseQuotaReply = nullptr;
1205 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1206 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
1211 #if ENABLE(TIZEN_FILE_SYSTEM)
1212 void WebPageProxy::exceededLocalFileSystemQuota(uint64_t frameID, const String& originIdentifier, int64_t currentUsage, PassRefPtr<Messages::WebPageProxy::ExceededLocalFileSystemQuota::DelayedReply> reply)
1214 WebFrameProxy* frame = process()->webFrame(frameID);
1215 MESSAGE_CHECK(frame);
1217 // Since exceededLocalFileSystemQuota() can spin a nested run loop we need to turn off the responsiveness timer.
1218 process()->responsivenessTimer()->stop();
1219 m_exceededLocalFileSystemQuotaReply = reply;
1220 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1221 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
1224 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
1226 if (!m_tizenClient.exceededLocalFileSystemQuota(this, origin.get(), currentUsage, frame))
1227 replyExceededLocalFileSystemQuota(false);
1230 void WebPageProxy::replyExceededLocalFileSystemQuota(bool allow)
1232 if (!m_exceededLocalFileSystemQuotaReply)
1235 m_exceededLocalFileSystemQuotaReply->send(allow);
1236 m_exceededLocalFileSystemQuotaReply = nullptr;
1237 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1238 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
1243 #endif // #if OS(TIZEN)
1245 void WebPageProxy::handleInputMethodKeydown(bool& handled)
1247 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1248 handled = m_keyEventQueue.first().forwardedEvent.isFiltered();
1250 handled = m_keyEventQueue.first().isFiltered();
1254 void WebPageProxy::confirmComposition(const String& compositionString)
1259 #if ENABLE(TIZEN_ISF_PORT)
1260 if (m_didCancelCompositionFromWebProcess)
1264 process()->send(Messages::WebPage::ConfirmComposition(compositionString), m_pageID, 0);
1267 void WebPageProxy::setComposition(const String& compositionString, Vector<WebCore::CompositionUnderline>& underlines, int cursorPosition)
1272 #if ENABLE(TIZEN_REDUCE_KEY_LAGGING)
1273 // Suspend layout&paint at the key input, and resume layout&paint after 150 ms.
1274 suspendActiveDOMObjectsAndAnimations();
1275 if (m_pageContentResumeTimer)
1276 ecore_timer_del(m_pageContentResumeTimer);
1277 m_pageContentResumeTimer = ecore_timer_add(150.0/1000.0, pageContentResumeTimerFired, this);
1280 process()->send(Messages::WebPage::SetComposition(compositionString, underlines, cursorPosition), m_pageID, 0);
1283 void WebPageProxy::cancelComposition()
1288 process()->send(Messages::WebPage::CancelComposition(), m_pageID, 0);
1291 #if ENABLE(TIZEN_USE_SETTINGS_FONT)
1292 void WebPageProxy::useSettingsFont()
1294 process()->send(Messages::WebPage::UseSettingsFont(), m_pageID, 0);
1298 #if ENABLE(TIZEN_WEBKIT2_NOTIFY_SUSPEND_BY_REMOTE_WEB_INSPECTOR)
1299 void WebPageProxy::setContentSuspendedByInspector(bool isSuspended)
1301 m_contentSuspendedByInspector = isSuspended;
1305 #if ENABLE(TIZEN_FOCUS_UI)
1306 void WebPageProxy::setFocusUIEnabled(bool enabled)
1308 if (m_focusUIEnabled == enabled)
1311 m_focusUIEnabled = enabled;
1314 static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->focusRing()->setImage(FOCUS_UI_FOCUS_RING_IMAGE_PATH, 4, 2);
1316 static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->focusRing()->setImage(String(), 0, 0);
1318 process()->send(Messages::WebPage::SetFocusUIEnabled(enabled), m_pageID);
1321 } // namespace WebKit