Initialize Tizen 2.3
[framework/osp/web.git] / inc / FWebCtrlGeolocationPermissionManager.h
1 // Open Service Platform\r
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
3 //\r
4 // Licensed under the Apache License, Version 2.0 (the License);\r
5 // you may not use this file except in compliance with the License.\r
6 // You may obtain a copy of the License at\r
7 //\r
8 //     http://www.apache.org/licenses/LICENSE-2.0\r
9 //\r
10 // Unless required by applicable law or agreed to in writing, software\r
11 // distributed under the License is distributed on an "AS IS" BASIS,\r
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
13 // See the License for the specific language governing permissions and\r
14 // limitations under the License.\r
15 //\r
16 \r
17 /**\r
18  * @file                FWebCtrlGeolocationPermissionManager.h\r
19  * @brief               This is the header file for the %GeolocationPermissionManager class.\r
20  *\r
21  * This header file contains the declarations of the %GeolocationPermissionManager class.\r
22  *\r
23  */\r
24 #ifndef _FWEB_CTRL_GEOLOCATION_PERMISSION_MANAGER_H_\r
25 #define _FWEB_CTRL_GEOLOCATION_PERMISSION_MANAGER_H_\r
26 \r
27 #include <unique_ptr.h>\r
28 #include <FBaseString.h>\r
29 \r
30 namespace Tizen { namespace Base { namespace Collection\r
31 {\r
32 class IList;\r
33 }}} // Tizen::Base::Collection\r
34 \r
35 namespace Tizen { namespace Web { namespace Controls\r
36 {\r
37 \r
38 class _GeolocationPermissionManagerImpl;\r
39 \r
40 /**\r
41  * @class               GeolocationPermissionManager\r
42  * @brief               This class provides methods to manage geolocation permissions.\r
43  *\r
44  * @since               2.0\r
45  *\r
46  * The %GeolocationPermissionManager class provides methods to manage geolocation permissions decided by a user from origins using html5 JavaScript geolocation APIs. @n\r
47  * Origin consists of the scheme, host, and port.\r
48  */\r
49 \r
50 class _OSP_EXPORT_ GeolocationPermissionManager\r
51         : public Tizen::Base::Object\r
52\r
53 public:\r
54 \r
55         /**\r
56          * Gets the origin list stored at the geolocation database.\r
57          *\r
58          * @since               2.0\r
59          * @privlevel           platform\r
60          * @privilege   %http://tizen.org/privilege/geolocationpermission.read\r
61          *\r
62          * @return              A pointer to Tizen::Base::Collection::IList that contains the origin(Tizen::Base::String) list, @n\r
63          *                              else @c null if no geolocation permission data exists\r
64          * @exception   E_SUCCESS                       The method is successful.\r
65          * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.\r
66          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.\r
67          * @remarks     The specific error code can be accessed using the GetLastResult() method.\r
68          */\r
69          Tizen::Base::Collection::IList* GetOriginListN(void) const;\r
70 \r
71         /**\r
72          * Checks whether geolocation permission is allowed or not for the specified @c origin.\r
73          *\r
74          * @since               2.0\r
75          * @privlevel   platform\r
76          * @privilege   %http://tizen.org/privilege/geolocationpermission.read\r
77          *\r
78          * @return              @c true if geolocation permission is allowed, @n\r
79          *                              else @c false\r
80          * @param[in]   origin                          The origin\r
81          * @exception   E_SUCCESS                       The method is successful.\r
82          * @exception   E_DATA_NOT_FOUND        There is no permission data for the specified @c origin.\r
83          * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.\r
84          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.\r
85          * @remarks             The specific error code can be accessed using the GetLastResult() method.\r
86          */\r
87         bool IsPermissionAllowed(const Tizen::Base::String& origin) const;\r
88 \r
89         /**\r
90          * Removes the geolocation data for the specified @c origin.\r
91          *\r
92          * @since               2.0\r
93          * @privlevel   platform\r
94          * @privilege   %http://tizen.org/privilege/geolocationpermission.write\r
95          *\r
96          * @return              An error code\r
97          * @param[in]   origin                          The origin\r
98          * @exception   E_SUCCESS                       The method is successful.\r
99          * @exception   E_DATA_NOT_FOUND        There is no permission data for the specified @c origin.\r
100          * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.\r
101          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.\r
102          * @see RemoveAll()\r
103          */\r
104         result Remove(const Tizen::Base::String& origin);\r
105 \r
106         /**\r
107          * Removes all the elements from the list.\r
108          * \r
109          * @since               2.0\r
110          * @privlevel   platform\r
111          * @privilege   %http://tizen.org/privilege/geolocationpermission.write\r
112          *\r
113          * @return              An error code\r
114          * @exception   E_SUCCESS                       The method is successful.\r
115          * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.\r
116          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.\r
117          * @see Remove()\r
118          */\r
119         result RemoveAll(void);\r
120 \r
121         /**\r
122          * Gets a geolocation permission manager instance.\r
123          *\r
124          * @since               2.0\r
125          *\r
126          * @return              A pointer to the %GeolocationPermissionManager instance, @n\r
127          *                              else @c null if it fails\r
128          * @exception   E_SUCCESS                       The method is successful.\r
129          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.\r
130          * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.\r
131          * @remarks             The specific error code can be accessed using the GetLastResult() method.\r
132          */\r
133         static GeolocationPermissionManager* GetInstance(void);\r
134 \r
135 private:\r
136         //\r
137         // This default constructor is intentionally declared as private to implement the Singleton semantic.\r
138         //\r
139         // @remarks             This constructor is hidden.\r
140         //\r
141         GeolocationPermissionManager(void);\r
142 \r
143         //\r
144         // This destructor is intentionally declared as private to implement the Singleton semantic.\r
145         //\r
146         // @remarks             This destructor is hidden.\r
147         //\r
148         virtual ~GeolocationPermissionManager(void);\r
149 \r
150         //\r
151         // Initializes this instance of the %Web control with the specified parameters.\r
152         //\r
153         // @since               2.0\r
154         //\r
155         // @return              An error code\r
156         //\r
157         result Construct(void);\r
158 \r
159         //\r
160         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.\r
161         //\r
162         // @param[in]   rhs                     The instance of the % GeolocationPermissionManager class to copy from\r
163         // @remarks             This constructor is hidden.\r
164         //\r
165         GeolocationPermissionManager(const GeolocationPermissionManager& rhs);\r
166 \r
167         //\r
168         // Initializes the geolocation permission manager instance.\r
169         //\r
170         // @since               2.0\r
171         //\r
172         static void InitGeolocationPermissionManager(void);\r
173 \r
174         //\r
175         // Destroys the geolocation permission manager instance.\r
176         //\r
177         // @since               2.0\r
178         //\r
179         static void DestroyGeolocationPermissionManager(void);\r
180 \r
181         //\r
182         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.\r
183         //\r
184         // @param[in]   rhs                     An instance of % GeolocationPermissionManager to assign from\r
185         // @remarks             This operator is hidden.\r
186         //\r
187         GeolocationPermissionManager& operator=(const GeolocationPermissionManager& rhs);\r
188 \r
189 private:\r
190 \r
191         _GeolocationPermissionManagerImpl* __pGeolocationPermissionManagerImpl;\r
192 \r
193         static GeolocationPermissionManager* __pInstance;\r
194 \r
195         friend class _GeolocationPermissionManagerImpl;\r
196 \r
197         friend struct std::default_delete<GeolocationPermissionManager>;\r
198 }; // GeolocationPermissionManager\r
199 \r
200 }}} // Tizen::Web::Controls\r
201 \r
202 #endif // _FWEB_CTRL_GEOLOCATION_PERMISSION_MANAGER_H_\r