fix bug for web storage popup
[framework/osp/web.git] / src / controls / FWebCtrl_WebImpl.cpp
index 3fbe037..29910e3 100755 (executable)
@@ -37,7 +37,6 @@
 #include <FBaseRtMutexGuard.h>
 #include <FBaseSysLog.h>
 #include <FBaseUtilUri.h>
-#include <FCntDownloadRequest.h>
 #include <FGrpColor.h>
 #include <FGrpPoint.h>
 #include <FGrpRectangle.h>
 #include <FApp_AppInfo.h>
 #include <FApp_AppManagerImpl.h>
 #include <FBase_StringConverter.h>
-#include <FCnt_DownloadManagerImpl.h>
-#include <FCnt_ContentManagerImpl.h>
 #include <FGrp_CoordinateSystem.h>
 #include <FGrp_Screen.h>
 #include <FIo_DatabaseImpl.h>
 #include <FIo_NormalFile.h>
+#include <FSys_SettingInfoImpl.h>
 #include <FSys_SystemResource.h>
-#include <FSys_VibratorImpl.h>
 #include <FUi_Control.h>
 #include <FUi_CoordinateSystemUtils.h>
 #include <FUi_EcoreEvasMgr.h>
 #include <FUi_EcoreEvas.h>
+#include <FUi_ResourceManager.h>
 #include <FUi_ResourceSizeInfo.h>
 #include <FUi_Window.h>
 #include <FUiAnim_EflNode.h>
@@ -149,24 +147,7 @@ static const int MAX_TEXT_MATCH = pow(2, 31) - 1;
 
 static const int PORTRAIT_KEYPAD_HEIGHT = 444;
 static const int LANDSCAPE_KEYPAD_HEIGHT = 316;
-static const int DEFAULT_LIST_ITEM_COUNT = 4;
-
-
-Eina_Bool
-AddHttpHeaderData(const Eina_Hash* pHash, const void* pKey, void* pValue, void* pUserData)
-{
-       result r = E_SUCCESS;
-
-       String key(reinterpret_cast< const char* >(pKey));
-       String value(reinterpret_cast< char* >(pValue));
-
-       SysLog(NID_WEB_CTRL, "The current value of key is %ls, value is %ls", key.GetPointer(), value.GetPointer());
-
-       r = reinterpret_cast< HttpHeader* >(pUserData)->AddField(key, value);
-       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
-
-       return EINA_TRUE;
-}
+static const int DEFAULT_LIST_ITEM_COUNT = 5;
 
 
 Eina_Bool
@@ -178,7 +159,7 @@ AddHttpAttributeData(const Eina_Hash* pHash, const void* pKey, void* pValue, voi
        std::unique_ptr<String> pAttrValue(new (std::nothrow) String(reinterpret_cast< char* >(pValue)));
        SysTryReturn(NID_WEB_CTRL, pAttrKey.get() && pAttrValue.get(), EINA_FALSE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
-       SysLog(NID_WEB_CTRL, "The current value of key is %ls, value is %ls", pAttrKey->GetPointer(), pAttrValue->GetPointer());
+       SysSecureLog(NID_WEB_CTRL, "The current value of key is %ls, value is %ls", pAttrKey->GetPointer(), pAttrValue->GetPointer());
 
        r = reinterpret_cast< HashMap* >(pUserData)->Add(*pAttrKey, *pAttrValue);
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
@@ -365,9 +346,12 @@ OnScriptConfirmRequested(Evas_Object* pView, const char* pMessage, void* pUserDa
        _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
        String msg(pMessage);
 
-       r = pImpl->ShowUserConfirmPopup(USER_SCRIPT_CONFIRM, pView, msg);
-       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+       r = pImpl->ShowUserConfirmPopupAsync(USER_SCRIPT_CONFIRM, pView, msg);
+       SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+       return EINA_TRUE;
 
+CATCH:
+       ewk_view_javascript_confirm_reply(pView, EINA_FALSE);
        return EINA_TRUE;
 }
 
@@ -391,7 +375,26 @@ OnScriptPromptRequested(Evas_Object* pView, const char* pMessage, const char* pD
 CATCH:
        ewk_view_javascript_prompt_reply(pView, null);
 
-       return EINA_FALSE;
+       return EINA_TRUE;
+}
+
+
+Eina_Bool
+_WebImpl::OnBeforeUnloadConfirmRequested(Evas_Object* pView, const char* pMessage, void* pUserData)
+{
+       _WebImpl* pWebImpl = reinterpret_cast< _WebImpl* >(pUserData);
+       SysAssertf(pWebImpl, "Failed to request");
+       result r = E_SUCCESS;
+
+       String msg(pMessage);
+
+       r = pWebImpl->ShowUserConfirmPopupAsync(USER_BEFORE_UNLOAD_CONFIRM, pView, msg);
+       SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+       return EINA_TRUE;
+
+CATCH:
+       ewk_view_javascript_confirm_reply(pView, EINA_FALSE);
+       return EINA_TRUE;
 }
 
 
@@ -521,14 +524,25 @@ OnApplicationCachePermissionRequested(Evas_Object* pView, Ewk_Security_Origin* p
        _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
        SysAssertf(pImpl , "Failed to request");
 
-       const char* pHostName = ewk_security_origin_host_get(pSecOrigin);
-       String msg;
-       result r = msg.Format(256, L"Allow %s to use offline application cache?", pHostName);
-       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+       _SystemResource* pSysResource = _SystemResource::GetInstance();
+       SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
 
-       r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_APP_CACHE, pView, msg);
-       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+       result r = E_SUCCESS;
 
+       String message(L"");
+       r = message.Format(512, 
+               pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_P1SS_HP2SS_IS_REQUESTING_PERMISSION_TO_STORE_DATA_ON_YOUR_DEVICE_FOR_OFFLINE_USE").GetPointer(),
+               _StringConverter::CopyToCharArrayN(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_THIS_WEBPAGE")),
+               ewk_security_origin_host_get(pSecOrigin));
+       SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_APP_CACHE, pView, message);
+       SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+       return EINA_TRUE;
+
+CATCH:
+       ewk_view_application_cache_permission_reply(pView, EINA_FALSE);
        return EINA_TRUE;
 }
 
@@ -539,14 +553,25 @@ OnIndexedDatabaseQuotaExceeded(Evas_Object* pView, Ewk_Security_Origin* pSecOrig
        _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
        SysAssertf(pImpl , "Failed to request");
 
-       const char* pHostName = ewk_security_origin_host_get(pSecOrigin);
-       String msg;
-       result r = msg.Format(512, L"%s Used %lld of storage. Allow %s to use upto 2GB of indexed db?", pHostName, currentQuota, pHostName);
-       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+       _SystemResource* pSysResource = _SystemResource::GetInstance();
+       SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
 
-       r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_INDEXED_DB_QUOTA_EXCEDED, pView, msg);
-       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+       result r = E_SUCCESS;
 
+       String message(L"");
+       r = message.Format(512, 
+               pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_P1SS_HP2SS_IS_ATTEMPTING_TO_STORE_A_LARGE_AMOUNT_OF_DATA_ON_YOUR_DEVICE_FOR_OFFLINE_USE").GetPointer(),
+               _StringConverter::CopyToCharArrayN(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_THIS_WEBPAGE")),
+               ewk_security_origin_host_get(pSecOrigin));
+       SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_INDEXED_DB_QUOTA_EXCEDED, pView, message);
+       SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+       return EINA_TRUE;
+
+CATCH:
+       ewk_view_exceeded_indexed_database_quota_reply(pView, EINA_FALSE);
        return EINA_TRUE;
 }
 
@@ -557,31 +582,54 @@ OnDatabaseQuotaExceeded(Evas_Object* pView, Ewk_Security_Origin* pSecOrigin, con
        _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
        SysAssertf(pImpl , "Failed to request");
 
-       const char* pHostName = ewk_security_origin_host_get(pSecOrigin);
-       String msg;
-       result r = msg.Format(512, L"Allow %s to open  %s use upto %lld  of web database?", pHostName, database_name, expectedQuota);
-       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+       _SystemResource* pSysResource = _SystemResource::GetInstance();
+       SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
 
-       r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_DB_QUOTA_EXCEDED, pView, msg);
-       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+       result r = E_SUCCESS;
 
+       String message(L"");
+       r = message.Format(512, 
+               pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_P1SS_HP2SS_IS_ATTEMPTING_TO_STORE_A_LARGE_AMOUNT_OF_DATA_ON_YOUR_DEVICE_FOR_OFFLINE_USE").GetPointer(),
+               _StringConverter::CopyToCharArrayN(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_THIS_WEBPAGE")),
+               ewk_security_origin_host_get(pSecOrigin));
+       SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_DB_QUOTA_EXCEDED, pView, message);
+       SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+       return EINA_TRUE;
+
+CATCH:
+       ewk_view_exceeded_database_quota_reply(pView, EINA_FALSE);
        return EINA_TRUE;
 }
 
 
-Eina_Bool OnLocalFileSystemQuotaExceeded(Evas_Object* pView, Ewk_Security_Origin* pSecOrigin,  long long currentQuota, void* pUserData)
+Eina_Bool
+OnLocalFileSystemQuotaExceeded(Evas_Object* pView, Ewk_Security_Origin* pSecOrigin,  long long currentQuota, void* pUserData)
 {
        _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
        SysAssertf(pImpl , "Failed to request");
 
-       const char* pHostName = ewk_security_origin_host_get(pSecOrigin);
-       String msg;
-       result r = msg.Format(512, L"%s Used %lld of storgae. Allow %s to use upto 2GB of file system?", pHostName, currentQuota, pHostName);
-       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+       _SystemResource* pSysResource = _SystemResource::GetInstance();
+       SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
 
-       r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_LOCAL_FS_QUOTA_EXCEDED, pView, msg);
-       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+       result r = E_SUCCESS;
+
+       String message(L"");
+       r = message.Format(512, 
+               pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_P1SS_HP2SS_IS_ATTEMPTING_TO_STORE_A_LARGE_AMOUNT_OF_DATA_ON_YOUR_DEVICE_FOR_OFFLINE_USE").GetPointer(),
+               _StringConverter::CopyToCharArrayN(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_THIS_WEBPAGE")),
+               ewk_security_origin_host_get(pSecOrigin));
+       SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_LOCAL_FS_QUOTA_EXCEDED, pView, message);
+       SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+       return EINA_TRUE;
 
+CATCH:
+       ewk_view_exceeded_local_file_system_quota_reply(pView, EINA_FALSE);
        return EINA_TRUE;
 }
 
@@ -831,7 +879,10 @@ OnFullScreenEntered(void* pUserData, Evas_Object* pView, void* pEventInfo)
        _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
        SysAssertf(pImpl, "Failed to request");
 
-       SysLog(NID_WEB_CTRL, "Enter.");
+       _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
+       SysAssertf(pWebCore, "Failed to get Web core object");
+
+       pWebCore->SetFullScreenEntered(true);
 }
 
 
@@ -841,7 +892,32 @@ OnFullScreenExited(void* pUserData, Evas_Object* pView, void* pEventInfo)
        _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
        SysAssertf(pImpl, "Failed to request");
 
