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 FSecPrivacyInfo.cpp
19 * @brief This is the implementation for the PrivacyInfo class.
23 #include <unique_ptr.h>
24 #include <FSecPrivacyManager.h>
25 #include <FBaseSysLog.h>
26 #include <FBaseColIList.h>
27 #include "FSec_PrivacyManagerImpl.h"
28 #include <FSec_AccessController.h>
30 using namespace Tizen::Base;
31 using namespace Tizen::Base::Collection;
32 using namespace Tizen::Security;
34 namespace Tizen { namespace Security
37 PrivacyManager::PrivacyManager(void)
38 : __pPrivacyManagerImpl(null)
43 PrivacyManager::~PrivacyManager(void)
45 if (__pPrivacyManagerImpl)
46 delete __pPrivacyManagerImpl;
50 PrivacyManager::GetInstance(void)
52 static PrivacyManager* pInstance = null;
59 std::unique_ptr< _PrivacyManagerImpl > pImpl(new (std::nothrow) _PrivacyManagerImpl);
60 pInstance = new (std::nothrow) PrivacyManager;
62 pInstance->__pPrivacyManagerImpl = pImpl.release();
67 Tizen::Base::Collection::IList*
68 PrivacyManager::GetPrivacyAppPackageListN(void) const
72 r = _AccessController::CheckUserPrivilege(_PRV_PRIVACYMANAGER_READ);
73 SysTryReturn(NID_SEC, r == E_SUCCESS, null, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
75 return __pPrivacyManagerImpl->GetPrivacyAppPackageListN();
79 Tizen::Base::Collection::IList*
80 PrivacyManager::GetPrivacyInfoListN(const Tizen::App::PackageId& packageId) const
84 r = _AccessController::CheckUserPrivilege(_PRV_PRIVACYMANAGER_READ);
85 SysTryReturn(NID_SEC, r == E_SUCCESS, null, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
87 return __pPrivacyManagerImpl->GetPrivacyInfoListN(packageId);
91 PrivacyManager::SetAppPackagePrivacy(const Tizen::App::PackageId& packageId, const PrivacyInfo& privacyInfo)
95 r = _AccessController::CheckUserPrivilege(_PRV_PRIVACYMANAGER_WRITE);
96 SysTryReturnResult(NID_SEC, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
98 r = __pPrivacyManagerImpl->SetAppPackagePrivacy(packageId, privacyInfo);
103 }} // Tizen::Security