Tizen 2.0 Release
[profile/ivi/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  * @if          VISPARTNER-MANUFACTURER\r
19  * @file                FWebCtrlGeolocationPermissionManager.h\r
20  * @brief               This is the header file for the %GeolocationPermissionManager class.\r
21  * @visibility  partner-manufacturer\r
22  *\r
23  * This header file contains the declarations of the %GeolocationPermissionManager class.\r
24  *\r
25  * @endif\r
26  */\r
27 #ifndef _FWEB_CTRL_GEOLOCATION_PERMISSION_MANAGER_H_\r
28 #define _FWEB_CTRL_GEOLOCATION_PERMISSION_MANAGER_H_\r
29 \r
30 #include <unique_ptr.h>\r
31 #include <FBaseString.h>\r
32 \r
33 namespace Tizen { namespace Base { namespace Collection\r
34 {\r
35 class IList;\r
36 }}} // Tizen::Base::Collection\r
37 \r
38 namespace Tizen { namespace Web { namespace Controls\r
39 {\r
40 \r
41 class _GeolocationPermissionManagerImpl;\r
42 \r
43 /**\r
44  * @if VISPARTNER-MANUFACTURER\r
45  * @class               GeolocationPermissionManager\r
46  * @brief               This class provides methods to manage geolocation permissions.\r
47  *\r
48  * @since               2.0\r
49  *\r
50  * @visibility  partner-manufacturer\r
51  * @privilege   %http://tizen.org/privilege/web.privacy\r
52  *\r
53  * The %GeolocationPermissionManager class provides methods to manage geolocation permissions decided by a user from origins using html5 JavaScript geolocation APIs.\r
54  * @n\r
55  * Origin consists of the scheme, host, and port.\r
56  * @endif\r
57  */\r
58 \r
59 class _OSP_EXPORT_ GeolocationPermissionManager\r
60         : public Tizen::Base::Object\r
61\r
62 public:\r
63 \r
64         /**\r
65          * @if VISPARTNER-MANUFACTURER\r
66          * Gets the origin list stored at the geolocation database.\r
67          *\r
68          * @since               2.0\r
69          *\r
70          * @visibility  partner-manufacturer\r
71          * @privilege   %http://tizen.org/privilege/web.privacy\r
72          *\r
73          * @return      A pointer to IList containing origin(Tizen::Base::String) list, @n\r
74          *                              else @c null if no geolocation permission data exists\r
75          * @exception E_SUCCESS                 The method is successful.\r
76          * @exception E_SERVICE_BUSY            The dedicated service module is too busy to handle another request.\r
77          * @exception E_PRIVILEGE_DENIED        The application does not have the privilege to call this method.\r
78          * @remarks     The specific error code can be accessed using the GetLastResult() method.\r
79          * @endif\r
80          */\r
81          Tizen::Base::Collection::IList* GetOriginListN(void) const;\r
82 \r
83         /**\r
84          * @if VISPARTNER-MANUFACTURER\r
85          * Checks whether geolocation permission is allowed or not for the specified @c origin.\r
86          *\r
87          * @since               2.0\r
88          *\r
89          * @visibility  partner-manufacturer\r
90          * @privilege   %http://tizen.org/privilege/web.privacy\r
91          *\r
92          * @return      @c true if geolocation permission is allowed, @n\r
93          *                              else @c false\r
94          * @param[in] origin    The origin\r
95          * @exception E_SUCCESS                 The method is successful.\r
96          * @exception E_DATA_NOT_FOUND  There is no permission data for the specified @c origin.\r
97          * @exception E_SERVICE_BUSY            The dedicated service module is too busy to handle another request.\r
98          * @exception E_PRIVILEGE_DENIED        The application does not have the privilege to call this method.\r
99          * @remarks     The specific error code can be accessed using the GetLastResult() method.\r
100          * @endif\r
101          */\r
102         bool IsPermissionAllowed(const Tizen::Base::String& origin) const;\r
103 \r
104         /**\r
105          * @if VISPARTNER-MANUFACTURER\r
106          * Removes the geolocation data for the specified @c origin.\r
107          *\r
108          * @since               2.0\r
109          *\r
110          * @visibility  partner-manufacturer\r
111          * @privilege   %http://tizen.org/privilege/web.privacy\r
112          *\r
113          * @return      An error code\r
114          * @param[in] origin    The origin\r
115          * @exception E_SUCCESS                 The method is successful.\r
116          * @exception E_DATA_NOT_FOUND  There is no permission data for the specified @c origin.\r
117          * @exception E_SERVICE_BUSY            The dedicated service module is too busy to handle another request.\r
118          * @exception E_PRIVILEGE_DENIED        The application does not have the privilege to call this method.\r
119          * @see RemoveAll()\r
120          * @endif\r
121          */\r
122         result Remove(const Tizen::Base::String& origin);\r
123 \r
124         /**\r
125          * @if VISPARTNER-MANUFACTURER\r
126          * Removes all elements in the list.\r
127          * \r
128          * @since               2.0\r
129          *\r
130          * @visibility  partner-manufacturer\r
131          * @privilege   %http://tizen.org/privilege/web.privacy\r
132          *\r
133          * @return      An error code\r
134          * @exception E_SUCCESS                 The method is successful.\r
135          * @exception E_SERVICE_BUSY            The dedicated service module is too busy to handle another request.\r
136          * @exception E_PRIVILEGE_DENIED        The application does not have the privilege to call this method.\r
137          * @see Remove()\r
138          * @endif\r
139          */\r
140         result RemoveAll(void);\r
141 \r
142         /**\r
143          * @if VISPARTNER-MANUFACTURER\r
144          * Gets the geolocation permission manager instance.\r
145          *\r
146          * @since               2.0\r
147          *\r
148          * @visibility  partner-manufacturer\r
149          * @privilege   %http://tizen.org/privilege/web.privacy\r
150          *\r
151          * @return      A pointer to the %GeolocationPermissionManager instance, @n\r
152          *                              else @c null if it fails\r
153          * @exception E_SUCCESS                 The method is successful.\r
154          * @exception E_PRIVILEGE_DENIED        The application does not have the privilege to call this method.\r
155          * @remarks     The specific error code can be accessed using the GetLastResult() method.\r
156          * @endif\r
157          */\r
158         static GeolocationPermissionManager* GetInstance(void);\r
159 \r
160 private:\r
161         //\r
162         // This default constructor is intentionally declared as private to implement the Singleton semantic.\r
163         //\r
164         // @remarks             This constructor is hidden.\r
165         //\r
166         GeolocationPermissionManager(void);\r
167 \r
168         //\r
169         // This destructor is intentionally declared as private to implement the Singleton semantic.\r
170         //\r
171         // @remarks             This destructor is hidden.\r
172         //\r
173         virtual ~GeolocationPermissionManager(void);\r
174 \r
175         /**\r
176          * Initializes this instance of the %Web control with the specified parameters.\r
177          *\r
178          * @since               2.0\r
179          *\r
180          * @return      An error code\r
181          */\r
182         result Construct(void);\r
183 \r
184         //\r
185         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.\r
186         //\r
187         // @param[in] rhs               The instance of the % GeolocationPermissionManager class to copy from\r
188         // @remarks             This constructor is hidden.\r
189         //\r
190         GeolocationPermissionManager(const GeolocationPermissionManager& rhs);\r
191 \r
192         //\r
193         // Initializes the geolocation permission manager instance.\r
194         //\r
195         // @since       2.0\r
196         //\r
197         static void InitGeolocationPermissionManager(void);\r
198 \r
199         //\r
200         // Destroys the geolocation permission manager instance.\r
201         //\r
202         // @since       2.0\r
203         //\r
204         static void DestroyGeolocationPermissionManager(void);\r
205 \r
206         //\r
207         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.\r
208         //\r
209         // @param[in] rhs               An instance of % GeolocationPermissionManager to assign from\r
210         // @remarks             This operator is hidden.\r
211         //\r
212         GeolocationPermissionManager& operator=(const GeolocationPermissionManager& rhs);\r
213 \r
214 private:\r
215 \r
216         _GeolocationPermissionManagerImpl* __pGeolocationPermissionManagerImpl;\r
217 \r
218         static GeolocationPermissionManager* __pInstance;\r
219 \r
220         friend class _GeolocationPermissionManagerImpl;\r
221 \r
222         friend struct std::default_delete<GeolocationPermissionManager>;\r
223 }; // GeolocationPermissionManager\r
224 \r
225 }}} // Tizen::Web::Controls\r
226 \r
227 #endif // _FWEB_CTRL_GEOLOCATION_PERMISSION_MANAGER_H_\r