1 // Open Service Platform
\r
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
\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
8 // http://www.apache.org/licenses/LICENSE-2.0
\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
18 * @file FWebCtrlGeolocationPermissionManager.h
\r
19 * @brief This is the header file for the %GeolocationPermissionManager class.
\r
20 * @privlevel platform
\r
22 * This header file contains the declarations of the %GeolocationPermissionManager class.
\r
25 #ifndef _FWEB_CTRL_GEOLOCATION_PERMISSION_MANAGER_H_
\r
26 #define _FWEB_CTRL_GEOLOCATION_PERMISSION_MANAGER_H_
\r
28 #include <unique_ptr.h>
\r
29 #include <FBaseString.h>
\r
31 namespace Tizen { namespace Base { namespace Collection
\r
34 }}} // Tizen::Base::Collection
\r
36 namespace Tizen { namespace Web { namespace Controls
\r
39 class _GeolocationPermissionManagerImpl;
\r
42 * @class GeolocationPermissionManager
\r
43 * @brief This class provides methods to manage geolocation permissions.
\r
47 * The %GeolocationPermissionManager class provides methods to manage geolocation permissions decided by a user from origins using html5 JavaScript geolocation APIs.
\r
49 * Origin consists of the scheme, host, and port.
\r
52 class _OSP_EXPORT_ GeolocationPermissionManager
\r
53 : public Tizen::Base::Object
\r
58 * Gets the origin list stored at the geolocation database.
\r
61 * @privlevel platform
\r
62 * @privilege %http://tizen.org/privilege/geolocationpermission.read
\r
64 * @return A pointer to Tizen::Base::Collection::IList containing origin(Tizen::Base::String) list, @n
\r
65 * else @c null if no geolocation permission data exists
\r
66 * @exception E_SUCCESS The method is successful.
\r
67 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
\r
68 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
\r
69 * @remarks The specific error code can be accessed using the GetLastResult() method.
\r
71 Tizen::Base::Collection::IList* GetOriginListN(void) const;
\r
74 * Checks whether geolocation permission is allowed or not for the specified @c origin.
\r
77 * @privlevel platform
\r
78 * @privilege %http://tizen.org/privilege/geolocationpermission.read
\r
80 * @return @c true if geolocation permission is allowed, @n
\r
82 * @param[in] origin The origin
\r
83 * @exception E_SUCCESS The method is successful.
\r
84 * @exception E_DATA_NOT_FOUND There is no permission data for the specified @c origin.
\r
85 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
\r
86 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
\r
87 * @remarks The specific error code can be accessed using the GetLastResult() method.
\r
89 bool IsPermissionAllowed(const Tizen::Base::String& origin) const;
\r
92 * Removes the geolocation data for the specified @c origin.
\r
95 * @privlevel platform
\r
96 * @privilege %http://tizen.org/privilege/geolocationpermission.write
\r
98 * @return An error code
\r
99 * @param[in] origin The origin
\r
100 * @exception E_SUCCESS The method is successful.
\r
101 * @exception E_DATA_NOT_FOUND There is no permission data for the specified @c origin.
\r
102 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
\r
103 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
\r
106 result Remove(const Tizen::Base::String& origin);
\r
109 * Removes all elements in the list.
\r
112 * @privlevel platform
\r
113 * @privilege %http://tizen.org/privilege/geolocationpermission.write
\r
115 * @return An error code
\r
116 * @exception E_SUCCESS The method is successful.
\r
117 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
\r
118 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
\r
121 result RemoveAll(void);
\r
124 * Gets the geolocation permission manager instance.
\r
128 * @return A pointer to the %GeolocationPermissionManager instance, @n
\r
129 * else @c null if it fails
\r
130 * @exception E_SUCCESS The method is successful.
\r
131 * @exception E_OUT_OF_MEMORY The memory is insufficient.
\r
132 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
\r
133 * @remarks The specific error code can be accessed using the GetLastResult() method.
\r
135 static GeolocationPermissionManager* GetInstance(void);
\r
139 // This default constructor is intentionally declared as private to implement the Singleton semantic.
\r
141 // @remarks This constructor is hidden.
\r
143 GeolocationPermissionManager(void);
\r
146 // This destructor is intentionally declared as private to implement the Singleton semantic.
\r
148 // @remarks This destructor is hidden.
\r
150 virtual ~GeolocationPermissionManager(void);
\r
153 // Initializes this instance of the %Web control with the specified parameters.
\r
157 // @return An error code
\r
159 result Construct(void);
\r
162 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
\r
164 // @param[in] rhs The instance of the % GeolocationPermissionManager class to copy from
\r
165 // @remarks This constructor is hidden.
\r
167 GeolocationPermissionManager(const GeolocationPermissionManager& rhs);
\r
170 // Initializes the geolocation permission manager instance.
\r
174 static void InitGeolocationPermissionManager(void);
\r
177 // Destroys the geolocation permission manager instance.
\r
181 static void DestroyGeolocationPermissionManager(void);
\r
184 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
\r
186 // @param[in] rhs An instance of % GeolocationPermissionManager to assign from
\r
187 // @remarks This operator is hidden.
\r
189 GeolocationPermissionManager& operator=(const GeolocationPermissionManager& rhs);
\r
193 _GeolocationPermissionManagerImpl* __pGeolocationPermissionManagerImpl;
\r
195 static GeolocationPermissionManager* __pInstance;
\r
197 friend class _GeolocationPermissionManagerImpl;
\r
199 friend struct std::default_delete<GeolocationPermissionManager>;
\r
200 }; // GeolocationPermissionManager
\r
202 }}} // Tizen::Web::Controls
\r
204 #endif // _FWEB_CTRL_GEOLOCATION_PERMISSION_MANAGER_H_
\r