add exception to AddLivebox.
refactoring(break dependency between _LiveboxProviderInfoImpl and LiveboxSizeInfo)
Change-Id: I26aee422874cda47eac48eebec9a4e5a163b7b79
Signed-off-by: jungmin76.park <jungmin76.park@samsung.com>
* @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
_LiveboxSizeInfoImpl* __pLiveboxSizeInfoImpl;
friend class _LiveboxSizeInfoImpl;
-friend class _LiveboxProviderInfoImpl;
};
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;
}
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;
}
LiveboxProviderManager::~LiveboxProviderManager()
{
+ SysLog(NID_APP, "LiveboxProviderManager is destroyed.");
}
LiveboxProviderManager*
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;
{
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;
}
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);
}
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
_LiveboxPopupProviderImpl::~_LiveboxPopupProviderImpl()
{
-
+ delete __pLiveboxPopup;
}
const String&
_LiveboxProviderImpl::~_LiveboxProviderImpl()
{
-
+ delete __pLiveboxFrame;
}
const String&
#include <FShellLiveboxProviderInfo.h>
#include <FShellLiveboxSizeInfo.h>
#include "FShell_LiveboxProviderInfoImpl.h"
+#include "FShell_LiveboxSizeInfoImpl.h"
namespace Tizen { namespace Shell {
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;
{
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*
*/
#include <unique_ptr.h>
-
+#include <errno.h>
+#include <string.h>
#include <shortcut.h>
#include <FBaseSysLog.h>
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";
_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
}
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
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;
}
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)
{
}
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);
__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;
}
#include <FBaseSysLog.h>
#include <FBase_StringConverter.h>
#include <FShellLiveboxProviderInfo.h>
+#include <FShellLiveboxSizeInfo.h>
#include "FShell_LiveboxProviderInfoImpl.h"
#include "FShell_LiveboxSizeInfoImpl.h"
{
}
+LiveboxSizeInfo*
+_LiveboxSizeInfoImpl::CreateLiveboxSizeInfo(Tizen::Graphics::Dimension size, const Tizen::Base::String& previewImagePath)
+{
+ return new (std::nothrow) LiveboxSizeInfo(size, previewImagePath);
+}
+
Dimension
_LiveboxSizeInfoImpl::GetSize() const
{
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"");
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);
namespace Tizen { namespace Shell
{
+class LiveboxSizeInfo;
/**
* @class _LiveboxSizeInfoImpl
* @brief This class contains size and preview image path for the size
*/
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.
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
{