-       SysLog(NID_WEB_CTRL, "Exit.");
+       _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
+       SysAssertf(pWebCore, "Failed to get Web core object");
+
+       pWebCore->SetFullScreenEntered(false);
+}
+
+
+void
+OnFocusDownRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+       _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
+       SysAssertf(pImpl, "Failed to request");
+
+       _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
+       pWebCore->SetFocusEnd(true);
+}
+
+
+void
+OnFocusUpRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+       _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
+       SysAssertf(pImpl, "Failed to request");
+
+       _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
+       pWebCore->SetFocusEnd(true);
 }
 
 
@@ -878,64 +954,75 @@ OnLoadingRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
        String url(ewk_policy_decision_url_get(pPolicy));
        SysSecureLog(NID_WEB_CTRL, "The current value of url is %ls", url.GetPointer());
 
-       if (url == L"about:blank")
-       {
-               ewk_policy_decision_use(pPolicy);
-               return;
-       }
-
-       if (pImpl->GetLoadingListener() && ewk_frame_is_main_frame(ewk_policy_decision_frame_get(pPolicy))
+       if (ewk_frame_is_main_frame(ewk_policy_decision_frame_get(pPolicy))
                && !pImpl->IsRedirectRequested())
        {
+               _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
+               SysAssertf(pWebCore, "Failed to get Web core object");
+
+               pWebCore->SetFullScreenEntered(false);
+
                pImpl->SetCertificateRequested(false);
 
                if (pImpl->GetTextSearchListener())
                {
                        pImpl->DisableAsyncSearch();
                }
-       
-               WebNavigationType navigationType = WEB_NAVIGATION_OTHER;
-               Ewk_Policy_Navigation_Type ewkNavigationType = ewk_policy_decision_navigation_type_get(pPolicy);
 
-               switch (ewkNavigationType)
+               ILoadingListener* pLoadingListener = pImpl->GetLoadingListener();
+               if (pLoadingListener)
                {
-               case EWK_POLICY_NAVIGATION_TYPE_LINK_CLICKED:
-                       navigationType = WEB_NAVIGATION_LINK_CLICKED;
-                       break;
-               case EWK_POLICY_NAVIGATION_TYPE_FORM_SUBMITTED:
-                       navigationType = WEB_NAVIGATION_FORM_SUBMITTED;
-                       break;
-               case EWK_POLICY_NAVIGATION_TYPE_BACK_FORWARD:
-                       navigationType = WEB_NAVIGATION_BACKFORWARD;
-                       break;
-               case EWK_POLICY_NAVIGATION_TYPE_RELOAD:
-                       navigationType = WEB_NAVIGATION_RELOAD;
-                       break;
-               case EWK_POLICY_NAVIGATION_TYPE_FORM_RESUBMITTED:
-                       navigationType = WEB_NAVIGATION_FORM_RESUBMITTED;
-                       break;
-               case EWK_POLICY_NAVIGATION_TYPE_OTHER:
-                       navigationType = WEB_NAVIGATION_OTHER;
-                       break;
-               default:
-                       SysAssert(false);
-               }
+                       WebNavigationType navigationType = WEB_NAVIGATION_OTHER;
+                       Ewk_Policy_Navigation_Type ewkNavigationType = ewk_policy_decision_navigation_type_get(pPolicy);
 
-               if (pImpl->GetLoadingListener()->OnLoadingRequested(url, navigationType))
-               {
-                       ewk_policy_decision_ignore(pPolicy);
+                       switch (ewkNavigationType)
+                       {
+                       case EWK_POLICY_NAVIGATION_TYPE_LINK_CLICKED:
+                               navigationType = WEB_NAVIGATION_LINK_CLICKED;
+                               break;
+                       case EWK_POLICY_NAVIGATION_TYPE_FORM_SUBMITTED:
+                               navigationType = WEB_NAVIGATION_FORM_SUBMITTED;
+                               break;
+                       case EWK_POLICY_NAVIGATION_TYPE_BACK_FORWARD:
+                               navigationType = WEB_NAVIGATION_BACKFORWARD;
+                               break;
+                       case EWK_POLICY_NAVIGATION_TYPE_RELOAD:
+                               navigationType = WEB_NAVIGATION_RELOAD;
+                               break;
+                       case EWK_POLICY_NAVIGATION_TYPE_FORM_RESUBMITTED:
+                               navigationType = WEB_NAVIGATION_FORM_RESUBMITTED;
+                               break;
+                       case EWK_POLICY_NAVIGATION_TYPE_OTHER:
+                               navigationType = WEB_NAVIGATION_OTHER;
+                               break;
+                       default:
+                               SysAssert(false);
+                       }
 
-                       return;
+                       if (pLoadingListener->OnLoadingRequested(url, navigationType))
+                       {
+                               ewk_policy_decision_ignore(pPolicy);
+
+                               return;
+                       }
                }
        }
 
+       if (url == L"about:blank")
+       {
+               ewk_policy_decision_use(pPolicy);
+
+               return;
+       }
+
        String currentUrl(pImpl->GetUrl());
        String redirectUrl(pImpl->GetProtocolFromUri(url,  currentUrl));
        if (redirectUrl != L"")
        {
-               pImpl->LoadUrl(redirectUrl);
                ewk_policy_decision_ignore(pPolicy);
 
+               pImpl->LoadUrl(redirectUrl);
+
                return;
        }
        
@@ -943,17 +1030,10 @@ OnLoadingRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
        uri.SetUri(url);
 
        String uriScheme(uri.GetScheme());
-       SysLog(NID_WEB_CTRL, "The current value of scheme is %ls", uriScheme.GetPointer());
+       SysSecureLog(NID_WEB_CTRL, "The current value of scheme is %ls", uriScheme.GetPointer());
 
-       if ((uriScheme != L"http") && (uriScheme != L"https") && (uriScheme != L"file"))
+       if ((uriScheme != L"http") && (uriScheme != L"https") && (uriScheme != L"file") && (uriScheme != L""))
        {
-               ewk_policy_decision_ignore(pPolicy);
-
-               if (uriScheme == L"")
-               {
-                       return;
-               }
-
                result r = E_SUCCESS;
 
                if (uriScheme == L"tel")
@@ -971,9 +1051,13 @@ OnLoadingRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
                        String operationId(L"http://tizen.org/appcontrol/operation/view");
                        r = _AppControlImpl::FindAndStart(operationId, &url, null, null, null, null);
                }
-               SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
 
-               return;
+               if (r == E_SUCCESS)
+               {
+                       ewk_policy_decision_ignore(pPolicy);
+
+                       return;
+               }
        }
 
        ewk_policy_decision_use(pPolicy);
@@ -1065,36 +1149,48 @@ OnWebDataReceived(void* pUserData, Evas_Object* pView, void* pEventInfo)
 
        result r = E_SUCCESS;
 
-       _SystemResource* pSysResource = _SystemResource::GetInstance();
-       SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
-
-       const char* pUrl = ewk_policy_decision_url_get(pPolicy);
        int code = ewk_policy_decision_response_status_code_get(pPolicy);
-       String mime(ewk_policy_decision_response_mime_get(pPolicy));
-       SysSecureLog(NID_WEB_CTRL, "url : %s, mime : %ls, code : %d", pUrl, mime.GetPointer(), code);
-
-       ILoadingListener* pLoadingListener = pImpl->GetLoadingListener();
-
        String url(ewk_policy_decision_url_get(pPolicy));
+       String mime(ewk_policy_decision_response_mime_get(pPolicy));
+       SysSecureLog(NID_WEB_CTRL, "code : %d, url : %ls, mime : %ls", code, url.GetPointer(), mime.GetPointer());
 
-       if (pLoadingListener && ewk_frame_is_main_frame(ewk_policy_decision_frame_get(pPolicy)))
+       if (ewk_frame_is_main_frame(ewk_policy_decision_frame_get(pPolicy)))
        {
-               const Eina_Hash* pHeader = ewk_policy_decision_response_headers_get(pPolicy);
-
-               DecisionPolicy policy;
-               HttpHeader httpHeader;
-
                if (code >= REDIRECTION_HEADER_GROUP && code < REDIRECTION_HEADER_GROUP + 100)
                {
                        pImpl->SetRedirectRequested(true);
-                       mime = L"";
                }
 
-               eina_hash_foreach(pHeader, AddHttpHeaderData, &httpHeader);
-               SysTryCatch(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+               ILoadingListener* pLoadingListener = pImpl->GetLoadingListener();
+               if (pLoadingListener)
+               {
+                       HttpHeader httpHeader;
+
+                       Eina_Iterator* iterator = eina_hash_iterator_tuple_new(ewk_policy_decision_response_headers_get(pPolicy));
+                       if (iterator)
+                       {
+                               Eina_Hash_Tuple *tuple = null;
 
-               policy = pLoadingListener->OnWebDataReceived(mime, httpHeader);
-               pImpl->SetPolicyDecision(policy);
+                               EINA_ITERATOR_FOREACH(iterator, tuple)
+                               {
+                                       String key(reinterpret_cast< const char* >(tuple->key));
+                                       String value(reinterpret_cast< char* >(tuple->data));
+
+                                       SysSecureLog(NID_WEB_CTRL, "The current value of key is %ls, value is %ls", key.GetPointer(), value.GetPointer());
+
+                                       r = httpHeader.AddField(key, value);
+                                       SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, eina_iterator_free(iterator), r, "[%s] Propagating.", GetErrorMessage(r));
+                               }
+
+                               eina_iterator_free(iterator);
+                       }
+
+                       pImpl->SetPolicyDecision(pLoadingListener->OnWebDataReceived(mime, httpHeader));
+               }
+               else
+               {
+                       pImpl->SetPolicyDecision(WEB_DECISION_CONTINUE);
+               }
        }
 
        switch (pImpl->GetPolicyDecision())
@@ -1105,17 +1201,17 @@ OnWebDataReceived(void* pUserData, Evas_Object* pView, void* pEventInfo)
                String redirectUrl(pImpl->GetRedirectUri(url, currentUrl, mime));
                if (redirectUrl != L"")
                {
-                       pImpl->LoadUrl(redirectUrl);
                        ewk_policy_decision_ignore(pPolicy);
 
+                       pImpl->LoadUrl(redirectUrl);
+
                        return;
                }
 
-               if (pImpl->IsMimeSupported(mime) || mime == L"")
+               if (ewk_policy_decision_type_get(pPolicy) == EWK_POLICY_DECISION_USE)
                {
                        break;
                }
-               
                else
                {
                        ewk_policy_decision_ignore(pPolicy);
@@ -1124,17 +1220,11 @@ OnWebDataReceived(void* pUserData, Evas_Object* pView, void* pEventInfo)
 
                        r = _AppControlImpl::FindAndStart(operationId, &url, &mime, null, null, null);
                        SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS || r == E_OBJ_NOT_FOUND, r, "[%s] Propagating.", GetErrorMessage(r));
