fix lock up issue for download
[framework/osp/web.git] / src / controls / FWebCtrl_WebImpl.cpp
index 49e19bd..96c8b32 100755 (executable)
@@ -362,7 +362,6 @@ OnScriptConfirmRequested(Evas_Object* pView, const char* pMessage, void* pUserDa
        SysLog(NID_WEB_CTRL, "The current value of message is %s", pMessage);
 
        result r = E_SUCCESS;
-       _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
        String msg(pMessage);
 
        MessageBox messageBox;
@@ -1130,8 +1129,6 @@ OnWebDataReceived(void* pUserData, Evas_Object* pView, void* pEventInfo)
                {
                        ewk_policy_decision_ignore(pPolicy);
 
-                       _SelectBox selectBox;
-                       int selectedIndex = 0;
                        String operationId(L"http://tizen.org/appcontrol/operation/view");
 
                        r = _AppControlImpl::FindAndStart(operationId, &url, &mime, null, null, null);
@@ -1139,24 +1136,15 @@ OnWebDataReceived(void* pUserData, Evas_Object* pView, void* pEventInfo)
        
                        if (r == E_OBJ_NOT_FOUND)
                        {
-                               r = selectBox.Construct(false, L"Select application", 1); //+1 for Downloader
-                               SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+                               _SelectBox* pSelectBox = new (std::nothrow) _SelectBox;
+                               SysTryReturnVoidResult(NID_WEB_CTRL, pSelectBox, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
-                               selectBox.AddListItem(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_DOWNLOAD"), _SelectBox::LIST_ITEM_TYPE_NORMAL, false);
-                               r = selectBox.ShowAndWait(selectedIndex);
+                               r = pSelectBox->Construct(false, L"Select application", 1, null, url);
                                SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
 
-                               if (selectedIndex == 0) //download
-                               {
-                                       RequestId reqId = 0;
-                                       DownloadRequest request(pUrl);
-
-                                       _DownloadManagerImpl* pManagerImpl = _DownloadManagerImpl::GetInstance();
-                                       SysTryReturnVoidResult(NID_WEB_CTRL, pManagerImpl, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
-
-                                       r = pManagerImpl->Start(request, reqId);
-                                       SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
-                               }
+                               pSelectBox->AddListItem(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_DOWNLOAD"), _SelectBox::LIST_ITEM_TYPE_NORMAL, false);
+                               r = pSelectBox->ShowPopup();
+                               SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
                        }
 
                        return;
@@ -4798,6 +4786,12 @@ _WebImpl::GetParentFormCore(_Control* pControlCore)
 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;
 }
 
@@ -4812,6 +4806,10 @@ _WebImpl::OnFocusLost(const _ControlImpl& source)
                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;