2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FSecPrivacyInfo.cpp
20 * @brief This is the implementation for the PrivacyInfo class.
24 #include <unique_ptr.h>
25 #include <FSecPrivacyManager.h>
26 #include <FBaseSysLog.h>
27 #include <FBaseColIList.h>
28 #include "FSec_PrivacyManagerImpl.h"
29 #include <FSec_AccessController.h>
31 using namespace Tizen::Base;
32 using namespace Tizen::Base::Collection;
33 using namespace Tizen::Security;
35 namespace Tizen { namespace Security
38 PrivacyManager::PrivacyManager(void)
39 : __pPrivacyManagerImpl(null)
44 PrivacyManager::~PrivacyManager(void)
46 if (__pPrivacyManagerImpl)
47 delete __pPrivacyManagerImpl;
51 PrivacyManager::GetInstance(void)
53 static PrivacyManager* pInstance = null;
60 std::unique_ptr< _PrivacyManagerImpl > pImpl(new (std::nothrow) _PrivacyManagerImpl);
61 pInstance = new (std::nothrow) PrivacyManager;
63 pInstance->__pPrivacyManagerImpl = pImpl.release();
68 Tizen::Base::Collection::IList*
69 PrivacyManager::GetPrivacyAppPackageListN(void) const
73 r = _AccessController::CheckUserPrivilege(_PRV_PRIVACYMANAGER_READ);
74 SysTryReturn(NID_SEC, r == E_SUCCESS, null, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
76 return __pPrivacyManagerImpl->GetPrivacyAppPackageListN();
80 Tizen::Base::Collection::IList*
81 PrivacyManager::GetPrivacyInfoListN(const Tizen::App::PackageId& packageId) const
85 r = _AccessController::CheckUserPrivilege(_PRV_PRIVACYMANAGER_READ);
86 SysTryReturn(NID_SEC, r == E_SUCCESS, null, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
88 return __pPrivacyManagerImpl->GetPrivacyInfoListN(packageId);
92 PrivacyManager::SetAppPackagePrivacy(const Tizen::App::PackageId& packageId, const PrivacyInfo& privacyInfo)
96 r = _AccessController::CheckUserPrivilege(_PRV_PRIVACYMANAGER_WRITE);
97 SysTryReturnResult(NID_SEC, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
99 r = __pPrivacyManagerImpl->SetAppPackagePrivacy(packageId, privacyInfo);
104 }} // Tizen::Security