-       
                        if (r == E_OBJ_NOT_FOUND)
                        {
-                               _SelectBox* pSelectBox = new (std::nothrow) _SelectBox;
-                               SysTryReturnVoidResult(NID_WEB_CTRL, pSelectBox, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
-
-                               r = pSelectBox->Construct(false, L"Select application", 1, null, url);
-                               SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+                               String operationId(L"http://tizen.org/appcontrol/operation/download");
 
-                               pSelectBox->AddListItem(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_DOWNLOAD"), _SelectBox::LIST_ITEM_TYPE_NORMAL, false);
-                               r = pSelectBox->ShowPopup();
+                               r = _AppControlImpl::FindAndStart(operationId, &url, null, null, null, null);
                                SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
                        }
 
@@ -1142,6 +1232,7 @@ OnWebDataReceived(void* pUserData, Evas_Object* pView, void* pEventInfo)
                }
                break;
        }
+
        case WEB_DECISION_DOWNLOAD:
        {
                ewk_policy_decision_ignore(pPolicy);
@@ -1152,16 +1243,18 @@ OnWebDataReceived(void* pUserData, Evas_Object* pView, void* pEventInfo)
                Ewk_Context* pContext = ewk_view_context_get(pView);
                SysAssertf(pContext, "Failed to get webkit instance.");
 
-               pDownloadHandler->StartDownload(pUrl);
+               pDownloadHandler->StartDownload(url);
 
                return;
        }
+
        case WEB_DECISION_IGNORE:
        {
                ewk_policy_decision_ignore(pPolicy);
 
                return;
        }
+
        default:
        {
                SysAssert(false);
@@ -1275,7 +1368,13 @@ OnLoadingCompleted(void* pUserData, Evas_Object* pView, void* pEventInfo)
                SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
                pEventArg.release();
        }
+}
+
 
+void
+OnLoadingCommitted(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+       evas_object_focus_set(pView, EINA_FALSE);
 }
 
 
@@ -1519,7 +1618,6 @@ FireWebPageBlockSelectedEventF(_WebImpl* pImpl)
        SysTryReturnResult(NID_WEB_CTRL, startPoint.get() && endPoint.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
 
        pImpl->GetBlockRange(*startPoint.get(), *endPoint.get());
-
        if ((endPoint->x != 0.0f) && (endPoint->y != 0.0f))
        {
                std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED_FLOAT));
@@ -1565,97 +1663,6 @@ OnWebPageBlockSelected(void* pUserData, Evas_Object* pView, void* pEventInfo)
 }
 
 
-Eina_Bool
-OnSelectUploadFile(Evas_Object* pView, Eina_Bool multipleFile, Eina_List* pAcceptTypes, const char* pCapture, void* pUserData)
-{
-       std::unique_ptr<_MediaSelectionListener> pMediaListener(new (std::nothrow) _MediaSelectionListener());
-       SysTryReturn(NID_WEB_CTRL, pMediaListener.get(), EINA_TRUE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
-
-       pMediaListener->Construct(pView);
-
-       HashMap extraData;
-       result r = extraData.Construct();
-       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_TRUE, r, "[%s] Propagating.", GetErrorMessage(r));
-
-       String isMultipleSelection(L"single");
-       String mode(L"selectionType");
-       String type(L"type");
-       String fileType = L"*/*";
-       String operationId = L"http://tizen.org/appcontrol/operation/pick";
-
-       if (multipleFile)
-       {
-               isMultipleSelection.Append(L"multiple");
-       }
-
-       if (eina_list_count(pAcceptTypes) == 1)
-       {
-               String item((char*)eina_list_nth(pAcceptTypes, 0));
-               String captureString(pCapture);
-
-               if (item.StartsWith("image/",0))
-               {
-                       if (captureString == L"camera")
-                       {
-                               fileType = L"image/jpg";
-                               operationId = L"http://tizen.org/appcontrol/operation/create_content";
-                               String typeKey = L"http://tizen.org/appcontrol/data/camera/allow_switch";
-                               String typeVal = L"false";
-                               extraData.Add(&typeKey, &typeVal);
-                       }
-                       else
-                       {
-                               fileType = L"image/*";
-                               String selectKey = L"http://tizen.org/appcontrol/data/selection_mode";
-                               extraData.Add(&selectKey, &isMultipleSelection);
-                       }
-               }
-               else if (item.StartsWith("audio/",0))
-               {
-                       fileType = L"audio/*";
-                       //TO DO: as microphone is not supported yet. suggest to throw an exception
-                       //if (captureString == L"microphone")
-                       //{
-                               //operationId = L"http://tizen.org/appcontrol/operation/create_content";
-                       //}
-                       //else
-                       //{
-                               String selectKey = L"http://tizen.org/appcontrol/data/selection_mode";
-                               extraData.Add(&selectKey, &isMultipleSelection);
-                       //}
-               }
-               else if (item.StartsWith("video/",0))
-               {
-                       if (captureString == L"camcorder")
-                       {
-                               fileType = L"video/3gpp";
-                               operationId = L"http://tizen.org/appcontrol/operation/create_content";
-                               String typeKey = L"http://tizen.org/appcontrol/data/camera/allow_switch";
-                               String typeVal = L"false";
-                               extraData.Add(&typeKey, &typeVal);
-                       }
-                       else
-                       {
-                               fileType = L"video/*";
-                               String selectKey = L"http://tizen.org/appcontrol/data/selection_mode";
-                               extraData.Add(&selectKey, &isMultipleSelection);
-                       }
-               }
-       }
-
-       r = _AppControlImpl::FindAndStart(operationId, null, &fileType, null, &extraData, pMediaListener.get());
-       SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
-       pMediaListener.release();
-
-       return EINA_TRUE;
-
-CATCH:
-       ewk_view_open_panel_reply(pView, null, EINA_FALSE);
-       return EINA_TRUE;
-}
-
-
 void
 OnHandleJavaScriptRequest(void* pUserData, Evas_Object* pView, void* pEventInfo)
 {
@@ -1686,11 +1693,6 @@ OnWebKeypadStateChanged(void* pUserData, Evas_Object* pView, void* pEventInfo)
        Eina_Rectangle* pEinaRect = reinterpret_cast< Eina_Rectangle* >(pEventInfo);
        SysAssertf(pImpl && pEinaRect, "Failed to request");
 
-       if (pImpl->IsVisible() == false)
-       {
-               evas_object_focus_set(pView, EINA_FALSE);
-       }
-
        if (pImpl->GetSetting().GetInputStyle() == INPUT_STYLE_OVERLAY)
        {
                _ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetInverseTransformer();
@@ -1708,11 +1710,7 @@ OnWebKeypadStateChanged(void* pUserData, Evas_Object* pView, void* pEventInfo)
                {
                        pFormImpl->DeflateClientRectHeight(pXformer->TransformVertical(rect.height));
 
-                       if (pFormImpl->HasFooter())
-                       {
-                               pFormImpl->GetCore().SetKeypadShowState(true);
-                               pFormImpl->Draw();
-                       }                       
+                       pFormImpl->Invalidate(false);
                }
 
                if (pImpl->GetWebKeypadEventListener())
@@ -1729,7 +1727,7 @@ OnWebKeypadStateChanged(void* pUserData, Evas_Object* pView, void* pEventInfo)
                                pImpl->GetWebKeypadEventListener()->OnWebKeypadWillOpen(*dynamic_cast< Web* >(&pImpl->GetPublic()));
                        }
                }
-               pImpl->SetKeypadVisibleState(true);
+
                pImpl->SetPreviousKeypadBounds(rect);
        }
        else
@@ -1746,6 +1744,23 @@ OnWebKeypadOpened(void* pUserData, Evas_Object* pView, void* pEventInfo)
        _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
        SysAssertf(pImpl, "Failed to request");
 
