2 // Open Service Platform
\r
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
\r
5 // Licensed under the Apache License, Version 2.0 (the License);
\r
6 // you may not use this file except in compliance with the License.
\r
7 // You may obtain a copy of the License at
\r
9 // http://www.apache.org/licenses/LICENSE-2.0
\r
11 // Unless required by applicable law or agreed to in writing, software
\r
12 // distributed under the License is distributed on an "AS IS" BASIS,
\r
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
14 // See the License for the specific language governing permissions and
\r
15 // limitations under the License.
\r
19 * @file FWebCtrlWebStorageManager.h
\r
20 * @brief This is the header file for the %WebStorageManager class.
\r
22 * This header file contains the declarations of the %WebStorageManager class for a %Web control.
\r
24 #ifndef _FWEB_CTRL_WEB_STORAGE_MANAGER_H_
\r
25 #define _FWEB_CTRL_WEB_STORAGE_MANAGER_H_
\r
27 #include <FBaseString.h>
\r
29 namespace Tizen { namespace Base { namespace Collection
\r
32 }}} // Tizen::Base::Collection
\r
34 namespace Tizen { namespace Web { namespace Controls
\r
36 class _WebStorageManagerImpl;
\r
37 }}} // Tizen::Web::Control
\r
39 namespace Tizen { namespace Web { namespace Controls
\r
43 * @enum WebStorageType
\r
45 * Defines the web storage type.
\r
51 WEB_STORAGE_TYPE_APPLICATION_CACHE, /**< The application cache: the web storage type */
\r
52 WEB_STORAGE_TYPE_INDEXED_DATABASE, /**< The indexed database: the web storage type */
\r
53 WEB_STORAGE_TYPE_WEB_SQL_DATABASE, /**< The web database: the web storage type */
\r
54 WEB_STORAGE_TYPE_WEB_STORAGE, /**< The web storage: the web storage type */
\r
55 WEB_STORAGE_TYPE_FILE_SYSTEM /**< The file system: the web storage type */
\r
59 * @class WebStorageManager
\r
60 * @brief This class holds the setting values for a %Web control.
\r
63 * @final This class is not intended for extension.
\r
65 * The %WebStorageManager
\r
67 class _OSP_EXPORT_ WebStorageManager
\r
68 : public Tizen::Base::Object
\r
73 * Gets the list of origins for the given storage type.
\r
74 * The WEB_STORAGE_TYPE_INDEXED_DATABASE is not supported.
\r
79 * @privilege http://tizen.org/privilege/web.privacy
\r
81 * @return A pointer to IList containing origin(Tizen::Base::String) list, @n
\r
82 * else @c null if no web storage data exists
\r
83 * @param[in] storageType The web storage type
\r
84 * @exception E_SUCCESS The method is successful.
\r
85 * @exception E_UNSUPPORTED_TYPE The specified storageType is not supported.
\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 Tizen::Base::Collection::IList* GetOriginListN(WebStorageType storageType) const;
\r
92 * Sets the default quota for the given origin for the given storage type.
\r
93 * Only the WEB_STORAGE_TYPE_WEB_SQL_DATABASE and the WEB_STORAGE_TYPE_APPLICATION_CACHE are supported.
\r
98 * @privilege http://tizen.org/privilege/web.privacy
\r
100 * @return An error code
\r
101 * @param[in] storageType The web storage type
\r
102 * @param[in] origin The origin
\r
103 * @param[in] quota The quota of the web storage to set in bytes
\r
104 * @exception E_SUCCESS The method is successful.
\r
105 * @exception E_UNSUPPORTED_TYPE The specified storageType is not supported.
\r
106 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
\r
108 result SetQuotaForOrigin(WebStorageType storageType, const Tizen::Base::String& origin, long quota);
\r
112 * Gets the quota for the given origin for the given storage type.
\r
113 * Only the WEB_STORAGE_TYPE_WEB_SQL_DATABASE is supported.
\r
117 * @privlevel public
\r
118 * @privilege http://tizen.org/privilege/web.privacy
\r
120 * @return The usage of the web storage in bytes
\r
121 * @param[in] storageType The web storage type
\r
122 * @param[in] origin The origin
\r
123 * @exception E_SUCCESS The method is successful.
\r
124 * @exception E_UNSUPPORTED_TYPE The specified storageType is not supported.
\r
125 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
\r
127 long GetQuotaForOrigin(WebStorageType storageType, , const Tizen::Base::String& origin);
\r
130 * Gets the usage for the given origin for the given storage type.
\r
131 * The WEB_STORAGE_TYPE_INDEXED_DATABASE and the WEB_STORAGE_TYPE_FILE_SYSTEM are not supported.
\r
135 * @privlevel public
\r
136 * @privilege http://tizen.org/privilege/web.privacy
\r
138 * @return The usage of the web storage in bytes
\r
139 * @param[in] storageType The web storage type
\r
140 * @param[in] origin The origin
\r
141 * @exception E_SUCCESS The method is successful.
\r
142 * @exception E_UNSUPPORTED_TYPE The specified storageType is not supported.
\r
143 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
\r
144 * @remarks The specific error code can be accessed using the GetLastResult() method.
\r
146 long GetUsageForOrigin(WebStorageType storageType, const Tizen::Base::String& origin) const;
\r
149 * Removes the data for the given origin for the given storage type.
\r
150 * The WEB_STORAGE_TYPE_INDEXED_DATABASE is not supported.
\r
154 * @privlevel public
\r
155 * @privilege http://tizen.org/privilege/web.privacy
\r
157 * @return An error code
\r
158 * @param[in] storageType The web storage type
\r
159 * @param[in] origin The origin
\r
160 * @exception E_SUCCESS The method is successful.
\r
161 * @exception E_UNSUPPORTED_TYPE The specified storageType is not supported.
\r
162 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
\r
165 result Remove(WebStorageType storageType, const Tizen::Base::String& origin);
\r
168 * Removes all data for the given storage type.
\r
172 * @privlevel public
\r
173 * @privilege http://tizen.org/privilege/web.privacy
\r
175 * @return An error code
\r
176 * @param[in] storageType The web storage type
\r
177 * @exception E_SUCCESS The method is successful.
\r
178 * @exception E_UNSUPPORTED_TYPE The specified storageType is not supported.
\r
179 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
\r
182 result RemoveAll(WebStorageType storageType);
\r
185 * Gets the web storage manager instance.
\r
189 * @return A pointer to the %WebStorageManager instance, @n
\r
190 * else @c null if it fails
\r
191 * @exception E_SUCCESS The method is successful.
\r
192 * @exception E_OUT_OF_MEMORY The memory is insufficient.
\r
193 * @remarks The specific error code can be accessed using the GetLastResult() method.
\r
195 static WebStorageManager* GetInstance(void);
\r
199 // This default constructor is intentionally declared as private to implement the Singleton semantic.
\r
201 // @remarks This constructor is hidden.
\r
203 WebStorageManager(void);
\r
206 // This destructor is intentionally declared as private to implement the Singleton semantic.
\r
208 // @remarks This destructor is hidden.
\r
210 virtual ~WebStorageManager(void);
\r
212 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
\r
214 // @param[in] rhs The instance of the % WebStorageManager class to copy from
\r
215 // @remarks This constructor is hidden.
\r
217 WebStorageManager(const WebStorageManager& rhs);
\r
220 // Initializes the web storage manager instance.
\r
224 static void InitWebStorageManager(void);
\r
227 // Destroys the web storage manager instance.
\r
231 static void DestroyWebStorageManager(void);
\r
234 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
\r
236 // @param[in] rhs An instance of % WebStorageManager to assign from
\r
237 // @remarks This operator is hidden.
\r
239 WebStorageManager& operator=(const WebStorageManager& rhs);
\r
242 _WebStorageManagerImpl* __pWebStorageManagerImpl;
\r
244 static WebStorageManager* __pInstance;
\r
246 friend class _WebStorageManagerImpl;
\r
248 friend struct std::default_delete<WebStorageManager>;
\r
249 }; // WebStorageManager
\r
251 }}} // Tizen::Web::Controls
\r
252 #endif // _FWEB_CTRL_WEB_STORAGE_MANAGER_H_
\r