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 using namespace WebCore;
74 Evas_Object* WebPageProxy::viewWidget()
76 return static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->view();
79 String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent)
82 return String::fromUTF8("Mozilla/5.0 (Linux; U; Tizen 2.0; en-us) AppleWebKit/537.1 (KHTML, like Gecko) Mobile TizenBrowser/2.0");
87 WTF::String osVersion;
94 version = makeString(String::number(WEBKIT_USER_AGENT_MAJOR_VERSION), '.',
95 String::number(WEBKIT_USER_AGENT_MINOR_VERSION), '+');
97 if (uname(&name) != -1)
98 osVersion = WTF::String(name.sysname) + " " + WTF::String(name.machine);
100 osVersion = "Unknown";
102 if (applicationNameForUserAgent.isEmpty())
103 return makeString("Mozilla/5.0 (", platform, "; ", osVersion, ") AppleWebKit/", version,
104 " (KHTML, like Gecko) Version/5.0 Safari/", version);
106 return makeString("Mozilla/5.0 (", platform, "; ", osVersion, ") AppleWebKit/", version,
107 " (KHTML, like Gecko) Version/5.0 Safari/", version, applicationNameForUserAgent);
110 void WebPageProxy::getEditorCommandsForKeyEvent(Vector<WTF::String>& commandsList)
115 void WebPageProxy::saveRecentSearches(const String&, const Vector<String>&)
120 void WebPageProxy::loadRecentSearches(const String&, Vector<String>&)
125 void WebPageProxy::setThemePath(const String& themePath)
127 process()->send(Messages::WebPage::SetThemePath(themePath), m_pageID, 0);
130 #if ENABLE(TIZEN_CUSTOM_HEADERS)
131 void WebPageProxy::addCustomHeader(const String& name, const String& value)
142 process()->send(Messages::WebPage::AddCustomHeader(name, value), m_pageID);
145 void WebPageProxy::removeCustomHeader(const String& name)
153 process()->send(Messages::WebPage::RemoveCustomHeader(name), m_pageID);
156 void WebPageProxy::clearCustomHeaders()
161 process()->send(Messages::WebPage::ClearCustomHeaders(), m_pageID);
166 bool WebPageProxy::scrollMainFrameBy(const IntSize& scrollOffset)
168 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
169 return static_cast<PageClientImpl*>(m_pageClient)->scrollBy(scrollOffset);
174 process()->send(Messages::WebPage::ScrollMainFrameBy(scrollOffset), m_pageID);
179 void WebPageProxy::scrollMainFrameTo(const IntPoint& scrollPosition)
181 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
182 static_cast<PageClientImpl*>(m_pageClient)->scrollTo(scrollPosition);
187 process()->send(Messages::WebPage::ScrollMainFrameTo(scrollPosition), m_pageID);
191 void WebPageProxy::didChangeScrollPositionForMainFrame(const IntPoint& scrollPosition)
193 #if !ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
194 m_scrollPosition = scrollPosition;
198 void WebPageProxy::didChangeContentsSize(const IntSize& size)
200 if (m_contentsSize == size)
203 m_contentsSize = size;
204 m_pageClient->didChangeContentsSize(size);
207 PassRefPtr<WebImage> WebPageProxy::createSnapshot(const IntRect& rect, float scaleFactor)
212 ShareableBitmap::Handle snapshotHandle;
213 // Do not wait for more than a second (arbitrary) for the WebProcess to get the snapshot so
214 // that the UI Process is not permanently stuck waiting on a potentially crashing Web Process.
215 static const double createSnapshotSyncMessageTimeout = 1.0;
216 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
217 float baseScaleFactor = static_cast<PageClientImpl*>(m_pageClient)->scaleFactor();
218 scaleFactor = scaleFactor * baseScaleFactor;
220 IntRect visibleContentRect = static_cast<PageClientImpl*>(m_pageClient)->visibleContentRect();
221 IntRect scaledRect = rect;
222 scaledRect.move(visibleContentRect.x(), visibleContentRect.y());
223 scaledRect.scale(1/baseScaleFactor);
224 process()->sendSync(Messages::WebPage::CreateSnapshot(scaledRect, scaleFactor), Messages::WebPage::CreateSnapshot::Reply(snapshotHandle), m_pageID, createSnapshotSyncMessageTimeout);
226 process()->sendSync(Messages::WebPage::CreateSnapshot(rect, scaleFactor), Messages::WebPage::CreateSnapshot::Reply(snapshotHandle), m_pageID, createSnapshotSyncMessageTimeout);
228 if (snapshotHandle.isNull())
230 return WebImage::create(ShareableBitmap::create(snapshotHandle));
233 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
234 void WebPageProxy::textChangeInTextField(const String& name, const String& value)
236 static_cast<PageClientImpl*>(m_pageClient)->textChangeInTextField(name, value);
240 #if ENABLE(TIZEN_ISF_PORT)
241 void WebPageProxy::setInputMethodState(bool active, const String& type, const String& value)
243 static_cast<PageClientImpl*>(m_pageClient)->setInputMethodState(active, type, value);
246 void WebPageProxy::setInputMethodState(bool active)
248 //FIXME : it should be contributable
249 static_cast<PageClientImpl*>(m_pageClient)->setInputMethodState(active);
253 #if ENABLE(TIZEN_ISF_PORT)
254 int WebPageProxy::getCursorOffset()
260 process()->sendSync(Messages::WebPage::GetCursorOffset(), Messages::WebPage::GetCursorOffset::Reply(offset), m_pageID);
264 void WebPageProxy::getSurroundingTextAndCursorOffset(String& text, int& offset)
269 process()->sendSync(Messages::WebPage::GetSurroundingTextAndCursorOffset(), Messages::WebPage::GetSurroundingTextAndCursorOffset::Reply(text, offset), m_pageID);
272 IntRect WebPageProxy::getSelectionRect(bool isOnlyEditable)
275 process()->sendSync(Messages::WebPage::GetSelectionRect(isOnlyEditable), Messages::WebPage::GetSelectionRect::Reply(rect), m_pageID);
279 void WebPageProxy::deleteSurroundingText(int offset, int count)
284 process()->send(Messages::WebPage::DeleteSurroundingText(offset, count), m_pageID);
287 void WebPageProxy::updateCursorOffset(int offset)
289 static_cast<PageClientImpl*>(m_pageClient)->updateCursorOffset(offset);
292 void WebPageProxy::didCancelComposition()
294 m_didCancelCompositionFromWebProcess = true;
295 InputMethodContextEfl* inputMethodContext = static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->inputMethodContext();
296 if (inputMethodContext)
297 inputMethodContext->resetIMFContext();
298 m_didCancelCompositionFromWebProcess = false;
302 void WebPageProxy::requestUpdateFormNavigation()
307 process()->send(Messages::WebPage::RequestUpdateFormNavigation(), m_pageID);
310 void WebPageProxy::moveFocus(int newIndex)
315 process()->send(Messages::WebPage::MoveFocus(newIndex), m_pageID);
318 void WebPageProxy::updateFormNavigation(int length, int offset)
320 static_cast<PageClientImpl*>(m_pageClient)->updateFormNavigation(length, offset);
323 #if ENABLE(TIZEN_REDUCE_KEY_LAGGING)
324 Eina_Bool WebPageProxy::pageContentResumeTimerFired(void* data)
326 static_cast<WebPageProxy*>(data)->resumeActiveDOMObjectsAndAnimations();
327 static_cast<WebPageProxy*>(data)->m_pageContentResumeTimer = 0;
328 return ECORE_CALLBACK_CANCEL;
332 #if ENABLE(TIZEN_TEXT_CARET_HANDLING_WK2)
333 void WebPageProxy::setCaretPosition(const WebCore::IntPoint& pos)
338 process()->send(Messages::WebPage::SetCaretPosition(pos), m_pageID);
341 void WebPageProxy::getCaretPosition(WebCore::IntRect& rect)
346 process()->sendSync(Messages::WebPage::GetCaretPosition(), Messages::WebPage::GetCaretPosition::Reply(rect), m_pageID);
350 #if ENABLE(TIZEN_PLUGIN_CUSTOM_REQUEST)
351 void WebPageProxy::processPluginCustomRequest(const String& request, const String& msg)
353 if (String("requestKeyboard,plugin") == request) {
355 if (String("show") == msg)
357 #if ENABLE(TIZEN_ISF_PORT)
358 setInputMethodState(active, "plugin", String());
360 setInputMethodState(active);
363 #if ENABLE(TIZEN_JSBRIDGE_PLUGIN)
364 else if (String("requestToNative,json") == request)
365 m_tizenClient.processJSBridgePlugin(this, request, msg);
371 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION) || ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
372 void WebPageProxy::setFocusedInputElementValue(const String& inputValue)
377 process()->send(Messages::WebPage::SetFocusedInputElementValue(inputValue), m_pageID);
380 String WebPageProxy::getFocusedInputElementValue()
386 process()->sendSync(Messages::WebPage::GetFocusedInputElementValue(), Messages::WebPage::GetFocusedInputElementValue::Reply(inputValue), m_pageID);
391 #if ENABLE(TIZEN_DATALIST_ELEMENT)
392 Vector<String> WebPageProxy::getFocusedInputElementDataList()
395 return Vector<String>();
397 Vector<String> optionList;
398 process()->sendSync(Messages::WebPage::GetFocusedInputElementDataList(), Messages::WebPage::GetFocusedInputElementDataList::Reply(optionList), m_pageID);
403 void WebPageProxy::focusedNodeChanged(const IntRect& focusedNodeRect)
405 static_cast<PageClientImpl*>(m_pageClient)->setFocusedNodeRect(focusedNodeRect);
408 void WebPageProxy::initializeTizenClient(const WKPageTizenClient* client)
410 m_tizenClient.initialize(client);
413 #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
414 WebHitTestResult::Data WebPageProxy::hitTestResultAtPoint(const IntPoint& point, int hitTestMode)
416 WebHitTestResult::Data hitTestResultData;
418 return hitTestResultData;
420 process()->sendSync(Messages::WebPage::HitTestResultAtPoint(point, hitTestMode),
421 Messages::WebPage::HitTestResultAtPoint::Reply(hitTestResultData), m_pageID);
423 return hitTestResultData;
427 #if ENABLE(TIZEN_RECORDING_SURFACE_SET)
428 void WebPageProxy::recordingSurfaceSetEnableSet(bool enable)
433 process()->send(Messages::WebPage::RecordingSurfaceSetEnableSet(enable), m_pageID, 0);
437 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
438 void WebPageProxy::hideContextMenu()
440 if (m_activeContextMenu)
441 m_activeContextMenu->hideContextMenu();
444 String WebPageProxy::contextMenuAbsoluteLinkURLString()
446 if (!m_activeContextMenu)
449 return m_activeContextMenuHitTestResultData.absoluteLinkURL;
452 String WebPageProxy::contextMenuAbsoluteImageURLString()
454 if (!m_activeContextMenu)
457 return m_activeContextMenuHitTestResultData.absoluteImageURL;
461 #if ENABLE(TIZEN_WEBKIT2_CLIPBOARD_HELPER)
462 void WebPageProxy::pasteContextMenuSelected()
464 static_cast<PageClientImpl*>(m_pageClient)->pasteContextMenuSelected();
467 void WebPageProxy::didSelectPasteMenuFromContextMenu(const String& data, const String& type)
472 #if ENABLE(TIZEN_CLIPBOARD) || ENABLE(TIZEN_PASTEBOARD)
473 process()->send(Messages::WebPage::SetClipboardDataForPaste(data, type), m_pageID);
475 WebContextMenuItemData item(ActionType, ContextMenuItemTagPaste, String("Paste"), true, false);
476 process()->send(Messages::WebPage::DidSelectItemFromActiveContextMenu(item), m_pageID);
480 #if ENABLE(TIZEN_CLIPBOARD) || ENABLE(TIZEN_PASTEBOARD)
481 void WebPageProxy::setClipboardData(const String& data, const String& type)
483 static_cast<PageClientImpl*>(m_pageClient)->setClipboardData(data, type);
486 void WebPageProxy::clearClipboardData()
488 static_cast<PageClientImpl*>(m_pageClient)->clearClipboardData();
492 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
493 void WebPageProxy::executePasteFromClipboardItem(const String& data, const String& type)
498 #if ENABLE(TIZEN_CLIPBOARD) || ENABLE(TIZEN_PASTEBOARD)
499 process()->send(Messages::WebPage::SetClipboardDataForPaste(data, type), m_pageID);
501 process()->send(Messages::WebPage::ExecuteEditCommandWithArgument("Paste", data), m_pageID);
504 void WebPageProxy::clipboardContextMenuSelected()
506 static_cast<PageClientImpl*>(m_pageClient)->clipboardContextMenuSelected();
510 #if ENABLE(TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR)
511 uint32_t WebPageProxy::startInspectorServer(uint32_t port)
516 uint32_t assignedPort = 0;
517 process()->sendSync(Messages::WebPage::StartInspectorServer(port), Messages::WebPage::StartInspectorServer::Reply(assignedPort), m_pageID);
521 bool WebPageProxy::stopInspectorServer()
527 process()->sendSync(Messages::WebPage::StopInspectorServer(), Messages::WebPage::StopInspectorServer::Reply(result), m_pageID);
532 #if ENABLE(TIZEN_MOBILE_WEB_PRINT)
533 void WebPageProxy::createPagesToPDF(const IntSize& surfaceSize, const IntSize& contentsSize, const String& fileName)
535 process()->send(Messages::WebPage::CreatePagesToPDF(surfaceSize, contentsSize, fileName), m_pageID);
539 #if ENABLE(TIZEN_WEB_STORAGE)
540 #if ENABLE(TIZEN_WEBKIT2_NUMBER_TYPE_SUPPORT)
541 void WebPageProxy::getWebStorageQuotaBytes(PassRefPtr<WebStorageQuotaCallback> prpCallback)
543 RefPtr<WebStorageQuotaCallback> callback = prpCallback;
545 callback->invalidate();
549 uint64_t callbackID = callback->callbackID();
550 m_quotaCallbacks.set(callbackID, callback.get());
551 process()->send(Messages::WebPage::GetStorageQuotaBytes(callbackID), m_pageID);
554 void WebPageProxy::didGetWebStorageQuotaBytes(const uint32_t quota, uint64_t callbackID)
556 RefPtr<WebStorageQuotaCallback> callback = m_quotaCallbacks.take(callbackID);
558 // FIXME: Log error or assert.
559 // this can validly happen if a load invalidated the callback, though
563 m_quotaCallbacks.remove(callbackID);
565 RefPtr<WebUInt32> uint32Object = WebUInt32::create(quota);
566 callback->performCallbackWithReturnValue(uint32Object.release().leakRef());
570 void WebPageProxy::setWebStorageQuotaBytes(uint32_t quota)
575 process()->send(Messages::WebPage::SetStorageQuotaBytes(quota), m_pageID, 0);
579 void WebPageProxy::scale(double scaleFactor, const IntPoint& origin)
581 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
582 static_cast<PageClientImpl*>(m_pageClient)->scaleContents(scaleFactor, origin);
584 scalePage(scaleFactor, origin);
588 void WebPageProxy::scaleImage(double scaleFactor, const IntPoint& origin)
590 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
591 static_cast<PageClientImpl*>(m_pageClient)->scaleImage(scaleFactor, origin);
593 scalePage(scaleFactor, origin);
597 double WebPageProxy::scaleFactor()
599 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
600 return static_cast<PageClientImpl*>(m_pageClient)->scaleFactor();
602 return pageScaleFactor();
606 #if ENABLE(TIZEN_ORIENTATION_EVENTS)
607 void WebPageProxy::sendOrientationChangeEvent(int orientation)
609 process()->send(Messages::WebPage::SendOrientationChangeEvent(orientation), m_pageID, 0);
613 void WebPageProxy::suspendPainting()
618 process()->send(Messages::DrawingArea::SuspendPainting(), m_pageID);
621 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
622 void WebPageProxy::suspendPaintingOfInactiveView()
624 if (!isValid() || isViewVisible())
627 process()->send(Messages::DrawingArea::SuspendPainting(), m_pageID);
631 void WebPageProxy::resumePainting()
636 process()->send(Messages::DrawingArea::ResumePainting(), m_pageID);
639 void WebPageProxy::suspendJavaScriptAndResource()
644 process()->send(Messages::WebPage::SuspendJavaScriptAndResources(), m_pageID);
647 void WebPageProxy::resumeJavaScriptAndResource()
652 process()->send(Messages::WebPage::ResumeJavaScriptAndResources(), m_pageID);
655 #if ENABLE(TIZEN_PLUGIN_SUSPEND_RESUME)
656 void WebPageProxy::suspendPlugin()
661 process()->send(Messages::WebPage::SuspendPlugin(), m_pageID);
664 void WebPageProxy::resumePlugin()
669 process()->send(Messages::WebPage::ResumePlugin(), m_pageID);
673 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
674 bool WebPageProxy::scrollOverflow(const FloatPoint& offset)
679 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION_ON_UI_SIDE)
680 if (static_cast<PageClientImpl*>(m_pageClient)->isScrollableLayerFocused())
681 return drawingArea()->layerTreeCoordinatorProxy()->setOffsetForFocusedScrollingContentsLayer(offset);
683 if (static_cast<PageClientImpl*>(m_pageClient)->isScrollableNodeFocused()) {
684 bool scrolled = false;
685 process()->sendSync(Messages::WebPage::ScrollOverflow(offset), Messages::WebPage::ScrollOverflow::Reply(scrolled), m_pageID);
692 bool WebPageProxy::setPressedNodeAtPoint(const IntPoint& point, bool checkOverflowLayer, WebLayerID& webLayerID)
697 bool pressed = false;
698 process()->sendSync(Messages::WebPage::SetPressedNodeAtPoint(point, checkOverflowLayer), Messages::WebPage::SetPressedNodeAtPoint::Reply(pressed, webLayerID), m_pageID);
703 void WebPageProxy::setOverflowResult(bool pressed, uint32_t webLayerID)
705 static_cast<PageClientImpl*>(m_pageClient)->setOverflowResult(pressed, webLayerID);
709 void WebPageProxy::executeEditCommandWithArgument(const String& commandName, const String& argument)
714 DEFINE_STATIC_LOCAL(String, ignoreSpellingCommandName, ("ignoreSpelling"));
715 if (commandName == ignoreSpellingCommandName)
716 ++m_pendingLearnOrIgnoreWordMessageCount;
718 process()->send(Messages::WebPage::ExecuteEditCommandWithArgument(commandName, argument), m_pageID);
721 void WebPageProxy::replyJavaScriptAlert()
726 m_alertReply->send();
727 m_alertReply = nullptr;
728 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
729 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
733 void WebPageProxy::replyJavaScriptConfirm(bool result)
738 m_confirmReply->send(result);
739 m_confirmReply = nullptr;
740 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
741 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
745 void WebPageProxy::replyJavaScriptPrompt(const String& result)
750 m_promptReply->send(result);
751 m_promptReply = nullptr;
752 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
753 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
757 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
758 void WebPageProxy::replyBeforeUnloadConfirmPanel(bool result)
760 if (!m_beforeUnloadConfirmPanelReply)
763 m_beforeUnloadConfirmPanelReply->send(result);
764 m_beforeUnloadConfirmPanelReply = nullptr;
765 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
766 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
771 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
772 void WebPageProxy::replyPolicyForCertificateError(bool result)
777 m_allowedReply->send(result);
778 m_allowedReply = nullptr;
782 #if PLUGIN_ARCHITECTURE(X11)
783 void WebPageProxy::createPluginContainer(uint64_t& windowID)
788 void WebPageProxy::windowedPluginGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect, uint64_t windowID)
794 void WebPageProxy::didRenderFrame()
796 static_cast<PageClientImpl*>(m_pageClient)->didRenderFrame();
799 void WebPageProxy::setBackgroundColor(double red, double green, double blue, double alpha)
801 static_cast<PageClientImpl*>(m_pageClient)->setBackgroundColor(red, green, blue, alpha);
804 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
805 bool WebPageProxy::makeContextCurrent()
807 return static_cast<PageClientImpl*>(m_pageClient)->makeContextCurrent();
811 #if ENABLE(TIZEN_WEBKIT2_GET_TEXT_STYLE_FOR_SELECTION)
812 void WebPageProxy::getTextStyleStateForSelection()
814 process()->send(Messages::WebPage::GetTextStyleStateForSelection(), m_pageID, 0);
817 void WebPageProxy::didGetTextStyleStateForSelection(int underlineState, int italicState, int boldState)
819 static_cast<PageClientImpl*>(m_pageClient)->didGetTextStyleStateForSelection(underlineState, italicState, boldState);
823 #if ENABLE(TIZEN_ICON_DATABASE)
824 void WebPageProxy::didReceiveIcon()
826 static_cast<PageClientImpl*>(m_pageClient)->didReceiveIcon();
830 #if ENABLE(TIZEN_MULTIPLE_SELECT)
831 void WebPageProxy::valueChangedForPopupMenuMultiple(WebPopupMenuProxy*, Vector<int32_t> newSelectedIndex)
833 process()->send(Messages::WebPage::DidChangeSelectedIndexForActivePopupMenuMultiple(newSelectedIndex), m_pageID);
837 #if ENABLE(TIZEN_WEBKIT2_HISTORICAL_RESTORE_VISIBLE_CONTENT_RECT)
838 void WebPageProxy::pageDidRequestRestoreVisibleContentRect(const IntPoint& point, float scale)
840 m_pageClient->pageDidRequestRestoreVisibleContentRect(point, scale);
844 #if ENABLE(TIZEN_OFFLINE_PAGE_SAVE)
845 void WebPageProxy::saveSerializedHTMLDataForMainPage(const String& serializedData, const String& fileName)
847 static_cast<PageClientImpl*>(m_pageClient)->saveSerializedHTMLDataForMainPage(serializedData, fileName);
850 void WebPageProxy::saveSubresourcesData(Vector<WebSubresourceTizen> subresourceData)
852 static_cast<PageClientImpl*>(m_pageClient)->saveSubresourcesData(subresourceData);
855 void WebPageProxy::startOfflinePageSave(String subresourceFolderName)
860 process()->send(Messages::WebPage::StartOfflinePageSave(subresourceFolderName), m_pageID);
864 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
865 bool WebPageProxy::selectClosestWord(const IntPoint& point, bool isStartedTextSelectionFromOutside)
871 process()->sendSync(Messages::WebPage::SelectClosestWord(point, isStartedTextSelectionFromOutside), Messages::WebPage::SelectClosestWord::Reply(result), m_pageID);
875 bool WebPageProxy::setLeftSelection(const IntPoint& point)
881 process()->sendSync(Messages::WebPage::SetLeftSelection(point), Messages::WebPage::SetLeftSelection::Reply(result), m_pageID);
885 bool WebPageProxy::setRightSelection(const IntPoint& point)
891 process()->sendSync(Messages::WebPage::SetRightSelection(point), Messages::WebPage::SetRightSelection::Reply(result), m_pageID);
895 bool WebPageProxy::getSelectionHandlers(IntRect& leftRect, IntRect& rightRect)
901 process()->sendSync(Messages::WebPage::GetSelectionHandlers(), Messages::WebPage::GetSelectionHandlers::Reply(leftRect, rightRect), m_pageID);
902 if (!leftRect.size().isZero() || !rightRect.size().isZero())
908 String WebPageProxy::getSelectionText()
914 process()->sendSync(Messages::WebPage::GetSelectionText(), Messages::WebPage::GetSelectionText::Reply(ret), m_pageID);
918 bool WebPageProxy::selectionRangeClear()
924 process()->sendSync(Messages::WebPage::SelectionRangeClear(), Messages::WebPage::SelectionRangeClear::Reply(result), m_pageID);
929 #if ENABLE(TIZEN_LINK_MAGNIFIER)
930 void WebPageProxy::getLinkMagnifierRect(const WebCore::IntPoint& position, const WebCore::IntSize& size)
932 process()->send(Messages::WebPage::GetLinkMagnifierRect(position, size), m_pageID);
935 void WebPageProxy::didGetLinkMagnifierRect(const IntPoint& position, const IntRect& rect)
938 LinkMagnifierProxy::linkMagnifier().show(EwkViewImpl::fromEvasObject(viewWidget()), position, rect);
943 void WebPageProxy::openLink(const IntPoint& position)
945 #if ENABLE(GESTURE_EVENTS)
946 IntPoint globalPosition(EwkViewImpl::fromEvasObject(viewWidget())->transformToScreen().mapPoint(position));
947 WebGestureEvent gesture(WebEvent::GestureSingleTap, position, globalPosition, WebEvent::Modifiers(0), ecore_time_get());
948 handleGestureEvent(gesture);
953 #if ENABLE(TIZEN_SCREEN_READER)
954 void WebPageProxy::raiseTapEvent(const IntPoint& position)
956 #if ENABLE(GESTURE_EVENTS)
957 IntPoint globalPosition = EwkViewImpl::fromEvasObject(viewWidget())->transformToScreen().mapPoint(position);
958 process()->send(Messages::WebPage::RaiseTapEvent(position, globalPosition), m_pageID);
960 UNUSED_PARAM(position);
964 bool WebPageProxy::moveScreenReaderFocus(bool forward)
967 process()->sendSync(Messages::WebPage::MoveScreenReaderFocus(forward), Messages::WebPage::MoveScreenReaderFocus::Reply(result), m_pageID);
971 void WebPageProxy::moveScreenReaderFocusByPoint(const IntPoint& point)
973 process()->send(Messages::WebPage::MoveScreenReaderFocusByPoint(point), m_pageID);
976 void WebPageProxy::recalcScreenReaderFocusRect()
978 if (!ScreenReaderProxy::screenReader().isEnabled())
981 process()->send(Messages::WebPage::RecalcScreenReaderFocusRect(), m_pageID);
984 void WebPageProxy::clearScreenReader()
986 process()->send(Messages::WebPage::ClearScreenReader(), m_pageID);
989 void WebPageProxy::didScreenReaderFocusRectChanged(const IntRect& rect)
991 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
992 FocusRing* focusRing = ewkViewGetFocusRing(viewWidget());
997 focusRing->show(rect);
999 focusRing->hide(false);
1005 void WebPageProxy::didScreenReaderTextChanged(const String& text)
1007 ScreenReaderProxy::screenReader().setText(text);
1011 #if ENABLE(TIZEN_CSP)
1012 void WebPageProxy::setContentSecurityPolicy(const String& policy, WebCore::ContentSecurityPolicy::HeaderType type)
1014 process()->send(Messages::WebPage::SetContentSecurityPolicy(policy, type), m_pageID);
1018 #if ENABLE(TIZEN_APPLICATION_CACHE)
1019 void WebPageProxy::requestApplicationCachePermission(uint64_t frameID, const String& originIdentifier, PassRefPtr<Messages::WebPageProxy::RequestApplicationCachePermission::DelayedReply> allow)
1021 WebFrameProxy* frame = process()->webFrame(frameID);
1022 MESSAGE_CHECK(frame);
1024 // Since requestApplicationCachePermission() can spin a nested run loop we need to turn off the responsiveness timer.
1025 process()->responsivenessTimer()->stop();
1027 m_applicationCacheReply = allow;
1028 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1029 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
1031 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
1033 if (!m_tizenClient.decidePolicyForApplicationCachePermissionRequest(this, origin.get(), frame))
1034 replyApplicationCachePermission(false);
1037 void WebPageProxy::replyApplicationCachePermission(bool allow)
1039 if (!m_applicationCacheReply)
1042 m_applicationCacheReply->send(allow);
1043 m_applicationCacheReply = nullptr;
1044 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1045 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
1050 #if ENABLE(TIZEN_INDEXED_DATABASE)
1051 void WebPageProxy::exceededIndexedDatabaseQuota(uint64_t frameID, const String& originIdentifier, int64_t currentUsage, PassRefPtr<Messages::WebPageProxy::ExceededIndexedDatabaseQuota::DelayedReply> reply)
1053 WebFrameProxy* frame = process()->webFrame(frameID);
1054 MESSAGE_CHECK(frame);
1056 // Since exceededIndexedDatabaseQuota() can spin a nested run loop we need to turn off the responsiveness timer.
1057 process()->responsivenessTimer()->stop();
1059 m_exceededIndexedDatabaseQuotaReply = reply;
1060 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1061 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
1064 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
1066 if (!m_tizenClient.exceededIndexedDatabaseQuota(this, origin.get(), currentUsage, frame))
1067 replyExceededIndexedDatabaseQuota(false);
1070 void WebPageProxy::replyExceededIndexedDatabaseQuota(bool allow)
1072 if (!m_exceededIndexedDatabaseQuotaReply)
1075 m_exceededIndexedDatabaseQuotaReply->send(allow);
1076 m_exceededIndexedDatabaseQuotaReply = nullptr;
1077 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1078 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
1083 #endif // #if OS(TIZEN)
1085 void WebPageProxy::handleInputMethodKeydown(bool& handled)
1087 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1088 handled = m_keyEventQueue.first().forwardedEvent.isFiltered();
1090 handled = m_keyEventQueue.first().isFiltered();
1094 void WebPageProxy::confirmComposition(const String& compositionString)
1099 #if ENABLE(TIZEN_ISF_PORT)
1100 if (m_didCancelCompositionFromWebProcess)
1104 process()->send(Messages::WebPage::ConfirmComposition(compositionString), m_pageID, 0);
1107 void WebPageProxy::setComposition(const String& compositionString, Vector<WebCore::CompositionUnderline>& underlines, int cursorPosition)
1112 #if ENABLE(TIZEN_REDUCE_KEY_LAGGING)
1113 // Suspend layout&paint at the key input, and resume layout&paint after 150 ms.
1114 suspendActiveDOMObjectsAndAnimations();
1115 if (m_pageContentResumeTimer)
1116 ecore_timer_del(m_pageContentResumeTimer);
1117 m_pageContentResumeTimer = ecore_timer_add(150.0/1000.0, pageContentResumeTimerFired, this);
1120 process()->send(Messages::WebPage::SetComposition(compositionString, underlines, cursorPosition), m_pageID, 0);
1123 void WebPageProxy::cancelComposition()
1128 process()->send(Messages::WebPage::CancelComposition(), m_pageID, 0);
1131 } // namespace WebKit