+       pImpl->SetKeypadVisibleState(true);
+
+       _FormImpl* pFormImpl = pImpl->GetParentFormImpl(dynamic_cast< _ControlImpl* >(pImpl));
+       if (pFormImpl)
+       {
+               _ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetInverseTransformer();
+               SysAssertf(pXformer, "Failed to get CoordinateTransformer");
+
+               pFormImpl->DeflateClientRectHeight(pXformer->TransformVertical(pImpl->GetPreviousKeypadBounds().height));
+
+               if (pFormImpl->HasFooter())
+               {
+                       pFormImpl->GetCore().SetKeypadShowState(true);
+                       pFormImpl->Draw();
+               }
+       }
+
        if (pImpl->GetWebKeypadEventListener())
        {
                pImpl->GetWebKeypadEventListener()->OnWebKeypadOpened(*static_cast< Web* >(&pImpl->GetPublic()));
@@ -1764,6 +1779,8 @@ OnWebKeypadClosed(void* pUserData, Evas_Object* pView, void* pEventInfo)
        {
                pFormImpl->DeflateClientRectHeight(0);
 
+               pFormImpl->Invalidate(false);
+
                if (pFormImpl->HasFooter())
                {
                        pFormImpl->GetCore().SetKeypadShowState(false);
@@ -1781,20 +1798,45 @@ OnWebKeypadClosed(void* pUserData, Evas_Object* pView, void* pEventInfo)
 
 
 void
+OnWindowObjectFocusLost(void* pUserData, Evas_Object* pWin, void* pEvent_info)
+{
+       _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+       SysAssertf(pImpl, "Failed to request");
+
+       pImpl->SetWinFocusLost(true);
+}
+
+
+void
 OnWindowObjectFocusGained(void* pUserData, Evas_Object* pWin, void* pEvent_info)
 {
        _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
        SysAssertf(pImpl, "Failed to request");
 
-       if (pImpl->IsKeypadOpened() == true && pImpl->IsVisible() == true && pImpl->IsFocused() == true)
+       if (pImpl->IsVisible() == true && pImpl->IsFocused() == true)
        {
                _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
                SysAssertf(pWebCore, "Failed to get Web core object");
 
-               evas_object_focus_set(pWebCore->GetWebNativeNode(), EINA_TRUE);
+               if (pImpl->IsWinFocusLost() == true)
+               {
+                       Ewk_Settings* pSettings = ewk_view_settings_get(pWebCore->GetWebNativeNode());
+                       SysAssertf(pSettings, "Failed to get settings instance.");
+
+                       if (ewk_settings_clear_text_selection_automatically_get(pSettings) == EINA_FALSE)
+                       {
+                               ewk_settings_clear_text_selection_automatically_set(pSettings, EINA_TRUE);
 
-               pImpl->SetKeypadVisibleState(true);
+                               evas_object_focus_set(pWebCore->GetWebNativeNode(), EINA_TRUE);
+                       }
+                       else if (pImpl->IsKeypadOpened() == true)
+                       {
+                               evas_object_focus_set(pWebCore->GetWebNativeNode(), EINA_TRUE);
+                       }
+               }
        }
+
+       pImpl->SetWinFocusLost(false);
 }
 
 
@@ -1806,7 +1848,39 @@ OnWebNativeNodeFocusGained(void* pUserData, Evas* pCanvas, Evas_Object* pView, v
 
        if (pImpl->IsKeypadOpened() == true)
        {
-               pImpl->SetKeypadOpened(false);  
+               pImpl->SetKeypadOpened(false);
+       }
+       else if (pImpl->IsWinFocusLost() == true && pImpl->IsFocused() == false)
+       {
+               _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
+               SysAssertf(pWebCore, "Failed to get Web core object");
+
+               evas_object_focus_set(pWebCore->GetWebNativeNode(), EINA_FALSE);
+       }
+}
+
+
+void
+OnWebNativeNodeFocusLost(void* pUserData, Evas* pCanvas, Evas_Object* pView, void* pEventInfo)
+{
+       _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+       SysAssertf(pImpl, "Failed to request");
+
+       _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
+       SysAssertf(pWebCore, "Failed to get Web core object");
+
+       Eina_Rectangle leftHandle;
+       Eina_Rectangle rightHandle;
+
+       EINA_RECTANGLE_SET(&leftHandle, 0, 0, 0, 0);
+       EINA_RECTANGLE_SET(&rightHandle, 0, 0, 0, 0);
+
+       if (pImpl->IsWinFocusLost() == true && ewk_view_text_selection_range_get(pWebCore->GetWebNativeNode(), &leftHandle, &rightHandle))
+       {
+               Ewk_Settings* pSettings = ewk_view_settings_get(pWebCore->GetWebNativeNode());
+               SysAssertf(pSettings, "Failed to get settings instance.");
+
+               ewk_settings_clear_text_selection_automatically_set(pSettings, EINA_FALSE);
        }
 } 
 
@@ -2157,6 +2231,7 @@ _WebImpl::_WebImpl(Web* pWeb, Tizen::Ui::_Control* pCore)
        , __isFooterVisible(false)
        , __isKeypadVisible(false)
        , __isKeypadOpened(false)
+       , __isWinFocusLost(false)
        , __isLoadingErrorOccurred(false)
        , __isRedirectRequested(false)
        , __isCertificateRequested(false)
@@ -2184,6 +2259,7 @@ _WebImpl::_WebImpl(Web* pWeb, Tizen::Ui::_Control* pCore)
        , __pNotificationConfirmPopup(null)
        , __pScriptAlertConfirmPopup(null)
        , __pScriptConfirmPopup(null)
+       , __pBeforeUnloadConfirmPopup(null)
        , __pAppCacheConfirmPopup(null)
        , __pDbQuotaConfirmPopup(null)
        , __pLocalFsQuotaConfirmPopup(null)
@@ -2212,7 +2288,13 @@ _WebImpl::_WebImpl(Web* pWeb, Tizen::Ui::_Control* pCore)
 
 _WebImpl::~_WebImpl()
 {
-       ClearCertificateDb();
+       _WebManager* pWebManager = _WebManager::GetInstance();
+       SysTryCatch(NID_WEB_CTRL, pWebManager, , E_SYSTEM, "[%s] Failed to get the _ControlManager instance.", GetErrorMessage(E_SYSTEM));
+       pWebManager->RemoveWeb(reinterpret_cast< int >(this));
+
+CATCH:
+       _SettingInfoImpl::RemoveSettingEventListener(*this);
+       RemoveEventListenerCallback();
 }
 
 
@@ -2298,11 +2380,6 @@ _WebImpl::Construct(void)
        r = InitWebEvent();
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
-       _DownloadManagerImpl* pManagerImpl = _DownloadManagerImpl::GetInstance();
-       SysTryReturn(NID_WEB_CTRL, pManagerImpl, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
-
-       pManagerImpl->SetDownloadListener(this);
-
        __pWebCore = dynamic_cast< _Web* >(&(GetCore()));
        SysTryReturnResult(NID_WEB_CTRL, __pWebCore, E_SYSTEM, "A system error has been occurred. Failed to get web control");
 
@@ -2407,10 +2484,16 @@ CATCH:
 result
 _WebImpl::LoadUrl(const String& url) const
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return E_SUCCESS;
+       }
+
        std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
        SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
-       ewk_view_url_set(__pWebCore->GetWebNativeNode(), pUrl.get());
+       ewk_view_url_set(pWebview, pUrl.get());
 
        return E_SUCCESS;
 }
@@ -2419,12 +2502,18 @@ _WebImpl::LoadUrl(const String& url) const
 result 
 _WebImpl::LoadUrl(const String& url, const HttpHeader& header)
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return E_SUCCESS;
+       }
+
        std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
        SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
-       
+
        Eina_Hash* pHttpHeader = ConvertToSlpHeaderN(header);
 
-       ewk_view_url_request_set(__pWebCore->GetWebNativeNode(), pUrl.get(), EWK_HTTP_METHOD_GET, pHttpHeader, null);
+       ewk_view_url_request_set(pWebview, pUrl.get(), EWK_HTTP_METHOD_GET, pHttpHeader, null);
 
        eina_hash_free(pHttpHeader);
 
@@ -2435,12 +2524,18 @@ _WebImpl::LoadUrl(const String& url, const HttpHeader& header)
 result
 _WebImpl::LoadUrlWithPostRequest(const String& url, const HttpHeader& header, const ByteBuffer& body) const
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return E_SUCCESS;
+       }
+
        std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
        SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
        Eina_Hash* pHttpHeader = ConvertToSlpHeaderN(header);
 
-       ewk_view_url_request_set(__pWebCore->GetWebNativeNode(), pUrl.get(), EWK_HTTP_METHOD_POST, pHttpHeader, reinterpret_cast< const char* >(body.GetPointer()));
+       ewk_view_url_request_set(pWebview, pUrl.get(), EWK_HTTP_METHOD_POST, pHttpHeader, reinterpret_cast< const char* >(body.GetPointer()));
 
        eina_hash_free(pHttpHeader);
 
@@ -2451,6 +2546,12 @@ _WebImpl::LoadUrlWithPostRequest(const String& url, const HttpHeader& header, co
 result
 _WebImpl::LoadData(const String& baseUrl, const ByteBuffer& content, const String& mime, const String& encoding) const
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return E_SUCCESS;
+       }
+
        SysTryReturnResult(NID_WEB_CTRL, content.GetLimit() > 0, E_INVALID_ARG, "The content buffer is empty.");
 
        std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(baseUrl));
