Apply reviewed doxygen
[framework/osp/web.git] / inc / FWebCtrlWebSetting.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file                FWebCtrlWebSetting.h
20  * @brief               This is the header file for the %WebSetting class.
21  *
22  * This header file contains the declarations of the %WebSetting class for a %Web control.
23  */
24 #ifndef _FWEB_CTRL_WEB_SETTING_H_
25 #define _FWEB_CTRL_WEB_SETTING_H_
26
27 #include <FBaseObject.h>
28 #include <FBaseString.h>
29 #include <FUiCtrlInputTypes.h>
30
31 namespace Tizen { namespace Web { namespace Controls
32 {
33 class _WebSettingImpl;
34 }}} // Tizen::Web::Control
35
36 namespace Tizen { namespace Web { namespace Controls
37 {
38
39 /**
40  * @enum CacheMode
41  *
42  * Defines the types of cache mode.
43  *
44  * @since               2.0
45  */
46 enum CacheMode
47 {
48         WEB_CACHE_VALIDATED,        /**< The use of cache data only when the cache data is valid */
49         WEB_CACHE_IGNORE            /**< The retrieval of data from a network resource without using cache data */
50 };
51
52 /**
53  * @enum CertificateErrorHandlingMode
54  *
55  * Defines the types of certification error handling mode.
56  *
57  * @since               2.0
58  */
59 enum CertificateErrorHandlingMode
60 {
61         WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM,            /**< The web certificate error handling mode: The confirm popup is displayed to get the user confirmation */
62         WEB_CERTIFICATE_ERROR_HANDLING_MODE_CANCEL,                 /**< The web certificate error handling mode: The confirm popup is not displayed and the request is canceled */
63         WEB_CERTIFICATE_ERROR_HANDLING_MODE_CONTINUE                    /**< The web certificate error handling mode: The confirm popup is not displayed and the request proceeds */
64 };
65
66 /**
67  * @class               WebSetting
68  * @brief               This class holds the setting values for a %Web control.
69  *
70  * @since               2.0
71  *
72  * The %WebSetting class holds the setting values, which configure the behavior of a %Web control. An application can, for example, enable or disable JavaScript and image auto loading.
73  */
74 class _OSP_EXPORT_ WebSetting
75         : public Tizen::Base::Object
76 {
77 public:
78         /**
79          * This is the default constructor for this class.
80          *
81          * @since               2.0
82          */
83         WebSetting(void);
84
85         /**
86          * Copying of objects using this copy constructor is allowed.
87          * This is the copy constructor for the %WebSetting class. @n
88          * It creates an instance of %WebSetting with the values of the specified instance.
89          *
90          * @since               2.0
91          *
92          * @param[in]   setting                 An instance of %WebSetting
93          */
94         WebSetting(const WebSetting& setting);
95
96         /**
97          * This destructor overrides Tizen::Base::Object::~Object().
98          *
99          * @since               2.0
100          */
101         virtual ~WebSetting(void);
102
103         /**
104          * Sets a cache control strategy for a %Web control.
105          *
106          * @since               2.0
107          * @privlevel   public
108          * @privilege   %http://tizen.org/privilege/web.service
109          *
110          * @param[in]   mode                    A cache mode
111          * @exception   E_SUCCESS                       The method is successful.
112          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
113          * @exception   E_USER_NOT_CONSENTED    The user blocks an application from calling this method. @b Since: @b 2.1
114          * @remarks             The specific error code can be accessed using the GetLastResult() method.
115          */
116         void SetCacheControl(CacheMode mode);
117
118         /**
119          * Sets the font size of the content.
120          *
121          * @since               2.0
122          *
123          * @param[in]   fontSize                The font size
124          */
125         void SetFontSize(int fontSize);
126
127         /**
128          * Sets the text encoding for the content of a %Web control.
129          *
130          * @since               2.0
131          *
132          * @param[in]   encoding                The text encoding
133          */
134         void SetDefaultTextEncoding(const Tizen::Base::String& encoding);
135
136         /**
137          * Enables or disables the use of JavaScript.
138          *
139          * @since               2.0
140          *
141          * @param[in]   enable                  Set to @c true if the %Web control uses JavaScript, @n
142          *                                                                      else @c false
143          */
144         void SetJavascriptEnabled(bool enable);
145
146         /**
147          * Decides if a %Web control loads images included in the content.
148          *
149          * @since               2.0
150          *
151          * @param[in]   enable                  Set to @c true if the %Web control must load images included in the content, @n
152          *                                                                      else @c false
153          */
154         void SetAutoImageLoadEnabled(bool enable);
155
156         /**
157          * Sets the input style of the keypad, which is displayed for the <input> or <textarea> tag.
158          *
159          * @since               2.0
160          *
161          * @param[in]   inputStyle              The input style of keypad
162          * @remarks             If an application sets the input style to @c INPUT_STYLE_OVERLAY, the application must implement IWebKeypadEventListener to rearrange the layout of the current Form.
163          *
164          */
165         void SetInputStyle(Tizen::Ui::Controls::InputStyle inputStyle);
166
167         /**
168          * Gets the value of the cache control strategy for a %Web control. @n
169          * The default value is @c WEB_CACHE_VALIDATED.
170          *
171          * @since               2.0
172          *
173          * @return              A cache mode
174          */
175         CacheMode GetCacheControl(void) const;
176
177         /**
178          * Gets the font size of the content. @n
179          * The default size is @c 17.
180          *
181          * @since               2.0
182          *
183          * @return              The size of the font
184          */
185         int GetFontSize(void) const;
186
187         /**
188          * Gets the text encoding of the content of a %Web control. @n
189          * The default encoding is UTF-8.
190          *
191          * @since               2.0
192          *
193          * @return              The text encoding
194          */
195         Tizen::Base::String GetDefaultTextEncoding(void) const;
196
197         /**
198          * Checks whether a %Web control uses JavaScript. @n
199          * The default value is @c true.
200          *
201          * @since               2.0
202          *
203          * @return              @c true if JavaScript is enabled and used by a %Web control, @n
204          *                                      else @c false
205          */
206         bool IsJavascriptEnabled(void) const;
207
208         /**
209          * Checks whether a %Web control loads images included in the content automatically. @n
210          * The default value is @c true.
211          *
212          * @since               2.0
213          *
214          * @return              @c true if auto image loading is enabled, @n
215          *                                      else @c false
216          */
217         bool IsAutoImageLoadEnabled(void) const;
218
219         /**
220          * Gets the input style of the keypad, which is displayed for the <input> or <textarea> tag. @n
221          * The default style is @c INPUT_STYLE_FULLSCREEN.
222          *
223          * @since               2.0
224          *
225          * @return              The input style of keypad
226          */
227         Tizen::Ui::Controls::InputStyle GetInputStyle(void) const;
228
229         /**
230          * Sets a certificate error handling mode for a %Web control.
231          *
232          * @since               2.0
233          *
234          * @privlevel   public
235          * @privilege   %http://tizen.org/privilege/web.service
236          *
237          * @param[in]   mode                    A certificate error handling mode
238          * @exception   E_SUCCESS                       The method is successful.
239          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
240          * @exception   E_USER_NOT_CONSENTED    The user blocks an application from calling this method. @b Since: @b 2.1
241          * @remarks             The specific error code can be accessed using the GetLastResult() method.
242          */
243         void SetCertificateErrorHandlingMode(CertificateErrorHandlingMode mode);
244
245         /**
246          * Gets the value of the certificate error handling mode for a %Web control. @n
247          * The default value is @c WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM.
248          *
249          * @since               2.0
250          *
251          * @return              A certificate error handling mode
252          */
253         CertificateErrorHandlingMode GetCertificateErrorHandlingMode(void) const;
254
255         /**
256          * Sets a user agent for a %Web control.
257          *
258          * @since               2.0
259          *
260          * @param[in]   agent                   The user agent
261          */
262         void SetUserAgent(const Tizen::Base::String& agent);
263
264         /**
265          * Gets a value of user agent for a %Web control.
266          *
267          * @since               2.0
268          *
269          * @return              The value of user agent
270          */
271         Tizen::Base::String GetUserAgent(void) const;
272
273         /**
274          * Decides if a %Web control loads the resized contents to fit width automatically.
275          *
276          * @since               2.0
277          *
278          * @param[in]   enable                  Set to @c true if the %Web control should load contents to fit width, @n
279          *                                                                      else @c false
280          */
281         void SetAutoFittingEnabled(bool enable);
282
283         /**
284          * Checks whether a %Web control loads the resize contents to fit width. @n
285          * The default value is @c true.
286          *
287          * @since               2.0
288          *
289          * @return              @c true if auto fitting is enabled, @n
290          *                                      else @c false
291          */
292         bool IsAutoFittingEnabled(void) const;
293
294         /**
295          * Decides if a %Web control allows JavaScript to open new window.
296          *
297          * @since               2.0
298          *
299          * @param[in]   enable                  Set to @c true if the %Web control should allow JavaScript to open new window, @n
300          *                                                                      else @c false
301          */
302         void SetJavaScriptPopupEnabled(bool enable);
303
304         /**
305          * Checks whether a %Web control allows JavaScript to open new window. @n Returns @c true if opening new window by JavaScript is enabled.
306          * The default value is @c true.
307          *
308          * @since               2.0
309          *
310          * @return              @c true if opening new window by JavaScript is enabled, @n
311          *                                      else @c false
312          */
313         bool IsJavaScriptPopupEnabled(void) const;
314
315         /**
316          * Decides if a %Web control supports html5 geolocation feature.
317          *
318          * @since               2.0
319          * @privlevel   public
320          * @privilege   %http://tizen.org/privilege/web.service
321          *
322          * @param[in]   enable                  Set to @c true if the %Web control should support html5 geolocation feature, @n
323          *                                                                      else @c false
324          * @exception   E_SUCCESS                       The method is successful.
325          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
326          * @exception   E_USER_NOT_CONSENTED    The user blocks an application from calling this method. @b Since: @b 2.1
327          * @remarks             The specific error code can be accessed using the GetLastResult() method.
328          */
329         void SetGeolocationEnabled(bool enable);
330
331         /**
332          * Checks whether a %Web control supports html5 geolocation feature. @n Returns @c true if html5 geolocation feature is enabled.
333          * The default value is @c true.
334          *
335          * @since               2.0
336          *
337          * @return              @c true if html5 geolocation feature is enabled, @n
338          *                                      else @c false
339          */
340         bool IsGeolocationEnabled(void) const;
341
342         /**
343          * Decides if a %Web control saves form data automatically and supports autocomplete feature.
344          *
345          * @since               2.1
346          * @privlevel   public
347          * @privilege   %http://tizen.org/privilege/web.service
348          *
349          * @param[in]   enable                  Set to @c true if the %Web control should save form data automatically and supports autocomplete feature, @n
350          *                                                                      else @c false
351          * @exception   E_SUCCESS                       The method is successful.
352          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
353          * @exception   E_USER_NOT_CONSENTED    The user blocks an application from calling this method.
354          * @remarks             The specific error code can be accessed using the GetLastResult() method.
355          */
356         void SetAutoFormDataShowEnabled(bool enable);
357
358         /**
359          * Checks whether %Web control saves form data automatically and supports autocomplete feature. @n Returns @c true if those are enabled.
360          * The default value is @c true.
361          *
362          * @since               2.1
363          *
364          * @return              @c true if saving form data and autocomplete feature are enabled, @n
365          *                                      else @c false
366          */
367         bool IsAutoFormDataShowEnabled(void) const;
368
369         /**
370          * Decides if a %Web control saves ID/password for login form automatically and supports autofill feature.
371          * 
372          * @since               2.1
373          * @privlevel   public
374          * @privilege   %http://tizen.org/privilege/web.service
375          *
376          * @param[in]   enable                  Set to @c true if the %Web control should save login ID/password automatically and supports autofill feature, @n
377          *                                                                      else @c false
378          * @exception   E_SUCCESS                       The method is successful.
379          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
380          * @exception   E_USER_NOT_CONSENTED    The user blocks an application from calling this method.
381          * @remarks             The specific error code can be accessed using the GetLastResult() method.
382          */
383         void SetAutoLoginFormFillEnabled(bool enable);
384
385         /**
386          * Checks whether %Web control saves ID/password for login form automatically and supports autofill feature. @n Returns @c true if those are enabled.
387          * The default value is @c true.
388          *
389          * @since               2.1
390          *
391          * @return              @c true if saving ID/password for login form and autofill feature are enabled, @n
392          *                                      else @c false
393          */
394         bool IsAutoLoginFormFillEnabled(void) const;
395
396         /**
397          * Gets the hash value of the current instance.
398          *
399          * @since               2.0
400          *
401          * @return              The hash value of the current instance
402          */
403         virtual int GetHashCode(void) const;
404
405         /**
406          * Compares two instances of the %WebSetting class.
407          *
408          * @since               2.0
409          *
410          * @return              @c true if the two instances match, @n
411          *                                      else @c false
412          * @param[in]   obj                             The object to compare with the current instance
413          * @remarks             This method returns @c true if and only if the two instances contain the same elements.
414          * @see                 Tizen::Base::Object::Equals()
415          */
416         virtual bool Equals(const Tizen::Base::Object& obj) const;
417
418         /**
419          * Copying of objects using this copy assignment operator is allowed. 
420          *
421          * @since               2.0
422          *
423          * @param[in]   setting                 The instance of the %WebSetting class to assign from
424          */
425         WebSetting& operator =(const WebSetting& setting);
426
427 private:
428         _WebSettingImpl* __pWebSettingImpl;
429
430         friend class _WebSettingImpl;
431 }; // WebSetting
432
433 }}} // Tizen::Web::Control
434 #endif // _FWEB_CTRL_WEB_SETTING_H_