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; Tizen 2.1; sdk) AppleWebKit/537.3 (KHTML, like Gecko) Version/2.1 Mobile Safari/537.3");
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)
243 InputMethodContextEfl* inputMethodContext = static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->inputMethodContext();
244 if (!inputMethodContext)
247 inputMethodContext->setUseInputMethod(active);
250 int WebPageProxy::getCursorOffset()
256 process()->sendSync(Messages::WebPage::GetCursorOffset(), Messages::WebPage::GetCursorOffset::Reply(offset), m_pageID);
260 void WebPageProxy::getSurroundingTextAndCursorOffset(String& text, int& offset)
265 process()->sendSync(Messages::WebPage::GetSurroundingTextAndCursorOffset(), Messages::WebPage::GetSurroundingTextAndCursorOffset::Reply(text, offset), m_pageID);
268 IntRect WebPageProxy::getSelectionRect(bool isOnlyEditable)
271 process()->sendSync(Messages::WebPage::GetSelectionRect(isOnlyEditable), Messages::WebPage::GetSelectionRect::Reply(rect), m_pageID);
275 void WebPageProxy::deleteSurroundingText(int offset, int count)
280 process()->send(Messages::WebPage::DeleteSurroundingText(offset, count), m_pageID);
283 void WebPageProxy::didCancelComposition()
285 m_didCancelCompositionFromWebProcess = true;
286 InputMethodContextEfl* inputMethodContext = static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->inputMethodContext();
287 if (inputMethodContext)
288 inputMethodContext->resetIMFContext();
289 m_didCancelCompositionFromWebProcess = false;
292 void WebPageProxy::removeInputMethodContext(uintptr_t id)
294 InputMethodContextEfl* inputMethodContext = static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->inputMethodContext();
295 if (!inputMethodContext)
298 inputMethodContext->removeIMFContext(id);
300 #endif // #if ENABLE(TIZEN_ISF_PORT)
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 m_editorState = EditorState();
359 m_editorState.isContentEditable = active;
360 m_pageClient->updateTextInputState();
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_CONTEXT_MENU_WEBKIT_2)
428 void WebPageProxy::hideContextMenu()
430 if (m_activeContextMenu)
431 m_activeContextMenu->hideContextMenu();
434 String WebPageProxy::contextMenuAbsoluteLinkURLString()
436 if (!m_activeContextMenu)
439 return m_activeContextMenuHitTestResultData.absoluteLinkURL;
442 String WebPageProxy::contextMenuAbsoluteImageURLString()
444 if (!m_activeContextMenu)
447 return m_activeContextMenuHitTestResultData.absoluteImageURL;
451 #if ENABLE(TIZEN_WEBKIT2_CLIPBOARD_HELPER)
452 void WebPageProxy::pasteContextMenuSelected()
454 static_cast<PageClientImpl*>(m_pageClient)->pasteContextMenuSelected();
457 void WebPageProxy::didSelectPasteMenuFromContextMenu(const String& data, const String& type)
462 #if ENABLE(TIZEN_CLIPBOARD) || ENABLE(TIZEN_PASTEBOARD)
463 process()->send(Messages::WebPage::SetClipboardDataForPaste(data, type), m_pageID);
465 WebContextMenuItemData item(ActionType, ContextMenuItemTagPaste, String("Paste"), true, false);
466 process()->send(Messages::WebPage::DidSelectItemFromActiveContextMenu(item), m_pageID);
470 #if ENABLE(TIZEN_CLIPBOARD) || ENABLE(TIZEN_PASTEBOARD)
471 void WebPageProxy::setClipboardData(const String& data, const String& type)
473 static_cast<PageClientImpl*>(m_pageClient)->setClipboardData(data, type);
476 void WebPageProxy::clearClipboardData()
478 static_cast<PageClientImpl*>(m_pageClient)->clearClipboardData();
482 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
483 void WebPageProxy::executePasteFromClipboardItem(const String& data, const String& type)
488 #if ENABLE(TIZEN_CLIPBOARD) || ENABLE(TIZEN_PASTEBOARD)
489 process()->send(Messages::WebPage::SetClipboardDataForPaste(data, type), m_pageID);
491 process()->send(Messages::WebPage::ExecuteEditCommandWithArgument("Paste", data), m_pageID);
494 void WebPageProxy::clipboardContextMenuSelected()
496 static_cast<PageClientImpl*>(m_pageClient)->clipboardContextMenuSelected();
500 #if ENABLE(TIZEN_REMOTE_WEB_INSPECTOR)
501 uint32_t WebPageProxy::startInspectorServer(uint32_t port)
506 uint32_t assignedPort = 0;
507 process()->sendSync(Messages::WebPage::StartInspectorServer(port), Messages::WebPage::StartInspectorServer::Reply(assignedPort), m_pageID);
511 bool WebPageProxy::stopInspectorServer()
517 process()->sendSync(Messages::WebPage::StopInspectorServer(), Messages::WebPage::StopInspectorServer::Reply(result), m_pageID);
522 #if ENABLE(TIZEN_MOBILE_WEB_PRINT)
523 void WebPageProxy::createPagesToPDF(const IntSize& surfaceSize, const IntSize& contentsSize, const String& fileName)
525 process()->send(Messages::WebPage::CreatePagesToPDF(surfaceSize, contentsSize, fileName), m_pageID);
529 #if ENABLE(TIZEN_WEB_STORAGE)
530 #if ENABLE(TIZEN_WEBKIT2_NUMBER_TYPE_SUPPORT)
531 void WebPageProxy::getWebStorageQuotaBytes(PassRefPtr<WebStorageQuotaCallback> prpCallback)
533 RefPtr<WebStorageQuotaCallback> callback = prpCallback;
535 callback->invalidate();
539 uint64_t callbackID = callback->callbackID();
540 m_quotaCallbacks.set(callbackID, callback.get());
541 process()->send(Messages::WebPage::GetStorageQuotaBytes(callbackID), m_pageID);
544 void WebPageProxy::didGetWebStorageQuotaBytes(const uint32_t quota, uint64_t callbackID)
546 RefPtr<WebStorageQuotaCallback> callback = m_quotaCallbacks.take(callbackID);
548 // FIXME: Log error or assert.
549 // this can validly happen if a load invalidated the callback, though
553 m_quotaCallbacks.remove(callbackID);
555 RefPtr<WebUInt32> uint32Object = WebUInt32::create(quota);
556 callback->performCallbackWithReturnValue(uint32Object.release().leakRef());
560 void WebPageProxy::setWebStorageQuotaBytes(uint32_t quota)
565 process()->send(Messages::WebPage::SetStorageQuotaBytes(quota), m_pageID, 0);
569 void WebPageProxy::scale(double scaleFactor, const IntPoint& origin)
571 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
572 static_cast<PageClientImpl*>(m_pageClient)->scaleContents(scaleFactor, origin);
574 scalePage(scaleFactor, origin);
578 void WebPageProxy::scaleImage(double scaleFactor, const IntPoint& origin)
580 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
581 static_cast<PageClientImpl*>(m_pageClient)->scaleImage(scaleFactor, origin);
583 scalePage(scaleFactor, origin);
587 double WebPageProxy::scaleFactor()
589 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
590 return static_cast<PageClientImpl*>(m_pageClient)->scaleFactor();
592 return pageScaleFactor();
596 #if ENABLE(TIZEN_ORIENTATION_EVENTS)
597 void WebPageProxy::sendOrientationChangeEvent(int orientation)
599 process()->send(Messages::WebPage::SendOrientationChangeEvent(orientation), m_pageID, 0);
603 void WebPageProxy::suspendPainting()
608 process()->send(Messages::DrawingArea::SuspendPainting(), m_pageID);
611 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
612 void WebPageProxy::suspendPaintingOfInactiveView()
614 if (!isValid() || isViewVisible())
617 process()->send(Messages::DrawingArea::SuspendPainting(), m_pageID);
621 void WebPageProxy::resumePainting()
626 process()->send(Messages::DrawingArea::ResumePainting(), m_pageID);
629 void WebPageProxy::suspendJavaScriptAndResource()
634 process()->send(Messages::WebPage::SuspendJavaScriptAndResources(), m_pageID);
637 void WebPageProxy::resumeJavaScriptAndResource()
642 process()->send(Messages::WebPage::ResumeJavaScriptAndResources(), m_pageID);
645 #if ENABLE(TIZEN_PLUGIN_SUSPEND_RESUME)
646 void WebPageProxy::suspendPlugin()
651 process()->send(Messages::WebPage::SuspendPlugin(), m_pageID);
654 void WebPageProxy::resumePlugin()
659 process()->send(Messages::WebPage::ResumePlugin(), m_pageID);
663 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
664 bool WebPageProxy::scrollOverflow(const FloatPoint& offset)
669 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION_ON_UI_SIDE)
670 if (static_cast<PageClientImpl*>(m_pageClient)->isScrollableLayerFocused())
671 return drawingArea()->layerTreeCoordinatorProxy()->setOffsetForFocusedScrollingContentsLayer(offset);
673 if (static_cast<PageClientImpl*>(m_pageClient)->isScrollableNodeFocused()) {
674 bool scrolled = false;
675 process()->sendSync(Messages::WebPage::ScrollOverflow(offset), Messages::WebPage::ScrollOverflow::Reply(scrolled), m_pageID);
682 bool WebPageProxy::setPressedNodeAtPoint(const IntPoint& point, bool checkOverflowLayer, WebLayerID& webLayerID)
687 bool pressed = false;
688 process()->sendSync(Messages::WebPage::SetPressedNodeAtPoint(point, checkOverflowLayer), Messages::WebPage::SetPressedNodeAtPoint::Reply(pressed, webLayerID), m_pageID);
693 void WebPageProxy::setOverflowResult(bool pressed, uint32_t webLayerID)
695 static_cast<PageClientImpl*>(m_pageClient)->setOverflowResult(pressed, webLayerID);
699 void WebPageProxy::executeEditCommandWithArgument(const String& commandName, const String& argument)
704 DEFINE_STATIC_LOCAL(String, ignoreSpellingCommandName, ("ignoreSpelling"));
705 if (commandName == ignoreSpellingCommandName)
706 ++m_pendingLearnOrIgnoreWordMessageCount;
708 process()->send(Messages::WebPage::ExecuteEditCommandWithArgument(commandName, argument), m_pageID);
711 void WebPageProxy::replyJavaScriptAlert()
716 m_alertReply->send();
717 m_alertReply = nullptr;
718 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
719 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
723 void WebPageProxy::replyJavaScriptConfirm(bool result)
728 m_confirmReply->send(result);
729 m_confirmReply = nullptr;
730 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
731 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
735 void WebPageProxy::replyJavaScriptPrompt(const String& result)
740 m_promptReply->send(result);
741 m_promptReply = nullptr;
742 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
743 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
747 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
748 void WebPageProxy::replyBeforeUnloadConfirmPanel(bool result)
750 if (!m_beforeUnloadConfirmPanelReply)
753 m_beforeUnloadConfirmPanelReply->send(result);
754 m_beforeUnloadConfirmPanelReply = nullptr;
755 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
756 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
761 #if ENABLE(TIZEN_ON_AUTHENTICATION_REQUESTED)
762 void WebPageProxy::replyReceiveAuthenticationChallengeInFrame(bool result)
767 m_AuthReply->send(result);
768 m_AuthReply = nullptr;
772 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
773 void WebPageProxy::replyPolicyForCertificateError(bool result)
778 m_allowedReply->send(result);
779 m_allowedReply = nullptr;
783 #if PLUGIN_ARCHITECTURE(X11)
784 void WebPageProxy::createPluginContainer(uint64_t& windowID)
789 void WebPageProxy::windowedPluginGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect, uint64_t windowID)
795 void WebPageProxy::didRenderFrame()
797 static_cast<PageClientImpl*>(m_pageClient)->didRenderFrame();
800 void WebPageProxy::setBackgroundColor(double red, double green, double blue, double alpha)
802 static_cast<PageClientImpl*>(m_pageClient)->setBackgroundColor(red, green, blue, alpha);
805 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
806 bool WebPageProxy::makeContextCurrent()
808 return static_cast<PageClientImpl*>(m_pageClient)->makeContextCurrent();
812 #if ENABLE(TIZEN_WEBKIT2_GET_TEXT_STYLE_FOR_SELECTION)
813 void WebPageProxy::getTextStyleStateForSelection()
815 process()->send(Messages::WebPage::GetTextStyleStateForSelection(), m_pageID, 0);
818 void WebPageProxy::didGetTextStyleStateForSelection(int underlineState, int italicState, int boldState)
820 static_cast<PageClientImpl*>(m_pageClient)->didGetTextStyleStateForSelection(underlineState, italicState, boldState);
824 #if ENABLE(TIZEN_ICON_DATABASE)
825 void WebPageProxy::didReceiveIcon()
827 static_cast<PageClientImpl*>(m_pageClient)->didReceiveIcon();
831 #if ENABLE(TIZEN_MULTIPLE_SELECT)
832 void WebPageProxy::valueChangedForPopupMenuMultiple(WebPopupMenuProxy*, Vector<int32_t> newSelectedIndex)
834 process()->send(Messages::WebPage::DidChangeSelectedIndexForActivePopupMenuMultiple(newSelectedIndex), m_pageID);
838 #if ENABLE(TIZEN_WEBKIT2_HISTORICAL_RESTORE_VISIBLE_CONTENT_RECT)
839 void WebPageProxy::pageDidRequestRestoreVisibleContentRect(const IntPoint& point, float scale)
841 m_pageClient->pageDidRequestRestoreVisibleContentRect(point, scale);
845 #if ENABLE(TIZEN_OFFLINE_PAGE_SAVE)
846 void WebPageProxy::saveSerializedHTMLDataForMainPage(const String& serializedData, const String& fileName)
848 static_cast<PageClientImpl*>(m_pageClient)->saveSerializedHTMLDataForMainPage(serializedData, fileName);
851 void WebPageProxy::saveSubresourcesData(Vector<WebSubresourceTizen> subresourceData)
853 static_cast<PageClientImpl*>(m_pageClient)->saveSubresourcesData(subresourceData);
856 void WebPageProxy::startOfflinePageSave(String subresourceFolderName)
861 process()->send(Messages::WebPage::StartOfflinePageSave(subresourceFolderName), m_pageID);
865 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
866 bool WebPageProxy::selectClosestWord(const IntPoint& point, bool isStartedTextSelectionFromOutside)
872 process()->sendSync(Messages::WebPage::SelectClosestWord(point, isStartedTextSelectionFromOutside), Messages::WebPage::SelectClosestWord::Reply(result), m_pageID);
876 bool WebPageProxy::setLeftSelection(const IntPoint& point)
882 process()->sendSync(Messages::WebPage::SetLeftSelection(point), Messages::WebPage::SetLeftSelection::Reply(result), m_pageID);
886 bool WebPageProxy::setRightSelection(const IntPoint& point)
892 process()->sendSync(Messages::WebPage::SetRightSelection(point), Messages::WebPage::SetRightSelection::Reply(result), m_pageID);
896 bool WebPageProxy::getSelectionHandlers(IntRect& leftRect, IntRect& rightRect)
902 process()->sendSync(Messages::WebPage::GetSelectionHandlers(), Messages::WebPage::GetSelectionHandlers::Reply(leftRect, rightRect), m_pageID);
903 if (!leftRect.size().isZero() || !rightRect.size().isZero())
909 String WebPageProxy::getSelectionText()
915 process()->sendSync(Messages::WebPage::GetSelectionText(), Messages::WebPage::GetSelectionText::Reply(ret), m_pageID);
919 bool WebPageProxy::selectionRangeClear()
925 process()->sendSync(Messages::WebPage::SelectionRangeClear(), Messages::WebPage::SelectionRangeClear::Reply(result), m_pageID);
929 bool WebPageProxy::scrollContentByCharacter(const IntPoint& point, SelectionDirection direction)
935 process()->sendSync(Messages::WebPage::ScrollContentByCharacter(point, direction), Messages::WebPage::ScrollContentByCharacter::Reply(result), m_pageID);
940 #if ENABLE(TIZEN_LINK_MAGNIFIER)
941 void WebPageProxy::getLinkMagnifierRect(const WebCore::IntPoint& position, const WebCore::IntSize& size)
943 process()->send(Messages::WebPage::GetLinkMagnifierRect(position, size), m_pageID);
946 void WebPageProxy::didGetLinkMagnifierRect(const IntPoint& position, const IntRect& rect)
949 LinkMagnifierProxy::linkMagnifier().show(EwkViewImpl::fromEvasObject(viewWidget()), position, rect);
954 void WebPageProxy::openLink(const IntPoint& position)
956 #if ENABLE(GESTURE_EVENTS)
957 IntPoint globalPosition(EwkViewImpl::fromEvasObject(viewWidget())->transformToScreen().mapPoint(position));
958 WebGestureEvent gesture(WebEvent::GestureSingleTap, position, globalPosition, WebEvent::Modifiers(0), ecore_time_get());
959 handleGestureEvent(gesture);
964 #if ENABLE(TIZEN_SCREEN_READER)
965 void WebPageProxy::raiseTapEvent(const IntPoint& position)
967 #if ENABLE(GESTURE_EVENTS)
968 IntPoint globalPosition = EwkViewImpl::fromEvasObject(viewWidget())->transformToScreen().mapPoint(position);
969 process()->send(Messages::WebPage::RaiseTapEvent(position, globalPosition), m_pageID);
971 UNUSED_PARAM(position);
975 bool WebPageProxy::moveScreenReaderFocus(bool forward)
978 process()->sendSync(Messages::WebPage::MoveScreenReaderFocus(forward), Messages::WebPage::MoveScreenReaderFocus::Reply(result), m_pageID);
982 void WebPageProxy::moveScreenReaderFocusByPoint(const IntPoint& point)
984 process()->send(Messages::WebPage::MoveScreenReaderFocusByPoint(point), m_pageID);
987 void WebPageProxy::recalcScreenReaderFocusRect()
989 if (!ScreenReaderProxy::screenReader().isEnabled())
992 process()->send(Messages::WebPage::RecalcScreenReaderFocusRect(), m_pageID);
995 void WebPageProxy::clearScreenReader()
997 process()->send(Messages::WebPage::ClearScreenReader(), m_pageID);
1000 void WebPageProxy::didScreenReaderFocusRectChanged(const IntRect& rect)
1002 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
1003 FocusRing* focusRing = ewkViewGetFocusRing(viewWidget());
1007 if (!rect.isEmpty())
1008 focusRing->show(rect);
1010 focusRing->hide(false);
1016 void WebPageProxy::didScreenReaderTextChanged(const String& text)
1018 ScreenReaderProxy::screenReader().setText(text);
1022 #if ENABLE(TIZEN_CSP)
1023 void WebPageProxy::setContentSecurityPolicy(const String& policy, WebCore::ContentSecurityPolicy::HeaderType type)
1025 process()->send(Messages::WebPage::SetContentSecurityPolicy(policy, type), m_pageID);
1029 #if ENABLE(TIZEN_APPLICATION_CACHE)
1030 void WebPageProxy::requestApplicationCachePermission(uint64_t frameID, const String& originIdentifier, PassRefPtr<Messages::WebPageProxy::RequestApplicationCachePermission::DelayedReply> allow)
1032 WebFrameProxy* frame = process()->webFrame(frameID);
1033 MESSAGE_CHECK(frame);
1035 // Since requestApplicationCachePermission() can spin a nested run loop we need to turn off the responsiveness timer.
1036 process()->responsivenessTimer()->stop();
1038 m_applicationCacheReply = allow;
1039 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1040 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
1042 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
1044 if (!m_tizenClient.decidePolicyForApplicationCachePermissionRequest(this, origin.get(), frame))
1045 replyApplicationCachePermission(true);
1048 void WebPageProxy::replyApplicationCachePermission(bool allow)
1050 if (!m_applicationCacheReply)
1053 m_applicationCacheReply->send(allow);
1054 m_applicationCacheReply = nullptr;
1055 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1056 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
1061 #if ENABLE(TIZEN_INDEXED_DATABASE)
1062 void WebPageProxy::exceededIndexedDatabaseQuota(uint64_t frameID, const String& originIdentifier, int64_t currentUsage, PassRefPtr<Messages::WebPageProxy::ExceededIndexedDatabaseQuota::DelayedReply> reply)
1064 WebFrameProxy* frame = process()->webFrame(frameID);
1065 MESSAGE_CHECK(frame);
1067 // Since exceededIndexedDatabaseQuota() can spin a nested run loop we need to turn off the responsiveness timer.
1068 process()->responsivenessTimer()->stop();
1070 m_exceededIndexedDatabaseQuotaReply = reply;
1071 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1072 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
1075 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
1077 if (!m_tizenClient.exceededIndexedDatabaseQuota(this, origin.get(), currentUsage, frame))
1078 replyExceededIndexedDatabaseQuota(false);
1081 void WebPageProxy::replyExceededIndexedDatabaseQuota(bool allow)
1083 if (!m_exceededIndexedDatabaseQuotaReply)
1086 m_exceededIndexedDatabaseQuotaReply->send(allow);
1087 m_exceededIndexedDatabaseQuotaReply = nullptr;
1088 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1089 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
1094 #if ENABLE(TIZEN_SQL_DATABASE)
1095 void WebPageProxy::replyExceededDatabaseQuota(bool allow)
1097 if (!m_exceededDatabaseQuotaReply) {
1098 TIZEN_LOGE("m_exceededDatabaseQuotaReply does not exist");
1102 m_exceededDatabaseQuotaReply->send(allow);
1103 m_exceededDatabaseQuotaReply = nullptr;
1104 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1105 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
1110 #if ENABLE(TIZEN_FILE_SYSTEM)
1111 void WebPageProxy::exceededLocalFileSystemQuota(uint64_t frameID, const String& originIdentifier, int64_t currentUsage, PassRefPtr<Messages::WebPageProxy::ExceededLocalFileSystemQuota::DelayedReply> reply)
1113 WebFrameProxy* frame = process()->webFrame(frameID);
1114 MESSAGE_CHECK(frame);
1116 // Since exceededLocalFileSystemQuota() can spin a nested run loop we need to turn off the responsiveness timer.
1117 process()->responsivenessTimer()->stop();
1118 m_exceededLocalFileSystemQuotaReply = reply;
1119 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1120 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
1123 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
1125 if (!m_tizenClient.exceededLocalFileSystemQuota(this, origin.get(), currentUsage, frame))
1126 replyExceededLocalFileSystemQuota(false);
1129 void WebPageProxy::replyExceededLocalFileSystemQuota(bool allow)
1131 if (!m_exceededLocalFileSystemQuotaReply)
1134 m_exceededLocalFileSystemQuotaReply->send(allow);
1135 m_exceededLocalFileSystemQuotaReply = nullptr;
1136 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1137 process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
1142 #endif // #if OS(TIZEN)
1144 void WebPageProxy::handleInputMethodKeydown(bool& handled)
1146 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1147 handled = m_keyEventQueue.first().forwardedEvent.isFiltered();
1149 handled = m_keyEventQueue.first().isFiltered();
1153 void WebPageProxy::confirmComposition(const String& compositionString)
1158 #if ENABLE(TIZEN_ISF_PORT)
1159 if (m_didCancelCompositionFromWebProcess)
1163 process()->send(Messages::WebPage::ConfirmComposition(compositionString), m_pageID, 0);
1166 void WebPageProxy::setComposition(const String& compositionString, Vector<WebCore::CompositionUnderline>& underlines, int cursorPosition)
1171 #if ENABLE(TIZEN_REDUCE_KEY_LAGGING)
1172 // Suspend layout&paint at the key input, and resume layout&paint after 150 ms.
1173 suspendActiveDOMObjectsAndAnimations();
1174 if (m_pageContentResumeTimer)
1175 ecore_timer_del(m_pageContentResumeTimer);
1176 m_pageContentResumeTimer = ecore_timer_add(150.0/1000.0, pageContentResumeTimerFired, this);
1179 process()->send(Messages::WebPage::SetComposition(compositionString, underlines, cursorPosition), m_pageID, 0);
1182 void WebPageProxy::cancelComposition()
1187 process()->send(Messages::WebPage::CancelComposition(), m_pageID, 0);
1190 #if ENABLE(TIZEN_USE_SETTINGS_FONT)
1191 void WebPageProxy::useSettingsFont()
1193 process()->send(Messages::WebPage::UseSettingsFont(), m_pageID, 0);
1197 } // namespace WebKit