summaryrefslogtreecommitdiff
path: root/inc/FWebCtrlGeolocationPermissionManager.h
blob: 37dc5488119c4655064992ef40726f2305b23c8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
// Open Service Platform
// Copyright (c) 2012 Samsung Electronics Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the License);
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

/**
 * @if		VISPARTNER-MANUFACTURER
 * @file		FWebCtrlGeolocationPermissionManager.h
 * @brief		This is the header file for the %GeolocationPermissionManager class.
 * @visibility	partner-manufacturer
 *
 * This header file contains the declarations of the %GeolocationPermissionManager class.
 *
 * @endif
 */
#ifndef _FWEB_CTRL_GEOLOCATION_PERMISSION_MANAGER_H_
#define _FWEB_CTRL_GEOLOCATION_PERMISSION_MANAGER_H_

#include <unique_ptr.h>
#include <FBaseString.h>

namespace Tizen { namespace Base { namespace Collection
{
class IList;
}}} // Tizen::Base::Collection

namespace Tizen { namespace Web { namespace Controls
{

class _GeolocationPermissionManagerImpl;

/**
 * @if VISPARTNER-MANUFACTURER
 * @class		GeolocationPermissionManager
 * @brief		This class provides methods to manage geolocation permissions.
 *
 * @since		2.0
 *
 * @visibility	partner-manufacturer
 * @privilege	%http://tizen.org/privilege/web.privacy
 *
 * The %GeolocationPermissionManager class provides methods to manage geolocation permissions decided by a user from origins using html5 JavaScript geolocation APIs.
 * @n
 * Origin consists of the scheme, host, and port.
 * @endif
 */

class _OSP_EXPORT_ GeolocationPermissionManager
	: public Tizen::Base::Object
{ 
public:

	/**
	 * @if VISPARTNER-MANUFACTURER
	 * Gets the origin list stored at the geolocation database.
	 *
	 * @since		2.0
	 *
	 * @visibility	partner-manufacturer
	 * @privilege	%http://tizen.org/privilege/web.privacy
	 *
	 * @return	A pointer to IList containing origin(Tizen::Base::String) list, @n
	 * 				else @c null if no geolocation permission data exists
	 * @exception E_SUCCESS			The method is successful.
	 * @exception E_SERVICE_BUSY		The dedicated service module is too busy to handle another request.
	 * @exception E_PRIVILEGE_DENIED	The application does not have the privilege to call this method.
	 * @remarks	The specific error code can be accessed using the GetLastResult() method.
	 * @endif
	 */
	 Tizen::Base::Collection::IList* GetOriginListN(void) const;

	/**
	 * @if VISPARTNER-MANUFACTURER
	 * Checks whether geolocation permission is allowed or not for the specified @c origin.
	 *
	 * @since		2.0
	 *
	 * @visibility	partner-manufacturer
	 * @privilege	%http://tizen.org/privilege/web.privacy
	 *
	 * @return	@c true if geolocation permission is allowed, @n
	 * 				else @c false
	 * @param[in] origin	The origin
	 * @exception E_SUCCESS			The method is successful.
	 * @exception E_DATA_NOT_FOUND	There is no permission data for the specified @c origin.
	 * @exception E_SERVICE_BUSY		The dedicated service module is too busy to handle another request.
	 * @exception E_PRIVILEGE_DENIED	The application does not have the privilege to call this method.
	 * @remarks	The specific error code can be accessed using the GetLastResult() method.
	 * @endif
	 */
	bool IsPermissionAllowed(const Tizen::Base::String& origin) const;

	/**
	 * @if VISPARTNER-MANUFACTURER
	 * Removes the geolocation data for the specified @c origin.
	 *
	 * @since		2.0
	 *
	 * @visibility	partner-manufacturer
	 * @privilege	%http://tizen.org/privilege/web.privacy
	 *
	 * @return	An error code
	 * @param[in] origin	The origin
	 * @exception E_SUCCESS			The method is successful.
	 * @exception E_DATA_NOT_FOUND	There is no permission data for the specified @c origin.
	 * @exception E_SERVICE_BUSY		The dedicated service module is too busy to handle another request.
	 * @exception E_PRIVILEGE_DENIED	The application does not have the privilege to call this method.
	 * @see RemoveAll()
	 * @endif
	 */
	result Remove(const Tizen::Base::String& origin);

	/**
	 * @if VISPARTNER-MANUFACTURER
	 * Removes all elements in the list.
	 * 
	 * @since		2.0
	 *
	 * @visibility	partner-manufacturer
	 * @privilege	%http://tizen.org/privilege/web.privacy
	 *
	 * @return	An error code
	 * @exception E_SUCCESS			The method is successful.
	 * @exception E_SERVICE_BUSY		The dedicated service module is too busy to handle another request.
	 * @exception E_PRIVILEGE_DENIED	The application does not have the privilege to call this method.
	 * @see Remove()
	 * @endif
	 */
	result RemoveAll(void);

	/**
	 * @if VISPARTNER-MANUFACTURER
	 * Gets the geolocation permission manager instance.
	 *
	 * @since		2.0
	 *
	 * @visibility	partner-manufacturer
	 * @privilege	%http://tizen.org/privilege/web.privacy
	 *
	 * @return	A pointer to the %GeolocationPermissionManager instance, @n
	 *				else @c null if it fails
	 * @exception E_SUCCESS			The method is successful.
	 * @exception E_PRIVILEGE_DENIED	The application does not have the privilege to call this method.
	 * @remarks	The specific error code can be accessed using the GetLastResult() method.
	 * @endif
	 */
	static GeolocationPermissionManager* GetInstance(void);

private:
	//
	// This default constructor is intentionally declared as private to implement the Singleton semantic.
	//
	// @remarks		This constructor is hidden.
	//
	GeolocationPermissionManager(void);

 	//
	// This destructor is intentionally declared as private to implement the Singleton semantic.
	//
	// @remarks		This destructor is hidden.
	//
	virtual ~GeolocationPermissionManager(void);

	/**
	 * Initializes this instance of the %Web control with the specified parameters.
	 *
	 * @since		2.0
	 *
	 * @return	An error code
	 */
	result Construct(void);

	//
	// The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
	//
	// @param[in] rhs		The instance of the % GeolocationPermissionManager class to copy from
	// @remarks		This constructor is hidden.
	//
	GeolocationPermissionManager(const GeolocationPermissionManager& rhs);

	//
	// Initializes the geolocation permission manager instance.
	//
	// @since	2.0
	//
	static void InitGeolocationPermissionManager(void);

	//
	// Destroys the geolocation permission manager instance.
	//
	// @since	2.0
	//
	static void DestroyGeolocationPermissionManager(void);

	//
	// The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
	//
	// @param[in] rhs		An instance of % GeolocationPermissionManager to assign from
	// @remarks		This operator is hidden.
	//
	GeolocationPermissionManager& operator=(const GeolocationPermissionManager& rhs);

private:

	_GeolocationPermissionManagerImpl* __pGeolocationPermissionManagerImpl;

	static GeolocationPermissionManager* __pInstance;

	friend class _GeolocationPermissionManagerImpl;

	friend struct std::default_delete<GeolocationPermissionManager>;
}; // GeolocationPermissionManager

}}} // Tizen::Web::Controls

#endif // _FWEB_CTRL_GEOLOCATION_PERMISSION_MANAGER_H_