From fc46318c83f7b625c672aeebf503eff98a599102 Mon Sep 17 00:00:00 2001 From: "jungmin76.park" Date: Tue, 12 Feb 2013 17:01:06 +0900 Subject: [PATCH] fix RequestUpdate problem that argument isn't delivered. add exception to AddLivebox. refactoring(break dependency between _LiveboxProviderInfoImpl and LiveboxSizeInfo) Change-Id: I26aee422874cda47eac48eebec9a4e5a163b7b79 Signed-off-by: jungmin76.park --- inc/FShellLiveboxProviderManager.h | 5 ++-- inc/FShellLiveboxSizeInfo.h | 1 - src/FShellLiveboxPopupProvider.cpp | 4 +-- src/FShellLiveboxProvider.cpp | 6 ++--- src/FShellLiveboxProviderManager.cpp | 12 ++++----- src/FShellLiveboxView.cpp | 2 +- src/FShell_LiveboxPopupProviderImpl.cpp | 2 +- src/FShell_LiveboxProviderImpl.cpp | 2 +- src/FShell_LiveboxProviderInfoImpl.cpp | 11 +++++--- src/FShell_LiveboxProviderManagerImpl.cpp | 24 ++++++++++------- src/FShell_LiveboxSizeInfoImpl.cpp | 7 +++++ src/inc/FShell_LiveboxProviderManagerImpl.h | 4 +-- src/inc/FShell_LiveboxSizeInfoImpl.h | 3 +++ src/inc/FShell_TemplateUtil.h | 42 ++++++++++++++--------------- 14 files changed, 72 insertions(+), 53 deletions(-) mode change 100644 => 100755 inc/FShellLiveboxProviderManager.h diff --git a/inc/FShellLiveboxProviderManager.h b/inc/FShellLiveboxProviderManager.h old mode 100644 new mode 100755 index e16f2b5..3676518 --- a/inc/FShellLiveboxProviderManager.h +++ b/inc/FShellLiveboxProviderManager.h @@ -101,14 +101,15 @@ public: * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. * @exception E_CERTIFICATE_VERIFICATION_FAILED The application isn't permitted to request add Livebox of other application package. * To get permission, the target application is signed with the same certificate. - * @exception E_UNSUPPORTED_OPERATION The specifed Livebox provider doesn't support this operation.@ + * @exception E_UNSUPPORTED_OPERATION The specified Livebox provider doesn't support this operation.@ * To request a Livebox viewer to add a Livebox, Livebox provider should support 1x1 size Livebox, but the specified Livebox provider doesn't support 1x1 size. + * @exception E_CONNECTION_FAILED The viewer application doesn't set a listener to receive this request. * @exception E_SYSTEM The method cannot proceed due to a severe system error. * * @remark Only Livebox provider that is packaged with the caller application can be added by this API. * @see SetLiveboxAddRequestListener */ - result AddLivebox(const Tizen::App::AppId& viewerAppId, const Tizen::Base::String& providerAppId, const Tizen::Base::String& providerName, const Tizen::Base::String& text, const Tizen::Base::String& userInfo); + result AddLivebox(const Tizen::App::AppId& viewerAppId, const Tizen::App::AppId& providerAppId, const Tizen::Base::String& providerName, const Tizen::Base::String& text, const Tizen::Base::String& userInfo); /** * Sets a LiveboxProvider factory. @n diff --git a/inc/FShellLiveboxSizeInfo.h b/inc/FShellLiveboxSizeInfo.h index 5081c65..5b0a8f6 100644 --- a/inc/FShellLiveboxSizeInfo.h +++ b/inc/FShellLiveboxSizeInfo.h @@ -108,7 +108,6 @@ private: _LiveboxSizeInfoImpl* __pLiveboxSizeInfoImpl; friend class _LiveboxSizeInfoImpl; -friend class _LiveboxProviderInfoImpl; }; diff --git a/src/FShellLiveboxPopupProvider.cpp b/src/FShellLiveboxPopupProvider.cpp index fdf12d4..2b33c5c 100644 --- a/src/FShellLiveboxPopupProvider.cpp +++ b/src/FShellLiveboxPopupProvider.cpp @@ -42,16 +42,16 @@ LiveboxPopupProvider::LiveboxPopupProvider() LiveboxPopupProvider::~LiveboxPopupProvider() { - SysLog(NID_APP, ""); + SysLog(NID_APP, "LiveboxPopupProvider is destroyed."); } result LiveboxPopupProvider::Construct(const String& instanceId) { - SysLog(NID_APP, ""); __pLiveboxPopupProviderImpl = new (std::nothrow) _LiveboxPopupProviderImpl(instanceId); SysTryReturnResult(NID_APP, __pLiveboxPopupProviderImpl, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]"); + SysLog(NID_APP, "LiveboxPopupProvider is constructed."); return E_SUCCESS; } diff --git a/src/FShellLiveboxProvider.cpp b/src/FShellLiveboxProvider.cpp index 34fbf5f..b87fb1e 100644 --- a/src/FShellLiveboxProvider.cpp +++ b/src/FShellLiveboxProvider.cpp @@ -34,21 +34,21 @@ using namespace Tizen::Base; LiveboxProvider::LiveboxProvider() { - SysLog(NID_APP, ""); } LiveboxProvider::~LiveboxProvider() { - SysLog(NID_APP, ""); + SysLog(NID_APP, "LiveboxProvider is destroyed."); } result LiveboxProvider::Construct(const String& instanceId) { - SysLog(NID_APP, ""); __pLiveboxProviderImpl = new (std::nothrow) _LiveboxProviderImpl(instanceId); SysTryReturnResult(NID_APP, __pLiveboxProviderImpl, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]"); + SysLog(NID_APP, "LiveboxProvider is constructed."); + return E_SUCCESS; } diff --git a/src/FShellLiveboxProviderManager.cpp b/src/FShellLiveboxProviderManager.cpp index cc5f6f6..b2a0012 100644 --- a/src/FShellLiveboxProviderManager.cpp +++ b/src/FShellLiveboxProviderManager.cpp @@ -58,6 +58,7 @@ LiveboxProviderManager::LiveboxProviderManager() LiveboxProviderManager::~LiveboxProviderManager() { + SysLog(NID_APP, "LiveboxProviderManager is destroyed."); } LiveboxProviderManager* @@ -72,7 +73,6 @@ LiveboxProviderManager::GetInstance() result r = pLiveboxManager->Construct(); // SysTryReturn(NID_APP, !IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r)); SysAssertf(!IsFailed(r), "Failed to construct LiveboxProviderManager!!"); - SysLog(NID_APP, "LiveboxProviderManager instance is created."); } return pLiveboxManager; @@ -83,12 +83,10 @@ LiveboxProviderManager::Construct() { SysAssert(__pLiveboxProviderManagerImpl == null); - SysLog(NID_APP, "Enter."); __pLiveboxProviderManagerImpl = _LiveboxProviderManagerImpl::GetInstance(); SysAssertf(__pLiveboxProviderManagerImpl, "Failed to construct _LiveboxProviderManagerImpl!!"); - SysLog(NID_APP, "Exit."); - + SysLog(NID_APP, "LiveboxProviderManager instance is constructed."); return E_SUCCESS; } @@ -107,12 +105,12 @@ LiveboxProviderManager::SetLiveboxPopupProviderFactory(ILiveboxPopupProviderFact result LiveboxProviderManager::RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument) { - __pLiveboxProviderManagerImpl->RequestUpdate(appId, providerName, argument); - return E_SUCCESS; + SysLog(NID_APP, "Enter."); + return __pLiveboxProviderManagerImpl->RequestUpdate(appId, providerName, argument); } result -LiveboxProviderManager::AddLivebox(const Tizen::App::AppId& viewerAppId, const Tizen::Base::String& providerAppId, const Tizen::Base::String& providerName, const Tizen::Base::String& text, const Tizen::Base::String& userInfo) +LiveboxProviderManager::AddLivebox(const Tizen::App::AppId& viewerAppId, const Tizen::App::AppId& providerAppId, const Tizen::Base::String& providerName, const Tizen::Base::String& text, const Tizen::Base::String& userInfo) { return __pLiveboxProviderManagerImpl->AddLivebox(viewerAppId, providerAppId, providerName, text, userInfo); } diff --git a/src/FShellLiveboxView.cpp b/src/FShellLiveboxView.cpp index 2d85075..32aa2e6 100644 --- a/src/FShellLiveboxView.cpp +++ b/src/FShellLiveboxView.cpp @@ -46,7 +46,7 @@ LiveboxView::~LiveboxView(void) result LiveboxView::Construct(const AppId& appId, const Tizen::Base::String& providerName, const Tizen::Graphics::Rectangle& rect) { - return Construct(appId, providerName, rect, L"default"); + return Construct(appId, providerName, rect, L""); } result diff --git a/src/FShell_LiveboxPopupProviderImpl.cpp b/src/FShell_LiveboxPopupProviderImpl.cpp index 2af297a..c789a41 100644 --- a/src/FShell_LiveboxPopupProviderImpl.cpp +++ b/src/FShell_LiveboxPopupProviderImpl.cpp @@ -41,7 +41,7 @@ _LiveboxPopupProviderImpl::_LiveboxPopupProviderImpl(const String& instanceId) _LiveboxPopupProviderImpl::~_LiveboxPopupProviderImpl() { - + delete __pLiveboxPopup; } const String& diff --git a/src/FShell_LiveboxProviderImpl.cpp b/src/FShell_LiveboxProviderImpl.cpp index 52f23a0..b29ff68 100644 --- a/src/FShell_LiveboxProviderImpl.cpp +++ b/src/FShell_LiveboxProviderImpl.cpp @@ -40,7 +40,7 @@ _LiveboxProviderImpl::_LiveboxProviderImpl(const String& instanceId) _LiveboxProviderImpl::~_LiveboxProviderImpl() { - + delete __pLiveboxFrame; } const String& diff --git a/src/FShell_LiveboxProviderInfoImpl.cpp b/src/FShell_LiveboxProviderInfoImpl.cpp index f09dc4e..6871362 100644 --- a/src/FShell_LiveboxProviderInfoImpl.cpp +++ b/src/FShell_LiveboxProviderInfoImpl.cpp @@ -28,6 +28,7 @@ #include #include #include "FShell_LiveboxProviderInfoImpl.h" +#include "FShell_LiveboxSizeInfoImpl.h" namespace Tizen { namespace Shell { @@ -135,7 +136,9 @@ _LiveboxProviderInfoImpl::GetSizeInfoListN() const SysTryReturn(NID_APP, supportedSizeCount > 0, null, E_INVALID_ARG, "[E_INVALID_ARG] There is no livebox of provider(%ls)",__providerId.GetPointer() ); - ArrayList* pSizes = new (std::nothrow) ArrayList; + std::unique_ptr pSizes(new (std::nothrow) ArrayList); + SysTryReturn(NID_APP, pSizes, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to allocate memory for ArrayList." ); + pSizes->Construct(); Dimension size(0, 0); String previewImagePath; @@ -144,9 +147,11 @@ _LiveboxProviderInfoImpl::GetSizeInfoListN() const { size.SetSize(widthArray[i], heightArray[i]); previewImagePath = livebox_service_preview(pPackageId.get(), livebox_service_size_type(size.width, size.height) ); - pSizes->Add( *new LiveboxSizeInfo(size, previewImagePath) ); + std::unique_ptr pLiveboxSizeInfo(_LiveboxSizeInfoImpl::CreateLiveboxSizeInfo(size, previewImagePath) ); + SysTryReturn(NID_APP, pLiveboxSizeInfo, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to allocate memory for LiveboxSizeInfo." ); + pSizes->Add( *pLiveboxSizeInfo.release() ); } - return pSizes; + return pSizes.release(); } LiveboxProviderInfo* diff --git a/src/FShell_LiveboxProviderManagerImpl.cpp b/src/FShell_LiveboxProviderManagerImpl.cpp index 2764295..412b93d 100644 --- a/src/FShell_LiveboxProviderManagerImpl.cpp +++ b/src/FShell_LiveboxProviderManagerImpl.cpp @@ -21,7 +21,8 @@ */ #include - +#include +#include #include #include @@ -79,6 +80,7 @@ const String ARG_KEY_PROVIDER_NAME = L"_ProviderName"; const String ARG_KEY_USER_INFO = L"_UserInfo"; const String ARG_KEY_WIDTH = L"_Width"; const String ARG_KEY_HEIGHT = L"_Height"; +const String ARG_KEY_ARGUMENT = L"_Argument"; const String ARG_KEY_EVENT_TYPE = L"_EventType"; const String ARG_KEY_TIME_STAMP = L"_TimeStamp"; const String ARG_KEY_X = L"_X"; @@ -199,15 +201,16 @@ result _LiveboxProviderManagerImpl::RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument) { + SysLog(NID_APP, "Enter."); /*if( appId == App::App::GetInstance()->GetAppId()) { //TODO: optimizing for local request } else*/ { - _LiveboxManagerProxy::GetInstance()->RequestUpdate(appId, providerName, argument); + return _LiveboxManagerProxy::GetInstance()->RequestUpdate(appId, providerName, argument); } - return E_SUCCESS; + } result @@ -245,11 +248,10 @@ int AddLiveboxCallback(int ret, int pid, void *data) } result -_LiveboxProviderManagerImpl::AddLivebox(const Tizen::App::AppId& viewerAppId, const Tizen::Base::String& providerAppId, const Tizen::Base::String& providerName, const Tizen::Base::String& text, const Tizen::Base::String& userInfo) +_LiveboxProviderManagerImpl::AddLivebox(const Tizen::App::AppId& viewerAppId, const Tizen::App::AppId& providerAppId, const Tizen::Base::String& providerName, const Tizen::Base::String& text, const Tizen::Base::String& userInfo) { SysTryReturnResult(NID_APP, providerAppId.IsEmpty()==false, E_INVALID_ARG, "The providerAppId is empty."); SysTryReturnResult(NID_APP, providerAppId.GetLength() < NATIVE_APP_MAX_APPID_LENGTH, E_INVALID_ARG, "The providerAppId is too long (Maximum %d bytes).", NATIVE_APP_MAX_APPID_LENGTH); -// SysTryReturnResult(NID_APP, _PackageManagerImpl::IsAppInstalled(providerAppId) == true, E_APP_NOT_INSTALLED, "The application(%ls) is not installed.", providerAppId.GetPointer()); SysTryReturnResult(NID_APP, Tizen::App::_Aul::IsInstalled(providerAppId) == true, E_APP_NOT_INSTALLED, "The application(%ls) is not installed.", providerAppId.GetPointer()); //TODO :: check privilege @@ -287,7 +289,8 @@ _LiveboxProviderManagerImpl::AddLivebox(const Tizen::App::AppId& viewerAppId, co std::unique_ptr pIcon(_StringConverter::CopyToCharArrayN(iconPath)); int ret = add_to_home_livebox(pProviderId.get(), pName.get(), LAUNCH_BY_PACKAGE, pContent.get(), pIcon.get(), -1.0l, AddLiveboxCallback, this); - SysTryReturnResult(NID_APP, ret == 0, E_SYSTEM, "[E_SYSTEM] failed to add_to_home_livebox (%d)", ret); + SysTryReturnResult(NID_APP, ret != -ENOTCONN, E_CONNECTION_FAILED, "[E_CONNECTION_FAILED] failed to add_to_home_livebox"); + SysTryReturnResult(NID_APP, ret == 0, E_SYSTEM, "[E_SYSTEM] failed to add_to_home_livebox (%s)", strerror(r)); return E_SUCCESS; } @@ -430,7 +433,10 @@ _LiveboxProviderManagerImpl::HandleLiveboxRequest(const Tizen::Base::String& ope SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_HEIGHT.GetPointer() ); Integer::Parse(*pValue, height); - this->UpdateLivebox(*pInstanceId, width, height); + pValue = dynamic_cast(pArgs->GetValue(ARG_KEY_ARGUMENT)); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_ARGUMENT.GetPointer() ); + + this->UpdateLivebox(*pInstanceId, width, height, *pValue); } else if (operationId == LIVEBOX_ON_REMOVE) { @@ -563,7 +569,7 @@ _LiveboxProviderManagerImpl::CreateLivebox(const String& name, const String& ins } result -_LiveboxProviderManagerImpl::UpdateLivebox(const String& instanceId, int width, int height) +_LiveboxProviderManagerImpl::UpdateLivebox(const String& instanceId, int width, int height, const String& argument) { SysLog(NID_APP, "instanceId(%ls), w:%d, h:%d", instanceId.GetPointer(), width, height); @@ -571,7 +577,7 @@ _LiveboxProviderManagerImpl::UpdateLivebox(const String& instanceId, int width, __liveBoxes.GetValue(instanceId, pLivebox); SysTryReturnResult(NID_APP, pLivebox, E_SYSTEM, "Can't find the Livebox provider"); - pLivebox->OnLiveboxProviderUpdating(L""); + pLivebox->OnLiveboxProviderUpdating(argument); return E_SUCCESS; } diff --git a/src/FShell_LiveboxSizeInfoImpl.cpp b/src/FShell_LiveboxSizeInfoImpl.cpp index 64aa5e4..9d36329 100644 --- a/src/FShell_LiveboxSizeInfoImpl.cpp +++ b/src/FShell_LiveboxSizeInfoImpl.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include "FShell_LiveboxProviderInfoImpl.h" #include "FShell_LiveboxSizeInfoImpl.h" @@ -63,6 +64,12 @@ _LiveboxSizeInfoImpl::~_LiveboxSizeInfoImpl() { } +LiveboxSizeInfo* +_LiveboxSizeInfoImpl::CreateLiveboxSizeInfo(Tizen::Graphics::Dimension size, const Tizen::Base::String& previewImagePath) +{ + return new (std::nothrow) LiveboxSizeInfo(size, previewImagePath); +} + Dimension _LiveboxSizeInfoImpl::GetSize() const { diff --git a/src/inc/FShell_LiveboxProviderManagerImpl.h b/src/inc/FShell_LiveboxProviderManagerImpl.h index 30403ab..2e3e37f 100644 --- a/src/inc/FShell_LiveboxProviderManagerImpl.h +++ b/src/inc/FShell_LiveboxProviderManagerImpl.h @@ -57,7 +57,7 @@ public: result SetLiveboxProviderFactory(ILiveboxProviderFactory& factory); result SetLiveboxPopupProviderFactory(ILiveboxPopupProviderFactory& factory); result RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument); - result AddLivebox(const Tizen::App::AppId& viewerAppId, const Tizen::Base::String& providerAppId, const Tizen::Base::String& providerName, const Tizen::Base::String& text, const Tizen::Base::String& userInfo); + result AddLivebox(const Tizen::App::AppId& viewerAppId, const Tizen::App::AppId& providerAppId, const Tizen::Base::String& providerName, const Tizen::Base::String& text, const Tizen::Base::String& userInfo); // internal APIs result RequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument = L""); @@ -88,7 +88,7 @@ private: result Construct(); result CreateLivebox(const Tizen::Base::String& name, const Tizen::Base::String& instanceId, int width, int height, const Tizen::Base::String& userInfo); - result UpdateLivebox(const Tizen::Base::String& instanceId, int width, int height); + result UpdateLivebox(const Tizen::Base::String& instanceId, int width, int height, const Tizen::Base::String& argument); result ResizeLivebox(const Tizen::Base::String& instanceId, int width, int height); result RemoveLivebox(const Tizen::Base::String& instanceId, bool terminateIfFinished); result CreateLiveboxPopupProvider(const Tizen::Base::String& instanceId, const Tizen::Base::String& providerName); diff --git a/src/inc/FShell_LiveboxSizeInfoImpl.h b/src/inc/FShell_LiveboxSizeInfoImpl.h index 61bf88a..0a5b852 100644 --- a/src/inc/FShell_LiveboxSizeInfoImpl.h +++ b/src/inc/FShell_LiveboxSizeInfoImpl.h @@ -33,6 +33,7 @@ namespace Tizen { namespace Shell { +class LiveboxSizeInfo; /** * @class _LiveboxSizeInfoImpl * @brief This class contains size and preview image path for the size @@ -86,6 +87,8 @@ public: */ Tizen::Base::String GetPreviewImagePath() const; + static LiveboxSizeInfo* CreateLiveboxSizeInfo(Tizen::Graphics::Dimension size, const Tizen::Base::String& previewImagePath); + private: /** * This is the default constructor for this class. diff --git a/src/inc/FShell_TemplateUtil.h b/src/inc/FShell_TemplateUtil.h index 8f989bc..c50fb3c 100644 --- a/src/inc/FShell_TemplateUtil.h +++ b/src/inc/FShell_TemplateUtil.h @@ -107,27 +107,27 @@ struct CollectionAllElementDeleter namespace Tizen { namespace Base { -template<> -class ComparerT -: public virtual Tizen::Base::Collection::IComparerT -, public Object -{ -public: - ComparerT(void) {} - - virtual ~ComparerT(void) {} - - virtual result Compare(const String& obj1, const String& obj2, int& cmp) const - { - cmp = String::Compare(obj1, obj2); - return E_SUCCESS; - } - -private: - ComparerT(const ComparerT& rhs); - - ComparerT& operator =(const ComparerT& rhs); -}; +//template<> +//class ComparerT +//: public virtual Tizen::Base::Collection::IComparerT +//, public Object +//{ +//public: +// ComparerT(void) {} +// +// virtual ~ComparerT(void) {} +// +// virtual result Compare(const String& obj1, const String& obj2, int& cmp) const +// { +// cmp = String::Compare(obj1, obj2); +// return E_SUCCESS; +// } +// +//private: +// ComparerT(const ComparerT& rhs); +// +// ComparerT& operator =(const ComparerT& rhs); +//}; namespace Collection { -- 2.7.4