Implement Focus UI
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / WebPageProxy.cpp
index 10901d4..1b39b9c 100755 (executable)
@@ -34,6 +34,7 @@
 #include "DrawingAreaProxy.h"
 #include "EventDispatcherMessages.h"
 #include "FindIndicator.h"
+#include "ImmutableArray.h"
 #include "Logging.h"
 #include "MessageID.h"
 #include "NativeWebKeyboardEvent.h"
 #include "ArgumentCodersGtk.h"
 #endif
 
+#if USE(SOUP)
+#include "WebSoupRequestManagerProxy.h"
+#endif
+
 #if ENABLE(TIZEN_DRAG_SUPPORT)
 #include "ArgumentCodersTizen.h"
 #endif
 #include <wtf/RefCountedLeakCounter.h>
 #endif
 
-#if ENABLE(TIZEN_ISF_PORT)
-#include <WebCore/Logging.h>
-#endif
 #if ENABLE(TIZEN_ISF_PORT) || ENABLE(TIZEN_GESTURE)
-#include "ewk_view_private.h"
+#include "EwkViewImpl.h"
+#include "InputMethodContextEfl.h"
+#endif
+
+#if ENABLE(TIZEN_VIEWPORT_META_TAG)
+#include <WebCore/EflScreenUtilities.h>
 #endif
 
 // This controls what strategy we use for mouse wheel coalescing.
@@ -187,7 +194,7 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> p
     , m_textZoomFactor(1)
     , m_pageZoomFactor(1)
     , m_pageScaleFactor(1)
-    , m_intrinsicDeviceScaleFactor(1)
+    , m_intrinsicDeviceScaleFactor(getMobileDPI() / 160)
     , m_customDeviceScaleFactor(0)
 #if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
     , m_layerHostingMode(LayerHostingModeInWindowServer)
@@ -244,6 +251,18 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> p
 #if ENABLE(PAGE_VISIBILITY_API)
     , m_visibilityState(PageVisibilityStateVisible)
 #endif
+#if ENABLE(TIZEN_REDUCE_KEY_LAGGING)
+    , m_pageContentResumeTimer(0)
+#endif
+#if ENABLE(TIZEN_ISF_PORT)
+    , m_didCancelCompositionFromWebProcess(false)
+#endif
+#if ENABLE(TIZEN_WEBKIT2_NOTIFY_SUSPEND_BY_REMOTE_WEB_INSPECTOR)
+    , m_contentSuspendedByInspector(false)
+#endif
+#if ENABLE(TIZEN_FOCUS_UI)
+    , m_spatialNavigationEnabled(false)
+#endif
 {
 #ifndef NDEBUG
     webPageProxyCounter.increment();
@@ -269,6 +288,10 @@ WebPageProxy::~WebPageProxy()
 #ifndef NDEBUG
     webPageProxyCounter.decrement();
 #endif
+#if ENABLE(TIZEN_REDUCE_KEY_LAGGING)
+    if (m_pageContentResumeTimer)
+        ecore_timer_del(m_pageContentResumeTimer);
+#endif
 }
 
 WebProcessProxy* WebPageProxy::process() const
@@ -334,6 +357,11 @@ void WebPageProxy::initializeFindClient(const WKPageFindClient* client)
     m_findClient.initialize(client);
 }
 
