2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file FAppAppControl.cpp
19 * @brief This is the implementation for the Application Control class.
24 #include <FBaseSysLog.h>
25 #include <FAppAppControl.h>
27 #include <FSec_AccessController.h>
29 #include "FApp_AppControlImpl.h"
32 using namespace Tizen::Base;
33 using namespace Tizen::Base::Collection;
34 using namespace Tizen::App;
35 using namespace Tizen::Security;
37 namespace Tizen { namespace App
40 const String APPCONTROL_RESULT_SUCCEEDED = L"Succeeded";
42 const String APPCONTROL_RESULT_FAILED = L"Failed";
44 const String APPCONTROL_RESULT_CANCELED = L"Canceled";
46 const String APPCONTROL_RESULT_TERMINATED = L"Terminated";
49 AppControl::AppControl(void)
50 : __pAppControlImpl(new (std::nothrow) _AppControlImpl(*this))
52 SysTryReturnVoidResult(NID_APP, __pAppControlImpl, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
55 AppControl::~AppControl(void)
57 delete __pAppControlImpl;
61 AppControl::Start(const IList* pDataList, IAppControlEventListener* pListener)
63 result r = _AccessController::CheckUserPrivilege(_PRV_APPLICATION_LAUNCH);
64 SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
66 SysAssertf(__pAppControlImpl != null, "Instance is not constructed properly.");
67 return __pAppControlImpl->Start(pDataList, pListener);
71 AppControl::Start(const String* pUriData, const String* pDataType, const IMap* pExtraData, IAppControlResponseListener* pListener)
73 result r = _AccessController::CheckUserPrivilege(_PRV_APPLICATION_LAUNCH);
74 SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
76 SysAssertf(__pAppControlImpl != null, "Instance is not constructed properly.");
77 return __pAppControlImpl->Start(pUriData, pDataType, pExtraData, pListener);
81 AppControl::FindAndStart(const String& operationId, const String* pUriPattern, const String* pDataType, const String* pCategory,
82 const IMap* pExtraData, IAppControlResponseListener* pListener)
84 result r = _AccessController::CheckUserPrivilege(_PRV_APPLICATION_LAUNCH);
85 SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
87 return _AppControlImpl::FindAndStart(operationId, pUriPattern, pDataType, pCategory, pExtraData, pListener);
91 AppControl::Stop(void)
93 SysAssertf(__pAppControlImpl != null, "Instance is not constructed properly.");
94 return __pAppControlImpl->Stop();
98 AppControl::GetAppName(void) const
100 SysAssertf(__pAppControlImpl != null, "Instance is not constructed properly.");
101 return __pAppControlImpl->GetAppName();
105 AppControl::GetAppId(void) const
107 SysTryReturn(NID_APP, __pAppControlImpl != null, L"", E_INVALID_STATE, "[E_INVALID_STATE] __pAppControlImpl instance must not be null.");
108 return __pAppControlImpl->GetAppId();
112 AppControl::GetAppControlProviderId(void) const
114 SysAssertf(__pAppControlImpl != null, "Instance is not constructed properly.");
115 return __pAppControlImpl->GetAppControlProviderId();
119 AppControl::GetOperationId(void) const
121 SysAssertf(__pAppControlImpl != null, "Instance is not constructed properly.");
122 return __pAppControlImpl->GetOperationId();
125 Tizen::Base::Collection::IList*
126 AppControl::GetCategoryListN(void) const
128 SysAssertf(__pAppControlImpl != null, "Instance is not constructed properly.");
129 return __pAppControlImpl->GetCategoryListN();
133 AppControl::StopAppControlResponseListener(IAppControlResponseListener* pListener)
135 _AppControlImpl::StopAppControlResponseListener(pListener);