From: Sehong Na Date: Thu, 2 Jan 2014 09:35:40 +0000 (+0900) Subject: Tizen 2.2.1 X-Git-Tag: 2.2.1_release X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=68830af363a01550e0d5ad00d02ebd19688598ac;p=framework%2Fosp%2Fweb.git Tizen 2.2.1 --- diff --git a/src/controls/FWebCtrl_AuthConfirmPopup.cpp b/src/controls/FWebCtrl_AuthConfirmPopup.cpp index 9b3108b..eeaa139 100755 --- a/src/controls/FWebCtrl_AuthConfirmPopup.cpp +++ b/src/controls/FWebCtrl_AuthConfirmPopup.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -57,22 +58,27 @@ static const int EDIT_TEXT_SIZE = 35; _AuthConfirmPopup::_AuthConfirmPopup(void) : __pIdEditField(null) , __pPwdEditField(null) - , __pImpl(null) + , __pAuthHandler(null) { } _AuthConfirmPopup::~_AuthConfirmPopup(void) { + if (IsModalPopup()) + { + __pAuthHandler->Cancel(); + } } // Authentication popup result -_AuthConfirmPopup::Construct(const String& host, const String& realm, _WebImpl* pImpl) +_AuthConfirmPopup::Construct(const String& host, const String& realm, AuthenticationChallenge* pAuth) { - __pImpl = pImpl; - SysAssertf(__pImpl != null, "Failed to get _WebImpl"); + SysTryReturnResult(NID_WEB_CTRL, pAuth != null, E_INVALID_ARG, "invalid argument(s) is used. The AuthenticationChallenge is null."); + + __pAuthHandler = pAuth; _SystemResource* pSysResource = _SystemResource::GetInstance(); SysAssertf(pSysResource != null, "Failed to get _SystemResource instance"); @@ -143,26 +149,23 @@ _AuthConfirmPopup::Construct(const String& host, const String& realm, _WebImpl* SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); __pPwdEditField = pPwdEditField.release(); - __pIdEditField->SetFocus(); Panel* pButtonPanel = CreateAndAddPanel(); SysTryReturn(NID_WEB_CTRL, pButtonPanel, r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r)); //Add Buttons - ArrayList idList(SingleObjectDeleter); + ArrayList idList; r = idList.Construct(); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + idList.Add(*(new Integer(ID_BUTTON_AUTH_CANCEL))); + idList.Add(*(new Integer(ID_BUTTON_AUTH_PROCESS))); - idList.Add(new Integer(ID_BUTTON_AUTH_CANCEL)); - idList.Add(new Integer(ID_BUTTON_AUTH_PROCESS)); - - - ArrayList titleList(SingleObjectDeleter); + ArrayList titleList; r = titleList.Construct(); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); - titleList.Add(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_CANCEL_ABB"))); - titleList.Add(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_CONTINUE_ABB"))); + titleList.Add(*(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_CANCEL_ABB")))); + titleList.Add(*(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_CONTINUE_ABB")))); r = CreateAndAddButtons(idList, titleList, pButtonPanel); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); @@ -191,21 +194,14 @@ _AuthConfirmPopup::OnActionPerformed(const Control& source, int actionId) r = HidePopup(); SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r)); - ArrayList* pAuthValueList = null; - switch (actionId) { case ID_BUTTON_AUTH_PROCESS: - - pAuthValueList = new (std::nothrow) ArrayList(); - pAuthValueList->Construct(); - pAuthValueList->Add(new String(__pIdEditField->GetText())); - pAuthValueList->Add(new String(__pPwdEditField->GetText())); - __pImpl->SendUserEvent(ID_AUTHENTICATION_CONFIRM_POPUP_PROCESS, pAuthValueList); + __pAuthHandler->Process(__pIdEditField->GetText(), __pPwdEditField->GetText()); break; case ID_BUTTON_AUTH_CANCEL: - __pImpl->SendUserEvent(ID_AUTHENTICATION_CONFIRM_POPUP_CANCEL, null); + __pAuthHandler->Cancel(); break; default: @@ -225,13 +221,12 @@ _AuthConfirmPopup::OnKeyReleased(Control& source, const KeyEventInfo& keyEventIn result r = E_SUCCESS; if ((keyEventInfo.GetKeyCode() == KEY_ESC || keyEventInfo.GetKeyCode() == KEY_BACK) && source.GetShowState() == true) { + __pAuthHandler->Cancel(); r = HidePopup(); if (IsFailed(r)) { SysLogException(NID_WEB_CTRL, r, "[%s] Propagating.", GetErrorMessage(r)); } - - __pImpl->SendUserEvent(ID_AUTHENTICATION_CONFIRM_POPUP_CANCEL, null); } return false; diff --git a/src/controls/FWebCtrl_AuthConfirmPopup.h b/src/controls/FWebCtrl_AuthConfirmPopup.h index 8678e61..8913901 100755 --- a/src/controls/FWebCtrl_AuthConfirmPopup.h +++ b/src/controls/FWebCtrl_AuthConfirmPopup.h @@ -40,7 +40,7 @@ class EditField; namespace Tizen { namespace Web { namespace Controls { -class _WebImpl; +class AuthenticationChallenge; enum _AuthPopupButtonId @@ -66,7 +66,7 @@ public: */ virtual ~_AuthConfirmPopup(void); - result Construct(const Tizen::Base::String& host, const Tizen::Base::String& realm, _WebImpl* pImpl); + result Construct(const Tizen::Base::String& host, const Tizen::Base::String& realm, AuthenticationChallenge* pAuth); virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); @@ -84,8 +84,7 @@ private: private: Tizen::Ui::Controls::EditField* __pIdEditField; Tizen::Ui::Controls::EditField* __pPwdEditField; - _WebImpl* __pImpl; - + AuthenticationChallenge* __pAuthHandler; }; // _AuthConfirmPopup }}} // Tizen::Web::Controls diff --git a/src/controls/FWebCtrl_CertificateConfirmPopup.cpp b/src/controls/FWebCtrl_CertificateConfirmPopup.cpp index d933c0f..0ef39ae 100755 --- a/src/controls/FWebCtrl_CertificateConfirmPopup.cpp +++ b/src/controls/FWebCtrl_CertificateConfirmPopup.cpp @@ -106,11 +106,11 @@ _CertificateConfirmPopup::Construct(_CertificatePopupMode certPopupMode, Ewk_Cer __pParent = pParent; - ArrayList idList(SingleObjectDeleter); + ArrayList idList; r = idList.Construct(); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); - ArrayList titleList(SingleObjectDeleter); + ArrayList titleList; r = titleList.Construct(); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); diff --git a/src/controls/FWebCtrl_InputPickerPopup.cpp b/src/controls/FWebCtrl_InputPickerPopup.cpp index fbc50e1..1b83049 100755 --- a/src/controls/FWebCtrl_InputPickerPopup.cpp +++ b/src/controls/FWebCtrl_InputPickerPopup.cpp @@ -213,11 +213,11 @@ _InputPickerPopup::Construct(const String& strDate, Ewk_Input_Type inputType, Ti __pButtonPanel = CreateAndAddPanel(); SysTryReturn(NID_WEB_CTRL, __pButtonPanel, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); - ArrayList idList(SingleObjectDeleter); + ArrayList idList; r = idList.Construct(); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); - ArrayList titleList(SingleObjectDeleter); + ArrayList titleList; r = titleList.Construct(); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); @@ -296,11 +296,11 @@ _InputPickerPopup::Construct(const Color& color, Tizen::Web::Controls::_WebImpl* __pButtonPanel = CreateAndAddPanel(); SysTryReturn(NID_WEB_CTRL, __pButtonPanel, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); - ArrayList idList(SingleObjectDeleter); + ArrayList idList; r = idList.Construct(); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); - ArrayList titleList(SingleObjectDeleter); + ArrayList titleList; r = titleList.Construct(); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); diff --git a/src/controls/FWebCtrl_PromptPopup.cpp b/src/controls/FWebCtrl_PromptPopup.cpp index 2fc1aa8..9a6ab1a 100755 --- a/src/controls/FWebCtrl_PromptPopup.cpp +++ b/src/controls/FWebCtrl_PromptPopup.cpp @@ -140,13 +140,13 @@ _PromptPopup::Construct(const String& message, const String& defaultVale, Evas_ _SystemResource* pSysResource = _SystemResource::GetInstance(); SysAssertf(pSysResource != null, "Failed to get _SystemResource instance"); - ArrayList idList(SingleObjectDeleter); + ArrayList idList; r = idList.Construct(); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); idList.Add(*(new Integer(ID_BUTTON_PROMPT_CANCEL))); idList.Add(*(new Integer(ID_BUTTON_PROMPT_OK))); - ArrayList titleList(SingleObjectDeleter); + ArrayList titleList; r = titleList.Construct(); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); titleList.Add(*(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_CANCEL_ABB")))); diff --git a/src/controls/FWebCtrl_SelectBox.cpp b/src/controls/FWebCtrl_SelectBox.cpp index 737bb5e..ac80e60 100755 --- a/src/controls/FWebCtrl_SelectBox.cpp +++ b/src/controls/FWebCtrl_SelectBox.cpp @@ -148,7 +148,6 @@ _SelectBox::_SelectBox(void) , __multiSelection(false) , __SelectedIndex(-1) , __prevIndex(-1) - , __panelHeight(0) , __orientation(_CONTROL_ORIENTATION_PORTRAIT) , __pWebView(null) , __pToggledArray(null) @@ -230,18 +229,16 @@ _SelectBox::Construct(Tizen::Web::Controls::_WebImpl* pImpl, bool isMultiSelect, Panel* pButtonPanel = CreateAndAddPanel(); SysTryReturn(NID_WEB_CTRL, pButtonPanel, r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r)); - __panelHeight = pButtonPanel->GetHeight(); - _SystemResource* pSysResource = _SystemResource::GetInstance(); SysAssertf(pSysResource != null, "Failed to get _SystemResource instance"); - ArrayList idList(SingleObjectDeleter); + ArrayList idList; r = idList.Construct(); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); idList.Add(*(new Integer(ID_BUTTON_SELECTION))); - ArrayList titleList(SingleObjectDeleter); + ArrayList titleList; r = titleList.Construct(); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); @@ -252,8 +249,6 @@ _SelectBox::Construct(Tizen::Web::Controls::_WebImpl* pImpl, bool isMultiSelect, r = CreateAndAddButtons(idList, titleList, pButtonPanel); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); - - SetSize(GetSize().width,GetSize().height + __panelHeight); } SetPropagatedKeyEventListener(this); @@ -603,23 +598,6 @@ _SelectBox::UpdateList(Eina_List* pItems, int prevIndex, bool clearPrevList, boo } } - int listItemHeight = 0; - GET_SHAPE_CONFIG(CONTEXTMENU::LIST_ITEM_HEIGHT, __orientation, listItemHeight); - int prevCount = (__pListView->GetSize()).height / listItemHeight; - int defaultCount = __multiSelection ? DEFAULT_LIST_ITEM_COUNT -1 : DEFAULT_LIST_ITEM_COUNT; - - if ((prevCount != itemCount) - && ((prevCount < defaultCount && itemCount < defaultCount) - || (prevCount < defaultCount && itemCount >= defaultCount) - || (prevCount >= defaultCount && itemCount < defaultCount))) - { - int listViewNewHeight = ((itemCount < defaultCount) ? itemCount : defaultCount) * listItemHeight; - int popupHeight = __multiSelection ? (listViewNewHeight + __panelHeight) : listViewNewHeight; - - __pListView->SetSize((__pListView->GetSize()).width, listViewNewHeight); - SetSize(GetSize().width, popupHeight); - } - __pListView->UpdateList(); return E_SUCCESS; diff --git a/src/controls/FWebCtrl_SelectBox.h b/src/controls/FWebCtrl_SelectBox.h index 8d9c89f..00afe24 100755 --- a/src/controls/FWebCtrl_SelectBox.h +++ b/src/controls/FWebCtrl_SelectBox.h @@ -122,7 +122,6 @@ public: static const int LIST_ITEM_TYPE_GROUP = 2; static const int LIST_ITEM_TYPE_NORMAL = 1; static const int LIST_ITEM_TYPE_SUB = 0; - static const int DEFAULT_LIST_ITEM_COUNT = 5; private: Tizen::Base::Collection::ArrayList __listElementArray; @@ -131,7 +130,6 @@ private: bool __multiSelection; int __SelectedIndex; int __prevIndex; - int __panelHeight; Tizen::Ui::_ControlOrientation __orientation; Evas_Object* __pWebView; Eina_Inarray* __pToggledArray; diff --git a/src/controls/FWebCtrl_UserConfirmPopup.cpp b/src/controls/FWebCtrl_UserConfirmPopup.cpp index c23e93e..95ea782 100755 --- a/src/controls/FWebCtrl_UserConfirmPopup.cpp +++ b/src/controls/FWebCtrl_UserConfirmPopup.cpp @@ -246,11 +246,11 @@ _UserConfirmPopup::Construct(_UserConfirmMode userConfirmMode, void* pEventInfo, Panel* pButtonPanel = CreateAndAddPanel(); SysTryReturn(NID_WEB_CTRL, pButtonPanel, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); - ArrayList idList(SingleObjectDeleter); + ArrayList idList; r = idList.Construct(); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); - ArrayList titleList(SingleObjectDeleter); + ArrayList titleList; r = titleList.Construct(); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); diff --git a/src/controls/FWebCtrl_WebImpl.cpp b/src/controls/FWebCtrl_WebImpl.cpp index 13673d9..4e0d109 100755 --- a/src/controls/FWebCtrl_WebImpl.cpp +++ b/src/controls/FWebCtrl_WebImpl.cpp @@ -2603,10 +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."); - int itemCount = eina_list_count(pItems); - int defaultCount = (itemCount < DEFAULT_LIST_ITEM_COUNT) ? itemCount : (isMultiSelect ? (DEFAULT_LIST_ITEM_COUNT - 1) : DEFAULT_LIST_ITEM_COUNT); - r = pSelectBox->Construct(this, isMultiSelect, title, defaultCount, 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); @@ -4761,6 +4765,8 @@ _WebImpl::HttpAuthenticationRequested(Ewk_Auth_Challenge* pChallenge) String host(ewk_auth_challenge_url_get(pChallenge)); String realm(ewk_auth_challenge_realm_get(pChallenge)); + __pAuthChallenge.reset(); + std::unique_ptr pAuthChallenge(new (std::nothrow) AuthenticationChallenge()); SysTryReturnResult(NID_WEB_CTRL, pAuthChallenge, E_OUT_OF_MEMORY, "Memory Allocation failed."); @@ -4795,9 +4801,10 @@ _WebImpl::ShowAuthenticationPopup(const String& host, const String& realm, Authe std::unique_ptr<_AuthConfirmPopup> pAuthPopup(new (std::nothrow) _AuthConfirmPopup()); SysTryReturnResult(NID_WEB_CTRL, pAuthPopup, E_OUT_OF_MEMORY, "Memory Allocation failed."); - r = pAuthPopup->Construct(host, realm, this); + r = pAuthPopup->Construct(host, realm, pAuthChallenge); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + __pAuthPopup.reset(); __pAuthPopup = std::move(pAuthPopup); r = __pAuthPopup->ShowPopup(); @@ -5295,22 +5302,6 @@ _WebImpl::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::ILi switch (requestId) { - case ID_AUTHENTICATION_CONFIRM_POPUP_CANCEL: - __pAuthPopup->RemoveAllControls(); - __pAuthPopup.reset(); - __pAuthChallenge->Cancel(); - __pAuthChallenge.reset(); - break; - case ID_AUTHENTICATION_CONFIRM_POPUP_PROCESS: - __pAuthPopup->RemoveAllControls(); - __pAuthPopup.reset(); - if (pArgs) - { - std::unique_ptr pAuthValue(reinterpret_cast< ArrayList* >(pArgs)); - __pAuthChallenge->Process(*reinterpret_cast< String* >(pAuthValue->GetAt(0)),*reinterpret_cast< String* >(pAuthValue->GetAt(1))); - } - __pAuthChallenge.reset(); - break; case ID_CERTIFICATE_CONFIRM_POPUP_CLOSE: __pCertConfirmPopup.reset(); break; diff --git a/src/controls/FWebCtrl_WebManager.cpp b/src/controls/FWebCtrl_WebManager.cpp index bb1a0eb..137a022 100755 --- a/src/controls/FWebCtrl_WebManager.cpp +++ b/src/controls/FWebCtrl_WebManager.cpp @@ -27,13 +27,13 @@ #include #include #include -#include -#include +#include +#include #include #include -#include -#include -#include +#include +#include +#include #include "FWebCtrl_EflWebkit.h" #include "FWebCtrl_Web.h" #include "FWebCtrl_WebImpl.h" @@ -53,22 +53,22 @@ namespace Tizen { namespace Web { namespace Controls _WebManager* _WebManager::__pInstance = null; -extern const wchar_t CUSTOM_DB_DIRECTORY_PATH[] = L"data/.webkit/customDatabase/"; -extern const wchar_t USER_CONFIRM_DB_NAME[] = L"userConfirm.db"; -extern const wchar_t GEOLOCATION_TABLE_NAME[] = L"geolocationPermission"; -extern const wchar_t CUSTOM_PROTOCOL_TABLE_NAME[] = L"customProtocol"; -extern const wchar_t CUSTOM_CONTENT_TABLE_NAME[] = L"customContent"; -extern const wchar_t CERTIFICATE_TABLE_NAME[] = L"certificate"; - - +extern const wchar_t CUSTOM_DB_DIRECTORY_PATH[] = L"data/.webkit/customDatabase/"; +extern const wchar_t USER_CONFIRM_DB_NAME[] = L"userConfirm.db"; +extern const wchar_t GEOLOCATION_TABLE_NAME[] = L"geolocationPermission"; +extern const wchar_t CUSTOM_PROTOCOL_TABLE_NAME[] = L"customProtocol"; +extern const wchar_t CUSTOM_CONTENT_TABLE_NAME[] = L"customContent"; +extern const wchar_t CERTIFICATE_TABLE_NAME[] = L"certificate"; + + static const int CUSTOM_DB_TABLE_COUNT= 4; _WebManager::_WebManager(void) : __pWebList(null) , __pCallbackList(null) - , __pActivePopupList(null) , __pActiveWeb(null) + , __pActivePopup(null) , __pProxy(null) { } @@ -138,11 +138,6 @@ _WebManager::Construct(void) r = pCallbackList->Construct(); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); - std::unique_ptr > pActivePopupList(new (std::nothrow) ArrayListT< int >()); - SysTryReturnResult(NID_WEB_CTRL, pActivePopupList.get(), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory."); - r = pActivePopupList->Construct(); - SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); - r = InitializeProxyAddress(); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); @@ -154,35 +149,34 @@ _WebManager::Construct(void) __pWebList = std::move(pWebList); __pCallbackList = std::move(pCallbackList); - __pActivePopupList = std::move(pActivePopupList); return E_SUCCESS; } -void +void _WebManager::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 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(); } @@ -193,15 +187,15 @@ _WebManager::InitializeProxyAddress(void) connection_h handle = null; char* pProxy = null; - ret = connection_create(&handle); - SysTryReturnResult(NID_WEB_CTRL, ret == CONNECTION_ERROR_NONE, E_SYSTEM, "A system error has been occurred. Failed to create connection."); - - connection_address_family_e family = CONNECTION_ADDRESS_FAMILY_IPV4; + ret = connection_create(&handle); + SysTryReturnResult(NID_WEB_CTRL, ret == CONNECTION_ERROR_NONE, E_SYSTEM, "A system error has been occurred. Failed to create connection."); - ret = connection_get_proxy(handle, family, &pProxy); + connection_address_family_e family = CONNECTION_ADDRESS_FAMILY_IPV4; + + ret = connection_get_proxy(handle, family, &pProxy); SysTryReturnResult(NID_WEB_CTRL, ret == CONNECTION_ERROR_NONE, E_SYSTEM, "A system error has been occurred. Failed to get proxy address."); - ret = connection_destroy(handle); + ret = connection_destroy(handle); SysTryReturnResult(NID_WEB_CTRL, ret == CONNECTION_ERROR_NONE, E_SYSTEM, "A system error has been occurred. Failed to destroy connection."); __pProxy = pProxy; @@ -210,97 +204,97 @@ _WebManager::InitializeProxyAddress(void) } -result +result _WebManager::CreateResourceDirectory(void) const -{ - String html5FeaturesPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH); - - if (!_FileImpl::IsFileExist(html5FeaturesPath)) - { - result r = E_SUCCESS; - - r = _DirectoryImpl::Create(html5FeaturesPath, true); - SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_SYSTEM, "A system error has been occurred. create html5 features directory."); - } - - return E_SUCCESS; -} - - -result +{ + String html5FeaturesPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH); + + if (!_FileImpl::IsFileExist(html5FeaturesPath)) + { + result r = E_SUCCESS; + + r = _DirectoryImpl::Create(html5FeaturesPath, true); + SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_SYSTEM, "A system error has been occurred. create html5 features directory."); + } + + return E_SUCCESS; +} + + +result _WebManager::InitializeCustomDb(void) const -{ - result r = E_SUCCESS; - - _DatabaseImpl db; - String path(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME); - String geolocationTable(GEOLOCATION_TABLE_NAME); - String protocolTable(CUSTOM_PROTOCOL_TABLE_NAME); - String contentTable(CUSTOM_CONTENT_TABLE_NAME); - String certificateTable(CERTIFICATE_TABLE_NAME); - - r = db.Construct(path, "a+", null); - SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); - - std::unique_ptr pEnum(db.QueryN(L"Select count(name) from sqlite_master Where type='table' And name in ('" + geolocationTable + L"', '" + protocolTable + L"', '" + contentTable + L"', '" + certificateTable + L"')")); - if (pEnum.get()) - { - int count = 0; - - r = pEnum->MoveNext(); - SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r)); - - r = pEnum->GetIntAt(0, count); - SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r)); - - if (count == CUSTOM_DB_TABLE_COUNT) - { - return E_SUCCESS; - } - } - - pEnum.reset(); - pEnum = std::unique_ptr(db.QueryN(L"Select name from sqlite_master Where type='table' And name = '" + geolocationTable + L"'")); - if (!pEnum.get()) - { - r = db.ExecuteSql( - L"CREATE TABLE IF NOT EXISTS " + geolocationTable + L"(id INTEGER PRIMARY KEY AUTOINCREMENT, origin TEXT, permission INTEGER)", - true); - SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); - } - - pEnum.reset(); - pEnum = std::unique_ptr(db.QueryN(L"Select name from sqlite_master Where type='table' And name = '" + protocolTable + L"'")); - if (!pEnum.get()) - { - r = db.ExecuteSql( - L"CREATE TABLE IF NOT EXISTS " + protocolTable + L"(id INTEGER PRIMARY KEY AUTOINCREMENT, baseUrl TEXT, url TEXT, mime TEXT, allow INTEGER)", - true); - SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); - } - - pEnum.reset(); - pEnum = std::unique_ptr(db.QueryN(L"Select name from sqlite_master Where type='table' And name = '" + contentTable + L"'")); - if (!pEnum.get()) - { - r = db.ExecuteSql( - L"CREATE TABLE IF NOT EXISTS " + contentTable + L"(id INTEGER PRIMARY KEY AUTOINCREMENT, baseUrl TEXT, url TEXT, mime TEXT, allow INTEGER)", - true); - SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); - } - - pEnum.reset(); - pEnum = std::unique_ptr(db.QueryN(L"Select name from sqlite_master Where type='table' And name = '" + certificateTable + L"'")); - if (!pEnum.get()) - { - r = db.ExecuteSql( - L"CREATE TABLE IF NOT EXISTS " + certificateTable + L"(id INTEGER PRIMARY KEY AUTOINCREMENT, pem TEXT, allow INTEGER)", - true); - SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); - } - - return E_SUCCESS; -} +{ + result r = E_SUCCESS; + + _DatabaseImpl db; + String path(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME); + String geolocationTable(GEOLOCATION_TABLE_NAME); + String protocolTable(CUSTOM_PROTOCOL_TABLE_NAME); + String contentTable(CUSTOM_CONTENT_TABLE_NAME); + String certificateTable(CERTIFICATE_TABLE_NAME); + + r = db.Construct(path, "a+", null); + SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + + std::unique_ptr pEnum(db.QueryN(L"Select count(name) from sqlite_master Where type='table' And name in ('" + geolocationTable + L"', '" + protocolTable + L"', '" + contentTable + L"', '" + certificateTable + L"')")); + if (pEnum.get()) + { + int count = 0; + + r = pEnum->MoveNext(); + SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r)); + + r = pEnum->GetIntAt(0, count); + SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r)); + + if (count == CUSTOM_DB_TABLE_COUNT) + { + return E_SUCCESS; + } + } + + pEnum.reset(); + pEnum = std::unique_ptr(db.QueryN(L"Select name from sqlite_master Where type='table' And name = '" + geolocationTable + L"'")); + if (!pEnum.get()) + { + r = db.ExecuteSql( + L"CREATE TABLE IF NOT EXISTS " + geolocationTable + L"(id INTEGER PRIMARY KEY AUTOINCREMENT, origin TEXT, permission INTEGER)", + true); + SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + } + + pEnum.reset(); + pEnum = std::unique_ptr(db.QueryN(L"Select name from sqlite_master Where type='table' And name = '" + protocolTable + L"'")); + if (!pEnum.get()) + { + r = db.ExecuteSql( + L"CREATE TABLE IF NOT EXISTS " + protocolTable + L"(id INTEGER PRIMARY KEY AUTOINCREMENT, baseUrl TEXT, url TEXT, mime TEXT, allow INTEGER)", + true); + SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + } + + pEnum.reset(); + pEnum = std::unique_ptr(db.QueryN(L"Select name from sqlite_master Where type='table' And name = '" + contentTable + L"'")); + if (!pEnum.get()) + { + r = db.ExecuteSql( + L"CREATE TABLE IF NOT EXISTS " + contentTable + L"(id INTEGER PRIMARY KEY AUTOINCREMENT, baseUrl TEXT, url TEXT, mime TEXT, allow INTEGER)", + true); + SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + } + + pEnum.reset(); + pEnum = std::unique_ptr(db.QueryN(L"Select name from sqlite_master Where type='table' And name = '" + certificateTable + L"'")); + if (!pEnum.get()) + { + r = db.ExecuteSql( + L"CREATE TABLE IF NOT EXISTS " + certificateTable + L"(id INTEGER PRIMARY KEY AUTOINCREMENT, pem TEXT, allow INTEGER)", + true); + SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + } + + return E_SUCCESS; +} result @@ -394,30 +388,23 @@ _WebManager::SetActiveWeb(Tizen::Web::Controls::_WebImpl* pWebAddress) __pActiveWeb = pWebAddress; } - for (int i = 0; i < __pActivePopupList->GetCount(); i++) + if (__pActivePopup != null) { - int activePopupAddr = 0; - __pActivePopupList->GetAt(i, activePopupAddr); - _WebPopup* pActivePopup = reinterpret_cast< _WebPopup* >(activePopupAddr); - - if (pActivePopup != null) - { - pActivePopup->SetShowState(false); + __pActivePopup->SetShowState(false); - _FormImpl* pFormImpl = __pActiveWeb->GetParentFormImpl(__pActiveWeb); + _FormImpl* pFormImpl = __pActiveWeb->GetParentFormImpl(__pActiveWeb); - if (pFormImpl != null) - { - pActivePopup->SetOwner(&pFormImpl->GetPublic()); - } - else - { - pActivePopup->SetOwner(&__pActiveWeb->GetPublic()); - } - - pActivePopup->SetShowState(true); - pActivePopup->Show(); + if (pFormImpl != null) + { + __pActivePopup->SetOwner(&pFormImpl->GetPublic()); } + else + { + __pActivePopup->SetOwner(&__pActiveWeb->GetPublic()); + } + + __pActivePopup->SetShowState(true); + __pActivePopup->Show(); } } @@ -432,27 +419,20 @@ _WebManager::RemoveActiveWeb(Tizen::Web::Controls::_WebImpl* pWebAddress) } -result -_WebManager::SetActivePopup(int popupAddress) +void +_WebManager::SetActivePopup(Tizen::Web::Controls::_WebPopup* pPopupAddress) { - result r = E_SUCCESS; - - r = __pActivePopupList->Add(popupAddress); - SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); - - return r; + __pActivePopup = pPopupAddress; } -result -_WebManager::RemoveActivePopup(int popupAddress) +void +_WebManager::RemoveActivePopup(Tizen::Web::Controls::_WebPopup* pPopupAddress) { - result r = E_SUCCESS; - - r = __pActivePopupList->Remove(popupAddress); - SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); - - return r; + if (__pActivePopup == pPopupAddress) + { + __pActivePopup = null; + } } diff --git a/src/controls/FWebCtrl_WebManager.h b/src/controls/FWebCtrl_WebManager.h index 7f28f40..57061fd 100755 --- a/src/controls/FWebCtrl_WebManager.h +++ b/src/controls/FWebCtrl_WebManager.h @@ -31,11 +31,11 @@ namespace Tizen { namespace Web { namespace Controls { -_OSP_EXPORT_ extern const wchar_t CUSTOM_DB_DIRECTORY_PATH[]; -_OSP_EXPORT_ extern const wchar_t USER_CONFIRM_DB_NAME[]; -_OSP_EXPORT_ extern const wchar_t GEOLOCATION_TABLE_NAME[]; -_OSP_EXPORT_ extern const wchar_t CUSTOM_PROTOCOL_TABLE_NAME[]; -_OSP_EXPORT_ extern const wchar_t CUSTOM_CONTENT_TABLE_NAME[]; +_OSP_EXPORT_ extern const wchar_t CUSTOM_DB_DIRECTORY_PATH[]; +_OSP_EXPORT_ extern const wchar_t USER_CONFIRM_DB_NAME[]; +_OSP_EXPORT_ extern const wchar_t GEOLOCATION_TABLE_NAME[]; +_OSP_EXPORT_ extern const wchar_t CUSTOM_PROTOCOL_TABLE_NAME[]; +_OSP_EXPORT_ extern const wchar_t CUSTOM_CONTENT_TABLE_NAME[]; _OSP_EXPORT_ extern const wchar_t CERTIFICATE_TABLE_NAME[]; class _WebImpl; @@ -57,8 +57,8 @@ public: void SetActiveWeb(Tizen::Web::Controls::_WebImpl* pWebAddress); void RemoveActiveWeb(Tizen::Web::Controls::_WebImpl* pWebAddress); - result SetActivePopup(int popupAddress); - result RemoveActivePopup(int popupAddress); + void SetActivePopup(Tizen::Web::Controls::_WebPopup* pPopupAddress); + void RemoveActivePopup(Tizen::Web::Controls::_WebPopup* pPopupAddress); static _WebManager* GetInstance(void); @@ -73,7 +73,7 @@ private: void ClearCertificateDb(void); result InitializeProxyAddress(void); - result CreateResourceDirectory(void) const; + result CreateResourceDirectory(void) const; result InitializeCustomDb(void) const; _WebManager& operator=(const _WebManager& rhs); @@ -81,9 +81,9 @@ private: private: std::unique_ptr > __pWebList; std::unique_ptr > __pCallbackList; - std::unique_ptr > __pActivePopupList; _WebImpl* __pActiveWeb; + _WebPopup* __pActivePopup; char* __pProxy; static _WebManager* __pInstance; diff --git a/src/controls/FWebCtrl_WebPopup.cpp b/src/controls/FWebCtrl_WebPopup.cpp index 34c0f5b..c9b6769 100755 --- a/src/controls/FWebCtrl_WebPopup.cpp +++ b/src/controls/FWebCtrl_WebPopup.cpp @@ -53,7 +53,7 @@ _WebPopup::_WebPopup(void) _WebPopup::~_WebPopup(void) { _WebManager* pWebManager = _WebManager::GetInstance(); - pWebManager->RemoveActivePopup(reinterpret_cast< int >(this)); + pWebManager->RemoveActivePopup(this); if (IsModalPopup()) { @@ -108,7 +108,7 @@ _WebPopup::ShowPopup(void) result r = E_SUCCESS; _WebManager* pWebManager = _WebManager::GetInstance(); - pWebManager->SetActivePopup(reinterpret_cast< int >(this)); + pWebManager->SetActivePopup(this); r = SetShowState(true); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); @@ -145,7 +145,7 @@ result _WebPopup::ShowAndWait(int& modalResult) { _WebManager* pWebManager = _WebManager::GetInstance(); - pWebManager->SetActivePopup(reinterpret_cast< int >(this)); + pWebManager->SetActivePopup(this); __isModal = true; diff --git a/src/controls/inc/FWebCtrl_WebImpl.h b/src/controls/inc/FWebCtrl_WebImpl.h index 5a6fcb0..d96237c 100755 --- a/src/controls/inc/FWebCtrl_WebImpl.h +++ b/src/controls/inc/FWebCtrl_WebImpl.h @@ -131,8 +131,6 @@ enum _SearchType { enum _WebPopupCloseId { - ID_AUTHENTICATION_CONFIRM_POPUP_CANCEL, - ID_AUTHENTICATION_CONFIRM_POPUP_PROCESS, ID_CERTIFICATE_CONFIRM_POPUP_CLOSE, ID_PROMPT_POPUP_CLOSE, ID_USER_CONFIRM_USERMEDIA_CLOSE,