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