result
-_AppArg::Construct(const _AppMessageImpl& msg, const String& oId, const String* pUri, const String* pMime)
-{
- __pBundle = bundle_dup(const_cast<bundle*>(msg.GetBundle()));
- SysTryReturnResult(NID_APP, __pBundle != null, E_OUT_OF_MEMORY, "Bundle creation failure.");
-
- return CreateAppControlArg(__pBundle, oId, pUri, pMime, null);
-}
-
-
-result
_AppArg::Construct(const _SqlDataControlImpl& dc, _DataControlRequestType requestType, const IList* pList)
{
__pBundle = bundle_create();
result
-_AppArg::Construct(bundle* b)
+_AppArg::Construct(const bundle* b)
{
- __pBundle = bundle_dup(b);
+ __pBundle = bundle_dup(const_cast<bundle*>(b));
SysTryReturnResult(NID_APP, __pBundle != null, E_INVALID_STATE, "Bundle creatioin from service handle failure.");
return E_SUCCESS;
#include "FApp_AppControlImpl.h"
#include "FApp_AppControlManager.h"
+#include "FApp_IAppControlPluginProvider.h"
#include "FApp_AppArg.h"
#include "FApp_AppControlRegistry.h"
#include "FApp_AppMessageImpl.h"
return ac.__pAppControlImpl;
}
+_IAppControlPluginProvider*
+_AppControlImpl::GetAppControlPluginProvider(const String& path)
+{
+ _LibraryImpl lib;
+ lib.Construct(path, _LIBRARY_OPTION);
+
+ APP_CONTROL_PROVIDER_GET_FN pProvider = reinterpret_cast<APP_CONTROL_PROVIDER_GET_FN>(lib.GetProcAddress(L"GetAppControlProviderPlugin"));
+
+ if (!pProvider)
+ {
+ SysLogException(NID_APP, E_SYSTEM, "Cannot load plugin properly for %ls.", path.GetPointer());
+ return null;
+ }
+
+ return (*pProvider)();
+}
+
result
_AppControlImpl::Start(const IList* pDataList, IAppControlEventListener* pListener)
{
SysTryReturnResult(NID_APP, pInfo == null, E_IN_PROGRESS, "Request ID %d is already in progress.", _reqId);
int req = _REQ_ID_INVALID;
- _LibraryImpl* pLib = null;
- pLib = new (std::nothrow) _LibraryImpl;
- SysTryReturnResult(NID_APP, pLib != null, E_OUT_OF_MEMORY, "Failed to allocate libraryimpl.");
-
- result r = pLib->Construct(_path, _LIBRARY_OPTION);
- SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Propagating.", GetErrorMessage(r));
+ _IAppControlPluginProvider* pProvider = GetAppControlPluginProvider(_path);
+ SysTryReturnResult(NID_APP, pProvider != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Propagating.");
if (pListener)
{
- _InProcessInfo* pItem = new (std::nothrow) _InProcessInfo(_provider, _opId, _property, true, *pLib, pListener);
+ _InProcessInfo* pItem = new (std::nothrow) _InProcessInfo(_provider, _opId, _property, true, pProvider, pListener);
if (pItem)
{
req = _AppControlManager::GetInstance()->__inAppManager.InsertItem(pItem);
}
}
- r = InvokeStartAppControl(*pLib, req, _provider, _opId, pDataList);
+
+ result r = InvokeStartAppControl(pProvider, req, _provider, _opId, pDataList);
if (pListener == null)
{
- delete pLib;
+ pProvider->Release();
}
// after acquring request number, pLib should be managed from the list, not CATCH
SysLog(NID_APP, "Exit %d", req);
return E_SUCCESS;
-
-CATCH:
- delete pLib;
-
- switch (r)
- {
- case E_LIBRARY_NOT_FOUND:
- r = E_OBJ_NOT_FOUND;
- break;
- default:
- r = E_SYSTEM;
- break;
- }
-
- return r;
}
result
SysTryReturnResult(NID_APP, pInfo == null, E_IN_PROGRESS, "Request ID %d is already in progress.", _reqId);
int req = _REQ_ID_INVALID;
- _LibraryImpl* pLib = null;
-
- pLib = new (std::nothrow) _LibraryImpl;
- SysTryReturnResult(NID_APP, pLib != null, E_OUT_OF_MEMORY, "Failed to allocate libraryimpl.");
-
- result r = pLib->Construct(_path, _LIBRARY_OPTION);
+ result r = E_SUCCESS;
- SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Propagating.", GetErrorMessage(r));
+ _IAppControlPluginProvider* pProvider = GetAppControlPluginProvider(_path);
+ SysTryReturnResult(NID_APP, pProvider != null, E_OBJ_NOT_FOUND, "Propagating.");
if (pListener)
{
- _InProcessInfo* pItem = new (std::nothrow) _InProcessInfo(_provider, _opId, _property, false, *pLib, pListener);
+ _InProcessInfo* pItem = new (std::nothrow) _InProcessInfo(_provider, _opId, _property, false, pProvider, pListener);
if (pItem)
{
req = _AppControlManager::GetInstance()->__inAppManager.InsertItem(pItem);
}
}
}
- r = InvokeStartAppControl(*pLib, req, _provider, _opId, pUriData, pMimeType, pDataList);
+ r = InvokeStartAppControl(pProvider, req, _provider, _opId, pUriData, pMimeType, pDataList);
if (pListener == null)
{
- delete pLib;
+ pProvider->Release();
}
// after acquring request number, pLib should be managed from the list, not CATCH
SysLog(NID_APP, "Exit %d", req);
return E_SUCCESS;
-
-CATCH:
- delete pLib;
-
- switch (r)
- {
- case E_LIBRARY_NOT_FOUND:
- r = E_OBJ_NOT_FOUND;
- break;
- default:
- r = E_SYSTEM;
- break;
- }
-
- return r;
}
result
-_AppControlImpl::InvokeStartAppControl(_LibraryImpl& lib, int req, const String& appId, const String& oId, const IList* pList)
+_AppControlImpl::InvokeStartAppControl(_IAppControlPluginProvider* pProvider, int req, const String& appId, const String& oId, const IList* pList)
{
SysLog(NID_APP, "Legacy stuff for converting argument");
pMap = ↦
}
- return InvokeStartAppControl(lib, req, appId, oId, null, null, pMap);
+ return InvokeStartAppControl(pProvider, req, appId, oId, null, null, pMap);
}
result
-_AppControlImpl::InvokeStartAppControl(_LibraryImpl& lib, int req, const String& appId, const String& oId, const String* pUri, const String* pMime, const IMap* pMap)
+_AppControlImpl::InvokeStartAppControl(_IAppControlPluginProvider* pProvider, int req, const String& appId, const String& oId, const String* pUri, const String* pMime, const IMap* pMap)
{
- result (*pFunc)(int req, const String&, const String&, const String*, const String*, const IMap*) = null;
-
- pFunc =
- reinterpret_cast<result (*)(int, const String&, const String&, const String*, const String*, const IMap*)>(lib.GetProcAddress(L"StartAppControl"));
- SysTryReturnResult(NID_APP, pFunc != null, E_OBJ_NOT_FOUND, "Entry \"StartAppControl\" not found for %ls", appId.GetPointer());
+ SysTryReturnResult(NID_APP, pProvider != null, E_SYSTEM, "Wrong AppControl provider plugin for %ls, %ls (%d).", appId.GetPointer(), oId.GetPointer(), req);
- const String* pActualUri = (pUri && !(pUri->IsEmpty())) ? pUri : null;
- const String* pActualMime = (pMime && !(pMime->IsEmpty())) ? pMime : null;
- return (*pFunc)(req, appId, oId, pActualUri, pActualMime, pMap);
+ _AppMessageImpl msg(appId, oId, pUri, pMime, pMap);
+ return pProvider->StartAppControlPlugin(req, appId, msg, null);
}
static bool
_InProcessInfo* pInfo = _AppControlManager::GetInstance()->__inAppManager.FindItem(_reqId);
SysTryReturnResult(NID_APP, pInfo != null, E_INVALID_OPERATION, "Request ID %d is not found.", _reqId);
- pStop = reinterpret_cast<result (*)(int)>(pInfo->pLib->GetProcAddress(L"TerminateAppControl"));
- SysTryReturnResult(NID_APP, pStop != null, E_SYSTEM, "No TerminateAppControl() function.");
-
- (*pStop)(_reqId);
+ if (pInfo->pProvider)
+ {
+ pInfo->pProvider->StopAppControlPlugin(_reqId);
+ }
_AppControlManager::GetInstance()->__inAppManager.RemoveItem(_reqId);
}
else
{
- _LibraryImpl lib;
- result r = lib.Construct(_path, _LIBRARY_OPTION);
- if (r == E_SUCCESS)
+ _IAppControlPluginProvider* pProvider = GetAppControlPluginProvider(_path);
+ if (pProvider)
{
- pStop = reinterpret_cast<result (*)(int)>(lib.GetProcAddress(L"TerminateAppControl"));
- SysTryReturnResult(NID_APP, pStop != null, E_SYSTEM, "No TerminateAppControl() function.");
+ pProvider->StopAppControlPlugin(_reqId);
+ SysLog(NID_APP, "Request %d is stopped.", _reqId);
- (*pStop)(_reqId);
+ pProvider->Release();
}
}
}
void
_AppControlImpl::StopAppControlResponseListener(IAppControlResponseListener* pListener)
{
- _AppControlManager::GetInstance()->__listenerList.Add(pListener);
+ _AppControlManager::GetInstance()->StopAppControlResponseListener(pListener);
}
void
#include <FBaseSysLog.h>
#include <FBase_StringConverter.h>
-#include <FBaseRt_LibraryImpl.h>
#include <FIo_DataControlResultSetImpl.h>
#include "FApp_AppArg.h"
#include "FApp_AppMessageImpl.h"
#include "FApp_AppManagerImpl.h"
#include "FApp_AppControlResponseEvent.h"
+#include "FApp_IAppControlPluginProvider.h"
+
using namespace Tizen::App::Package;
using namespace Tizen::Base;
// AppControl event handling is expected to be performed in the main thread.
__appControlEvent.Construct();
__appControlEvent.AddListener(*dynamic_cast<_IAppControlSysEventListener*>(this));
- __listenerList.Construct();
__appControlResponseEventContainer.Construct();
__appControlResponseEventList.Construct();
}
SysLog(NID_APP, "Invoking callback 0x%x", pInfo->launchCb);
//pAppArg->Print();
- if (pInfo->pUserData && (!__listenerList.Contains(pInfo->pUserData)))
+ if (pInfo->pUserData)
{
(*pInfo->launchCb)(pInfo->pUserData, pInfo->pArg, pAppArg, static_cast<service_result_e>(res), pInfo->property, reqId);
}
SysTryReturnVoidResult(NID_APP, pInfo != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] request Id %d not found with args 0x%x", reqId,
pArgs);
- if (pInfo->pListener && (!__listenerList.Contains(pInfo->pListener)))
+ if (pInfo->pListener)
{
String aId = pInfo->providerId;
String oId = pInfo->operationId;
}
// call TerminateAppControl
- result (* pFunc)(int req) = null;
- pFunc = reinterpret_cast<result (*)(int)>(pInfo->pLib->GetProcAddress(L"TerminateAppControl"));
- if (pFunc)
- {
- (*pFunc)(pInfo->reqId);
- }
- else
+ if (pInfo->pProvider)
{
- SysLogException(NID_APP, E_SYSTEM, "No TerminateAppControl() function.");
+ pInfo->pProvider->StopAppControlPlugin(pInfo->reqId);
+ SysLog(NID_APP, "AppControl stopped for req %d.", pInfo->reqId);
}
// remove from list and unload dll
}
+static bool
+IsMatchingProcListener(const _InProcessInfo& info, IEventListener* pListener)
+{
+ return (info.pListener == pListener);
+}
+
+static bool
+IsMatchingLaunchListener(const _LaunchInfo& info, IEventListener* pListener)
+{
+ return (info.pUserData == pListener);
+}
+
+void
+_AppControlManager::StopAppControlResponseListener(IAppControlResponseListener* pListener)
+{
+ // __inAppManager, __launchManager
+ _InProcessInfo* pProcInfo = __inAppManager.FindItemWithListener(IsMatchingProcListener, pListener);
+ if (pProcInfo)
+ {
+ __inAppManager.RemoveItem(pProcInfo);
+ SysLog(NID_APP, "Listener 0x%x is removed from in-process stub list.", pListener);
+ }
+
+ _LaunchInfo* pLaunchInfo = __launchManager.FindItemWithListener(IsMatchingLaunchListener, pListener);
+ if (pLaunchInfo)
+ {
+ __launchManager.RemoveItem(pLaunchInfo);
+ SysLog(NID_APP, "Listener 0x%x is removed from launch request list.", pListener);
+ }
+
+}
+
+
// generic launch callback
static void
LaunchResultCb(bundle* b, int request_code, appsvc_result_val res, void* data)
int
+_AppControlManager::LaunchPkg(_AppMessageImpl& msg, AppSvcResFn pCb, void* data)
+{
+ bundle* kb = msg.GetBundle();
+ SysTryReturn(NID_APP, kb != NULL, -1, E_OUT_OF_MEMORY, "Bundle allocation failure.");
+
+ if (_AppImpl::GetInstance() != null)
+ {
+ const long handle = _AppImpl::GetInstance()->GetWindowHandle();
+ _AppArg::UpdateWindowHandle(kb, handle);
+ }
+
+ int pid = appsvc_run_service(kb, 0, reinterpret_cast<appsvc_res_fn>(pCb), this);
+
+ result r = E_SUCCESS;
+ if (pid < 0)
+ {
+ switch (pid)
+ {
+ case APPSVC_RET_EILLACC:
+ r = E_ILLEGAL_ACCESS;
+ break;
+ case APPSVC_RET_EINVAL:
+ r = E_MAX_EXCEEDED;
+ break;
+ default:
+ r = E_SYSTEM;
+ break;
+ }
+ SysLog(NID_APP, "[%s] Launching service %s failure", GetErrorMessage(r), appsvc_get_appid(kb));
+ }
+ SetLastResult(r);
+
+ return pid;
+}
+
+
+int
_AppControlManager::LaunchPkg(_AppMessageImpl& msg, const AppId& appId, const String& opId, const String* pUri, const String* pMime, AppSvcResFn pCb, void* data)
{
std::unique_ptr<char[]> pPackage(_StringConverter::CopyToCharArrayN(appId));
int
-_AppControlManager::Launch(const _AppMessageImpl& msg, const AppId& aId, const String& oId, const String* pUriData, const String* pMimeType, AppSvcResFn pCb, void* pData)
+_AppControlManager::Launch(const AppId& appId, _AppArg* pArg, int req)
{
- SysLog(NID_APP, "Enter");
-
- _AppArg arg;
- arg.Construct(msg, oId, pUriData, pMimeType);
-
- int pid = Launch(aId, &arg, pCb, pData, -1);
- SysTryReturn(NID_APP, pid >= 0, -1, GetLastResult(), "Launching(%ls) is failed", aId.GetPointer());
-
- SysLog(NID_APP, "Exit");
-
- return pid;
+ return Launch(appId, pArg, reinterpret_cast<AppSvcResFn>(LaunchResultCb), this, req);
}
int
-_AppControlManager::Launch(const AppId& appId, _AppArg* pArg, int req)
+_AppControlManager::Launch(const _AppMessageImpl& msg, AppSvcResFn pCb, void* pData)
{
- return Launch(appId, pArg, reinterpret_cast<AppSvcResFn>(LaunchResultCb), this, req);
+ const bundle* pBundle = msg.GetBundle();
+
+ _AppArg arg;
+ arg.Construct(pBundle);
+
+ return Launch(_AppMessageImpl::GetApplicationId(pBundle), &arg, pCb, pData, -1);
}
}
-bool
-_AppControlManager::IsAllowedAppControl(const char aTable[][2][96], int count, const String& aId, const String& oId)
-{
- for (int i = 0; i < count; i++)
- {
- if (aId == aTable[i][0] && oId == aTable[i][1])
- {
- SysLog(NID_APP, "Found entry (%s, %s)", aTable[i][0], aTable[i][1]);
- return true;
- }
- }
-
- return false;
-}
-
-
AppCtrlResult
_AppControlManager::ConvertAppControlResultCode(int resCode)
{
}
}
-AppId
-_AppControlManager::GetAliasAppId(const AppId& appId)
-{
- return _AppControlRegistry::GetInstance()->GetAliasAppId(appId);
-}
-
}} // Tizen::App
SysAssert(__pBundle != NULL);
}
-_AppMessageImpl::~_AppMessageImpl(void)
+_AppMessageImpl::_AppMessageImpl(const String& appId, const String& oId, const String* pUri, const String* pMime, const IMap* pMap)
+: __pBundle(bundle_create())
{
SysAssert(__pBundle != NULL);
+
+ SetApplicationId(__pBundle, appId);
+
+ SetOperation(__pBundle, oId);
+
+ if (pUri)
+ {
+ SetUri(__pBundle, *pUri);
+ }
+
+ if (pMime)
+ {
+ SetMime(__pBundle, *pMime);
+ }
+
+ AddData(pMap);
+}
+
+_AppMessageImpl::~_AppMessageImpl(void)
+{
bundle_free(__pBundle);
}
return E_SUCCESS;
}
+String
+_AppMessageImpl::GetApplicationId(const bundle* pBundle)
+{
+ return String(appsvc_get_appid(const_cast<bundle*>(pBundle)));
+}
+
+result
+_AppMessageImpl::SetApplicationId(bundle* pBundle, const String& appId)
+{
+ std::unique_ptr<char[]> pVal(_StringConverter::CopyToCharArrayN(appId));
+
+ // alias appid handling is done internally
+ appsvc_set_appid(pBundle, pVal.get());
+
+ return E_SUCCESS;
+}
+
+String
+_AppMessageImpl::GetOperation(const bundle* pBundle)
+{
+ return String(appsvc_get_operation(const_cast<bundle*>(pBundle)));
+}
+
+result
+_AppMessageImpl::SetOperation(bundle* pBundle, const char* pOperation)
+{
+ appsvc_set_operation(pBundle, pOperation);
+
+ return E_SUCCESS;
+}
+
result
_AppMessageImpl::SetOperation(bundle* pBundle, const String& operation)
{
std::unique_ptr<char[]> pVal(_StringConverter::CopyToCharArrayN(operation));
- appsvc_set_operation(pBundle, pVal.get());
+ return SetOperation(pBundle, pVal.get());
+}
- return E_SUCCESS;
+String
+_AppMessageImpl::GetUri(const bundle* pBundle)
+{
+ return String(appsvc_get_uri(const_cast<bundle*>(pBundle)));
}
result
return E_SUCCESS;
}
+String
+_AppMessageImpl::GetMime(const bundle* pBundle)
+{
+ return String(appsvc_get_mime(const_cast<bundle*>(pBundle)));
+}
+
result
_AppMessageImpl::SetMime(bundle* pBundle, const String& mime)
{
#include <limits.h>
-#include <FBaseRt_LibraryImpl.h>
-
#include "FApp_RequestManagerT.h"
#include "FApp_LaunchInfo.h"
#include "FApp_AppArg.h"
+#include "FApp_IAppControlPluginProvider.h"
+
using namespace Tizen::Base::Runtime;
_InProcessInfo::~_InProcessInfo(void)
{
- delete pLib;
+ if (pProvider)
+ {
+ pProvider->Release();
+ }
}
_LaunchInfo::~_LaunchInfo(void)
return (r == E_SUCCESS) ? pItem : null;
}
+template<typename T> T*
+_RequestManagerT<T>::FindItemWithListener(Pred pred, IEventListener* pListener) const
+{
+ RequestListEnumType* pIter = __requestList.GetMapEnumeratorN();
+ if (pIter == null)
+ {
+ return null;
+ }
+
+ while (pIter->MoveNext() == E_SUCCESS)
+ {
+ T* pInfo = null;
+ result r = pIter->GetValue(pInfo);
+
+ if (pInfo)
+ {
+ if (pred(*pInfo, pListener))
+ {
+ return pInfo;
+ }
+ }
+ }
+
+ return null;
+}
+
// specialization
template<>
result Construct(const _AppControlImpl& ac, const Tizen::Base::String* pUri, const Tizen::Base::String* pMime, const Tizen::Base::Collection::IMap* pMap);
- result Construct(const _AppMessageImpl& msg, const Tizen::Base::String& oId, const Tizen::Base::String* pUri, const Tizen::Base::String* pMime);
-
result Construct(const _SqlDataControlImpl& dc, _DataControlRequestType requestType, const Tizen::Base::Collection::IList* pList);
result Construct(const _MapDataControlImpl& dc, _DataControlRequestType requestType, const Tizen::Base::Collection::IList* pList);
result ConstructResult(const _AppArg& arg, const Tizen::Base::Collection::IMap* pMap);
- result Construct(bundle* b);
+ result Construct(const bundle* b);
result ConstructForAppLaunchCondition(const Tizen::Base::String& condition, const Tizen::Base::Collection::IList* pList);
result ConstructForAppLaunchCondition(const Tizen::Base::String& condition, const Tizen::Base::Collection::IList* pList, const Tizen::Base::Collection::IMap* pMap);
class AppControl;
class IAppControlEventListener;
class IAppControlResponseListener;
+class _IAppControlPluginProvider;
class _AppArg;
enum _AppControlProperty
result StartNative(const Tizen::Base::String* pUriData, const Tizen::Base::String* pMimeType, const Tizen::Base::Collection::IMap* pExtraData, IAppControlResponseListener* pListener);
- static result InvokeStartAppControl(Tizen::Base::Runtime::_LibraryImpl& lib, int req, const Tizen::Base::String& appId, const Tizen::Base::String& oId, const Tizen::Base::String* pUri, const Tizen::Base::String* pMime, const Tizen::Base::Collection::IMap* pMap);
+ static _IAppControlPluginProvider* GetAppControlPluginProvider(const Tizen::Base::String& path);
- static result InvokeStartAppControl(Tizen::Base::Runtime::_LibraryImpl& lib, int req, const Tizen::Base::String& appId, const Tizen::Base::String& oId, const Tizen::Base::Collection::IList* pList);
+ static result InvokeStartAppControl(_IAppControlPluginProvider* pProvider, int req, const Tizen::Base::String& appId, const Tizen::Base::String& oId, const Tizen::Base::String* pUri, const Tizen::Base::String* pMime, const Tizen::Base::Collection::IMap* pMap);
+
+ static result InvokeStartAppControl(_IAppControlPluginProvider* pProvider, int req, const Tizen::Base::String& appId, const Tizen::Base::String& oId, const Tizen::Base::Collection::IList* pList);
static result AppControlCbLegacy(void* data, _AppArg* pArg, _AppArg* pResArg, service_result_e res, int prop, int reqId);
int Launch(const AppId& appId, _AppArg* pArg, AppSvcResFn pCb, void* pData, int req);
- int Launch(const _AppMessageImpl& msg, const AppId& aId, const Tizen::Base::String& oId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pMimeType, AppSvcResFn pCb, void* pData);
+ int Launch(const _AppMessageImpl& msg, AppSvcResFn pCb, void* pData);
result LaunchAppImplicit(_AppArg* pArg, int req);
int LaunchPkg(_AppMessageImpl& msg, const AppId& appId, const Tizen::Base::String& opId, const Tizen::Base::String* pUri, const Tizen::Base::String* pMime, AppSvcResFn pCb, void* data);
+ int LaunchPkg(_AppMessageImpl& msg, AppSvcResFn pCb, void* data);
+
int Launch(_AppMessageImpl& msg, const char* pkg_name, const char* op, const char* mime, const char* uri, AppSvcResFn pCb, void* data);
result LaunchAppWithCondition(const AppId& appId, const Tizen::Base::String& condition, Tizen::Base::Collection::IList* pArgs);
result SendAppControlStartResponse(int req, const char* pValue, const char* pOp);
- static bool IsAllowedAppControl(const char aTable[][2][96], int count, const Tizen::Base::String& aId, const Tizen::Base::String& oId);
-
- static AppId GetAliasAppId(const AppId& appId);
-
static result GetMimeFromExt(const Tizen::Base::String& ext, Tizen::Base::String& out);
void RemoveLaunchRequest(int req);
static AppCtrlResult ConvertAppControlResultCode(int res);
+ void StopAppControlResponseListener(IAppControlResponseListener* pLisetener);
+
static void InvokeAppControlCompleteListener(IAppControlResponseListener& listener, const AppId& appId, const Tizen::Base::String& op, AppCtrlResult res, const Tizen::Base::Collection::IMap* pExtraData, bool noRaise);
static void InvokeLegacyAppControlCompleteListener(IAppControlEventListener& listener, const AppId& appId, const Tizen::Base::String& op, const Tizen::Base::Collection::IList* pList, bool noRaise);
_RequestManagerT<_LaunchInfo> __launchManager;
_RequestManagerT<_InProcessInfo> __inAppManager;
_RequestManagerT<_ResultInfo> __resultManager;
- Tizen::Base::Collection::ArrayListT<void*> __listenerList;
Tizen::Base::Collection::HashMapT<int, _AppControlResponseEvent*> __appControlResponseEventContainer;
Tizen::Base::Collection::ArrayListT<int> __appControlResponseEventList;
*
*/
class _OSP_EXPORT_ _AppMessageImpl
+ : public Tizen::Base::Object
{
public:
_AppMessageImpl(void);
- ~_AppMessageImpl(void);
+ _AppMessageImpl(const Tizen::Base::String& appId, const Tizen::Base::String& oId, const Tizen::Base::String* pUri, const Tizen::Base::String* pMime, const Tizen::Base::Collection::IMap* pMap);
+
+ virtual ~_AppMessageImpl(void);
_AppMessageImpl(const _AppMessageImpl& rhs);
result RemoveData(const Tizen::Base::String& key);
+ Tizen::Base::String GetApplicationId(void) const { return GetApplicationId(GetBundle()); }
+
+ result SetApplicationId(const Tizen::Base::String& appId) { return SetApplicationId(GetBundle(), appId); }
+
+ Tizen::Base::String GetOperation(void) const { return GetOperation(GetBundle()); }
+
+ result SetOperation(const char* pOperation) { return SetOperation(GetBundle(), pOperation); }
+
+ result SetOperation(const Tizen::Base::String& operation) { return SetOperation(GetBundle(), operation); }
+
+ Tizen::Base::String GetUri(void) const { return GetUri(GetBundle()); }
+
+ result SetUri(const Tizen::Base::String& uri) { return SetUri(GetBundle(), uri); }
+
+ Tizen::Base::String GetMime(void) const { return GetMime(GetBundle()); }
+
+ result SetMime(const Tizen::Base::String& mime) { return SetMime(GetBundle(), mime); }
+
+ result SetCategory(const Tizen::Base::String& category) { return SetCategory(GetBundle(), category); }
+
+
+ static Tizen::Base::String GetApplicationId(const bundle* pBundle);
+
+ static result SetApplicationId(bundle* pBundle, const Tizen::Base::String& appId);
+
+ static Tizen::Base::String GetOperation(const bundle* pBundle);
+
+ static result SetOperation(bundle* pBundle, const char* pOperation);
+
static result SetOperation(bundle* pBundle, const Tizen::Base::String& operation);
+ static Tizen::Base::String GetUri(const bundle* pBundle);
+
static result SetUri(bundle* pBundle, const Tizen::Base::String& uri);
+ static Tizen::Base::String GetMime(const bundle* pBundle);
+
static result SetMime(bundle* pBundle, const Tizen::Base::String& mime);
static result SetCategory(bundle* pBundle, const Tizen::Base::String& category);
static result AddStringMap(bundle* pBundle, const Tizen::Base::Collection::IMap* pMap);
static Tizen::Base::Collection::ArrayList* GetValueArrayN(bundle* pBundle, const char* pKey);
+
static Tizen::Base::Collection::ArrayList* GetValueArrayN(bundle* pBundle, const Tizen::Base::String& key);
static result AddValueArray(bundle* pBundle, const char* pKey, const Tizen::Base::Collection::IList* pList);
+
static result AddValueArray(bundle* pBundle, const Tizen::Base::String& key, const Tizen::Base::Collection::IList* pList);
private:
--- /dev/null
+//
+// 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 FApp_IAppControlPluginProvider.h
+ * @brief This is the header file for _IAppControlPluginProvider class.
+ */
+
+#ifndef _FAPP_INTERNAL_IAPP_CONTROL_PLUGIN_PROVIDER_H_
+#define _FAPP_INTERNAL_IAPP_CONTROL_PLUGIN_PROVIDER_H_
+
+#include <FApp_Types.h>
+#include <FBaseRtIEventListener.h>
+
+namespace Tizen { namespace App {
+
+class _AppMessageImpl;
+
+/**
+* @interface _IAppControlPluginProvider
+* @brief This is a tagging interface that all event listeners must implement.
+*
+*/
+class _IAppControlPluginProvider
+ : virtual public Tizen::Base::Runtime::IEventListener
+{
+public:
+ /**
+ * This is the destructor for this class.
+ */
+ virtual ~_IAppControlPluginProvider(void) {}
+
+ /**
+ * This method is called when the AppControl is about to start.
+ *
+ * @return An error code
+ * @param[in] req The request ID
+ * @param[in] appId Application ID
+ * @param[in] message AppControl request detail
+ * @param[out] pPid Output process ID
+ */
+ virtual result StartAppControlPlugin(int req, const AppId& appId, const _AppMessageImpl& message, int* pPid) = 0;
+
+ /**
+ * This method is called when the AppControl is about to stop.
+ *
+ * @return An error code
+ * @param[in] req The request ID
+ */
+ virtual result StopAppControlPlugin(int req) = 0;
+
+ /**
+ * Release the plugin instance itself
+ *
+ * @return An error code
+ */
+ virtual result Release(void) =0;
+}; // _IAppControlPluginProvider
+
+typedef _IAppControlPluginProvider* (*APP_CONTROL_PROVIDER_GET_FN)(void);
+
+}} //Tizen::App
+
+#endif // _FAPP_INTERNAL_IAPP_CONTROL_PLUGIN_PROVIDER_H_
+
{
namespace Runtime
{
-class _LibraryImpl;
class IEventListener;
}
}}
namespace Tizen { namespace App
{
-
+class _IAppControlPluginProvider;
class _AppArg;
typedef result (*LaunchCbType)(void* data, _AppArg* pArg, _AppArg* pResArg, service_result_e res, int prop, int reqId);
struct _InProcessInfo
{
public:
- _InProcessInfo(const Tizen::Base::String& aId, const Tizen::Base::String& oId, int prop, bool legacy, Tizen::Base::Runtime::_LibraryImpl& lib, Tizen::Base::Runtime::IEventListener* pListener)
+ _InProcessInfo(const Tizen::Base::String& aId, const Tizen::Base::String& oId, int prop, bool legacy, _IAppControlPluginProvider* pProvider, Tizen::Base::Runtime::IEventListener* pListener)
: reqId(-1)
, providerId(aId)
, operationId(oId)
, property(prop)
- , pLib(&lib)
+ , pProvider(pProvider)
, pListener(pListener)
, isLegacy(legacy)
{
const Tizen::Base::String providerId;
const Tizen::Base::String operationId;
const int property;
- Tizen::Base::Runtime::_LibraryImpl* pLib; // non-empty
+ _IAppControlPluginProvider* pProvider;
Tizen::Base::Runtime::IEventListener* pListener;
const bool isLegacy;
}; // _InProcessInfo
#include <FBaseColHashMapT.h>
#include <FBaseSysLog.h>
+namespace Tizen { namespace Base { namespace Runtime
+{
+class IEventListener;
+}}}
+
namespace Tizen { namespace App
{
public:
typedef Tizen::Base::Collection::HashMapT<int, T*> RequestListType;
typedef Tizen::Base::Collection::IMapEnumeratorT<int, T*> RequestListEnumType;
+ typedef bool (*Pred)(const T&, Tizen::Base::Runtime::IEventListener*);
_RequestManagerT(void);
void RemoveItem(T* pItem);
+ T* FindItemWithListener(Pred, Tizen::Base::Runtime::IEventListener* pListener) const;
+
T* FindItem(int reqId) const;
private: