fix RequestUpdate problem that argument isn't delivered.
authorjungmin76.park <jungmin76.park@samsung.com>
Tue, 12 Feb 2013 08:01:06 +0000 (17:01 +0900)
committerjungmin76.park <jungmin76.park@samsung.com>
Tue, 12 Feb 2013 08:08:02 +0000 (17:08 +0900)
add exception to AddLivebox.
refactoring(break dependency between _LiveboxProviderInfoImpl and LiveboxSizeInfo)

Change-Id: I26aee422874cda47eac48eebec9a4e5a163b7b79
Signed-off-by: jungmin76.park <jungmin76.park@samsung.com>
14 files changed:
inc/FShellLiveboxProviderManager.h [changed mode: 0644->0755]
inc/FShellLiveboxSizeInfo.h
src/FShellLiveboxPopupProvider.cpp
src/FShellLiveboxProvider.cpp
src/FShellLiveboxProviderManager.cpp
src/FShellLiveboxView.cpp
src/FShell_LiveboxPopupProviderImpl.cpp
src/FShell_LiveboxProviderImpl.cpp
src/FShell_LiveboxProviderInfoImpl.cpp
src/FShell_LiveboxProviderManagerImpl.cpp
src/FShell_LiveboxSizeInfoImpl.cpp
src/inc/FShell_LiveboxProviderManagerImpl.h
src/inc/FShell_LiveboxSizeInfoImpl.h
src/inc/FShell_TemplateUtil.h

old mode 100644 (file)
new mode 100755 (executable)
index e16f2b5..3676518
@@ -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
index 5081c65..5b0a8f6 100644 (file)
@@ -108,7 +108,6 @@ private:
     _LiveboxSizeInfoImpl* __pLiveboxSizeInfoImpl;
 
 friend class _LiveboxSizeInfoImpl;
-friend class _LiveboxProviderInfoImpl;
 };
 
 
index fdf12d4..2b33c5c 100644 (file)
@@ -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;
 }
 
index 34fbf5f..b87fb1e 100644 (file)
@@ -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;
 }
 
index cc5f6f6..b2a0012 100644 (file)
@@ -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);
 }
index 2d85075..32aa2e6 100644 (file)
@@ -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
index 2af297a..c789a41 100644 (file)
@@ -41,7 +41,7 @@ _LiveboxPopupProviderImpl::_LiveboxPopupProviderImpl(const String& instanceId)
 
 _LiveboxPopupProviderImpl::~_LiveboxPopupProviderImpl()
 {
-
+       delete __pLiveboxPopup;
 }
 
 const String&
index 52f23a0..b29ff68 100644 (file)
@@ -40,7 +40,7 @@ _LiveboxProviderImpl::_LiveboxProviderImpl(const String& instanceId)
 
 _LiveboxProviderImpl::~_LiveboxProviderImpl()
 {
-
+       delete __pLiveboxFrame;
 }
 
 const String&
index f09dc4e..6871362 100644 (file)
@@ -28,6 +28,7 @@
 #include <FShellLiveboxProviderInfo.h>
 #include <FShellLiveboxSizeInfo.h>
 #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<ArrayList> 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<LiveboxSizeInfo> 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*
index 2764295..412b93d 100644 (file)
@@ -21,7 +21,8 @@
  */
 
 #include <unique_ptr.h>
-
+#include <errno.h>
+#include <string.h>
 #include <shortcut.h>
 
 #include <FBaseSysLog.h>
@@ -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<char[]> 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<const String*>(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;
 }
index 64aa5e4..9d36329 100644 (file)
@@ -26,6 +26,7 @@
 #include <FBaseSysLog.h>
 #include <FBase_StringConverter.h>
 #include <FShellLiveboxProviderInfo.h>
+#include <FShellLiveboxSizeInfo.h>
 
 #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
 {
index 30403ab..2e3e37f 100644 (file)
@@ -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);
index 61bf88a..0a5b852 100644 (file)
@@ -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.
index 8f989bc..c50fb3c 100644 (file)
@@ -107,27 +107,27 @@ struct CollectionAllElementDeleter
 namespace Tizen { namespace Base
 {
 
-template<>
-class ComparerT<String>
-: public virtual Tizen::Base::Collection::IComparerT<String>
-, 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<String>
+//: public virtual Tizen::Base::Collection::IComparerT<String>
+//, 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
 {