src/controls/FWebCtrl_UserConfirmPopup.cpp
src/controls/FWebCtrl_WebPopup.cpp
src/controls/FWebCtrl_CertificatePopup.cpp
+ src/controls/FWebCtrlWebStorageManager.cpp
+ src/controls/FWebCtrl_WebStorageManagerImpl.cpp
)
## Add Definitions
ADD_DEFINITIONS(${OSP_DEFINITIONS} -D_MODEL_RES_WVGA)
#include <FWebCtrlPageNavigationList.h>
#include <FWebCtrlWeb.h>
#include <FWebCtrlWebSetting.h>
+#include <FWebCtrlWebStorageManager.h>
/**
* @namespace Tizen::Web::Controls
#ifndef _FWEB_CTRL_WEB_STORAGE_MANAGER_H_\r
#define _FWEB_CTRL_WEB_STORAGE_MANAGER_H_\r
\r
+#include <unique_ptr.h>\r
#include <FBaseString.h>\r
\r
namespace Tizen { namespace Base { namespace Collection\r
* @param[in] origin The origin\r
* @param[in] quota The quota of the web storage to set in bytes\r
* @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_ARG The specified @c origin is invalid.\r
* @exception E_UNSUPPORTED_TYPE The specified storageType is not supported.\r
* @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
*/\r
* @param[in] storageType The web storage type\r
* @param[in] origin The origin\r
* @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_ARG The specified @c origin is invalid.\r
* @exception E_UNSUPPORTED_TYPE The specified storageType is not supported.\r
* @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
*/\r
- long GetQuotaForOrigin(WebStorageType storageType, , const Tizen::Base::String& origin);\r
+ long GetQuotaForOrigin(WebStorageType storageType, const Tizen::Base::String& origin);\r
\r
/**\r
* Gets the usage for the given origin for the given storage type.\r
* @param[in] storageType The web storage type\r
* @param[in] origin The origin\r
* @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_ARG The specified @c origin is invalid.\r
* @exception E_UNSUPPORTED_TYPE The specified storageType is not supported.\r
* @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
* @remarks The specific error code can be accessed using the GetLastResult() method.\r
* @param[in] storageType The web storage type\r
* @param[in] origin The origin\r
* @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_ARG The specified @c origin is invalid.\r
* @exception E_UNSUPPORTED_TYPE The specified storageType is not supported.\r
* @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
* @see RemoveAll()\r
*\r
* @since 2.1\r
*\r
+ *\r
* @return A pointer to the %WebStorageManager instance, @n\r
* else @c null if it fails\r
* @exception E_SUCCESS The method is successful.\r
- * @exception E_OUT_OF_MEMORY The memory is insufficient.\r
+ * @exception E_OUT_OF_MEMORY The memory is insufficient.\r
* @remarks The specific error code can be accessed using the GetLastResult() method.\r
*/\r
static WebStorageManager* GetInstance(void);\r
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FWebCtrlWebStorageManager.cpp
+ * @brief The file contains the definition of FWebCtrlWebStorageManager class.
+ *
+ * The file contains the definition of FWebCtrlWebStorageManager class.
+ */
+#include <unique_ptr.h>
+#include <FBaseColIList.h>
+#include <FBaseSysLog.h>
+#include <FWebCtrlWebStorageManager.h>
+#include <FSec_AccessController.h>
+#include "FWebCtrl_WebStorageManagerImpl.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Security;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+WebStorageManager* WebStorageManager::__pInstance = null;
+
+
+WebStorageManager::WebStorageManager(void)
+ : __pWebStorageManagerImpl(null)
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr<_WebStorageManagerImpl> pWebStorageManagerImpl(new (std::nothrow) _WebStorageManagerImpl());
+ SysTryReturnVoidResult(NID_WEB_CTRL, pWebStorageManagerImpl.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ __pWebStorageManagerImpl = pWebStorageManagerImpl.release();
+}
+
+
+WebStorageManager::~WebStorageManager(void)
+{
+}
+
+
+void
+WebStorageManager::InitWebStorageManager(void)
+{
+ std::unique_ptr<WebStorageManager> pInstance(new (std::nothrow) WebStorageManager());
+ SysTryReturnVoidResult(NID_WEB_CTRL, pInstance.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ __pInstance = pInstance.release();
+ std::atexit(DestroyWebStorageManager);
+}
+
+
+void
+WebStorageManager::DestroyWebStorageManager(void)
+{
+ delete __pInstance;
+ __pInstance = null;
+}
+
+
+WebStorageManager*
+WebStorageManager::GetInstance(void)
+{
+ static pthread_once_t onceBlock = PTHREAD_ONCE_INIT;
+ if (__pInstance== null)
+ {
+ ClearLastResult();
+ pthread_once(&onceBlock, InitWebStorageManager);
+ result r = GetLastResult();
+ if (IsFailed(r))
+ {
+ onceBlock = PTHREAD_ONCE_INIT;
+ }
+ }
+
+ return __pInstance;
+}
+
+
+IList*
+WebStorageManager::GetOriginListN(WebStorageType storageType) const
+{
+ SysAssertf(__pWebStorageManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_PRIVACY);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
+
+ IList* pList = __pWebStorageManagerImpl->GetOriginListN(storageType);
+ SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ return pList;
+}
+
+
+result
+WebStorageManager::SetQuotaForOrigin(WebStorageType storageType, const String& origin, long quota)
+{
+ SysAssertf(__pWebStorageManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_PRIVACY);
+ SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
+
+ r = __pWebStorageManagerImpl->SetQuotaForOrigin(storageType, origin, quota);
+ SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+
+long
+WebStorageManager::GetQuotaForOrigin(WebStorageType storageType, const String& origin)
+{
+ SysAssertf(__pWebStorageManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+ long quota = 0;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_PRIVACY);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, 0, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
+
+ quota = __pWebStorageManagerImpl->GetQuotaForOrigin(storageType, origin);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, 0, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ return quota;
+}
+
+
+long
+WebStorageManager::GetUsageForOrigin(WebStorageType storageType, const String& origin) const
+{
+ SysAssertf(__pWebStorageManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+ long usage = 0;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_PRIVACY);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, 0, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
+
+ usage = __pWebStorageManagerImpl->GetQuotaForOrigin(storageType, origin);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, 0, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ return usage;
+}
+
+
+result
+WebStorageManager::Remove(WebStorageType storageType, const String& origin)
+{
+ SysAssertf(__pWebStorageManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_PRIVACY);
+ SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
+
+ r = __pWebStorageManagerImpl->Remove(storageType, origin);
+ SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+
+result
+WebStorageManager::RemoveAll(WebStorageType storageType)
+{
+ SysAssertf(__pWebStorageManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_WEB_PRIVACY);
+ SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
+
+ r = __pWebStorageManagerImpl->RemoveAll(storageType);
+ SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+
+}}} // Tizen::Web::Controls
\ No newline at end of file
namespace Tizen { namespace Web { namespace Controls
{
+
_WebPresenter::_WebPresenter(void)
: __stopState(false)
, __boolean(false)
, __string(L"")
, __integer(0)
+ , __pIList(null)
+ , __longInteger(0)
{
//empty statement
}
+
_WebPresenter::~_WebPresenter(void)
{
}
result = __string;
}
+
+
void
_WebPresenter::WaitAsyncProcess(int& result)
{
result = __integer;
}
+
+void
+_WebPresenter::WaitAsyncProcess(Eina_List* result)
+{
+ ProcessEvent();
+
+ result = __pIList;
+}
+
+
+void
+_WebPresenter::WaitAsyncProcess(long& result)
+{
+ ProcessEvent();
+
+ result = __longInteger;
+}
+
+
void
_WebPresenter::ProcessEvent(void)
{
__integer = result;
__stopState = true;
}
+
+
+void
+_WebPresenter::EndAsyncProcess(const Eina_List* result)
+{
+ __pIList = const_cast<Eina_List*>(result);
+ __stopState = true;
+}
+
+
+void
+_WebPresenter::EndAsyncProcess(long result)
+{
+ __longInteger = result;
+ __stopState = true;
+}
+
+
}}} // Tizen::Web::Controls
void WaitAsyncProcess(bool& result);
void WaitAsyncProcess(Tizen::Base::String& result);
void WaitAsyncProcess(int& result);
+ void WaitAsyncProcess(Eina_List* result);
+ void WaitAsyncProcess(long& result);
void EndAsyncProcess(bool result);
void EndAsyncProcess(const Tizen::Base::String& result);
void EndAsyncProcess(int result);
+ void EndAsyncProcess(const Eina_List* result);
+ void EndAsyncProcess(long result);
private:
_WebPresenter(const _WebPresenter& rhs);
bool __stopState;
bool __boolean;
-
Tizen::Base::String __string;
int __integer;
+ Eina_List* __pIList;
+ long __longInteger;
};
}}} // Tizen::Web::Controls
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FWebCtrl_WebStorageManagerImpl.cpp
+ * @brief The file contains the definition of _WebStorageManagerImpl class.
+ */
+#include <EWebKit2.h>
+#include <FBaseColArrayList.h>
+#include <FBaseColIList.h>
+#include <FBaseSysLog.h>
+#include "FWebCtrl_Utility.h"
+#include "FWebCtrl_WebPresenter.h"
+#include "FWebCtrl_WebStorageManagerImpl.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+
+namespace Tizen { namespace Web { namespace Controls
+{
+
+
+void
+OnOriginReceived(Eina_List* pOrigins, void* pUserData)
+{
+ _WebPresenter* pPresenter = reinterpret_cast< _WebPresenter* >(pUserData);
+
+ pPresenter->EndAsyncProcess(pOrigins);
+}
+
+
+void
+OnIntReceived(int64_t integer, void* pUserData)
+{
+ _WebPresenter* pPresenter = reinterpret_cast< _WebPresenter* >(pUserData);
+
+
+
+ pPresenter->EndAsyncProcess((long)integer);
+}
+
+
+void
+OnUIntReceived(uint64_t integer, void* pUserData)
+{
+ _WebPresenter* pPresenter = reinterpret_cast< _WebPresenter* >(pUserData);
+
+
+
+ pPresenter->EndAsyncProcess((long)integer);
+}
+
+
+_WebStorageManagerImpl::_WebStorageManagerImpl(void)
+{
+}
+
+
+_WebStorageManagerImpl::~_WebStorageManagerImpl(void)
+{
+}
+
+
+IList*
+_WebStorageManagerImpl::GetOriginListN(WebStorageType storageType)
+{
+ Ewk_Context* pDefaultContext = ewk_context_default_get();
+ Eina_List* pOriginEinaList;
+ ArrayList* pOriginList;
+ _WebPresenter presenter;
+ presenter.InitAsyncProcess();
+
+ switch (storageType)
+ {
+ case WEB_STORAGE_TYPE_APPLICATION_CACHE:
+ ewk_context_application_cache_origins_get(pDefaultContext, OnOriginReceived, &presenter);
+ break;
+
+ case WEB_STORAGE_TYPE_WEB_SQL_DATABASE:
+ ewk_context_web_database_origins_get(pDefaultContext, OnOriginReceived, &presenter);
+ break;
+
+ case WEB_STORAGE_TYPE_WEB_STORAGE:
+ ewk_context_web_storage_origins_get(pDefaultContext, OnOriginReceived, &presenter);
+ break;
+
+ case WEB_STORAGE_TYPE_FILE_SYSTEM:
+ ewk_context_local_file_system_origins_get(pDefaultContext, OnOriginReceived, &presenter);
+ break;
+
+ default:
+ break;
+ }
+
+ presenter.WaitAsyncProcess(pOriginEinaList);
+
+ pOriginList = new (std::nothrow) ArrayList();
+ pOriginList->Construct();
+
+ for(; pOriginEinaList; pOriginEinaList = eina_list_next(pOriginEinaList))
+ {
+ Ewk_Security_Origin* pOrigin = static_cast<Ewk_Security_Origin*>(eina_list_data_get(pOriginEinaList));
+ String* pStringOrigin = new (std::nothrow) String(_Utility::CreateOrigin(pOrigin));
+ pOriginList->Add(pStringOrigin);
+ }
+
+ return pOriginList;
+}
+
+
+result
+_WebStorageManagerImpl::SetQuotaForOrigin(WebStorageType storageType, const String& origin, long quota)
+{
+ Ewk_Context* pDefaultContext = ewk_context_default_get();
+
+ SysTryReturnResult(NID_WEB_CTRL, (storageType == WEB_STORAGE_TYPE_WEB_SQL_DATABASE) || (storageType == WEB_STORAGE_TYPE_APPLICATION_CACHE), E_UNSUPPORTED_TYPE, "[%s] This storage type is not supported.", GetErrorMessage(E_UNSUPPORTED_TYPE));
+
+ Ewk_Security_Origin* pOrigin = CompareOrigin(storageType, origin);
+ SysTryReturnResult(NID_WEB_CTRL, pOrigin, E_INVALID_ARG, "[%s] This origin does not exist.", GetErrorMessage(E_INVALID_ARG));
+
+ switch (storageType)
+ {
+ case WEB_STORAGE_TYPE_APPLICATION_CACHE:
+ ewk_context_application_cache_quota_for_origin_set(pDefaultContext, pOrigin, quota);
+ break;
+
+ case WEB_STORAGE_TYPE_WEB_SQL_DATABASE:
+ ewk_context_web_database_quota_for_origin_set(pDefaultContext, pOrigin, quota);
+ break;
+
+ default:
+ break;
+ }
+ return E_SUCCESS;
+}
+
+
+long
+_WebStorageManagerImpl::GetQuotaForOrigin(WebStorageType storageType, const String& origin)
+{
+ Ewk_Context* pDefaultContext = ewk_context_default_get();
+ long quota = 0;
+
+ SysTryReturn(NID_WEB_CTRL, storageType == WEB_STORAGE_TYPE_WEB_SQL_DATABASE, 0, E_UNSUPPORTED_TYPE, "[%s] This storage type is not supported.", GetErrorMessage(E_UNSUPPORTED_TYPE));
+
+ Ewk_Security_Origin* pOrigin = CompareOrigin(storageType, origin);
+ SysTryReturnResult(NID_WEB_CTRL, pOrigin, E_INVALID_ARG, "[%s] This origin does not exist.", GetErrorMessage(E_INVALID_ARG));
+
+ _WebPresenter presenter;
+ presenter.InitAsyncProcess();
+
+ switch (storageType)
+ {
+ case WEB_STORAGE_TYPE_APPLICATION_CACHE:
+ ewk_context_application_cache_usage_for_origin_get(pDefaultContext, pOrigin, OnIntReceived, &presenter);
+ break;
+
+ case WEB_STORAGE_TYPE_WEB_SQL_DATABASE:
+ ewk_context_web_database_quota_for_origin_get(pDefaultContext, OnUIntReceived, &presenter, pOrigin);
+ break;
+
+ default:
+ break;
+ }
+
+ presenter.WaitAsyncProcess(quota);
+
+ return quota;
+}
+
+
+long
+_WebStorageManagerImpl::GetUsageForOrigin(WebStorageType storageType, const String& origin)
+{
+ Ewk_Context* pDefaultContext = ewk_context_default_get();
+ long usage = 0;
+
+ SysTryReturn(NID_WEB_CTRL, (storageType != WEB_STORAGE_TYPE_INDEXED_DATABASE) && (storageType != WEB_STORAGE_TYPE_FILE_SYSTEM), 0, E_UNSUPPORTED_TYPE, "[%s] This storage type is not supported.", GetErrorMessage(E_UNSUPPORTED_TYPE));
+
+ Ewk_Security_Origin* pOrigin = CompareOrigin(storageType, origin);
+ SysTryReturnResult(NID_WEB_CTRL, pOrigin, E_INVALID_ARG, "[%s] This origin does not exist.", GetErrorMessage(E_INVALID_ARG));
+
+ _WebPresenter presenter;
+ presenter.InitAsyncProcess();
+
+ switch (storageType)
+ {
+ case WEB_STORAGE_TYPE_APPLICATION_CACHE:
+ //ewk_context_application_cache_usage_for_origin_get(pDefaultContext, pOrigin, OnIntReceived, &presenter);
+ break;
+
+ case WEB_STORAGE_TYPE_WEB_SQL_DATABASE:
+ ewk_context_web_database_usage_for_origin_get(pDefaultContext, OnUIntReceived, &presenter, pOrigin);
+ break;
+
+ case WEB_STORAGE_TYPE_WEB_STORAGE :
+ ewk_context_web_storage_usage_for_origin_get(pDefaultContext, pOrigin, OnUIntReceived, &presenter);
+ break;
+
+ default:
+ break;
+ }
+
+ presenter.WaitAsyncProcess(usage);
+
+ return usage;
+}
+
+
+result
+_WebStorageManagerImpl::Remove(WebStorageType storageType, const String& origin)
+{
+ Ewk_Context* pDefaultContext = ewk_context_default_get();
+
+ SysTryReturnResult(NID_WEB_CTRL, storageType != WEB_STORAGE_TYPE_INDEXED_DATABASE, E_UNSUPPORTED_TYPE, "[%s] This storage type is not supported.", GetErrorMessage(E_UNSUPPORTED_TYPE));
+
+ Ewk_Security_Origin* pOrigin = CompareOrigin(storageType, origin);
+ SysTryReturnResult(NID_WEB_CTRL, pOrigin, E_INVALID_ARG, "[%s] This origin does not exist.", GetErrorMessage(E_INVALID_ARG));
+
+ switch (storageType)
+ {
+ case WEB_STORAGE_TYPE_APPLICATION_CACHE:
+ ewk_context_application_cache_delete(pDefaultContext, pOrigin);
+ break;
+
+ case WEB_STORAGE_TYPE_WEB_SQL_DATABASE:
+ ewk_context_web_database_delete(pDefaultContext, pOrigin);
+ break;
+
+ case WEB_STORAGE_TYPE_WEB_STORAGE :
+ ewk_context_web_storage_origin_delete(pDefaultContext, pOrigin);
+ break;
+
+ case WEB_STORAGE_TYPE_FILE_SYSTEM:
+ ewk_context_local_file_system_delete(pDefaultContext, pOrigin);
+ break;
+
+ default:
+ break;
+ }
+
+ return E_SUCCESS;
+}
+
+
+result
+_WebStorageManagerImpl::RemoveAll(WebStorageType storageType)
+{
+ Ewk_Context* pDefaultContext = ewk_context_default_get();
+
+ switch (storageType)
+ {
+ case WEB_STORAGE_TYPE_APPLICATION_CACHE:
+ ewk_context_application_cache_delete_all(pDefaultContext);
+ break;
+
+ case WEB_STORAGE_TYPE_INDEXED_DATABASE :
+ ewk_context_web_indexed_database_delete_all(pDefaultContext);
+ break;
+
+ case WEB_STORAGE_TYPE_WEB_SQL_DATABASE:
+ ewk_context_web_database_delete_all(pDefaultContext);
+ break;
+
+ case WEB_STORAGE_TYPE_WEB_STORAGE :
+ ewk_context_web_storage_delete_all(pDefaultContext);
+ break;
+
+ case WEB_STORAGE_TYPE_FILE_SYSTEM:
+ ewk_context_local_file_system_all_delete(pDefaultContext);
+ break;
+
+ default:
+ break;
+ }
+ return E_SUCCESS;
+}
+
+
+Ewk_Security_Origin*
+_WebStorageManagerImpl::CompareOrigin(WebStorageType storageType, const String& origin)
+{
+ Ewk_Context* pDefaultContext = ewk_context_default_get();
+ _WebPresenter presenter;
+ Eina_List* pOriginList;
+ presenter.InitAsyncProcess();
+
+ switch (storageType)
+ {
+ case WEB_STORAGE_TYPE_APPLICATION_CACHE:
+ ewk_context_application_cache_origins_get(pDefaultContext, OnOriginReceived, &presenter);
+ break;
+
+ case WEB_STORAGE_TYPE_WEB_SQL_DATABASE:
+ ewk_context_web_database_origins_get(pDefaultContext, OnOriginReceived, &presenter);
+ break;
+
+ case WEB_STORAGE_TYPE_WEB_STORAGE:
+ ewk_context_web_storage_origins_get(pDefaultContext, OnOriginReceived, &presenter);
+ break;
+
+ case WEB_STORAGE_TYPE_FILE_SYSTEM:
+ ewk_context_local_file_system_origins_get(pDefaultContext, OnOriginReceived, &presenter);
+ break;
+
+ default:
+ break;
+ }
+
+ presenter.WaitAsyncProcess(pOriginList);
+
+ for(; pOriginList; pOriginList = eina_list_next(pOriginList))
+ {
+ Ewk_Security_Origin* pOrigin = static_cast<Ewk_Security_Origin*>(eina_list_data_get(pOriginList));
+ int cmp = origin.CompareTo(_Utility::CreateOrigin(pOrigin));
+
+ if (cmp ==0)
+ {
+ return pOrigin;
+ }
+ }
+ return null;
+}
+}}} // Tizen::Web::Controls
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FWebCtrl_WebStorageManagerImpl.h\r
+ * @brief The file contains the declaration of _WebStorageManagerImpl class.\r
+ *\r
+ * The file contains the declaration of _WebStorageManagerImpl class.\r
+ */\r
+#ifndef _FWEB_CTRL_INTERNAL_WEB_STORAGE_MANAGER_IMPL_H_\r
+#define _FWEB_CTRL_INTERNAL_WEB_STORAGE_MANAGER_IMPL_H_\r
+\r
+#include <ewk_security_origin.h>\r
+#include <FBaseString.h>\r
+#include <FWebCtrlWebStorageManager.h>\r
+\r
+namespace Tizen { namespace Base { namespace Collection\r
+{\r
+class IList;\r
+}}}\r
+\r
+namespace Tizen { namespace Web { namespace Controls\r
+{\r
+\r
+class _WebStorageManagerImpl\r
+ : public Tizen::Base::Object\r
+{\r
+public:\r
+ _WebStorageManagerImpl(void);\r
+\r
+ virtual ~_WebStorageManagerImpl(void);\r
+\r
+ Tizen::Base::Collection::IList* GetOriginListN(WebStorageType storageType);\r
+\r
+ result SetQuotaForOrigin(WebStorageType storageType, const Tizen::Base::String& origin, long quota);\r
+\r
+ long GetQuotaForOrigin(WebStorageType storageType, const Tizen::Base::String& origin);\r
+\r
+ long GetUsageForOrigin(WebStorageType storageType, const Tizen::Base::String& origin);\r
+\r
+ result Remove(WebStorageType storageType, const Tizen::Base::String& origin);\r
+\r
+ result RemoveAll(WebStorageType storageType);\r
+\r
+ Ewk_Security_Origin* CompareOrigin(WebStorageType storageType, const Tizen::Base::String& origin);\r
+\r
+private:\r
+ _WebStorageManagerImpl(const _WebStorageManagerImpl& rhs);\r
+\r
+ _WebStorageManagerImpl& operator=(const _WebStorageManagerImpl& rhs);\r
+\r
+};\r
+\r
+}}} // Tizen::Web::Controls\r
+#endif // _FWEB_CTRL_INTERNAL_WEB_STORAGE_MANAGER_IMPL_H_
\ No newline at end of file