Merge "Update deprecated libprivilege-control API functions." into tizen
[platform/framework/native/appfw.git] / inc / FSecPrivacyManager.h
1 //
2 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
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.
15 //
16
17 /**
18 * @file         FSecPrivacyManager.h
19 * @brief        This is the header file for the %PrivacyManager class.
20 *
21 * This header file contains the declarations of the %PrivacyManager class.
22 */
23
24 #ifndef _FSEC_PRIVACY_MANAGER_H_
25 #define _FSEC_PRIVACY_MANAGER_H_
26
27 #include <FBaseObject.h>
28 #include <FAppTypes.h>
29
30 namespace Tizen { namespace Base { namespace Collection
31 {
32 class IList;
33 }}}
34
35 namespace Tizen { namespace Security
36 {
37
38 class PrivacyInfo;
39
40 /**
41  * @class               PrivacyManager
42  * @brief               This class provides methods for managing the privacy information and the application's privacy settings.
43  *
44  * @since               2.1
45  *
46  * @final               This class is not intended for extension.
47  *
48  * The %PrivacyManager class lets an application to get or save application's privacy settings.
49  */
50
51 class _OSP_EXPORT_ PrivacyManager
52         : public Tizen::Base::Object
53 {
54 public:
55
56         /**
57          * Gets a pointer to the %PrivacyManager instance.
58          *
59          * @since               2.1
60          *
61          * @return              A pointer to the %PrivacyManager instance, @n
62          *                              else @c null if it fails
63          *
64          * @exception   E_SUCCESS                               The method is successful.
65          * @exception   E_SYSTEM                                The method cannot proceed due to a severe system error.
66          *
67          * @remarks             The specific error code can be accessed using the GetLastResult() method.
68          */
69         static PrivacyManager* GetInstance(void);
70
71         /**
72          * Gets the list of packages which access user's privacy information.
73          *
74          * @since               2.1
75          * @privlevel   platform
76          * @privilege   %http://tizen.org/privilege/privacymanager.read
77          *
78          * @return              A pointer to the list of application packages (PackageId) which access user's privacy information, @n
79          *                              else @c null if an error occurs
80          *
81          * @exception   E_SUCCESS                               The method is successful.
82          * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
83          * @exception   E_SYSTEM                                The method cannot proceed due to a severe system error.
84          *
85          * @remarks             The specific error code can be accessed using the GetLastResult() method.
86          */
87         Tizen::Base::Collection::IList* GetPrivacyAppPackageListN(void) const;
88
89         /**
90          * Gets the list of privacy information of a package.
91          *
92          * @since               2.1
93          * @privlevel   platform
94          * @privilege   %http://tizen.org/privilege/privacymanager.read
95          *
96          * @return              A pointer to the privacy information list (Privacyinfo), @n
97          *                              else @c null if an error occurs
98          * @param[in]   packageId                               The package ID
99          *
100          * @exception   E_SUCCESS                               The method is successful.
101          * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
102          * @exception   E_SYSTEM                                The method cannot proceed due to a severe system error.
103          *
104          * @remarks              The specific error code can be accessed using the GetLastResult() method.
105          */
106         Tizen::Base::Collection::IList* GetPrivacyInfoListN(const Tizen::App::PackageId& packageId) const;
107
108         /**
109          * Sets the privacy setting of the specified package.
110          *
111          * @since               2.1
112          * @privlevel   platform
113          * @privilege   %http://tizen.org/privilege/privacymanager.write
114          *
115          * @return              An error code
116          * @param[in]   packageId                               The package ID
117          * @param[in]   privacyInfo                             The privacy information to set
118          * @exception   E_SUCCESS                               The method is successful.
119          * @exception   E_OBJ_NOT_FOUND                 Either of the following conditions has occurred:
120          *                                                                              - The specified @c packageId is not found in privacy database.
121          *                                                                              - The package is not defined to access the privacy information.
122          * @exception   E_INVALID_ARG                   The specified @c packageId length is invalid.
123          * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
124          * @exception   E_SYSTEM                                The method cannot proceed due to a severe system error.
125          *
126          */
127         result SetAppPackagePrivacy(const Tizen::App::PackageId& packageId, const PrivacyInfo& privacyInfo);
128
129 private:
130
131         //
132         // This default constructor is intentionally declared as private to implement the %Singleton semantic.
133         //
134         // @since               2.1
135         //
136         PrivacyManager(void);
137
138         //
139         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
140         //
141         // @since               2.1
142         //
143         PrivacyManager(const PrivacyManager& rhs);
144
145         //
146         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
147         //
148         // @since               2.1
149         //
150         PrivacyManager& operator =(const PrivacyManager& rhs);
151
152         //
153         // This destructor is intentionally declared as private to implement the %Singleton semantic.
154         //
155         // @since               2.1
156         //
157         virtual ~PrivacyManager(void);
158
159 private:
160
161         class _PrivacyManagerImpl* __pPrivacyManagerImpl;
162         friend class _PrivacyManagerImpl;
163
164 }; // PrivacyManager
165
166 }} // Tizen::Security
167
168 #endif // _FSEC_PRIVACY_MANAGER_H_