apply html5 vibration feature
[framework/osp/web.git] / inc / FWebCtrlWebStorageManager.h
1 //\r
2 // Open Service Platform\r
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
4 //\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
8 //\r
9 //     http://www.apache.org/licenses/LICENSE-2.0\r
10 //\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
16 //\r
17 \r
18 /**\r
19 * @file            FWebCtrlWebStorageManager.h\r
20 * @brief                     This is the header file for the %WebStorageManager class.\r
21 *\r
22 * This header file contains the declarations of the %WebStorageManager class for a %Web control.\r
23 */\r
24 #ifndef _FWEB_CTRL_WEB_STORAGE_MANAGER_H_\r
25 #define _FWEB_CTRL_WEB_STORAGE_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 class _WebStorageManagerImpl;\r
38 }}} // Tizen::Web::Control\r
39 \r
40 namespace Tizen { namespace Web { namespace Controls\r
41 {\r
42 \r
43 /**\r
44 * @enum WebStorageType\r
45 *\r
46 * Defines the web storage type.\r
47 *\r
48 * @since                2.1\r
49 */\r
50 enum WebStorageType\r
51 {\r
52         WEB_STORAGE_TYPE_APPLICATION_CACHE,     /**< The application cache: the web storage type */\r
53         WEB_STORAGE_TYPE_INDEXED_DATABASE,      /**< The indexed database: the web storage type */\r
54         WEB_STORAGE_TYPE_WEB_SQL_DATABASE,      /**< The web database: the web storage type */\r
55         WEB_STORAGE_TYPE_WEB_STORAGE,           /**< The web storage: the web storage type */\r
56         WEB_STORAGE_TYPE_FILE_SYSTEM            /**< The file system: the web storage type */\r
57 };\r
58 \r
59 /**\r
60 * @class                WebStorageManager\r
61 * @brief                This class holds the setting values for a %Web control.\r
62 *\r
63 * @since                2.1\r
64 * @final                This class is not intended for extension.\r
65 *\r
66 * The %WebStorageManager\r
67 */\r
68 class _OSP_EXPORT_ WebStorageManager\r
69         : public Tizen::Base::Object\r
70 {\r
71 public:\r
72 \r
73         /**\r
74          * Gets the list of origins for the given storage type.\r
75          * The WEB_STORAGE_TYPE_INDEXED_DATABASE is not supported.\r
76          *\r
77          * @since               2.1\r
78          *\r
79          * @privlevel   public\r
80          * @privilege   %http://tizen.org/privilege/web.privacy\r
81          *\r
82          * @return              A pointer to IList containing origin(Tizen::Base::String) list, @n\r
83          *                                      else @c null if no web storage data exists\r
84          * @param[in]   storageType             The web storage type\r
85          * @exception   E_SUCCESS                       The method is successful.\r
86          * @exception   E_UNSUPPORTED_TYPE      The specified storageType is not supported.\r
87          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.\r
88          * @remarks             The specific error code can be accessed using the GetLastResult() method.\r
89          */\r
90         Tizen::Base::Collection::IList* GetOriginListN(WebStorageType storageType) const;\r
91 \r
92         /**\r
93          * Sets the default quota for the given origin for the given storage type.\r
94          * Only the WEB_STORAGE_TYPE_WEB_SQL_DATABASE and the WEB_STORAGE_TYPE_APPLICATION_CACHE are supported.\r
95          *\r
96          * @since               2.1\r
97          *\r
98          * @privlevel   public\r
99          * @privilege   %http://tizen.org/privilege/web.privacy\r
100          *\r
101          * @return              An error code\r
102          * @param[in]   storageType             The web storage type\r
103          * @param[in]   origin                  The origin\r
104          * @param[in]   quota                   The quota of the web storage to set in bytes\r
105          * @exception   E_SUCCESS                       The method is successful.\r
106          * @exception   E_INVALID_ARG           The specified @c origin is invalid.\r
107          * @exception   E_UNSUPPORTED_TYPE      The specified storageType is not supported.\r
108          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.\r
109          */\r
110         result SetQuotaForOrigin(WebStorageType storageType, const Tizen::Base::String& origin, long quota);\r
111 \r
112 \r
113         /**\r
114          * Gets the quota for the given origin for the given storage type.\r
115          * Only the WEB_STORAGE_TYPE_WEB_SQL_DATABASE is supported.\r
116          *\r
117          * @since               2.1\r
118          *\r
119          * @privlevel   public\r
120          * @privilege   %http://tizen.org/privilege/web.privacy\r
121          *\r
122          * @return              The usage of the web storage in bytes\r
123          * @param[in]   storageType             The web storage type\r
124          * @param[in]   origin                  The origin\r
125          * @exception   E_SUCCESS                       The method is successful.\r
126          * @exception   E_INVALID_ARG           The specified @c origin is invalid.\r
127          * @exception   E_UNSUPPORTED_TYPE      The specified storageType is not supported.\r
128          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.\r
129          */\r
130         long GetQuotaForOrigin(WebStorageType storageType, const Tizen::Base::String& origin);\r
131 \r
132         /**\r
133          * Gets the usage for the given origin for the given storage type.\r
134          * The WEB_STORAGE_TYPE_INDEXED_DATABASE and the WEB_STORAGE_TYPE_FILE_SYSTEM are not supported.\r
135          *\r
136          * @since               2.1\r
137          *\r
138          * @privlevel   public\r
139          * @privilege   %http://tizen.org/privilege/web.privacy\r
140          *\r
141          * @return              The usage of the web storage in bytes\r
142          * @param[in]   storageType             The web storage type\r
143          * @param[in]   origin                  The origin\r
144          * @exception   E_SUCCESS                       The method is successful.\r
145          * @exception   E_INVALID_ARG           The specified @c origin is invalid.\r
146          * @exception   E_UNSUPPORTED_TYPE      The specified storageType is not supported.\r
147          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.\r
148          * @remarks             The specific error code can be accessed using the GetLastResult() method.\r
149          */\r
150         long GetUsageForOrigin(WebStorageType storageType, const Tizen::Base::String& origin) const;\r
151 \r
152         /**\r
153          * Removes the data for the given origin for the given storage type.\r
154          * The WEB_STORAGE_TYPE_INDEXED_DATABASE is not supported.\r
155          *\r
156          * @since               2.1\r
157          *\r
158          * @privlevel   public\r
159          * @privilege   %http://tizen.org/privilege/web.privacy\r
160          *\r
161          * @return              An error code\r
162          * @param[in]   storageType             The web storage type\r
163          * @param[in]   origin                  The origin\r
164          * @exception   E_SUCCESS                       The method is successful.\r
165          * @exception   E_INVALID_ARG           The specified @c origin is invalid.\r
166          * @exception   E_UNSUPPORTED_TYPE      The specified storageType is not supported.\r
167          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.\r
168          * @see RemoveAll()\r
169          */\r
170         result Remove(WebStorageType storageType, const Tizen::Base::String& origin);\r
171 \r
172         /**\r
173          * Removes all data for the given storage type.\r
174          *\r
175          * @since               2.1\r
176          *\r
177          * @privlevel   public\r
178          * @privilege   %http://tizen.org/privilege/web.privacy\r
179          *\r
180          * @return              An error code\r
181          * @param[in]   storageType             The web storage type\r
182          * @exception   E_SUCCESS                       The method is successful.\r
183          * @exception   E_UNSUPPORTED_TYPE      The specified storageType is not supported.\r
184          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.\r
185          * @see Remove()\r
186          */\r
187         result RemoveAll(WebStorageType storageType);\r
188 \r
189         /**\r
190          * Gets the web storage manager instance.\r
191          *\r
192          * @since               2.1\r
193          *\r
194          *\r
195          * @return              A pointer to the %WebStorageManager instance, @n\r
196          *                                      else @c null if it fails\r
197          * @exception   E_SUCCESS                       The method is successful.\r
198          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.\r
199          * @remarks             The specific error code can be accessed using the GetLastResult() method.\r
200          */\r
201         static WebStorageManager* GetInstance(void);\r
202 \r
203 private:\r
204         //\r
205         // This default constructor is intentionally declared as private to implement the Singleton semantic.\r
206         //\r
207         // @remarks             This constructor is hidden.\r
208         //\r
209         WebStorageManager(void);\r
210 \r
211         //\r
212         // This destructor is intentionally declared as private to implement the Singleton semantic.\r
213         //\r
214         // @remarks             This destructor is hidden.\r
215         //\r
216         virtual ~WebStorageManager(void);\r
217 \r
218         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.\r
219         //\r
220         // @param[in] rhs                       The instance of the % WebStorageManager class to copy from\r
221         // @remarks             This constructor is hidden.\r
222         //\r
223         WebStorageManager(const WebStorageManager& rhs);\r
224 \r
225         //\r
226         // Initializes the web storage manager instance.\r
227         //\r
228         // @since               2.1\r
229         //\r
230         static void InitWebStorageManager(void);\r
231 \r
232         //\r
233         // Destroys the web storage manager instance.\r
234         //\r
235         // @since               2.1\r
236         //\r
237         static void DestroyWebStorageManager(void);\r
238 \r
239         //\r
240         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.\r
241         //\r
242         // @param[in] rhs                       An instance of % WebStorageManager to assign from\r
243         // @remarks             This operator is hidden.\r
244         //\r
245         WebStorageManager& operator=(const WebStorageManager& rhs);\r
246 \r
247 private:\r
248         _WebStorageManagerImpl* __pWebStorageManagerImpl;\r
249 \r
250         static WebStorageManager* __pInstance;\r
251 \r
252         friend class _WebStorageManagerImpl;\r
253 \r
254         friend struct std::default_delete<WebStorageManager>;\r
255 }; // WebStorageManager\r
256 \r
257 }}} // Tizen::Web::Controls\r
258 #endif // _FWEB_CTRL_WEB_STORAGE_MANAGER_H_\r