From: hyun lee Date: Thu, 18 Jul 2013 15:17:27 +0000 (+0900) Subject: Fix for issue about popup X-Git-Tag: submit/tizen_2.2/20131107.062229~79 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=be29b6822619d941816bd9f275251464ac99d32e;p=framework%2Fosp%2Fweb.git Fix for issue about popup Change-Id: I8d3cfa7f4317c1e232f7f7975486bb52c5761acb Signed-off-by: hyun lee --- diff --git a/src/controls/FWebCtrl_CertificateConfirmPopup.cpp b/src/controls/FWebCtrl_CertificateConfirmPopup.cpp index 2ed73a3..711bbf4 100755 --- a/src/controls/FWebCtrl_CertificateConfirmPopup.cpp +++ b/src/controls/FWebCtrl_CertificateConfirmPopup.cpp @@ -66,6 +66,7 @@ _CertificateConfirmPopup::_CertificateConfirmPopup(void) : __certPopupMode(CERTIFICATE_POPUP_MODE_USER_CONFIRM) , __confirm(false) , __pCertificatePolicyData(null) + , __pImpl(null) { } @@ -80,7 +81,7 @@ _CertificateConfirmPopup::~_CertificateConfirmPopup(void) result -_CertificateConfirmPopup::Construct(_CertificatePopupMode certPopupMode, Ewk_Certificate_Policy_Decision* pPolicy) +_CertificateConfirmPopup::Construct(_CertificatePopupMode certPopupMode, Ewk_Certificate_Policy_Decision* pPolicy, Tizen::Web::Controls::_WebImpl* pImpl) { SysTryReturnResult(NID_WEB_CTRL, pPolicy, E_INVALID_ARG, "Certificate Policy pointer is null."); result r = E_SUCCESS; @@ -97,6 +98,11 @@ _CertificateConfirmPopup::Construct(_CertificatePopupMode certPopupMode, Ewk_Cer int popupMaxHeight = 0; Rectangle rect(0, 0, 0, 0); + if (pImpl == null) + { + __pImpl = pImpl; + } + ArrayList idList; r = idList.Construct(); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); @@ -222,7 +228,7 @@ _CertificateConfirmPopup::OnActionPerformed(const Control& source, int actionId) std::unique_ptr<_CertificateConfirmPopup> pCertificatePopup(new (std::nothrow) _CertificateConfirmPopup()); SysTryReturnVoidResult(NID_WEB_CTRL, pCertificatePopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed."); - r = pCertificatePopup->Construct(CERTIFICATE_POPUP_MODE_VIEW, __pCertificatePolicyData); + r = pCertificatePopup->Construct(CERTIFICATE_POPUP_MODE_VIEW, __pCertificatePolicyData, null); SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r)); r = pCertificatePopup->ShowPopup(); @@ -249,9 +255,9 @@ _CertificateConfirmPopup::OnActionPerformed(const Control& source, int actionId) { SysLogException(NID_WEB_CTRL, r, "[%s] Propagating.", GetErrorMessage(r)); } - if (__certPopupMode == CERTIFICATE_POPUP_MODE_VIEW ) + if (__certPopupMode == CERTIFICATE_POPUP_MODE_VIEW) { - GetOwner()->SendUserEvent(ID_CERTIFICATE_CONFIRM_POPUP_CLOSE, null); + __pImpl->SendUserEvent(ID_CERTIFICATE_CONFIRM_POPUP_CLOSE, null); } } @@ -276,9 +282,9 @@ _CertificateConfirmPopup::OnKeyReleased(Control& source, const KeyEventInfo& key { SysLogException(NID_WEB_CTRL, r, "[%s] Propagating.", GetErrorMessage(r)); } - if (__certPopupMode == CERTIFICATE_POPUP_MODE_VIEW ) + if (__certPopupMode == CERTIFICATE_POPUP_MODE_VIEW) { - GetOwner()->SendUserEvent(ID_CERTIFICATE_CONFIRM_POPUP_CLOSE, null); + __pImpl->SendUserEvent(ID_CERTIFICATE_CONFIRM_POPUP_CLOSE, null); } } diff --git a/src/controls/FWebCtrl_UserConfirmPopup.cpp b/src/controls/FWebCtrl_UserConfirmPopup.cpp index 9eb5049..7304145 100755 --- a/src/controls/FWebCtrl_UserConfirmPopup.cpp +++ b/src/controls/FWebCtrl_UserConfirmPopup.cpp @@ -19,6 +19,7 @@ * @file FWebCtrl_UserConfirmPopup.cpp * @brief The file contains the definition of _UserConfirmPopup class. */ +#include #include #include #include @@ -64,12 +65,14 @@ _UserConfirmPopup::_UserConfirmPopup(void) , __userConfirmMode(USER_CONFIRM_USERMEDIA) , __pCheckButton(null) , __sync(false) + , __pImpl(null) { } _UserConfirmPopup::~_UserConfirmPopup(void) { + if (IsModalPopup()) { HandleUserAction(EINA_FALSE); @@ -78,7 +81,7 @@ _UserConfirmPopup::~_UserConfirmPopup(void) result -_UserConfirmPopup::Construct(_UserConfirmMode userConfirmMode, void* pEventInfo, bool sync, String msg) +_UserConfirmPopup::Construct(_UserConfirmMode userConfirmMode, void* pEventInfo, Tizen::Web::Controls::_WebImpl* pImpl, bool sync, String msg) { result r = E_SUCCESS; SysTryReturnResult(NID_WEB_CTRL, pEventInfo, E_INVALID_ARG, "Invalid argument(s) is used. pPolicy is null."); @@ -98,6 +101,11 @@ _UserConfirmPopup::Construct(_UserConfirmMode userConfirmMode, void* pEventInfo, bool hasTitle = true; int popupMaxHeight = 2*pPopupData->labelDim.height + pPopupData->btnDim.height + 2*pPopupData->sideMargin; + if (pImpl == null) + { + __pImpl = pImpl; + } + if (__userConfirmMode == USER_CONFIRM_GEOLOCATION) { popupMaxHeight += pPopupData->checkDim.height; @@ -240,22 +248,22 @@ _UserConfirmPopup::OnActionPerformed(const Control& source, int actionId) { case USER_CONFIRM_USERMEDIA: { - GetOwner()->SendUserEvent(ID_USER_CONFIRM_USERMEDIA_CLOSE, null); + __pImpl->SendUserEvent(ID_USER_CONFIRM_USERMEDIA_CLOSE, null); break; } case USER_CONFIRM_GEOLOCATION: { - GetOwner()->SendUserEvent(ID_USER_CONFIRM_GEOLOCATION_CLOSE, null); + __pImpl->SendUserEvent(ID_USER_CONFIRM_GEOLOCATION_CLOSE, null); break; } case USER_CONFIRM_NOTIFICATION: { - GetOwner()->SendUserEvent(ID_USER_CONFIRM_NOTIFICATION_CLOSE, null); + __pImpl->SendUserEvent(ID_USER_CONFIRM_NOTIFICATION_CLOSE, null); break; } case USER_SCRIPT_ALERT: { - GetOwner()->SendUserEvent(ID_USER_SCRIPT_ALERT_CLOSE, null); + __pImpl->SendUserEvent(ID_USER_SCRIPT_ALERT_CLOSE, null); break; } default: @@ -372,6 +380,12 @@ CATCH: ewk_view_javascript_alert_reply(pView); break; } + case USER_SCRIPT_CONFIRM: + { + Evas_Object* pView = reinterpret_cast< Evas_Object* >(__pUserPolicyData); + ewk_view_javascript_confirm_reply(pView, allow); + break; + } case USER_CONFIRM_APP_CACHE: { Evas_Object *pObj = reinterpret_cast< Evas_Object* >(__pUserPolicyData); @@ -521,22 +535,27 @@ _UserConfirmPopup::OnKeyReleased(Control& source, const KeyEventInfo& keyEventIn { case USER_CONFIRM_USERMEDIA: { - GetOwner()->SendUserEvent(ID_USER_CONFIRM_USERMEDIA_CLOSE, null); + __pImpl->SendUserEvent(ID_USER_CONFIRM_USERMEDIA_CLOSE, null); break; } case USER_CONFIRM_GEOLOCATION: { - GetOwner()->SendUserEvent(ID_USER_CONFIRM_GEOLOCATION_CLOSE, null); + __pImpl->SendUserEvent(ID_USER_CONFIRM_GEOLOCATION_CLOSE, null); break; } case USER_CONFIRM_NOTIFICATION: { - GetOwner()->SendUserEvent(ID_USER_CONFIRM_NOTIFICATION_CLOSE, null); + __pImpl->SendUserEvent(ID_USER_CONFIRM_NOTIFICATION_CLOSE, null); break; } case USER_SCRIPT_ALERT: { - GetOwner()->SendUserEvent(ID_USER_SCRIPT_ALERT_CLOSE, null); + __pImpl->SendUserEvent(ID_USER_SCRIPT_ALERT_CLOSE, null); + break; + } + case USER_SCRIPT_CONFIRM: + { + __pImpl->SendUserEvent(ID_USER_SCRIPT_CONFIRM_CLOSE, null); break; } case USER_PROTOCOL_HANDLER: diff --git a/src/controls/FWebCtrl_WebImpl.cpp b/src/controls/FWebCtrl_WebImpl.cpp index 96c8b32..47067cb 100755 --- a/src/controls/FWebCtrl_WebImpl.cpp +++ b/src/controls/FWebCtrl_WebImpl.cpp @@ -87,7 +87,7 @@ #include #include #include -#include +#include #include "FWeb_HistoryItemImpl.h" #include "FWebCtrl_AppControlListener.h" #include "FWebCtrl_AuthConfirmPopup.h" @@ -362,26 +362,12 @@ 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; - r = messageBox.Construct(L"", msg, MSGBOX_STYLE_OKCANCEL); - SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r)); - - int modalResult = 0; - - r = messageBox.ShowAndWait(modalResult); + r = pImpl->ShowUserConfirmPopup(USER_SCRIPT_CONFIRM, pView, msg); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r)); - if (modalResult == MSGBOX_RESULT_OK) - { - ewk_view_javascript_confirm_reply(pView, EINA_TRUE); - } - else - { - ewk_view_javascript_confirm_reply(pView, EINA_FALSE); - } - return EINA_TRUE; } @@ -416,6 +402,8 @@ OnCertificateRequested(void* pUserData, Evas_Object* pView, void* pEventInfo) Ewk_Certificate_Policy_Decision* pPolicy = reinterpret_cast< Ewk_Certificate_Policy_Decision* >(pEventInfo); SysAssertf(pImpl && pPolicy, "Failed to request"); + _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore())); + switch (pImpl->GetSetting().GetCertificateErrorHandlingMode()) { case WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM: @@ -458,6 +446,8 @@ OnCertificateRequested(void* pUserData, Evas_Object* pView, void* pEventInfo) { r = pImpl->ShowCertificateConfirmPopup(CERTIFICATE_POPUP_MODE_USER_CONFIRM, pPolicy); SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); + + ewk_view_resume(pWebCore->GetWebNativeNode()); } if (pImpl) @@ -482,6 +472,8 @@ CATCH: ewk_certificate_policy_decision_allowed_set(pPolicy, EINA_FALSE); pImpl->SetCertificateConfirmed(false); pImpl->SetCertificateRequested(true); + + ewk_view_resume(pWebCore->GetWebNativeNode()); } @@ -1712,15 +1704,15 @@ OnWebKeypadStateChanged(void* pUserData, Evas_Object* pView, void* pEventInfo) return; } - _Form* pFormCore = pImpl->GetParentFormCore(dynamic_cast< _Control* >(&pImpl->GetCore())); - if (pFormCore) + _FormImpl* pFormImpl = pImpl->GetParentFormImpl(dynamic_cast< _ControlImpl* >(pImpl)); + if (pFormImpl) { - pFormCore->DeflateClientRectHeight(pXformer->TransformVertical(rect.height)); + pFormImpl->DeflateClientRectHeight(pXformer->TransformVertical(rect.height)); - if (pFormCore->HasFooter()) + if (pFormImpl->HasFooter()) { - pFormCore->SetKeypadShowState(true); - pFormCore->Draw(); + pFormImpl->GetCore().SetKeypadShowState(true); + pFormImpl->Draw(); } } @@ -1768,15 +1760,15 @@ OnWebKeypadClosed(void* pUserData, Evas_Object* pView, void* pEventInfo) _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData); SysAssertf(pImpl, "Failed to request"); - _Form* pFormCore = pImpl->GetParentFormCore(dynamic_cast< _Control* >(&pImpl->GetCore())); - if (pFormCore) + _FormImpl* pFormImpl = pImpl->GetParentFormImpl(dynamic_cast< _ControlImpl* >(pImpl)); + if (pFormImpl) { - pFormCore->DeflateClientRectHeight(0); + pFormImpl->DeflateClientRectHeight(0); - if (pFormCore->HasFooter()) + if (pFormImpl->HasFooter()) { - pFormCore->SetKeypadShowState(false); - pFormCore->Draw(); + pFormImpl->GetCore().SetKeypadShowState(false); + pFormImpl->Draw(); } } @@ -2192,6 +2184,7 @@ _WebImpl::_WebImpl(Web* pWeb, Tizen::Ui::_Control* pCore) , __pGeolocationConfirmPopup(null) , __pNotificationConfirmPopup(null) , __pScriptAlertConfirmPopup(null) + , __pScriptConfirmPopup(null) , __pAppCacheConfirmPopup(null) , __pDbQuotaConfirmPopup(null) , __pLocalFsQuotaConfirmPopup(null) @@ -2206,6 +2199,7 @@ _WebImpl::_WebImpl(Web* pWeb, Tizen::Ui::_Control* pCore) , __policy(WEB_DECISION_CONTINUE) , __defaultUserAgent(L"") , __pFormDataList(null) + , __popupClosed(false) { __textSearch.__searchAll = false; __textSearch.__searchForward = true; @@ -4555,7 +4549,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); + r = pCertConfirmPopup->Construct(userConfirmMode, pPolicy, this); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); __pCertConfirmPopup = std::move(pCertConfirmPopup); @@ -4614,7 +4608,7 @@ _WebImpl::ShowUserConfirmPopup(_UserConfirmMode userConfirmMode, void* pPolicy, std::unique_ptr<_UserConfirmPopup> pUserConfirmPopup(new (std::nothrow) _UserConfirmPopup()); SysTryReturnResult(NID_WEB_CTRL, pUserConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed."); - r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, true, msg); + r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, this, true, msg); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); int modalResult = 0; @@ -4623,62 +4617,93 @@ _WebImpl::ShowUserConfirmPopup(_UserConfirmMode userConfirmMode, void* pPolicy, { case USER_CONTENT_HANDLER: { - __pContentHandlerConfirmPopup.reset(); - __pContentHandlerConfirmPopup = std::move(pUserConfirmPopup); r = __pContentHandlerConfirmPopup->ShowAndWait(modalResult); SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pContentHandlerConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r)); + + __pContentHandlerConfirmPopup.reset(); + + ewk_view_resume(__pWebCore->GetWebNativeNode()); + break; } case USER_PROTOCOL_HANDLER: { - __pProtocolHandlerConfirmPopup.reset(); - __pProtocolHandlerConfirmPopup = std::move(pUserConfirmPopup); r = __pProtocolHandlerConfirmPopup->ShowAndWait(modalResult); SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pProtocolHandlerConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r)); + + __pProtocolHandlerConfirmPopup.reset(); + + ewk_view_resume(__pWebCore->GetWebNativeNode()); + break; } case USER_CONFIRM_APP_CACHE: { - __pAppCacheConfirmPopup.reset(); - __pAppCacheConfirmPopup = std::move(pUserConfirmPopup); r = __pAppCacheConfirmPopup->ShowAndWait(modalResult); SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pAppCacheConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r)); + + __pAppCacheConfirmPopup.reset(); + + ewk_view_resume(__pWebCore->GetWebNativeNode()); + break; } case USER_CONFIRM_DB_QUOTA_EXCEDED: { - __pDbQuotaConfirmPopup.reset(); - __pDbQuotaConfirmPopup = std::move(pUserConfirmPopup); r = __pDbQuotaConfirmPopup->ShowAndWait(modalResult); SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pDbQuotaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r)); + + __pDbQuotaConfirmPopup.reset(); + + ewk_view_resume(__pWebCore->GetWebNativeNode()); + break; } case USER_CONFIRM_LOCAL_FS_QUOTA_EXCEDED: { - __pLocalFsQuotaConfirmPopup.reset(); - __pLocalFsQuotaConfirmPopup = std::move(pUserConfirmPopup); r = __pLocalFsQuotaConfirmPopup->ShowAndWait(modalResult); SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pLocalFsQuotaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r)); + + __pLocalFsQuotaConfirmPopup.reset(); + + ewk_view_resume(__pWebCore->GetWebNativeNode()); + break; } case USER_CONFIRM_INDEXED_DB_QUOTA_EXCEDED: { - __pIndexedDbQuotaConfirmPopup.reset(); - __pIndexedDbQuotaConfirmPopup = std::move(pUserConfirmPopup); r = __pIndexedDbQuotaConfirmPopup->ShowAndWait(modalResult); SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pIndexedDbQuotaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r)); + + __pIndexedDbQuotaConfirmPopup.reset(); + + ewk_view_resume(__pWebCore->GetWebNativeNode()); + + 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: @@ -4697,7 +4722,7 @@ _WebImpl::ShowUserConfirmPopupAsync(_UserConfirmMode userConfirmMode, void* pPol std::unique_ptr<_UserConfirmPopup> pUserConfirmPopup(new (std::nothrow) _UserConfirmPopup()); SysTryReturnResult(NID_WEB_CTRL, pUserConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed."); - r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, false, msg); + r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, this, false, msg); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); switch(userConfirmMode) @@ -4761,25 +4786,25 @@ CATCH: } -_Form* -_WebImpl::GetParentFormCore(_Control* pControlCore) +_FormImpl* +_WebImpl::GetParentFormImpl(_ControlImpl* pControlImpl) { String parentName; - _Form* pFormCore = null; + _FormImpl* pFormImpl = null; - _Control* pParentControlCore = dynamic_cast< _Control* >(pControlCore->GetParent()); - if (!pParentControlCore) + _ControlImpl* pParentControlImpl = dynamic_cast< _ControlImpl* >(pControlImpl->GetParent()); + if (!pParentControlImpl) { return null; } - pFormCore = dynamic_cast< _Form* >(pParentControlCore); - if (pFormCore) + pFormImpl = dynamic_cast< _FormImpl* >(pParentControlImpl); + if (pFormImpl) { - return pFormCore; + return pFormImpl; } - return GetParentFormCore(pParentControlCore); + return GetParentFormImpl(pParentControlImpl); } @@ -4833,6 +4858,12 @@ _WebImpl::OnPreAttachedToMainTree(void) { result r = E_SUCCESS; + if (IsVisible() == true) + { + _WebManager* pWebManager = _WebManager::GetInstance(); + pWebManager->SetActiveWeb(this); + } + r = __pWebCore->InitializeWebNativeNode(); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); @@ -4898,12 +4929,15 @@ _WebImpl::OnChangeLayout(_ControlOrientation orientation) void _WebImpl::OnAncestorVisibleStateChanged(const _Control& control) { + _WebManager* pWebManager = _WebManager::GetInstance(); if (IsVisible() == true) { + pWebManager->SetActiveWeb(this); ewk_view_page_visibility_state_set(__pWebCore->GetWebNativeNode(), EWK_PAGE_VISIBILITY_STATE_VISIBLE, false); } else { + pWebManager->RemoveActiveWeb(this); ewk_view_page_visibility_state_set(__pWebCore->GetWebNativeNode(), EWK_PAGE_VISIBILITY_STATE_HIDDEN, false); } } @@ -4913,7 +4947,7 @@ void _WebImpl::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs) { _ContainerImpl::OnUserEventReceivedN(requestId, pArgs); - + switch (requestId) { case ID_CERTIFICATE_CONFIRM_POPUP_CLOSE: @@ -4934,6 +4968,9 @@ _WebImpl::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::ILi case ID_USER_SCRIPT_ALERT_CLOSE: __pScriptAlertConfirmPopup.reset(); break; + case ID_USER_SCRIPT_CONFIRM_CLOSE: + __pScriptConfirmPopup.reset(); + break; default: break; } diff --git a/src/controls/FWebCtrl_WebManager.cpp b/src/controls/FWebCtrl_WebManager.cpp index 364ede6..64691ff 100755 --- a/src/controls/FWebCtrl_WebManager.cpp +++ b/src/controls/FWebCtrl_WebManager.cpp @@ -23,11 +23,16 @@ */ #include +#include +#include #include "FWebCtrl_WebImpl.h" #include "FWebCtrl_WebManager.h" +#include "FWebCtrl_WebPopup.h" using namespace Tizen::Base; using namespace Tizen::Base::Collection; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; namespace Tizen { namespace Web { namespace Controls { @@ -35,6 +40,8 @@ namespace Tizen { namespace Web { namespace Controls _WebManager::_WebManager(void) : __pWebList(null) , __pCallbackList(null) + , __pActiveWeb(null) + , __pActivePopup(null) { } @@ -152,4 +159,65 @@ _WebManager::IsValidCallback(int callerAdress, int callbackAdress) const return ret; } +void +_WebManager::SetActiveWeb(Tizen::Web::Controls::_WebImpl* pWebAddress) +{ + if (__pActiveWeb == null) + { + __pActiveWeb = pWebAddress; + } + else + { + if (__pActiveWeb->IsVisible() == true) + { + return; + } + __pActiveWeb = pWebAddress; + } + + if (__pActivePopup != null) + { + __pActivePopup->SetShowState(false); + + _FormImpl* pFormImpl = __pActiveWeb->GetParentFormImpl(__pActiveWeb); + + if (pFormImpl != null) + { + __pActivePopup->SetOwner(&pFormImpl->GetPublic()); + } + else + { + __pActivePopup->SetOwner(&__pActiveWeb->GetPublic()); + } + + __pActivePopup->SetShowState(true); + __pActivePopup->Show(); + } + +} + +void +_WebManager::RemoveActiveWeb(Tizen::Web::Controls::_WebImpl* pWebAddress) +{ + if (__pActiveWeb == pWebAddress) + { + __pActiveWeb = null; + } +} + +void +_WebManager::SetActivePopup(Tizen::Web::Controls::_WebPopup* pPopupAddress) +{ + __pActivePopup = pPopupAddress; +} + +void +_WebManager::RemoveActivePopup(Tizen::Web::Controls::_WebPopup* pPopupAddress) +{ + if (__pActivePopup == pPopupAddress) + { + __pActivePopup = null; + } +} + } } } diff --git a/src/controls/FWebCtrl_WebManager.h b/src/controls/FWebCtrl_WebManager.h index ed0adca..3519729 100755 --- a/src/controls/FWebCtrl_WebManager.h +++ b/src/controls/FWebCtrl_WebManager.h @@ -31,6 +31,7 @@ namespace Tizen { namespace Web { namespace Controls { class _WebImpl; +class _WebPopup; class _WebManager : public Tizen::Base::Object @@ -46,6 +47,11 @@ public: result RemoveCallback(int callerAdress, int callbackAdress); bool IsValidCallback(int callerAdress, int callbackAdress) const; + void SetActiveWeb(Tizen::Web::Controls::_WebImpl* pWebAddress); + void RemoveActiveWeb(Tizen::Web::Controls::_WebImpl* pWebAddress); + void SetActivePopup(Tizen::Web::Controls::_WebPopup* pPopupAddress); + void RemoveActivePopup(Tizen::Web::Controls::_WebPopup* pPopupAddress); + private: _WebManager(void); _WebManager(const _WebManager& rhs); @@ -56,9 +62,12 @@ private: private: std::unique_ptr > __pWebList; std::unique_ptr > __pCallbackList; + + _WebImpl* __pActiveWeb; + _WebPopup* __pActivePopup; }; } } } #endif - \ No newline at end of file + diff --git a/src/controls/FWebCtrl_WebPopup.cpp b/src/controls/FWebCtrl_WebPopup.cpp index 1c35aab..71dd038 100644 --- a/src/controls/FWebCtrl_WebPopup.cpp +++ b/src/controls/FWebCtrl_WebPopup.cpp @@ -25,6 +25,7 @@ #include #include #include +#include "FWebCtrl_WebManager.h" #include "FWebCtrl_WebPopup.h" @@ -50,6 +51,9 @@ _WebPopup::_WebPopup(void) _WebPopup::~_WebPopup(void) { + _WebManager* pWebManager = _WebManager::GetInstance(); + pWebManager->RemoveActivePopup(this); + if (IsModalPopup() == true) { HidePopup(0); @@ -124,6 +128,9 @@ _WebPopup::HidePopup(int modalResult) if (__isModal) { + _WebManager* pWebManager = _WebManager::GetInstance(); + pWebManager->RemoveActivePopup(this); + __modal = modalResult; __isModal = false; @@ -137,6 +144,9 @@ _WebPopup::HidePopup(int modalResult) result _WebPopup::ShowAndWait(int& modalResult) { + _WebManager* pWebManager = _WebManager::GetInstance(); + pWebManager->SetActivePopup(this); + __isModal = true; return DoModal(modalResult); diff --git a/src/controls/inc/FWebCtrl_CertificateConfirmPopup.h b/src/controls/inc/FWebCtrl_CertificateConfirmPopup.h index f9b3c0d..f02de31 100755 --- a/src/controls/inc/FWebCtrl_CertificateConfirmPopup.h +++ b/src/controls/inc/FWebCtrl_CertificateConfirmPopup.h @@ -32,6 +32,7 @@ namespace Tizen { namespace Web { namespace Controls { +class _WebImpl; enum _IdButtonCertificatePopup { @@ -63,7 +64,7 @@ public: */ virtual ~_CertificateConfirmPopup(void); - result Construct(_CertificatePopupMode certPopupMode, Ewk_Certificate_Policy_Decision* pPolicy); + result Construct(_CertificatePopupMode certPopupMode, Ewk_Certificate_Policy_Decision* pPolicy, Tizen::Web::Controls::_WebImpl* pImpl); void HandleUserAction(bool allow); @@ -95,6 +96,7 @@ private: bool __confirm; Ewk_Certificate_Policy_Decision* __pCertificatePolicyData; + Tizen::Web::Controls::_WebImpl* __pImpl; }; // _CertificateConfirmPopup }}} // Tizen::Web::Controls diff --git a/src/controls/inc/FWebCtrl_UserConfirmPopup.h b/src/controls/inc/FWebCtrl_UserConfirmPopup.h index a693806..0cbdfbe 100755 --- a/src/controls/inc/FWebCtrl_UserConfirmPopup.h +++ b/src/controls/inc/FWebCtrl_UserConfirmPopup.h @@ -35,6 +35,7 @@ class CheckButton; namespace Tizen { namespace Web { namespace Controls { +class _WebImpl; enum _UserConfirmPopupButtonId { @@ -51,6 +52,7 @@ enum _UserConfirmMode USER_CONFIRM_GEOLOCATION, USER_CONFIRM_NOTIFICATION, USER_SCRIPT_ALERT, + USER_SCRIPT_CONFIRM, USER_CONFIRM_APP_CACHE, USER_CONFIRM_DB_QUOTA_EXCEDED, USER_CONFIRM_LOCAL_FS_QUOTA_EXCEDED, @@ -73,7 +75,7 @@ public: */ virtual ~_UserConfirmPopup(void); - result Construct(_UserConfirmMode userConfirmMode, void* pEventInfo, bool sync = false, Tizen::Base::String msg = L""); + result Construct(_UserConfirmMode userConfirmMode, void* pEventInfo, Tizen::Web::Controls::_WebImpl* pImpl, bool sync = false, Tizen::Base::String msg = L""); virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); @@ -101,6 +103,7 @@ private: Tizen::Ui::Controls::CheckButton* __pCheckButton; bool __sync; + Tizen::Web::Controls::_WebImpl* __pImpl; }; // _UserConfirmPopup }}} // Tizen::Web::Controls diff --git a/src/controls/inc/FWebCtrl_WebImpl.h b/src/controls/inc/FWebCtrl_WebImpl.h index 316bda2..4212e09 100755 --- a/src/controls/inc/FWebCtrl_WebImpl.h +++ b/src/controls/inc/FWebCtrl_WebImpl.h @@ -66,15 +66,15 @@ class _VibratorImpl; namespace Tizen { namespace Ui { -class Contorl; -class _Contorl; -class _ContorlImpl; +class Control; +class _Control; +class _ControlImpl; }} // Tizen::Ui namespace Tizen { namespace Ui { namespace Controls { class Keypad; -class _Form; +class _FormImpl; }}} // Tizen::Ui::Controls namespace Tizen { namespace Web { namespace Json @@ -136,7 +136,8 @@ enum _WebPopupCloseId ID_USER_CONFIRM_USERMEDIA_CLOSE, ID_USER_CONFIRM_GEOLOCATION_CLOSE, ID_USER_CONFIRM_NOTIFICATION_CLOSE, - ID_USER_SCRIPT_ALERT_CLOSE + ID_USER_SCRIPT_ALERT_CLOSE, + ID_USER_SCRIPT_CONFIRM_CLOSE }; class _OSP_EXPORT_ _WebImpl @@ -360,7 +361,7 @@ public: result ShowUserConfirmPopup(_UserConfirmMode userConfirmMode, void* pPolicy, Tizen::Base::String msg = L""); result ShowUserConfirmPopupAsync(_UserConfirmMode userConfirmMode, void* pPolicy, Tizen::Base::String msg = L""); - Tizen::Ui::Controls::_Form* GetParentFormCore(Tizen::Ui::_Control* pControlCore); + Tizen::Ui::Controls::_FormImpl* GetParentFormImpl(Tizen::Ui::_ControlImpl* pControlImpl); result ShowSelectBoxPopup(bool isMultiSelect, const Tizen::Base::String& title, Eina_List* pItems, Evas_Object* pWebView, int selectedIndex); result UpdateSelectBoxPopup(Eina_List* pItems, int selectedIndex, bool isGroupedList); @@ -486,6 +487,7 @@ private: std::unique_ptr<_UserConfirmPopup> __pGeolocationConfirmPopup; std::unique_ptr<_UserConfirmPopup> __pNotificationConfirmPopup; std::unique_ptr<_UserConfirmPopup> __pScriptAlertConfirmPopup; + std::unique_ptr<_UserConfirmPopup> __pScriptConfirmPopup; std::unique_ptr<_UserConfirmPopup> __pAppCacheConfirmPopup; std::unique_ptr<_UserConfirmPopup> __pDbQuotaConfirmPopup; std::unique_ptr<_UserConfirmPopup> __pLocalFsQuotaConfirmPopup; @@ -512,6 +514,8 @@ private: Tizen::Base::String __defaultUserAgent; Eina_List* __pFormDataList; + + bool __popupClosed; }; // _WebImpl }}} // Tizen::Web::Controls