@@ -2458,7 +2559,7 @@ _WebImpl::LoadData(const String& baseUrl, const ByteBuffer& content, const Strin
        std::unique_ptr<char[]> pEncoding(_StringConverter::CopyToCharArrayN(encoding));
        SysTryReturn(NID_WEB_CTRL, pUrl.get() && pMime.get() && pEncoding.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
-       ewk_view_contents_set(__pWebCore->GetWebNativeNode(), reinterpret_cast< const char* >(content.GetPointer()), content.GetLimit(), pMime.get(), pEncoding.get(), pUrl.get());
+       ewk_view_contents_set(pWebview, reinterpret_cast< const char* >(content.GetPointer()), content.GetLimit(), pMime.get(), pEncoding.get(), pUrl.get());
 
        return E_SUCCESS;
 }
@@ -2467,14 +2568,26 @@ _WebImpl::LoadData(const String& baseUrl, const ByteBuffer& content, const Strin
 void
 _WebImpl::Pause(void)
 {
-       ewk_view_suspend(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       ewk_view_suspend(pWebview);
 }
 
 
 void
 _WebImpl::Resume(void)
 {
-       ewk_view_resume(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       ewk_view_resume(pWebview);
 }
 
 
@@ -2490,7 +2603,14 @@ _WebImpl::ShowSelectBoxPopup(bool isMultiSelect, const String& title, Eina_List*
        std::unique_ptr<_SelectBox> pSelectBox(new (std::nothrow) _SelectBox());
        SysTryReturnResult(NID_WEB_CTRL, pSelectBox.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
 
-       r = pSelectBox->Construct(isMultiSelect, title, DEFAULT_LIST_ITEM_COUNT, pWebView);
+       if (isMultiSelect)
+       {
+               r = pSelectBox->Construct(this, isMultiSelect, title, DEFAULT_LIST_ITEM_COUNT - 1, pWebView);
+       }
+       else
+       {
+               r = pSelectBox->Construct(this, isMultiSelect, title, DEFAULT_LIST_ITEM_COUNT, pWebView);
+       }
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        r = pSelectBox->UpdateList(pItems, selectedIndex, false, false);
@@ -2518,6 +2638,8 @@ _WebImpl::ClearSelectBoxPopup(void)
 
        __pSelectBox.reset();
 
+       Resume();
+
        return E_SUCCESS;
 }
 
@@ -2549,64 +2671,112 @@ _WebImpl::GetColorpicker(void)
 bool
 _WebImpl::CanGoBack(void) const
 {
-       return static_cast< bool >(ewk_view_back_possible(__pWebCore->GetWebNativeNode()));
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return false;
+       }
+
+       return static_cast< bool >(ewk_view_back_possible(pWebview));
 }
 
 
 bool
 _WebImpl::CanGoForward(void) const
 {
-       return static_cast< bool >(ewk_view_forward_possible(__pWebCore->GetWebNativeNode()));
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return false;
+       }
+
+       return static_cast< bool >(ewk_view_forward_possible(pWebview));
 }
 
 
 void
 _WebImpl::GoBack(void) const
 {
-       ewk_view_back(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       ewk_view_back(pWebview);
 }
 
 
 void
 _WebImpl::GoForward(void) const
 {
-       ewk_view_forward(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       ewk_view_forward(pWebview);
 }
 
 
 Tizen::Base::String
 _WebImpl::GetUrl(void) const
 {
-       return ewk_view_url_get(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return L"";
+       }
+
+       return ewk_view_url_get(pWebview);
 }
 
 
 Tizen::Base::String
 _WebImpl::GetTitle(void) const
 {
-       return ewk_view_title_get(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return L"";
+       }
+
+       return ewk_view_title_get(pWebview);
 }
 
 
 void
 _WebImpl::StopLoading(void) const
 {
-       ewk_view_stop(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       ewk_view_stop(pWebview);
 }
 
 
 void
 _WebImpl::Reload(void) const
 {
-       ewk_view_reload(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       ewk_view_reload(pWebview);
 }
 
 
 String*
 _WebImpl::EvaluateJavascriptN(const String& scriptCode)
 {
-       Evas_Object* pView = __pWebCore->GetWebNativeNode();
-       if (!pView)
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
        {
                return null;
        }
@@ -2617,23 +2787,29 @@ _WebImpl::EvaluateJavascriptN(const String& scriptCode)
        std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
        SysTryReturn(NID_WEB_CTRL, pPresenter.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
-       ewk_view_script_execute(pView, pScript.get(), OnScriptExecuted, pPresenter.get());
+       ewk_view_script_execute(pWebview, pScript.get(), OnScriptExecuted, pPresenter.get());
 
-       std::unique_ptr<String> pResult(new (std::nothrow) String(L""));
-       SysTryReturn(NID_WEB_CTRL, pResult.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+       String* pResult = new (std::nothrow) String(L"");
+       SysTryReturn(NID_WEB_CTRL, pResult, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
-       pPresenter->WaitAsyncProcess(*pResult.get());
+       pPresenter->WaitAsyncProcess(*pResult);
 
-       return pResult.release();
+       return pResult;
 }
 
 
 result
 _WebImpl::SetZoomLevel(float level)
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return E_SUCCESS;
+       }
+
        SysTryReturnResult(NID_WEB_CTRL, level >= MIN_ZOOM_LEVEL && level <= MAX_ZOOM_LEVEL, E_OUT_OF_RANGE, "The level(%f) must be between 0.3 and 2.0(%f).", level, level);
 
-       ewk_view_scale_set(__pWebCore->GetWebNativeNode(), static_cast< double >(level), 0, 0);
+       ewk_view_scale_set(pWebview, static_cast< double >(level), 0, 0);
 
        return E_SUCCESS;
 }
@@ -2642,15 +2818,21 @@ _WebImpl::SetZoomLevel(float level)
 float
 _WebImpl::GetZoomLevel(void) const
 {
-       return static_cast< float >(ewk_view_scale_get(__pWebCore->GetWebNativeNode()));
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return -1.0f;
+       }
+
+       return static_cast< float >(ewk_view_scale_get(pWebview));
 }
 
 
 const PageNavigationList*
 _WebImpl::GetBackForwardListN(void) const
 {
-       Evas_Object* pView = __pWebCore->GetWebNativeNode();
-       if (!pView)
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
        {
                return null;
        }
@@ -2669,7 +2851,7 @@ _WebImpl::GetBackForwardListN(void) const
        String url(L"");
        String title(L"");
 
-       Ewk_History* pEwkHistoryList = ewk_view_history_get(pView);
+       Ewk_History* pEwkHistoryList = ewk_view_history_get(pWebview);
        SysTryReturn(NID_WEB_CTRL, pEwkHistoryList, null, E_SYSTEM, "[%s] A system error has been occurred. Failed to get full history.", GetErrorMessage(E_SYSTEM));
 
        Ewk_History_Item* pEwkItem = ewk_history_nth_item_get(pEwkHistoryList, 0);
@@ -2729,8 +2911,8 @@ CATCH:
 bool
 _WebImpl::SearchText(const String& text, bool searchForward)
 {
-       Evas_Object* pView = __pWebCore->GetWebNativeNode();
-       if (!pView)
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
        {
                return false;
        }
@@ -2747,7 +2929,7 @@ _WebImpl::SearchText(const String& text, bool searchForward)
        std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
        SysTryReturn(NID_WEB_CTRL, pPresenter.get(), false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
-       r = SynchronizeSearch(SEARCH_SYNC, pView, condition, text, searchForward, false, pPresenter.get());
+       r = SynchronizeSearch(SEARCH_SYNC, pWebview, condition, text, searchForward, false, pPresenter.get());
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
 
        int result = 0;
@@ -2760,8 +2942,8 @@ _WebImpl::SearchText(const String& text, bool searchForward)
 result
 _WebImpl::SearchTextAllAsync(const Tizen::Base::String& text, bool caseSensitive)
 {
-       Evas_Object* pView = __pWebCore->GetWebNativeNode();
-       if (!pView)
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
        {
                return E_SUCCESS;
        }
@@ -2775,7 +2957,7 @@ _WebImpl::SearchTextAllAsync(const Tizen::Base::String& text, bool caseSensitive
            condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
        }
 
-       r = SynchronizeSearch(SEARCH_ALL_ASYNC, pView, condition, text, true, caseSensitive);
+       r = SynchronizeSearch(SEARCH_ALL_ASYNC, pWebview, condition, text, true, caseSensitive);
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        return E_SUCCESS;
@@ -2785,8 +2967,8 @@ _WebImpl::SearchTextAllAsync(const Tizen::Base::String& text, bool caseSensitive
 result
 _WebImpl::SearchNextAsync(bool searchForward)
 {
-       Evas_Object* pView = __pWebCore->GetWebNativeNode();
-       if (!pView)
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
        {
                return E_SUCCESS;
        }
@@ -2809,7 +2991,7 @@ _WebImpl::SearchNextAsync(bool searchForward)
                condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_BACKWARDS);
        }
 
-       r = SynchronizeSearch(SEARCH_NEXT_ASYNC, pView, condition, __textSearch.__text, searchForward);
+       r = SynchronizeSearch(SEARCH_NEXT_ASYNC, pWebview, condition, __textSearch.__text, searchForward);
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        return E_SUCCESS;
@@ -3026,8 +3208,8 @@ _WebImpl::GetElementByPointN(const Point& point) const
 const HitElementResult*
 _WebImpl::GetElementByPointN(const FloatPoint& point) const
 {
-       Evas_Object* pView = __pWebCore->GetWebNativeNode();
-       if (!pView)
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
        {
                return null;
        }
@@ -3044,7 +3226,7 @@ _WebImpl::GetElementByPointN(const FloatPoint& point) const
 
        Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(point)));
 
-       Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pView, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
+       Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pWebview, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
        SysTryReturn(NID_WEB_CTRL, pEwkHitTest, null, E_SYSTEM, "[%s] Failed to get hit test.", GetErrorMessage(E_SYSTEM));
 
        Eina_Hash* pAttrHash = ewk_hit_test_attribute_hash_get(pEwkHitTest);
@@ -3139,7 +3321,13 @@ CATCH:
 bool
 _WebImpl::IsLoading(void) const
 {
-       double percent = ewk_view_load_progress_get(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return false;
+       }
+
+       double percent = ewk_view_load_progress_get(pWebview);
 
        if (Double::Compare(percent, 0.0) > 0 && Double::Compare(percent, 1.0) < 0)
        {
@@ -3155,19 +3343,26 @@ _WebImpl::IsLoading(void) const
 String
 _WebImpl::GetTextFromBlock(void) const
 {
-       return ewk_view_text_selection_text_get(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return L"";
+       }
+
+       return ewk_view_text_selection_text_get(pWebview);
 }
 
 
 bool
 _WebImpl::IsPrivateBrowsingEnabled(void) const
 {
-       if (__pWebCore->GetWebNativeNode() == null)
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
        {
                return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsPrivateBrowsingEnabled();
        }
 
-       Ewk_Settings* pSettings = ewk_view_settings_get(__pWebCore->GetWebNativeNode());
+       Ewk_Settings* pSettings = ewk_view_settings_get(pWebview);
        SysAssertf(pSettings, "Failed to get webkit instance.");
 
        return static_cast< bool >(ewk_settings_private_browsing_enabled_get(pSettings));
@@ -3177,13 +3372,15 @@ _WebImpl::IsPrivateBrowsingEnabled(void) const
 void
 _WebImpl::SetPrivateBrowsingEnabled(bool enable)
 {
-       if (__pWebCore->GetWebNativeNode() == null)
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
        {
                _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetPrivateBrowsingEnabled(enable);
+
                return;
        }
 
-       Ewk_Settings* pSettings = ewk_view_settings_get(__pWebCore->GetWebNativeNode());
+       Ewk_Settings* pSettings = ewk_view_settings_get(pWebview);
        SysAssertf(pSettings, "Failed to get webkit instance.");
 
        ewk_settings_private_browsing_enabled_set(pSettings, static_cast< Eina_Bool >(enable));
@@ -3193,14 +3390,26 @@ _WebImpl::SetPrivateBrowsingEnabled(bool enable)
 void
 _WebImpl::ClearHistory(void)
 {
-       ewk_view_back_forward_list_clear(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       ewk_view_back_forward_list_clear(pWebview);
 }
 
 
 void
 _WebImpl::ClearCache(void)
 {
-       Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       Ewk_Context* pContext = ewk_view_context_get(pWebview);
 
        ewk_context_cache_clear(pContext);
 }
@@ -3209,7 +3418,13 @@ _WebImpl::ClearCache(void)
 void
 _WebImpl::ClearCookie(void)
 {
-       Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       Ewk_Context* pContext = ewk_view_context_get(pWebview);
        Ewk_Cookie_Manager* pCookieManager =  ewk_context_cookie_manager_get(pContext);
 
        ewk_cookie_manager_cookies_clear(pCookieManager);
@@ -3219,7 +3434,13 @@ _WebImpl::ClearCookie(void)
 void
 _WebImpl::ClearFormData(void)
 {
-       Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       Ewk_Context* pContext = ewk_view_context_get(pWebview);
 
        ewk_context_form_candidate_data_clear(pContext);
 }
@@ -3228,7 +3449,13 @@ _WebImpl::ClearFormData(void)
 void
 _WebImpl::ClearLoginFormData(void)
 {
-       Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       Ewk_Context* pContext = ewk_view_context_get(pWebview);
 
        ewk_context_form_password_data_clear(pContext);
 }
@@ -3237,12 +3464,13 @@ _WebImpl::ClearLoginFormData(void)
 bool
 _WebImpl::IsCookieEnabled(void) const
 {
-       if (__pWebCore->GetWebNativeNode() == null)
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
        {
                return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsCookieEnabled();
        }
 
-       Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
+       Ewk_Context* pContext = ewk_view_context_get(pWebview);
        Ewk_Cookie_Manager* pCookieManager =  ewk_context_cookie_manager_get(pContext);
        SysAssertf(pCookieManager, "Failed to get webkit instance.");
 
@@ -3261,14 +3489,15 @@ _WebImpl::IsCookieEnabled(void) const
 void
 _WebImpl::SetCookieEnabled(bool enable)
 {
-       if (__pWebCore->GetWebNativeNode() == null)
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
        {
                _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetCookiEnabled(enable);
 
                return;
        }
 
-       Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
+       Ewk_Context* pContext = ewk_view_context_get(pWebview);
        Ewk_Cookie_Manager* pCookieManager =  ewk_context_cookie_manager_get(pContext);
        SysAssertf(pCookieManager, "Failed to get webkit instance.");
 
@@ -3287,6 +3516,12 @@ _WebImpl::SetCookieEnabled(bool enable)
 result 
 _WebImpl::SavePageAsPdf(const String& filePath, const Dimension* pSize) const
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return E_SUCCESS;
+       }
+
        result r = E_SUCCESS;
 
        std::unique_ptr<char[]> pFilePath(_StringConverter::CopyToCharArrayN(filePath));
@@ -3311,15 +3546,15 @@ _WebImpl::SavePageAsPdf(const String& filePath, const Dimension* pSize) const
        {
                SysTryReturnResult(NID_WEB_CTRL, pSize->width > 0 && pSize->height > 0, E_INVALID_ARG, "Invalid argument(s) is used. Size of pdf file is invalid.");
 
-               ewk_view_contents_pdf_get(__pWebCore->GetWebNativeNode(), pSize->width, pSize->height, pFilePath.get());
+               ewk_view_contents_pdf_get(pWebview, pSize->width, pSize->height, pFilePath.get());
        }
        else
        {
                Evas_Coord contentsWidth;
                Evas_Coord contentsHeight;
 
-               ewk_view_contents_size_get(__pWebCore->GetWebNativeNode(), &contentsWidth, &contentsHeight);
-               ewk_view_contents_pdf_get(__pWebCore->GetWebNativeNode(), contentsWidth, contentsHeight, pFilePath.get());
+               ewk_view_contents_size_get(pWebview, &contentsWidth, &contentsHeight);
+               ewk_view_contents_pdf_get(pWebview, contentsWidth, contentsHeight, pFilePath.get());
        }
 
        return E_SUCCESS;
@@ -3329,10 +3564,16 @@ _WebImpl::SavePageAsPdf(const String& filePath, const Dimension* pSize) const
 bool
 _WebImpl::IsMimeSupported(const String& mime) const
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return false;
+       }
+
        std::unique_ptr<char[]> pMime(_StringConverter::CopyToCharArrayN(mime));
        SysTryReturn(NID_WEB_CTRL, pMime.get(), false, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
-       return static_cast< bool >(ewk_frame_can_show_mime_type(ewk_view_main_frame_get(__pWebCore->GetWebNativeNode()), pMime.get()));
+       return static_cast< bool >(ewk_frame_can_show_mime_type(ewk_view_main_frame_get(pWebview), pMime.get()));
 }
 
 
@@ -3559,10 +3800,12 @@ _WebImpl::SetEventListenerCallback(void) const
                evas_object_smart_callback_add(pWebNativeNode, "load,stop", OnLoadingCanceled, this);
                evas_object_smart_callback_add(pWebNativeNode, "load,error", OnLoadingErrorOccurred, this);
                evas_object_smart_callback_add(pWebNativeNode, "title,changed", OnPageTitleReceived, this);
+               evas_object_smart_callback_add(pWebNativeNode, "load,committed", OnLoadingCommitted, this);
 
                evas_object_smart_callback_add(pWebNativeNode, "requestToNative,json", OnHandleJavaScriptRequest, this);
 
                evas_object_smart_callback_add(pWinObject, "focus,in", OnWindowObjectFocusGained, this);
+               evas_object_smart_callback_add(pWinObject, "focus,out", OnWindowObjectFocusLost, this);
 
                evas_object_smart_callback_add(pWebNativeNode, "inputmethod,changed", OnWebKeypadStateChanged, this);
                evas_object_smart_callback_add(pWebNativeNode, "editorclient,ime,opened", OnWebKeypadOpened, this);
@@ -3576,6 +3819,7 @@ _WebImpl::SetEventListenerCallback(void) const
                ewk_view_javascript_alert_callback_set(pWebNativeNode, OnScriptAlertRequested, const_cast< _WebImpl* >(this));
                ewk_view_javascript_prompt_callback_set(pWebNativeNode, OnScriptPromptRequested, const_cast< _WebImpl* >(this));
                ewk_view_javascript_confirm_callback_set(pWebNativeNode, OnScriptConfirmRequested, const_cast< _WebImpl* >(this));
+               ewk_view_before_unload_confirm_panel_callback_set(pWebNativeNode, OnBeforeUnloadConfirmRequested, const_cast< _WebImpl* >(this));
 
                evas_object_smart_callback_add(pWebNativeNode, "policy,response,decide", OnWebDataReceived, this);
 
@@ -3599,12 +3843,14 @@ _WebImpl::SetEventListenerCallback(void) const
                evas_object_smart_callback_add(pWebNativeNode, "touchmove,handled", OnWebPreventDefaultTriggered, this);
                evas_object_smart_callback_add(pWebNativeNode, "icon,received", OnFaviconReceived, this);
 
-               evas_object_smart_callback_add(pWebNativeNode, "text,selected", OnWebPageBlockSelected, this);
+               evas_object_smart_callback_add(pWebNativeNode, "magnifier,hide", OnWebPageBlockSelected, this);
 
                evas_object_smart_callback_add(pWebNativeNode, "fullscreen,enterfullscreen", OnFullScreenEntered, this);
                evas_object_smart_callback_add(pWebNativeNode, "fullscreen,exitfullscreen", OnFullScreenExited, this);
 
-               ewk_view_open_panel_callback_set(pWebNativeNode, OnSelectUploadFile, const_cast< _WebImpl* >(this));
+               evas_object_smart_callback_add(pWebNativeNode, "keyevent,down,not,handled", OnFocusDownRequested, this);
+               evas_object_smart_callback_add(pWebNativeNode, "keyevent,up,not,handled", OnFocusUpRequested, this);
+
                Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
                SysAssertf(pContext, "Failed to get webkit instance.");
                ewk_context_did_start_download_callback_set(pContext, OnDidStartDownloadCallback, const_cast< _WebImpl* >(this));
@@ -3616,6 +3862,7 @@ _WebImpl::SetEventListenerCallback(void) const
                ewk_view_exceeded_local_file_system_quota_callback_set(pWebNativeNode, OnLocalFileSystemQuotaExceeded, const_cast< _WebImpl* >(this));
 
                evas_object_event_callback_add(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained, this);
+               evas_object_event_callback_add(pWebNativeNode, EVAS_CALLBACK_FOCUS_OUT, OnWebNativeNodeFocusLost, this);
        }
 }
 
@@ -3643,10 +3890,12 @@ _WebImpl::RemoveEventListenerCallback(void) const
                evas_object_smart_callback_del(pWebNativeNode, "load,stop", OnLoadingCanceled);
                evas_object_smart_callback_del(pWebNativeNode, "load,error", OnLoadingErrorOccurred);
                evas_object_smart_callback_del(pWebNativeNode, "title,changed", OnPageTitleReceived);
+               evas_object_smart_callback_del(pWebNativeNode, "load,committed", OnLoadingCommitted);
 
                evas_object_smart_callback_del(pWebNativeNode, "requestToNative,json", OnHandleJavaScriptRequest);
 
                evas_object_smart_callback_del_full(pWinObject, "focus,in", OnWindowObjectFocusGained, this);
+               evas_object_smart_callback_del_full(pWinObject, "focus,out", OnWindowObjectFocusLost, this);
 
                evas_object_smart_callback_del(pWebNativeNode, "inputmethod,changed", OnWebKeypadStateChanged);
                evas_object_smart_callback_del(pWebNativeNode, "editorclient,ime,opened", OnWebKeypadOpened);
@@ -3657,9 +3906,10 @@ _WebImpl::RemoveEventListenerCallback(void) const
 
                evas_object_smart_callback_del(pWebNativeNode, "geolocation,permission,request", OnGeolocationPermissionRequested);
 
-               ewk_view_javascript_alert_callback_set(null, null, null);
-               ewk_view_javascript_prompt_callback_set(null, null, null);
-               ewk_view_javascript_confirm_callback_set(null, null, null);
+               ewk_view_javascript_alert_callback_set(pWebNativeNode, null, null);
+               ewk_view_javascript_prompt_callback_set(pWebNativeNode, null, null);
+               ewk_view_javascript_confirm_callback_set(pWebNativeNode, null, null);
+               ewk_view_before_unload_confirm_panel_callback_set(pWebNativeNode, null, null);
 
                evas_object_smart_callback_del(pWebNativeNode, "policy,response,decide", OnWebDataReceived);
 
@@ -3683,12 +3933,14 @@ _WebImpl::RemoveEventListenerCallback(void) const
                evas_object_smart_callback_del(pWebNativeNode, "touchmove,handled", OnWebPreventDefaultTriggered);
                evas_object_smart_callback_del(pWebNativeNode, "icon,received", OnFaviconReceived);
 
-               evas_object_smart_callback_del(pWebNativeNode, "text,selected", OnWebPageBlockSelected);
+               evas_object_smart_callback_del(pWebNativeNode, "magnifier,hide", OnWebPageBlockSelected);
 
                evas_object_smart_callback_del(pWebNativeNode, "fullscreen,enterfullscreen", OnFullScreenEntered);
                evas_object_smart_callback_del(pWebNativeNode, "fullscreen,exitfullscreen", OnFullScreenExited);
 
-               ewk_view_open_panel_callback_set(null, null, null);
+               evas_object_smart_callback_del(pWebNativeNode, "keyevent,down,not,handled", OnFocusDownRequested);
+               evas_object_smart_callback_del(pWebNativeNode, "keyevent,up,not,handled", OnFocusUpRequested);
+
                Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
                SysAssertf(pContext, "Failed to get webkit instance.");
                ewk_context_vibration_client_callbacks_set(pContext, null, null, null);
@@ -3699,36 +3951,11 @@ _WebImpl::RemoveEventListenerCallback(void) const
                ewk_view_exceeded_local_file_system_quota_callback_set(pWebNativeNode, null, null);
 
                evas_object_event_callback_del(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained);
+               evas_object_event_callback_del(pWebNativeNode, EVAS_CALLBACK_FOCUS_OUT, OnWebNativeNodeFocusLost);
        }
 }
 
 
-void
-_WebImpl::ClearCertificateDb(void)
-{
-       result r = E_SUCCESS;
-
-       String certificatePath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
-       String table(CERTIFICATE_TABLE_NAME);
-       _DatabaseImpl db;
-
-       r = db.Construct(certificatePath, "r+", null);
-       SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
-
-       db.BeginTransaction();
-
-       r = db.ExecuteSql(L"Delete From " + table, true);
-       SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
-       db.CommitTransaction();
-
-       return;
-
-CATCH:
-       db.RollbackTransaction();
-}
-
-
 result
 _WebImpl::SetBlockSelectionPosition(const Point& startPoint)
 {
@@ -3739,42 +3966,37 @@ _WebImpl::SetBlockSelectionPosition(const Point& startPoint)
 result
 _WebImpl::SetBlockSelectionPosition(const FloatPoint& startPoint)
 {
-       Evas_Object* pView = __pWebCore->GetWebNativeNode();
-       Ewk_View_Smart_Data* pSmartData = (Ewk_View_Smart_Data*) evas_object_smart_data_get(pView);
-       if (pSmartData && pSmartData->api)
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
        {
-               Point absPoint( _CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(startPoint)));
+               return E_SUCCESS;
+       }
 
-               Eina_Bool ret = pSmartData->api->text_selection_down(pSmartData, absPoint.x, absPoint.y);
-               if (ret)
-               {
-                       pSmartData->api->text_selection_up(pSmartData, absPoint.x, absPoint.y);
+       Ewk_View_Smart_Data* pSmartData = reinterpret_cast< Ewk_View_Smart_Data* >(evas_object_smart_data_get(pWebview));
+       SysAssertf(pSmartData && pSmartData->api, "Failed to get webkit instance.");
+       Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(startPoint)));
 
-                       Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pView, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
-                       SysTryReturnResult(NID_WEB_CTRL, pEwkHitTest, E_SYSTEM, "Failed to get hit test.");
+       Eina_Bool ret = pSmartData->api->text_selection_down(pSmartData, absPoint.x, absPoint.y);
+       if (ret)
+       {
+               pSmartData->api->text_selection_up(pSmartData, absPoint.x, absPoint.y);
 
-                       String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
+               Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pWebview, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
+               SysTryReturnResult(NID_WEB_CTRL, pEwkHitTest, E_SYSTEM, "Failed to get hit test.");
 
-                       if (tagName.Equals(L"INPUT", false) || tagName.Equals(L"TEXTAREA", false))
-                       {
-                               ewk_view_command_execute(pView, "SelectWord", 0);
-                       }
-                       else
-                       {
-                               Eina_Hash* pAttrHash = ewk_hit_test_attribute_hash_get(pEwkHitTest);
-                               char* pValue = reinterpret_cast< char* >(eina_hash_find(pAttrHash, "contenteditable"));
-                               if(pValue)
-                               {
-                                       ewk_view_command_execute(pView, "SelectWord", 0);
-                               }
-                       }
+               String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
+
+               Eina_Hash* pAttrHash = ewk_hit_test_attribute_hash_get(pEwkHitTest);
+               char* pValue = reinterpret_cast< char* >(eina_hash_find(pAttrHash, "contenteditable"));
+               if (tagName.Equals(L"INPUT", false) || tagName.Equals(L"TEXTAREA", false) || pValue)
+               {
+                       ewk_view_command_execute(pWebview, "SelectWord", null);
+                       evas_object_smart_callback_call(pWebview, "magnifier,hide", NULL);
                }
        }
 
        SysTryReturnResult(NID_WEB_CTRL, GetTextFromBlock().GetLength() > 0, E_INVALID_ARG, "Failed to set text selection up.");
 
-       evas_object_smart_callback_call(pView, "text,selected", NULL);
-
        return E_SUCCESS;
 }
 
@@ -3782,7 +4004,13 @@ _WebImpl::SetBlockSelectionPosition(const FloatPoint& startPoint)
 void
 _WebImpl::ReleaseBlock(void)
 {
-       ewk_view_text_selection_range_clear(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       ewk_view_text_selection_range_clear(pWebview);
 }
 
 
@@ -3802,6 +4030,13 @@ _WebImpl::GetBlockRange(Point& startPoint, Point& endPoint) const
 void
 _WebImpl::GetBlockRange(FloatPoint& startPoint, FloatPoint& endPoint) const
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               startPoint.x = startPoint.y = endPoint.x = endPoint.y = 0.0f;
+               
+       }
+
        Eina_Rectangle leftHandle;
        Eina_Rectangle rightHandle;
 
@@ -3826,12 +4061,17 @@ _WebImpl::GetBlockRange(FloatPoint& startPoint, FloatPoint& endPoint) const
 Bitmap*
 _WebImpl::GetFaviconN(void) const
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return null;
+       }
+
        result r = E_SUCCESS;
 
-       Evas_Object* pView = __pWebCore->GetWebNativeNode();
-       Ewk_Context* pContext = ewk_view_context_get(pView);
-       const char* pUrl = ewk_view_url_get(pView);
-       Evas* pEvas = evas_object_evas_get(pView);
+       Ewk_Context* pContext = ewk_view_context_get(pWebview);
+       const char* pUrl = ewk_view_url_get(pWebview);
+       Evas* pEvas = evas_object_evas_get(pWebview);
 
        Evas_Object* pFavicon = ewk_context_icon_database_icon_object_add(pContext, pUrl, pEvas);
        if (!pFavicon)
@@ -3864,23 +4104,41 @@ _WebImpl::GetFaviconN(void) const
 void
 _WebImpl::ScrollBy(const Tizen::Graphics::Point& diff)
 {
-       ewk_view_scroll_by(__pWebCore->GetWebNativeNode(), diff.x, diff.y);
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       ewk_view_scroll_by(pWebview, diff.x, diff.y);
 }
 
 
 void
 _WebImpl::ScrollTo(const Tizen::Graphics::Point& dest)
 {
-       ewk_view_scroll_set(__pWebCore->GetWebNativeNode(), dest.x, dest.y);
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       ewk_view_scroll_set(pWebview, dest.x, dest.y);
 }
 
 
 Point
 _WebImpl::GetScrollPosition(void) const
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return Point(0, 0);
+       }
+
        Point position;
 
-       ewk_view_scroll_pos_get(__pWebCore->GetWebNativeNode(), &position.x, &position.y);
+       ewk_view_scroll_pos_get(pWebview, &position.x, &position.y);
 
        return position;
 }
@@ -3889,10 +4147,16 @@ _WebImpl::GetScrollPosition(void) const
 Dimension
 _WebImpl::GetPageSize(void) const
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return Dimension(0, 0);
+       }
+
        Evas_Coord width = 0;
        Evas_Coord height = 0;
 
-       ewk_view_contents_size_get(__pWebCore->GetWebNativeNode(), &width, &height);
+       ewk_view_contents_size_get(pWebview, &width, &height);
 
        Dimension size(static_cast< int >(width), static_cast< int >(height));
 
@@ -3900,36 +4164,6 @@ _WebImpl::GetPageSize(void) const
 }
 
 
-result
-_WebImpl::AddHttpHeaderField(const String& name, const String& value)
-{
-       SysTryReturnResult(NID_WEB_CTRL, name.GetLength() > 0, E_INVALID_ARG, "Invalid argument(s) is used. name key is missing.");
-
-       std::unique_ptr<char[]> pName(_StringConverter::CopyToCharArrayN(name));
-       SysTryReturn(NID_WEB_CTRL, pName.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
-
-       std::unique_ptr<char[]> pValue(_StringConverter::CopyToCharArrayN(value));
-
-       ewk_view_custom_header_add(__pWebCore->GetWebNativeNode(), pName.get(), pValue.get());
-
-       return E_SUCCESS;
-}
-
-
-result
-_WebImpl::RemoveHttpHeaderField(const String& name)
-{
-       SysTryReturnResult(NID_WEB_CTRL, name.GetLength() > 0, E_INVALID_ARG, "Invalid argument(s) is used. name key is missing.");
-
-       std::unique_ptr<char[]> pName(_StringConverter::CopyToCharArrayN(name));
-       SysTryReturn(NID_WEB_CTRL, pName.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
-
-       ewk_view_custom_header_remove(__pWebCore->GetWebNativeNode(), pName.get());
-
-       return E_SUCCESS;
-}
-
-
 void
 _WebImpl::SetLoadingErrorOccurred(bool arg)
 {
@@ -4003,6 +4237,12 @@ _WebImpl::IsCertificateConfirmed(void) const
 result
 _WebImpl::SetFullScreenKeypad(void)
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return E_SUCCESS;
+       }
+
        result r = E_SUCCESS;
 
        std::unique_ptr<Keypad> pKeypad(new (std::nothrow) Keypad());
@@ -4011,8 +4251,23 @@ _WebImpl::SetFullScreenKeypad(void)
        r = pKeypad->Construct(KEYPAD_STYLE_NORMAL, 100);
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
-       String text(ewk_view_focused_input_element_value_get(__pWebCore->GetWebNativeNode()));
-       pKeypad->SetText(text);
+       Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(__pWebCore->GetTouchPosition())));
+
+       Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pWebview, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
+       SysTryReturnResult(NID_WEB_CTRL, pEwkHitTest, E_SYSTEM, "Failed to get hit test.");
+
+       String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
+       if (tagName.Equals(L"INPUT", false))
+       {
+               String text(ewk_view_focused_input_element_value_get(pWebview));
+               pKeypad->SetText(text);
+       }
+       else
+       {
+               String* pText = EvaluateJavascriptN(L"document.activeElement.value");
+               SysTryReturnResult(NID_WEB_CTRL, pText, E_OUT_OF_MEMORY, "Memory allocation failed.");
+               pKeypad->SetText(*pText);
+       }
 
        r = pKeypad->SetShowState(true);
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
@@ -4078,6 +4333,20 @@ _WebImpl::SetKeypadOpened(bool isKeypadOpened)
 }
 
 
+bool
+_WebImpl::IsWinFocusLost(void) const
+{
+       return __isWinFocusLost;
+}
+
+
+void
+_WebImpl::SetWinFocusLost(bool isWinFocusLost)
+{
+       __isWinFocusLost = isWinFocusLost;
+}
+
+
 Rectangle
 _WebImpl::GetPreviousKeypadBounds(void) const
 {
@@ -4102,9 +4371,31 @@ _WebImpl::OnTextValueChangeCanceled(const Control& source)
 void
 _WebImpl::OnTextValueChanged(const Control& source)
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
        std::unique_ptr<char[]> pText(_StringConverter::CopyToCharArrayN(__pKeypad->GetText()));
+       SysTryReturnVoidResult(NID_WEB_CTRL, pText.get(), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+
+       Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(__pWebCore->GetTouchPosition())));
 
-       ewk_view_focused_input_element_value_set(__pWebCore->GetWebNativeNode(), pText.get());
+       Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pWebview, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
+       SysTryReturnVoidResult(NID_WEB_CTRL, pEwkHitTest, E_SYSTEM, "[E_SYSTEM] Failed to get hit test.");
+
+       String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
+       if (tagName.Equals(L"INPUT", false))
+       {
+               ewk_view_focused_input_element_value_set(__pWebCore->GetWebNativeNode(), pText.get());
+       }
+       else
+       {
+               ewk_view_command_execute(pWebview, "SelectAll", null);
+               ewk_view_command_execute(pWebview, "Delete", null);
+               ewk_view_command_execute(pWebview, "InsertText", pText.get());
+       }
 
        RemoveFullScreenKeypad();
 }
@@ -4442,7 +4733,7 @@ _WebImpl::VibrationRequested(uint64_t duration)
 
        __pVibrator.reset();
 
-       std::unique_ptr<_VibratorImpl> pVibrator(new (std::nothrow) _VibratorImpl);
+       std::unique_ptr<Vibrator> pVibrator(new (std::nothrow) Vibrator());
        SysTryReturnResult(NID_WEB_CTRL, pVibrator.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
 
        r = pVibrator->Construct();
@@ -4452,7 +4743,7 @@ _WebImpl::VibrationRequested(uint64_t duration)
 
        IntensityDurationVibrationPattern pattern = {static_cast< int >(duration), -1};
 
-       r = __pVibrator->Start(&pattern, 1, 1);
+       r = __pVibrator->Start(&pattern, 1);
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        return E_SUCCESS;
@@ -4538,7 +4829,7 @@ _WebImpl::ShowCertificateConfirmPopup(_CertificatePopupMode userConfirmMode, Ewk
        std::unique_ptr<_CertificateConfirmPopup> pCertConfirmPopup(new (std::nothrow) _CertificateConfirmPopup());
        SysTryReturnResult(NID_WEB_CTRL, pCertConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
 
-       r = pCertConfirmPopup->Construct(userConfirmMode, pPolicy, this);
+       r = pCertConfirmPopup->Construct(userConfirmMode, pPolicy);
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        __pCertConfirmPopup = std::move(pCertConfirmPopup);
@@ -4682,19 +4973,6 @@ _WebImpl::ShowUserConfirmPopup(_UserConfirmMode userConfirmMode, void* pPolicy,
 
                break;
        }
-       case USER_SCRIPT_CONFIRM:
-       {
-               __pScriptConfirmPopup = std::move(pUserConfirmPopup);
-
-               r = __pScriptConfirmPopup->ShowAndWait(modalResult);
-               SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pScriptConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
-
-               __pScriptConfirmPopup.reset();
-
-               ewk_view_resume(__pWebCore->GetWebNativeNode());
-
-               break;
-       }
        default:
                break;
        }
@@ -4717,15 +4995,14 @@ _WebImpl::ShowUserConfirmPopupAsync(_UserConfirmMode userConfirmMode, void* pPol
        switch(userConfirmMode)
        {
        case USER_CONFIRM_USERMEDIA:
-    {
-        __pUserMediaConfirmPopup.reset();
+       {
+               __pUserMediaConfirmPopup.reset();
 
                __pUserMediaConfirmPopup = std::move(pUserConfirmPopup);
 
                r = __pUserMediaConfirmPopup->ShowPopup();
                SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pUserMediaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
 
-               __pUserMediaConfirmPopup.release();
                break;
        }
        case USER_CONFIRM_GEOLOCATION:
@@ -4737,7 +5014,6 @@ _WebImpl::ShowUserConfirmPopupAsync(_UserConfirmMode userConfirmMode, void* pPol
                r = __pGeolocationConfirmPopup->ShowPopup();
                SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pGeolocationConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
 
-               __pGeolocationConfirmPopup.release();
                break;
        }
        case USER_CONFIRM_NOTIFICATION:
@@ -4749,7 +5025,6 @@ _WebImpl::ShowUserConfirmPopupAsync(_UserConfirmMode userConfirmMode, void* pPol
                r = __pNotificationConfirmPopup->ShowPopup();
                SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pNotificationConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
 
-               __pNotificationConfirmPopup.release();
                break;
        }
        case USER_SCRIPT_ALERT:
@@ -4761,7 +5036,28 @@ _WebImpl::ShowUserConfirmPopupAsync(_UserConfirmMode userConfirmMode, void* pPol
                r = __pScriptAlertConfirmPopup->ShowPopup();
                SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pScriptAlertConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
 
-               __pScriptAlertConfirmPopup.release();
+               break;
+       }
+       case USER_SCRIPT_CONFIRM:
+       {
+               __pScriptConfirmPopup.reset();
+
+               __pScriptConfirmPopup = std::move(pUserConfirmPopup);
+
+               r = __pScriptConfirmPopup->ShowPopup();
+               SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pScriptConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+               break;
+       }
+       case USER_BEFORE_UNLOAD_CONFIRM:
+       {
+               __pBeforeUnloadConfirmPopup.reset();
+
+               __pBeforeUnloadConfirmPopup = std::move(pUserConfirmPopup);
+
+               r = __pBeforeUnloadConfirmPopup->ShowPopup();
+               SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pBeforeUnloadConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
+
                break;
        }
        default:
@@ -4800,12 +5096,6 @@ _WebImpl::GetParentFormImpl(_ControlImpl* pControlImpl)
 bool 
 _WebImpl::OnFocusGained(const _ControlImpl& source)
 {
-       Ewk_Settings* pSettings = ewk_view_settings_get(__pWebCore->GetWebNativeNode());
-       SysAssertf(pSettings, "Failed to get webkit instance.");
-       ewk_settings_clear_text_selection_automatically_set(pSettings, true);
-
-       evas_object_focus_set(__pWebCore->GetWebNativeNode(), EINA_TRUE);
-
        return false;
 }
 
@@ -4813,19 +5103,17 @@ _WebImpl::OnFocusGained(const _ControlImpl& source)
 bool 
 _WebImpl::OnFocusLost(const _ControlImpl& source)
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return false;
+       }
+
        if(IsKeypadVisible() == true)
        {
                SetKeypadOpened(true);
-
-               SetKeypadVisibleState(false);
        }
 
-       Ewk_Settings* pSettings = ewk_view_settings_get(__pWebCore->GetWebNativeNode());
-       SysAssertf(pSettings, "Failed to get webkit instance.");
-       ewk_settings_clear_text_selection_automatically_set(pSettings, false);
-
-       evas_object_focus_set(__pWebCore->GetWebNativeNode(), EINA_FALSE);
-
        return false;
 }
 
@@ -4847,51 +5135,80 @@ _WebImpl::OnPreAttachedToMainTree(void)
 {
        result r = E_SUCCESS;
 
+       r = _ContainerImpl::OnPreAttachedToMainTree();
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       if (!HasValidNativeNode())
+       {
+               r = __pWebCore->InitializeWebNativeNode();
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+               _ControlManager* pControlManager = _ControlManager::GetInstance();
+               SysTryReturnResult(NID_WEB_CTRL, pControlManager, E_SYSTEM, "Failed to get the _ControlManager instance.");
+               OnChangeLayout(pControlManager->GetScreenRotation());
+
+               r = InitializeSetting();
+               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+               _SettingInfoImpl::AddSettingEventListener(*this);
+
+               _WebManager* pWebManager = _WebManager::GetInstance();
+               SysTryReturnResult(NID_WEB_CTRL, pWebManager, E_SYSTEM, "Failed to get the _WebManager instance.");
+               pWebManager->AddWeb(reinterpret_cast< int >(this));
+       }
+
        if (IsVisible() == true)
        {
                _WebManager* pWebManager = _WebManager::GetInstance();
+               SysTryReturnResult(NID_WEB_CTRL, pWebManager, E_SYSTEM, "Failed to get the _WebManager instance.");
                pWebManager->SetActiveWeb(this);
        }
 
-       r = __pWebCore->InitializeWebNativeNode();
-       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+       return E_SUCCESS;
+}
 
-       _ControlManager* pControlManager = _ControlManager::GetInstance();
-       SysTryReturnResult(NID_WEB_CTRL, pControlManager, E_SYSTEM, "Failed to get the ControlManager instance.");
-       OnChangeLayout(pControlManager->GetScreenRotation());
 
-       r = InitializeSetting();
-       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+result
+_WebImpl::OnDetachingFromMainTree(void)
+{
+       result r = E_SUCCESS;
 
-       r = _ContainerImpl::OnPreAttachedToMainTree();
+       r = _ContainerImpl::OnDetachingFromMainTree();
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        _WebManager* pWebManager = _WebManager::GetInstance();
-       pWebManager->AddWeb(reinterpret_cast< int >(this));
+       SysTryReturnResult(NID_WEB_CTRL, pWebManager, E_SYSTEM, "Failed to get the _WebManager instance.");
+       pWebManager->RemoveActiveWeb(this);
 
        return E_SUCCESS;
 }
 
 
-result
-_WebImpl::OnDetachingFromMainTree(void)
+void
+_WebImpl::OnSettingChanged(String& key)
 {
-       _WebManager* pWebManager = _WebManager::GetInstance();
-       pWebManager->RemoveWeb(reinterpret_cast< int >(this));
-       pWebManager->RemoveActiveWeb(this);     
-
-       _DownloadManagerImpl* pManagerImpl = _DownloadManagerImpl::GetInstance();
-       pManagerImpl->SetDownloadListener(null);
-
-       RemoveEventListenerCallback();
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
 
-       return E_SUCCESS;
+       if (key == L"http://tizen.org/setting/font.type")
+       {
+               ewk_view_use_settings_font(pWebview);
+       }
 }
 
 
 void
 _WebImpl::OnChangeLayout(_ControlRotation rotation)
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
        int degree = 0;
 
        switch (rotation)
@@ -4900,18 +5217,18 @@ _WebImpl::OnChangeLayout(_ControlRotation rotation)
                        degree =  0;
                        break;
                case _CONTROL_ROTATION_90:
-                       degree =  90;
+                       degree =  -90;
                        break;
                case _CONTROL_ROTATION_180:
                        degree =  180;
                        break;
                case _CONTROL_ROTATION_270:
-                       degree =  -90;
+                       degree =  90;
                        break;
                default:
                        SysAssert(false);
        }
-       ewk_view_orientation_send(__pWebCore->GetWebNativeNode(), degree);
+       ewk_view_orientation_send(pWebview, degree);
 }
 
 
@@ -4935,22 +5252,38 @@ _WebImpl::OnChangeLayout(_ControlOrientation orientation)
                pWebNotification = static_cast< _WebNotification* >(pEnum->GetCurrent());
                pWebNotification->OnChangeLayout();
        }
+
+       if (IsKeypadVisible())
+       {
+               _ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetInverseTransformer();
+               SysAssertf(pXformer, "Failed to get CoordinateTransformer");
+
+               _FormImpl* pFormImpl = GetParentFormImpl(dynamic_cast< _ControlImpl* >(this));
+               pFormImpl->DeflateClientRectHeight(pXformer->TransformVertical(GetPreviousKeypadBounds().height));
+       }
 }
 
 
 void
 _WebImpl::OnAncestorVisibleStateChanged(const _Control& control)
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
        _WebManager* pWebManager = _WebManager::GetInstance();
+       SysTryReturnVoidResult(NID_WEB_CTRL, pWebManager, E_SYSTEM, "[E_SYSTEM] Failed to get the _WebManager instance.");
        if (IsVisible() == true)
        {
                pWebManager->SetActiveWeb(this);
-               ewk_view_page_visibility_state_set(__pWebCore->GetWebNativeNode(), EWK_PAGE_VISIBILITY_STATE_VISIBLE, false);
+               ewk_view_page_visibility_state_set(pWebview, EWK_PAGE_VISIBILITY_STATE_VISIBLE, false);
        }
        else
        {
                pWebManager->RemoveActiveWeb(this);
-               ewk_view_page_visibility_state_set(__pWebCore->GetWebNativeNode(), EWK_PAGE_VISIBILITY_STATE_HIDDEN, false);
+               ewk_view_page_visibility_state_set(pWebview, EWK_PAGE_VISIBILITY_STATE_HIDDEN, false);
        }
 }
 
@@ -4959,7 +5292,7 @@ void
 _WebImpl::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
 {
        _ContainerImpl::OnUserEventReceivedN(requestId, pArgs);
-
+       
        switch (requestId)
        {
        case ID_CERTIFICATE_CONFIRM_POPUP_CLOSE:
@@ -4983,9 +5316,19 @@ _WebImpl::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::ILi
        case ID_USER_SCRIPT_CONFIRM_CLOSE:
                __pScriptConfirmPopup.reset();
                break;
+
+       case ID_USER_BEFORE_UNLOAD_CONFIRM_CLOSE:
+               __pBeforeUnloadConfirmPopup.reset();
+               break;
+
+       case ID_USER_SCRIPT_SELECTBOX_CLOSE:
+               __pSelectBox.reset();
+               break;
        default:
                break;
        }
+
+       Resume();
 }
 
 
@@ -5001,6 +5344,8 @@ _WebImpl::HideColorPicker(void)
 {
        __pColorPicker.reset();
 
+       Resume();
+
        return EINA_TRUE;
 }
 
@@ -5020,7 +5365,8 @@ _WebImpl::ShowColorPicker(int red, int green, int blue, int alpha, Color& color)
 
        __pColorPicker = std::move(pColorHadler);
 
-       r = __pColorPicker->ShowPopup();
+       int modalResult = 0;
+       r = __pColorPicker->ShowAndWait(modalResult);
        SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
 
        if (__pColorPicker)
@@ -5032,6 +5378,7 @@ CATCH:
        if (__pColorPicker)
        {
                __pColorPicker.reset();
+               Resume();
        }
 
        return r;
@@ -5051,7 +5398,8 @@ _WebImpl::ShowDatePicker(Ewk_Input_Type inputType, const char* inputValue, Strin
 
        __pDatePicker = std::move(pInputPicker);
 
-       r = __pDatePicker->ShowPopup();
+       int modalResult = 0;
+       r = __pDatePicker->ShowAndWait(modalResult);
        SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
 
        if (__pDatePicker)
@@ -5063,6 +5411,7 @@ CATCH:
        if (__pDatePicker)
        {
                __pDatePicker.reset();
+               Resume();
        }
 
        return r;
@@ -5391,11 +5740,4 @@ _WebImpl::SetWebNotification(_WebNotification* pWebNotification)
 }
 
 
-void
-_WebImpl::OnDownloadCompleted(RequestId reqId, const String &path)
-{
-       _ContentManagerImpl::ScanFile(path);
-}
-
-
 }}} // Tizen::Web::Controls