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 int WebPageProxy::getCursorOffset()
294 process()->sendSync(Messages::WebPage::GetCursorOffset(), Messages::WebPage::GetCursorOffset::Reply(offset), m_pageID);
298 void WebPageProxy::getSurroundingTextAndCursorOffset(String& text, int& offset)
303 process()->sendSync(Messages::WebPage::GetSurroundingTextAndCursorOffset(), Messages::WebPage::GetSurroundingTextAndCursorOffset::Reply(text, offset), m_pageID);
306 IntRect WebPageProxy::getSelectionRect(bool isOnlyEditable)
309 process()->sendSync(Messages::WebPage::GetSelectionRect(isOnlyEditable), Messages::WebPage::GetSelectionRect::Reply(rect), m_pageID);
313 void WebPageProxy::deleteSurroundingText(int offset, int count)
318 process()->send(Messages::WebPage::DeleteSurroundingText(offset, count), m_pageID);
321 void WebPageProxy::didCancelComposition()
323 m_didCancelCompositionFromWebProcess = true;
324 InputMethodContextEfl* inputMethodContext = static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->inputMethodContext();
325 if (inputMethodContext)
326 inputMethodContext->resetIMFContext();
327 m_didCancelCompositionFromWebProcess = false;
330 void WebPageProxy::removeInputMethodContext(uintptr_t id)
332 InputMethodContextEfl* inputMethodContext = static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->inputMethodContext();
333 if (!inputMethodContext)
336 inputMethodContext->removeIMFContext(id);
338 #endif // #if ENABLE(TIZEN_ISF_PORT)
340 void WebPageProxy::requestUpdateFormNavigation()
345 process()->send(Messages::WebPage::RequestUpdateFormNavigation(), m_pageID);
348 void WebPageProxy::moveFocus(int newIndex)
353 process()->send(Messages::WebPage::MoveFocus(newIndex), m_pageID);
356 void WebPageProxy::updateFormNavigation(int length, int offset)
358 static_cast<PageClientImpl*>(m_pageClient)->updateFormNavigation(length, offset);
361 #if ENABLE(TIZEN_REDUCE_KEY_LAGGING)
362 Eina_Bool WebPageProxy::pageContentResumeTimerFired(void* data)
364 static_cast<WebPageProxy*>(data)->resumeActiveDOMObjectsAndAnimations();
365 static_cast<WebPageProxy*>(data)->m_pageContentResumeTimer = 0;
366 return ECORE_CALLBACK_CANCEL;
370 #if ENABLE(TIZEN_TEXT_CARET_HANDLING_WK2)
371 void WebPageProxy::setCaretPosition(const WebCore::IntPoint& pos)
376 process()->send(Messages::WebPage::SetCaretPosition(pos), m_pageID);
379 void WebPageProxy::getCaretPosition(WebCore::IntRect& rect)
384 process()->sendSync(Messages::WebPage::GetCaretPosition(), Messages::WebPage::GetCaretPosition::Reply(rect), m_pageID);
388 #if ENABLE(TIZEN_PLUGIN_CUSTOM_REQUEST)
389 void WebPageProxy::processPluginCustomRequest(const String& request, const String& msg)
391 if (String("requestKeyboard,plugin") == request) {
393 if (String("show") == msg)
395 #if ENABLE(TIZEN_ISF_PORT)
396 m_editorState = EditorState();
397 m_editorState.isContentEditable = active;
398 m_pageClient->updateTextInputState();
401 #if ENABLE(TIZEN_JSBRIDGE_PLUGIN)
402 else if (String("requestToNative,json") == request)
403 m_tizenClient.processJSBridgePlugin(this, request, msg);
409 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION) || ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
410 void WebPageProxy::setFocusedInputElementValue(const String& inputValue)
415 process()->send(Messages::WebPage::SetFocusedInputElementValue(inputValue), m_pageID);
418 String WebPageProxy::getFocusedInputElementValue()
424 process()->sendSync(Messages::WebPage::GetFocusedInputElementValue(), Messages::WebPage::GetFocusedInputElementValue::Reply(inputValue), m_pageID);
429 #if ENABLE(TIZEN_DATALIST_ELEMENT)
430 Vector<String> WebPageProxy::getFocusedInputElementDataList()
433 return Vector<String>();
435 Vector<String> optionList;
436 process()->sendSync(Messages::WebPage::GetFocusedInputElementDataList(), Messages::WebPage::GetFocusedInputElementDataList::Reply(optionList), m_pageID);
441 void WebPageProxy::focusedNodeChanged(const IntRect& focusedNodeRect)
443 static_cast<PageClientImpl*>(m_pageClient)->setFocusedNodeRect(focusedNodeRect);
446 void WebPageProxy::initializeTizenClient(const WKPageTizenClient* client)
448 m_tizenClient.initialize(client);
451 #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
452 #if ENABLE(TOUCH_ADJUSTMENT)
453 WebHitTestResult::Data WebPageProxy::hitTestResultAtPoint(const IntPoint& point, int hitTestMode, const IntSize& area)
455 WebHitTestResult::Data WebPageProxy::hitTestResultAtPoint(const IntPoint& point, int hitTestMode)
458 WebHitTestResult::Data hitTestResultData;
460 return hitTestResultData;
462 #if ENABLE(TOUCH_ADJUSTMENT)
463 process()->sendSync(Messages::WebPage::HitTestResultAtPoint(point, hitTestMode, area),
464 Messages::WebPage::HitTestResultAtPoint::Reply(hitTestResultData), m_pageID);
466 process()->sendSync(Messages::WebPage::HitTestResultAtPoint(point, hitTestMode),
467 Messages::WebPage::HitTestResultAtPoint::Reply(hitTestResultData), m_pageID);
470 return hitTestResultData;
474 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
475 void WebPageProxy::hideContextMenu()
477 if (m_activeContextMenu)
478 m_activeContextMenu->hideContextMenu();
481 String WebPageProxy::contextMenuAbsoluteLinkURLString()
483 if (!m_activeContextMenu)
486 return m_activeContextMenuHitTestResultData.absoluteLinkURL;
489 String WebPageProxy::contextMenuAbsoluteImageURLString()
491 if (!m_activeContextMenu)
494 return m_activeContextMenuHitTestResultData.absoluteImageURL;
498 #if ENABLE(TIZEN_WEBKIT2_CLIPBOARD_HELPER)
499 void WebPageProxy::pasteContextMenuSelected()
501 static_cast<PageClientImpl*>(m_pageClient)->pasteContextMenuSelected();
504 void WebPageProxy::didSelectPasteMenuFromContextMenu(const String& data, const String& type)
509 #if ENABLE(TIZEN_CLIPBOARD) || ENABLE(TIZEN_PASTEBOARD)
510 process()->send(Messages::WebPage::SetClipboardDataForPaste(data, type), m_pageID);
512 WebContextMenuItemData item(ActionType, ContextMenuItemTagPaste, String("Paste"), true, false);
513 process()->send(Messages::WebPage::DidSelectItemFromActiveContextMenu(item), m_pageID);
517 #if ENABLE(TIZEN_CLIPBOARD) || ENABLE(TIZEN_PASTEBOARD)
518 void WebPageProxy::setClipboardData(const String& data, const String& type)
520 static_cast<PageClientImpl*>(m_pageClient)->setClipboardData(data, type);
523 void WebPageProxy::clearClipboardData()
525 static_cast<PageClientImpl*>(m_pageClient)->clearClipboardData();
529 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
530 void WebPageProxy::executePasteFromClipboardItem(const String& data, const String& type)
535 #if ENABLE(TIZEN_CLIPBOARD) || ENABLE(TIZEN_PASTEBOARD)
536 process()->send(Messages::WebPage::SetClipboardDataForPaste(data, type), m_pageID);
538 process()->send(Messages::WebPage::ExecuteEditCommandWithArgument("Paste", data), m_pageID);
541 void WebPageProxy::clipboardContextMenuSelected()
543 static_cast<PageClientImpl*>(m_pageClient)->clipboardContextMenuSelected();
547 #if ENABLE(TIZEN_REMOTE_WEB_INSPECTOR)
548 uint32_t WebPageProxy::startInspectorServer(uint32_t port)
553 uint32_t assignedPort = 0;
554 process()->sendSync(Messages::WebPage::StartInspectorServer(port), Messages::WebPage::StartInspectorServer::Reply(assignedPort), m_pageID);
558 bool WebPageProxy::stopInspectorServer()
564 process()->sendSync(Messages::WebPage::StopInspectorServer(), Messages::WebPage::StopInspectorServer::Reply(result), m_pageID);
569 #if ENABLE(TIZEN_MOBILE_WEB_PRINT)
570 void WebPageProxy::createPagesToPDF(const IntSize& surfaceSize, const IntSize& contentsSize, const String& fileName)
572 process()->send(Messages::WebPage::CreatePagesToPDF(surfaceSize, contentsSize, fileName), m_pageID);
576 #if ENABLE(TIZEN_WEB_STORAGE)
577 #if ENABLE(TIZEN_WEBKIT2_NUMBER_TYPE_SUPPORT)
578 void WebPageProxy::getWebStorageQuotaBytes(PassRefPtr<WebStorageQuotaCallback> prpCallback)
580 RefPtr<WebStorageQuotaCallback> callback = prpCallback;
582 callback->invalidate();
586 uint64_t callbackID = callback->callbackID();
587 m_quotaCallbacks.set(callbackID, callback.get());
588 process()->send(Messages::WebPage::GetStorageQuotaBytes(callbackID), m_pageID);
591 void WebPageProxy::didGetWebStorageQuotaBytes(const uint32_t quota, uint64_t callbackID)
593 RefPtr<WebStorageQuotaCallback> callback = m_quotaCallbacks.take(callbackID);
595 // FIXME: Log error or assert.
596 // this can validly happen if a load invalidated the callback, though
600 m_quotaCallbacks.remove(callbackID);
602 RefPtr<WebUInt32> uint32Object = WebUInt32::create(quota);
603 callback->performCallbackWithReturnValue(uint32Object.release().leakRef());
607 void WebPageProxy::setWebStorageQuotaBytes(uint32_t quota)
612 process()->send(Messages::WebPage::SetStorageQuotaBytes(quota), m_pageID, 0);
616 void WebPageProxy::scale(double scaleFactor, const IntPoint& origin)
618 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
619 static_cast<PageClientImpl*>(m_pageClient)->scaleContents(scaleFactor, origin);
621 scalePage(scaleFactor, origin);
625 void WebPageProxy::scaleImage(double scaleFactor, const IntPoint& origin)
627 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
628 static_cast<PageClientImpl*>(m_pageClient)->scaleImage(scaleFactor, origin);
630 scalePage(scaleFactor, origin);
634 double WebPageProxy::scaleFactor()
636 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
637 return static_cast<PageClientImpl*>(m_pageClient)->scaleFactor();
639 return pageScaleFactor();
643 #if ENABLE(TIZEN_ORIENTATION_EVENTS)
644 void WebPageProxy::sendOrientationChangeEvent(int orientation)
646 process()->send(Messages::WebPage::SendOrientationChangeEvent(orientation), m_pageID, 0);
650 void WebPageProxy::suspendPainting()
655 process()->send(Messages::DrawingArea::SuspendPainting(), m_pageID);
658 void WebPageProxy::resumePainting()
663 process()->send(Messages::DrawingArea::ResumePainting(), m_pageID);
666 void WebPageProxy::suspendJavaScriptAndResource()
671 process()->send(Messages::WebPage::SuspendJavaScriptAndResources(), m_pageID);
674 void WebPageProxy::resumeJavaScriptAndResource()
679 process()->send(Messages::WebPage::ResumeJavaScriptAndResources(), m_pageID);
682 void WebPageProxy::suspendAnimations()
687 process()->send(Messages::WebPage::SuspendAnimations(), m_pageID);
690 void WebPageProxy::resumeAnimations()
695 process()->send(Messages::WebPage::ResumeAnimations(), m_pageID);
698 #if ENABLE(TIZEN_PLUGIN_SUSPEND_RESUME)
699 void WebPageProxy::suspendPlugin()
704 process()->send(Messages::WebPage::SuspendPlugin(), m_pageID);
707 void WebPageProxy::resumePlugin()
712 process()->send(Messages::WebPage::ResumePlugin(), m_pageID);
716 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
717 void WebPageProxy::purgeBackingStoresOfInactiveView()
719 if (!isValid() || isViewVisible())
722 process()->send(Messages::LayerTreeCoordinator::PurgeBackingStores(), m_pageID);
726 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
727 bool WebPageProxy::scrollOverflow(const FloatPoint& offset)
732 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION_ON_UI_SIDE)
733 if (static_cast<PageClientImpl*>(m_pageClient)->isScrollableLayerFocused())
734 return drawingArea()->layerTreeCoordinatorProxy()->setOffsetForFocusedScrollingContentsLayer(offset);
736 if (static_cast<PageClientImpl*>(m_pageClient)->isScrollableNodeFocused()) {
737 bool scrolled = false;
738 process()->sendSync(Messages::WebPage::ScrollOverflow(offset), Messages::WebPage::ScrollOverflow::Reply(scrolled), m_pageID);
745 bool WebPageProxy::setPressedNodeAtPoint(const IntPoint& point, bool checkOverflowLayer, WebLayerID& webLayerID)
750 bool pressed = false;
751 process()->sendSync(Messages::WebPage::SetPressedNodeAtPoint(point, checkOverflowLayer), Messages::WebPage::SetPressedNodeAtPoint::Reply(pressed, webLayerID), m_pageID);
756 void WebPageProxy::setOverflowResult(bool pressed, uint32_t webLayerID)
758 static_cast<PageClientImpl*>(m_pageClient)->setOverflowResult(pressed, webLayerID);
762 void WebPageProxy::executeEditCommandWithArgument(const String& commandName, const String& argument)
767 DEFINE_STATIC_LOCAL(String, ignoreSpellingCommandName, ("ignoreSpelling"));
768 if (commandName == ignoreSpellingCommandName)
769 ++m_pendingLearnOrIgnoreWordMessageCount;
771 process()->send(Messages::WebPage::ExecuteEditCommandWithArgument(commandName, argument), m_pageID);
774 void WebPageProxy::replyJavaScriptAlert()
779 m_alertReply->send();
780 m_alertReply = nullptr;
781 #if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
782 m_uiClient.notifyPopupReplyWaitingState(this, false);
784 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
785 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
789 void WebPageProxy::replyJavaScriptConfirm(bool result)
794 m_confirmReply->send(result);
795 m_confirmReply = nullptr;
796 #if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
797 m_uiClient.notifyPopupReplyWaitingState(this, false);
799 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
800 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
804 void WebPageProxy::replyJavaScriptPrompt(const String& result)
809 m_promptReply->send(result);
810 m_promptReply = nullptr;
811 #if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
812 m_uiClient.notifyPopupReplyWaitingState(this, false);
814 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
815 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
819 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
820 void WebPageProxy::replyBeforeUnloadConfirmPanel(bool result)
822 if (!m_beforeUnloadConfirmPanelReply)
825 m_beforeUnloadConfirmPanelReply->send(result);
826 m_beforeUnloadConfirmPanelReply = nullptr;
827 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
828 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
833 #if ENABLE(TIZEN_ON_AUTHENTICATION_REQUESTED)
834 void WebPageProxy::replyReceiveAuthenticationChallengeInFrame(bool result)
839 m_AuthReply->send(result);
840 m_AuthReply = nullptr;
844 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
845 void WebPageProxy::replyPolicyForCertificateError(bool result)
850 m_allowedReply->send(result);
851 m_allowedReply = nullptr;
855 #if PLUGIN_ARCHITECTURE(X11)
856 void WebPageProxy::createPluginContainer(uint64_t& windowID)
861 void WebPageProxy::windowedPluginGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect, uint64_t windowID)
867 void WebPageProxy::didRenderFrame()
869 static_cast<PageClientImpl*>(m_pageClient)->didRenderFrame();
872 void WebPageProxy::setBackgroundColor(double red, double green, double blue, double alpha)
874 static_cast<PageClientImpl*>(m_pageClient)->setBackgroundColor(red, green, blue, alpha);
877 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
878 bool WebPageProxy::makeContextCurrent()
880 return static_cast<PageClientImpl*>(m_pageClient)->makeContextCurrent();
884 #if ENABLE(TIZEN_ICON_DATABASE)
885 void WebPageProxy::didReceiveIcon()
887 static_cast<PageClientImpl*>(m_pageClient)->didReceiveIcon();
891 #if ENABLE(TIZEN_MULTIPLE_SELECT)
892 void WebPageProxy::valueChangedForPopupMenuMultiple(WebPopupMenuProxy*, Vector<int32_t> newSelectedIndex)
894 process()->send(Messages::WebPage::DidChangeSelectedIndexForActivePopupMenuMultiple(newSelectedIndex), m_pageID);
898 #if ENABLE(TIZEN_WEBKIT2_HISTORICAL_RESTORE_VISIBLE_CONTENT_RECT)
899 void WebPageProxy::pageDidRequestRestoreVisibleContentRect(const IntPoint& point, float scale)
901 m_pageClient->pageDidRequestRestoreVisibleContentRect(point, scale);
905 #if ENABLE(TIZEN_OFFLINE_PAGE_SAVE)
906 void WebPageProxy::saveSerializedHTMLDataForMainPage(const String& serializedData, const String& fileName)
908 static_cast<PageClientImpl*>(m_pageClient)->saveSerializedHTMLDataForMainPage(serializedData, fileName);
911 void WebPageProxy::saveSubresourcesData(Vector<WebSubresourceTizen> subresourceData)
913 static_cast<PageClientImpl*>(m_pageClient)->saveSubresourcesData(subresourceData);
916 void WebPageProxy::startOfflinePageSave(String subresourceFolderName)
921 process()->send(Messages::WebPage::StartOfflinePageSave(subresourceFolderName), m_pageID);
925 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
926 bool WebPageProxy::selectClosestWord(const IntPoint& point)
932 process()->sendSync(Messages::WebPage::SelectClosestWord(point), Messages::WebPage::SelectClosestWord::Reply(result), m_pageID);
936 int WebPageProxy::setLeftSelection(const IntPoint& point, const int direction)
942 process()->sendSync(Messages::WebPage::SetLeftSelection(point, direction), Messages::WebPage::SetLeftSelection::Reply(result), m_pageID);
946 int WebPageProxy::setRightSelection(const IntPoint& point, const int direction)
952 process()->sendSync(Messages::WebPage::SetRightSelection(point, direction), Messages::WebPage::SetRightSelection::Reply(result), m_pageID);
956 bool WebPageProxy::getSelectionHandlers(IntRect& leftRect, IntRect& rightRect)
962 process()->sendSync(Messages::WebPage::GetSelectionHandlers(), Messages::WebPage::GetSelectionHandlers::Reply(leftRect, rightRect), m_pageID);
963 if (!leftRect.size().isZero() || !rightRect.size().isZero())
969 String WebPageProxy::getSelectionText()
975 process()->sendSync(Messages::WebPage::GetSelectionText(), Messages::WebPage::GetSelectionText::Reply(ret), m_pageID);
979 bool WebPageProxy::selectionRangeClear()
985 process()->sendSync(Messages::WebPage::SelectionRangeClear(), Messages::WebPage::SelectionRangeClear::Reply(result), m_pageID);
989 bool WebPageProxy::scrollContentByCharacter(const IntPoint& point, SelectionDirection direction)
995 process()->sendSync(Messages::WebPage::ScrollContentByCharacter(point, direction), Messages::WebPage::ScrollContentByCharacter::Reply(result), m_pageID);
999 bool WebPageProxy::scrollContentByLine(const IntPoint& point, SelectionDirection direction)
1004 bool result = false;
1005 process()->sendSync(Messages::WebPage::ScrollContentByLine(point, direction), Messages::WebPage::ScrollContentByLine::Reply(result), m_pageID);
1010 #if ENABLE(TIZEN_LINK_MAGNIFIER)
1011 void WebPageProxy::getLinkMagnifierRect(const WebCore::IntPoint& position, const WebCore::IntSize& size)
1013 process()->send(Messages::WebPage::GetLinkMagnifierRect(position, size), m_pageID);
1016 void WebPageProxy::didGetLinkMagnifierRect(const IntPoint& position, const IntRect& rect)
1018 if (!rect.isEmpty())
1019 LinkMagnifierProxy::linkMagnifier().show(EwkViewImpl::fromEvasObject(viewWidget()), position, rect);
1024 void WebPageProxy::openLink(const IntPoint& position)
1026 #if ENABLE(GESTURE_EVENTS)
1027 IntPoint globalPosition(static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->transformToScreen().mapPoint(position));
1028 WebGestureEvent gesture(WebEvent::GestureSingleTap, position, globalPosition, WebEvent::Modifiers(0), ecore_time_get());
1029 handleGestureEvent(gesture);
1034 #if ENABLE(TIZEN_SCREEN_READER)
1035 bool WebPageProxy::moveScreenReaderFocus(bool forward)
1038 process()->sendSync(Messages::WebPage::MoveScreenReaderFocus(forward), Messages::WebPage::MoveScreenReaderFocus::Reply(result), m_pageID);
1042 void WebPageProxy::moveScreenReaderFocusByPoint(const IntPoint& point)
1044 process()->send(Messages::WebPage::MoveScreenReaderFocusByPoint(point), m_pageID);
1047 void WebPageProxy::clearScreenReaderFocus()
1049 process()->send(Messages::WebPage::ClearScreenReaderFocus(), m_pageID);
1052 bool WebPageProxy::raiseTapEvent(const IntPoint& position)
1054 IntPoint globalPosition = static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->transformToScreen().mapPoint(position);
1056 process()->sendSync(Messages::WebPage::RaiseTapEvent(position, globalPosition), Messages::WebPage::RaiseTapEvent::Reply(result), m_pageID);
1061 void WebPageProxy::adjustScreenReaderFocusedObjectValue(bool up)
1063 process()->send(Messages::WebPage::AdjustScreenReaderFocusedObjectValue(up), m_pageID);
1066 void WebPageProxy::recalcScreenReaderFocusRect()
1068 if (!ScreenReaderProxy::screenReader().isActive(static_cast<PageClientImpl*>(m_pageClient)->viewImpl()))
1071 process()->send(Messages::WebPage::RecalcScreenReaderFocusRect(), m_pageID);
1074 void WebPageProxy::clearScreenReader()
1076 process()->send(Messages::WebPage::ClearScreenReader(), m_pageID);
1079 void WebPageProxy::didScreenReaderTextChanged(const String& text)
1081 ScreenReaderProxy::screenReader().setText(text);
1085 #if ENABLE(TIZEN_SCREEN_READER) || ENABLE(TIZEN_FOCUS_UI)
1086 void WebPageProxy::didChangeFocusedRect(const IntRect& rect)
1088 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
1089 FocusRing* focusRing = ewkViewGetFocusRing(viewWidget());
1093 if (!rect.isEmpty())
1094 focusRing->show(rect);
1096 focusRing->hide(false);
1104 #if ENABLE(TIZEN_CSP)
1105 void WebPageProxy::setContentSecurityPolicy(const String& policy, WebCore::ContentSecurityPolicy::HeaderType type)
1107 process()->send(Messages::WebPage::SetContentSecurityPolicy(policy, type), m_pageID);
1111 #if ENABLE(TIZEN_APPLICATION_CACHE)
1112 void WebPageProxy::requestApplicationCachePermission(uint64_t frameID, const String& originIdentifier, PassRefPtr<Messages::WebPageProxy::RequestApplicationCachePermission::DelayedReply> allow)
1114 WebFrameProxy* frame = process()->webFrame(frameID);
1115 MESSAGE_CHECK(frame);
1117 // Since requestApplicationCachePermission() can spin a nested run loop we need to turn off the responsiveness timer.
1118 process()->responsivenessTimer()->stop();
1120 m_applicationCacheReply = allow;
1121 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1122 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
1124 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
1126 if (!m_tizenClient.decidePolicyForApplicationCachePermissionRequest(this, origin.get(), frame))
1127 replyApplicationCachePermission(true);
1130 void WebPageProxy::replyApplicationCachePermission(bool allow)
1132 if (!m_applicationCacheReply)
1135 m_applicationCacheReply->send(allow);
1136 m_applicationCacheReply = nullptr;
1137 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1138 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
1143 #if ENABLE(TIZEN_INDEXED_DATABASE)
1144 void WebPageProxy::exceededIndexedDatabaseQuota(uint64_t frameID, const String& originIdentifier, int64_t currentUsage, PassRefPtr<Messages::WebPageProxy::ExceededIndexedDatabaseQuota::DelayedReply> reply)
1146 WebFrameProxy* frame = process()->webFrame(frameID);
1147 MESSAGE_CHECK(frame);
1149 // Since exceededIndexedDatabaseQuota() can spin a nested run loop we need to turn off the responsiveness timer.
1150 process()->responsivenessTimer()->stop();
1152 m_exceededIndexedDatabaseQuotaReply = reply;
1153 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1154 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
1157 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
1159 if (!m_tizenClient.exceededIndexedDatabaseQuota(this, origin.get(), currentUsage, frame))
1160 replyExceededIndexedDatabaseQuota(false);
1163 void WebPageProxy::replyExceededIndexedDatabaseQuota(bool allow)
1165 if (!m_exceededIndexedDatabaseQuotaReply)
1168 m_exceededIndexedDatabaseQuotaReply->send(allow);
1169 m_exceededIndexedDatabaseQuotaReply = nullptr;
1170 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1171 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
1176 #if ENABLE(TIZEN_SQL_DATABASE)
1177 void WebPageProxy::replyExceededDatabaseQuota(bool allow)
1179 if (!m_exceededDatabaseQuotaReply) {
1180 TIZEN_LOGE("m_exceededDatabaseQuotaReply does not exist");
1184 m_exceededDatabaseQuotaReply->send(allow);
1185 m_exceededDatabaseQuotaReply = nullptr;
1186 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1187 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
1192 #if ENABLE(TIZEN_FILE_SYSTEM)
1193 void WebPageProxy::exceededLocalFileSystemQuota(uint64_t frameID, const String& originIdentifier, int64_t currentUsage, PassRefPtr<Messages::WebPageProxy::ExceededLocalFileSystemQuota::DelayedReply> reply)
1195 WebFrameProxy* frame = process()->webFrame(frameID);
1196 MESSAGE_CHECK(frame);
1198 // Since exceededLocalFileSystemQuota() can spin a nested run loop we need to turn off the responsiveness timer.
1199 process()->responsivenessTimer()->stop();
1200 m_exceededLocalFileSystemQuotaReply = reply;
1201 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1202 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
1205 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
1207 if (!m_tizenClient.exceededLocalFileSystemQuota(this, origin.get(), currentUsage, frame))
1208 replyExceededLocalFileSystemQuota(false);
1211 void WebPageProxy::replyExceededLocalFileSystemQuota(bool allow)
1213 if (!m_exceededLocalFileSystemQuotaReply)
1216 m_exceededLocalFileSystemQuotaReply->send(allow);
1217 m_exceededLocalFileSystemQuotaReply = nullptr;
1218 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1219 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
1224 #endif // #if OS(TIZEN)
1226 void WebPageProxy::handleInputMethodKeydown(bool& handled)
1228 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1229 handled = m_keyEventQueue.first().forwardedEvent.isFiltered();
1231 handled = m_keyEventQueue.first().isFiltered();
1235 void WebPageProxy::confirmComposition(const String& compositionString)
1240 #if ENABLE(TIZEN_ISF_PORT)
1241 if (m_didCancelCompositionFromWebProcess)
1245 process()->send(Messages::WebPage::ConfirmComposition(compositionString), m_pageID, 0);
1248 void WebPageProxy::setComposition(const String& compositionString, Vector<WebCore::CompositionUnderline>& underlines, int cursorPosition)
1253 #if ENABLE(TIZEN_REDUCE_KEY_LAGGING)
1254 // Suspend layout&paint at the key input, and resume layout&paint after 150 ms.
1255 suspendActiveDOMObjectsAndAnimations();
1256 if (m_pageContentResumeTimer)
1257 ecore_timer_del(m_pageContentResumeTimer);
1258 m_pageContentResumeTimer = ecore_timer_add(150.0/1000.0, pageContentResumeTimerFired, this);
1261 process()->send(Messages::WebPage::SetComposition(compositionString, underlines, cursorPosition), m_pageID, 0);
1264 void WebPageProxy::cancelComposition()
1269 process()->send(Messages::WebPage::CancelComposition(), m_pageID, 0);
1272 #if ENABLE(TIZEN_USE_SETTINGS_FONT)
1273 void WebPageProxy::useSettingsFont()
1275 process()->send(Messages::WebPage::UseSettingsFont(), m_pageID, 0);
1279 #if ENABLE(TIZEN_WEBKIT2_NOTIFY_SUSPEND_BY_REMOTE_WEB_INSPECTOR)
1280 void WebPageProxy::setContentSuspendedByInspector(bool isSuspended)
1282 m_contentSuspendedByInspector = isSuspended;
1286 #if ENABLE(TIZEN_FOCUS_UI)
1287 void WebPageProxy::setSpatialNavigationEnabled(bool enabled)
1289 if (m_spatialNavigationEnabled == enabled)
1292 m_spatialNavigationEnabled = enabled;
1295 static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->focusRing->setImage(FOCUS_UI_FOCUS_RING_IMAGE_PATH, 4, 2);
1297 static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->focusRing->setImage(String(), 0, 0);
1299 process()->send(Messages::WebPage::SetSpatialNavigationEnabled(enabled), m_pageID);
1302 } // namespace WebKit