fc98633eef78f302ec5d5d8127d174fc9981f753
[platform/framework/native/installer.git] / src / Manager / SmackManager.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17 /**
18  * @file        SmackManager.h
19  * @brief       This is the header file for the %SmackManager class.
20  *
21  * This header file contains the declarations of the %SmackManager class.
22  */
23 #ifndef _SMACK_MANAGER_H_
24 #define _SMACK_MANAGER_H_
25
26 #include <FAppTypes.h>
27
28 #include "InstallationContext.h"
29
30 class SmackManager
31 {
32 public:
33         SmackManager(void);
34         virtual ~SmackManager(void);
35         bool Construct(InstallationContext* pContext);
36
37         bool Install(const Tizen::App::PackageId& packageId);
38         bool Uninstall(const Tizen::App::PackageId& packageId);
39
40         bool AddLabelDir(const Tizen::Base::String& label, const Tizen::Base::String& dirPath, bool rootDirectory = false);
41         bool AddLabelSharedDir(const Tizen::App::PackageId& packageId, const Tizen::Base::String& dirPath);
42         bool AddSharedDirReaders(const Tizen::Base::String& label);
43         bool AddFriend(const Tizen::App::PackageId& packageId1, const Tizen::App::PackageId& packageId2);
44
45         bool AddPermissions(const Tizen::App::PackageId& packageId);
46         bool RevokePermissions(const Tizen::App::PackageId& packageId);
47
48 private:
49         bool IsSmackEnable();
50
51         int Install(const char* pPackageId);
52         int Uninstall(const char* pPackageId);
53
54         int AddLabelDir(const char* pLabel, const char* pDirPath);
55         int AddLabelSharedDir(const char* pLabel, const char* pSharedLabel, const char* pDirPath);
56         int AddSharedDirReaders(const char* pSharedLabel, const char** ppAppList);
57         int AddFriend(const char* pPackageId1, const char* pPackageId2);
58
59         int EnablePermissions(const char* pPackageId, int appType, const char** ppPermissions, bool persistent);
60         int RevokePermissions(const char* pPackageId);
61
62         // deprecated
63         int AddPermissions(const char* pPackageId, const char** ppPermissions);
64
65 private:
66         InstallationContext* __pContext;
67         bool __isSmackEnable;
68
69
70 }; // SmackManager
71
72 #endif // _SMACK_MANAGER_H_