+void WebPageProxy::initializeFindMatchesClient(const WKPageFindMatchesClient* client)
+{
+    m_findMatchesClient.initialize(client);
+}
+
 #if ENABLE(CONTEXT_MENUS)
 void WebPageProxy::initializeContextMenuClient(const WKPageContextMenuClient* client)
 {
@@ -460,6 +488,7 @@ void WebPageProxy::close()
 
 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
     invalidateCallbackMap(m_booleanCallbacks);
+    invalidateCallbackMap(m_dictionaryCallbacks);
 #endif
     invalidateCallbackMap(m_voidCallbacks);
     invalidateCallbackMap(m_dataCallbacks);
@@ -594,6 +623,12 @@ void WebPageProxy::loadContentsbyMimeType(const WebData* contents, const String&
         reattachToWebProcess();
 
     process()->assumeReadAccessToBaseURL(baseURL);
+#if ENABLE(TIZEN_UNIVERSAL_FILE_READ_ACCESS)
+    SandboxExtension::Handle sandboxExtensionHandleEmail;
+    bool createdExtension = maybeInitializeSandboxExtensionHandle(KURL(KURL(), baseURL), sandboxExtensionHandleEmail);
+    if (createdExtension)
+        process()->willAcquireUniversalFileReadSandboxExtension();
+#endif
     process()->send(Messages::WebPage::LoadContentsbyMimeType(contents->dataReference(), mimeType, encoding, baseURL), m_pageID);
     process()->responsivenessTimer()->start();
 }
@@ -980,6 +1015,7 @@ void WebPageProxy::performDrag(DragData* dragData, const String& dragStorageName
 #endif
 {
 #if ENABLE(TIZEN_DRAG_SUPPORT)
+    TIZEN_LOGI("dragData (%p)", dragData);
     SandboxExtension::Handle sandboxExtensionHandle;
     SandboxExtension::HandleArray sandboxExtensionHandleEmptyArray;
     performDragControllerAction(DragControllerActionPerformDrag, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionHandleEmptyArray);
@@ -1011,6 +1047,7 @@ void WebPageProxy::didPerformDragControllerAction(WebCore::DragSession dragSessi
 #if PLATFORM(QT) || PLATFORM(GTK) || ENABLE(TIZEN_DRAG_SUPPORT)
 void WebPageProxy::startDrag(const DragData& dragData, const ShareableBitmap::Handle& dragImageHandle)
 {
+    TIZEN_LOGI("dragData (%p)", dragData);
     RefPtr<ShareableBitmap> dragImage = 0;
     if (!dragImageHandle.isNull()) {
         dragImage = ShareableBitmap::create(dragImageHandle);
@@ -1024,6 +1061,7 @@ void WebPageProxy::startDrag(const DragData& dragData, const ShareableBitmap::Ha
 
 void WebPageProxy::dragEnded(const IntPoint& clientPosition, const IntPoint& globalPosition, uint64_t operation)
 {
+    TIZEN_LOGI("clientPosition (%p)", clientPosition);
     if (!isValid())
         return;
     process()->send(Messages::WebPage::DragEnded(clientPosition, globalPosition, operation), m_pageID);
@@ -1224,9 +1262,22 @@ void WebPageProxy::handleGestureEvent(const WebGestureEvent& event)
     if (!isValid())
         return;
 
+#if ENABLE(TIZEN_ISF_PORT) || ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
+    if (event.type() == WebEvent::GestureSingleTap) {
+#if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
+        FocusRing* focusRing = ewkViewGetFocusRing(viewWidget());
+        if (focusRing) {
+            IntPoint tapPosition = EwkViewImpl::fromEvasObject(viewWidget())->transformToScene().mapPoint(event.position());
+            focusRing->requestToShow(tapPosition, true);
+        }
+#endif
+
 #if ENABLE(TIZEN_ISF_PORT)
-    if (event.type() == WebEvent::GestureSingleTap)
-        ewk_view_imf_context_reset(viewWidget());
+        InputMethodContextEfl* inputMethodContext = static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->inputMethodContext();
+        if (inputMethodContext)
+            inputMethodContext->resetIMFContext();
+#endif
+    }
 #endif
 
 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
@@ -1263,7 +1314,11 @@ void WebPageProxy::handlePotentialActivation(const IntPoint& touchPoint, const I
 
 void WebPageProxy::handleTouchEvent(const NativeWebTouchEvent& event)
 {
+#if ENABLE(TIZEN_WEBKIT2_NOTIFY_SUSPEND_BY_REMOTE_WEB_INSPECTOR)
+    if (!isValid() || isContentSuspendedByInspector())
+#else
     if (!isValid())
+#endif
         return;
 
     // If the page is suspended, which should be the case during panning, pinching
@@ -1565,9 +1620,6 @@ void WebPageProxy::scalePage(double scale, const IntPoint& origin)
         return;
 
     process()->send(Messages::WebPage::ScalePage(scale, origin), m_pageID);
-#if OS(TIZEN)
-    m_pageClient->setRequestedScaleFactor(scale);
-#endif
 }
 
 void WebPageProxy::setIntrinsicDeviceScaleFactor(float scaleFactor)
@@ -1706,6 +1758,16 @@ void WebPageProxy::setMemoryCacheClientCallsEnabled(bool memoryCacheClientCallsE
     process()->send(Messages::WebPage::SetMemoryCacheMessagesEnabled(memoryCacheClientCallsEnabled), m_pageID);
 }
 
+void WebPageProxy::findStringMatches(const String& string, FindOptions options, unsigned maxMatchCount)
+{
+    if (string.isEmpty()) {
+        didFindStringMatches(string, Vector<Vector<WebCore::IntRect> > (), 0);
+        return;
+    }
+
+    m_process->send(Messages::WebPage::FindStringMatches(string, options, maxMatchCount), m_pageID);
+}
+
 void WebPageProxy::findString(const String& string, FindOptions options, unsigned maxMatchCount)
 {
     if (m_mainFrameHasCustomRepresentation)
@@ -1714,6 +1776,16 @@ void WebPageProxy::findString(const String& string, FindOptions options, unsigne
         process()->send(Messages::WebPage::FindString(string, options, maxMatchCount), m_pageID);
 }
 
+void WebPageProxy::getImageForFindMatch(int32_t matchIndex)
+{
+    m_process->send(Messages::WebPage::GetImageForFindMatch(matchIndex), m_pageID);
+}
+
+void WebPageProxy::selectFindMatch(int32_t matchIndex)
+{
+    m_process->send(Messages::WebPage::SelectFindMatch(matchIndex), m_pageID);
+}
+
 void WebPageProxy::hideFindUI()
 {
     process()->send(Messages::WebPage::HideFindUI(), m_pageID);
@@ -1796,6 +1868,21 @@ void WebPageProxy::getContentsAsString(PassRefPtr<StringCallback> prpCallback)
     process()->send(Messages::WebPage::GetContentsAsString(callbackID), m_pageID);
 }
 
+#if ENABLE(MHTML)
+void WebPageProxy::getContentsAsMHTMLData(PassRefPtr<DataCallback> prpCallback, bool useBinaryEncoding)
+{
+    RefPtr<DataCallback> callback = prpCallback;
+    if (!isValid()) {
+        callback->invalidate();
+        return;
+    }
+
+    uint64_t callbackID = callback->callbackID();
+    m_dataCallbacks.set(callbackID, callback.get());
+    process()->send(Messages::WebPage::GetContentsAsMHTMLData(callbackID, useBinaryEncoding), m_pageID);
+}
+#endif
+
 void WebPageProxy::getSelectionOrContentsAsString(PassRefPtr<StringCallback> prpCallback)
 {
     RefPtr<StringCallback> callback = prpCallback;
@@ -2017,12 +2104,6 @@ void WebPageProxy::didStartProgress()
 {
     m_estimatedProgress = initialProgressValue;
 
-#if OS(TIZEN)
-    //FIXME: After ewk_view_loader_client is implemented,
-    // consider this line to move to loaderClient.
-    m_pageClient->didStartProgress();
-#endif
-
     m_loaderClient.didStartProgress(this);
 }
 
@@ -2037,11 +2118,6 @@ void WebPageProxy::didFinishProgress()
 {
     m_estimatedProgress = 1.0;
 
-#if OS(TIZEN)
-    //FIXME: consider to move this to loaderClient.
-    m_pageClient->didFinishProgress();
-#endif
-
     m_loaderClient.didFinishProgress(this);
 }
 
@@ -2192,11 +2268,6 @@ void WebPageProxy::didFinishLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDeco
 
     frame->didFinishLoad();
 
-#if OS(TIZEN)
-    if (frame->isMainFrame())
-        m_pageClient->didFinishLoadForMainFrame();
-#endif
-
     m_loaderClient.didFinishLoadForFrame(this, frame, userData.get());
 #if ENABLE(TIZEN_NATIVE_MEMORY_SNAPSHOT)
     if (isMemorySnapshot && isMemorySnapshot[0] != '0')
@@ -2480,7 +2551,11 @@ void WebPageProxy::unableToImplementPolicy(uint64_t frameID, const ResourceError
 
 // FormClient
 
+#if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
+void WebPageProxy::willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, bool containsPasswordData, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments)
+#else
 void WebPageProxy::willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments)
+#endif
 {
     RefPtr<APIObject> userData;
     WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
@@ -2494,7 +2569,11 @@ void WebPageProxy::willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, cons
     MESSAGE_CHECK(sourceFrame);
 
     RefPtr<WebFormSubmissionListenerProxy> listener = frame->setUpFormSubmissionListenerProxy(listenerID);
+#if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
+    if (!m_formClient.willSubmitForm(this, frame, sourceFrame, textFieldValues.stringPairVector(), containsPasswordData, userData.get(), listener.get()))
+#else
     if (!m_formClient.willSubmitForm(this, frame, sourceFrame, textFieldValues.stringPairVector(), userData.get(), listener.get()))
+#endif
         listener->continueSubmission();
 }
 
@@ -2580,7 +2659,11 @@ void WebPageProxy::closePage(bool stopResponsivenessTimer)
 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
 bool WebPageProxy::isWaitingForJavaScriptPopupReply()
 {
+#if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
+    return m_alertReply || m_confirmReply || m_promptReply || m_beforeUnloadConfirmPanelReply;
+#else
     return m_alertReply || m_confirmReply || m_promptReply;
+#endif
 }
 #endif
 
@@ -2594,6 +2677,9 @@ void WebPageProxy::runJavaScriptAlert(uint64_t frameID, const String& message, P
     process()->responsivenessTimer()->stop();
 
     m_alertReply = reply;
+#if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
+    m_uiClient.notifyPopupReplyWaitingState(this, true);
+#endif
 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
     process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
 #endif
@@ -2610,6 +2696,9 @@ void WebPageProxy::runJavaScriptConfirm(uint64_t frameID, const String& message,
     process()->responsivenessTimer()->stop();
 
     m_confirmReply = reply;
+#if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
+    m_uiClient.notifyPopupReplyWaitingState(this, true);
+#endif
 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
     process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
 #endif
@@ -2626,6 +2715,9 @@ void WebPageProxy::runJavaScriptPrompt(uint64_t frameID, const String& message,
     process()->responsivenessTimer()->stop();
 
     m_promptReply = reply;
+#if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
+    m_uiClient.notifyPopupReplyWaitingState(this, true);
+#endif
 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
     process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
 #endif
@@ -2760,7 +2852,24 @@ void WebPageProxy::windowToScreen(const IntRect& viewRect, IntRect& result)
 {
     result = m_pageClient->windowToScreen(viewRect);
 }
-    
+
+#if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
+void WebPageProxy::runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, PassRefPtr<Messages::WebPageProxy::RunBeforeUnloadConfirmPanel::DelayedReply> reply)
+{
+    WebFrameProxy* frame = process()->webFrame(frameID);
+    MESSAGE_CHECK(frame);
+
+    // Since runBeforeUnloadConfirmPanel() can spin a nested run loop we need to turn off the responsiveness timer.
+    process()->responsivenessTimer()->stop();
+
+    m_beforeUnloadConfirmPanelReply = reply;
+#if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
+    process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
+#endif
+    if (!m_uiClient.runBeforeUnloadConfirmPanel(this, message, frame))
+        replyBeforeUnloadConfirmPanel(false);
+}
+#else
 void WebPageProxy::runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose)
 {
     WebFrameProxy* frame = process()->webFrame(frameID);
@@ -2771,6 +2880,7 @@ void WebPageProxy::runBeforeUnloadConfirmPanel(const String& message, uint64_t f
 
     shouldClose = m_uiClient.runBeforeUnloadConfirmPanel(this, message, frame);
 }
+#endif
 
 #if USE(TILED_BACKING_STORE)
 void WebPageProxy::pageDidRequestScroll(const IntPoint& point)
@@ -2900,12 +3010,6 @@ void WebPageProxy::getWebAppCapable(PassRefPtr<BooleanCallback> prpCallback)
 void WebPageProxy::didGetWebAppCapable(const bool capable, uint64_t callbackID)
 {
     RefPtr<BooleanCallback> callback = m_booleanCallbacks.take(callbackID);
-    if (!callback) {
-        // FIXME: Log error or assert.
-        // this can validly happen if a load invalidated the callback, though
-        return;
-    }
-
     m_booleanCallbacks.remove(callbackID);
     callback->performCallbackWithReturnValue(WebBoolean::create(capable).leakRef());
 }
@@ -2935,6 +3039,30 @@ void WebPageProxy::didGetWebAppIconURL(const String& iconURL, uint64_t callbackI
     m_stringCallbacks.remove(callbackID);
     callback->performCallbackWithReturnValue(iconURL.impl());
 }
+
+void WebPageProxy::getWebAppIconURLs(PassRefPtr<DictionaryCallback> prpCallback)
+{
+    RefPtr<DictionaryCallback> callback = prpCallback;
+    if (!isValid()) {
+        callback->invalidate();
+        return;
+    }
+
+    uint64_t callbackID = callback->callbackID();
+    m_dictionaryCallbacks.set(callbackID, callback.get());
+    process()->send(Messages::WebPage::GetWebAppIconURLs(callbackID), m_pageID);
+}
+
+void WebPageProxy::didGetWebAppIconURLs(const StringPairVector& iconURLs, uint64_t callbackID)
+{
+    RefPtr<DictionaryCallback> callback = m_dictionaryCallbacks.take(callbackID);
+    ImmutableDictionary::MapType iconURLList;
+    size_t iconURLCount = iconURLs.stringPairVector().size();
+    for (size_t i = 0; i < iconURLCount; ++i)
+        iconURLList.set(iconURLs.stringPairVector()[i].first, WebString::create(iconURLs.stringPairVector()[i].second));
+
+    callback->performCallbackWithReturnValue(ImmutableDictionary::adopt(iconURLList).get());
+}
 #endif
 
 void WebPageProxy::setMediaVolume(float volume)
@@ -3175,7 +3303,7 @@ void WebPageProxy::editorStateChanged(const EditorState& editorState)
 
 #if PLATFORM(MAC)
     m_pageClient->updateTextInputState(couldChangeSecureInputState);
-#elif PLATFORM(QT) || ENABLE(TIZEN_ISF_PORT)
+#elif PLATFORM(QT) || PLATFORM(EFL)
     m_pageClient->updateTextInputState();
 #endif
 }
@@ -3208,6 +3336,11 @@ void WebPageProxy::didCountStringMatches(const String& string, uint32_t matchCou
     m_findClient.didCountStringMatches(this, string, matchCount);
 }
 
+void WebPageProxy::didGetImageForFindMatch(const ShareableBitmap::Handle& contentImageHandle, uint32_t matchIndex)
+{
+    m_findMatchesClient.didGetImageForMatchResult(this, WebImage::create(ShareableBitmap::create(contentImageHandle)).get(), matchIndex);
+}
+
 void WebPageProxy::setFindIndicator(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, const ShareableBitmap::Handle& contentImageHandle, bool fadeOut, bool animate)
 {
     RefPtr<FindIndicator> findIndicator = FindIndicator::create(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, contentImageScaleFactor, contentImageHandle);
@@ -3219,6 +3352,24 @@ void WebPageProxy::didFindString(const String& string, uint32_t matchCount)
     m_findClient.didFindString(this, string, matchCount);
 }
 
+void WebPageProxy::didFindStringMatches(const String& string, Vector<Vector<WebCore::IntRect> > matchRects, int32_t firstIndexAfterSelection)
+{
+    Vector<RefPtr<APIObject> > matches;
+    matches.reserveInitialCapacity(matchRects.size());
+
+    for (size_t i = 0; i < matchRects.size(); ++i) {
+        const Vector<WebCore::IntRect>& rects = matchRects[i];
+        size_t numRects = matchRects[i].size();
+        Vector<RefPtr<APIObject> > apiRects;
+        apiRects.reserveInitialCapacity(numRects);
+
+        for (size_t i = 0; i < numRects; ++i)
+            apiRects.uncheckedAppend(WebRect::create(toAPI(rects[i])));
+        matches.uncheckedAppend(ImmutableArray::adopt(apiRects));
+    }
+    m_findMatchesClient.didFindStringMatches(this, string, ImmutableArray::adopt(matches).get(), firstIndexAfterSelection);
+}
+
 void WebPageProxy::didFailToFindString(const String& string)
 {
     m_findClient.didFailToFindString(this, string);
@@ -3293,10 +3444,6 @@ void WebPageProxy::updatePopupMenu(uint64_t textDirection, const Vector<WebPopup
 #if ENABLE(CONTEXT_MENUS)
 void WebPageProxy::showContextMenu(const IntPoint& menuLocation, const WebHitTestResult::Data& hitTestResultData, const Vector<WebContextMenuItemData>& proposedItems, CoreIPC::ArgumentDecoder* arguments)
 {
-#if ENABLE(TOUCH_EVENTS) && ENABLE(TIZEN_GESTURE) && ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
-    // Cancel touch event when ContextMenu is shown.
-    m_pageClient->cancelTouchEvent();
-#endif
     internalShowContextMenu(menuLocation, hitTestResultData, proposedItems, arguments);
 
     // No matter the result of internalShowContextMenu, always notify the WebProcess that the menu is hidden so it starts handling mouse events again.
@@ -3334,6 +3481,7 @@ void WebPageProxy::internalShowContextMenu(const IntPoint& menuLocation, const W
 
 void WebPageProxy::contextMenuItemSelected(const WebContextMenuItemData& item)
 {
+    TIZEN_LOGI("selected item : action(%d), title(%s)", item.action(), item.title().utf8().data());
     // Application custom items don't need to round-trip through to WebCore in the WebProcess.
     if (item.action() >= ContextMenuItemBaseApplicationTag) {
         m_contextMenuClient.customContextMenuItemSelected(this, item);
@@ -3343,11 +3491,6 @@ void WebPageProxy::contextMenuItemSelected(const WebContextMenuItemData& item)
         return;
     }
 
-#if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
-    if (item.action() == ContextMenuItemTagPaste)
-        m_pageClient->setIsTextSelectionMode(false);
-#endif
-
 #if PLATFORM(MAC)
     if (item.action() == ContextMenuItemTagSmartCopyPaste) {
         setSmartInsertDeleteEnabled(!isSmartInsertDeleteEnabled());
@@ -3677,6 +3820,13 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
         m_gestureEventQueue.removeFirst();
         m_pageClient->doneWithGestureEvent(event, handled);
 #endif
+
+#if ENABLE(TIZEN_ISF_PORT)
+        if (m_isVisible && type == WebEvent::GestureSingleTap) {
+            InputMethodContextEfl* inputMethodContext = static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->inputMethodContext();
+            inputMethodContext->updateTextInputStateByUserAction(true);
+        }
+#endif
         break;
     }
 #endif
@@ -3706,20 +3856,11 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
 
 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
         QueuedUIEvents<NativeWebKeyboardEvent> queuedEvents = m_keyEventQueue.first();
-        MESSAGE_CHECK(type == queuedEvents.forwardedEvent.type());
+        NativeWebKeyboardEvent event = queuedEvents.forwardedEvent;
+        MESSAGE_CHECK(type == event.type());
         m_keyEventQueue.removeFirst();
 
-        m_pageClient->doneWithKeyEvent(queuedEvents.forwardedEvent, handled);
-
-        if (!handled) {
-            if (m_uiClient.implementsDidNotHandleKeyEvent())
-                m_uiClient.didNotHandleKeyEvent(this, queuedEvents.forwardedEvent);
-#if PLATFORM(WIN)
-            else
-                ::TranslateMessage(queuedEvents.forwardedEvent.nativeEvent());
-#endif
-        }
-
+        m_pageClient->doneWithKeyEvent(event, handled);
         for (size_t i = 0; i < queuedEvents.deferredEvents.size(); ++i) {
             bool isEventHandled = false;
             m_pageClient->doneWithKeyEvent(queuedEvents.deferredEvents.at(i), isEventHandled);
@@ -3734,16 +3875,23 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
             process()->send(Messages::WebPage::KeyEvent(m_keyEventQueue.first()), m_pageID);
 
         m_pageClient->doneWithKeyEvent(event, handled);
+#endif // #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
+
         if (handled)
             break;
 
+#if ENABLE(TIZEN_ISF_PORT)
+        InputMethodContextEfl* inputMethodContext = static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->inputMethodContext();
+        if (event.type() == WebEvent::KeyDown && event.keyIdentifier() == "Enter" && inputMethodContext && inputMethodContext->autoCapitalType() == ECORE_IMF_AUTOCAPITAL_TYPE_NONE)
+            inputMethodContext->hideIMFContext();
+#endif
+
         if (m_uiClient.implementsDidNotHandleKeyEvent())
             m_uiClient.didNotHandleKeyEvent(this, event);
 #if PLATFORM(WIN)
         else
             ::TranslateMessage(event.nativeEvent());
 #endif
-#endif // #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
         break;
     }
 #if ENABLE(TOUCH_EVENTS)
@@ -3990,6 +4138,7 @@ void WebPageProxy::processDidCrash()
 
 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
     invalidateCallbackMap(m_booleanCallbacks);
+    invalidateCallbackMap(m_dictionaryCallbacks);
 #endif
     invalidateCallbackMap(m_voidCallbacks);
     invalidateCallbackMap(m_dataCallbacks);
@@ -4124,20 +4273,47 @@ void WebPageProxy::canAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID
     canAuthenticate = m_loaderClient.canAuthenticateAgainstProtectionSpaceInFrame(this, frame, protectionSpace.get());
 }
 
+#if ENABLE(TIZEN_ON_AUTHENTICATION_REQUESTED)
+void WebPageProxy::didReceiveAuthenticationChallenge(uint64_t frameID, const AuthenticationChallenge& coreChallenge, uint64_t challengeID, PassRefPtr<Messages::WebPageProxy::DidReceiveAuthenticationChallenge::DelayedReply> reply)
+#else
 void WebPageProxy::didReceiveAuthenticationChallenge(uint64_t frameID, const AuthenticationChallenge& coreChallenge, uint64_t challengeID)
+#endif
 {
     WebFrameProxy* frame = process()->webFrame(frameID);
     MESSAGE_CHECK(frame);
 
 #if ENABLE(TIZEN_ON_AUTHENTICATION_REQUESTED)
     RefPtr<AuthenticationChallengeProxy> authenticationChallenge = frame->setUpAuthenticationChallengeProxy(coreChallenge, challengeID, process());
+    m_AuthReply = reply;
+
+    if (!m_loaderClient.didReceiveAuthenticationChallengeInFrame(this, frame, authenticationChallenge.get()))
+        replyReceiveAuthenticationChallengeInFrame(true);
 #else
     RefPtr<AuthenticationChallengeProxy> authenticationChallenge = AuthenticationChallengeProxy::create(coreChallenge, challengeID, process());
-#endif
 
     m_loaderClient.didReceiveAuthenticationChallengeInFrame(this, frame, authenticationChallenge.get());
+#endif
 }
 
+#if ENABLE(TIZEN_SQL_DATABASE)
+void WebPageProxy::exceededDatabaseQuota(uint64_t frameID, const String& originIdentifier, const String& displayName, uint64_t expectedUsage, PassRefPtr<Messages::WebPageProxy::ExceededDatabaseQuota::DelayedReply> allowExceed)
+{
+    WebFrameProxy* frame = process()->webFrame(frameID);
+    MESSAGE_CHECK(frame);
+
+    // Since exceededDatabaseQuota() can spin a nested run loop we need to turn off the responsiveness timer.
+    process()->responsivenessTimer()->stop();
+
+    m_exceededDatabaseQuotaReply = allowExceed;
+    RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
+#if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
+    process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
+#endif
+
+    if (!m_uiClient.exceededDatabaseQuota(this, frame, origin.get(), displayName, expectedUsage))
+        replyExceededDatabaseQuota(true);
+}
+#else
 void WebPageProxy::exceededDatabaseQuota(uint64_t frameID, const String& originIdentifier, const String& databaseName, const String& displayName, uint64_t currentQuota, uint64_t currentOriginUsage, uint64_t currentDatabaseUsage, uint64_t expectedUsage, uint64_t& newQuota)
 {
     WebFrameProxy* frame = process()->webFrame(frameID);
@@ -4147,6 +4323,7 @@ void WebPageProxy::exceededDatabaseQuota(uint64_t frameID, const String& originI
 
     newQuota = m_uiClient.exceededDatabaseQuota(this, frame, origin.get(), databaseName, displayName, currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage);
 }
+#endif
 
 void WebPageProxy::requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier)
 {
@@ -4181,9 +4358,6 @@ void WebPageProxy::showNotification(const String& title, const String& body, con
 #if ENABLE(TIZEN_MEDIA_STREAM)
 void WebPageProxy::requestUserMediaPermission(uint64_t requestID)
 {
-    if (!isRequestIDValid(requestID))
-        return;
-
     RefPtr<UserMediaPermissionRequest> request = m_userMediaPermissionRequestManager.createRequest(requestID);
 
     if (!m_tizenClient.decidePolicyForUserMediaPermissionRequest(this, request.get()))
@@ -4491,6 +4665,13 @@ void WebPageProxy::dictationAlternatives(uint64_t dictationContext, Vector<Strin
 
 #endif // PLATFORM(MAC)
 
+#if USE(SOUP)
+void WebPageProxy::didReceiveURIRequest(String uriString, uint64_t requestID)
+{
+    m_process->context()->soupRequestManagerProxy()->didReceiveURIRequest(uriString, this, requestID);
+}
+#endif
+
 #if ENABLE(TIZEN_PAGE_VISIBILITY_API)
 void WebPageProxy::setPageVisibility(WebCore::PageVisibilityState pageVisibilityState, bool isInitialState)
 {