apply html5 vibration feature
[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          *
108          * @privlevel   public
109          * @privilege   %http://tizen.org/privilege/web.service
110          *
111          * @param[in]   mode                    A cache mode
112          * @exception   E_SUCCESS                       The method is successful.
113          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
114          * @exception   E_USER_NOT_CONSENTED    The user blocks an application from calling this method. @b Since: @b 2.1
115          * @remarks             The specific error code can be accessed using the GetLastResult() method.
116          */
117         void SetCacheControl(CacheMode mode);
118
119         /**
120          * Sets the font size of the content.
121          *
122          * @since               2.0
123          *
124          * @param[in]   fontSize                The font size
125          */
126         void SetFontSize(int fontSize);
127
128         /**
129          * Sets the text encoding for the content of a %Web control.
130          *
131          * @since               2.0
132          *
133          * @param[in]   encoding                The text encoding
134          */
135         void SetDefaultTextEncoding(const Tizen::Base::String& encoding);
136
137         /**
138          * Enables or disables the use of JavaScript.
139          *
140          * @since               2.0
141          *
142          * @param[in]   enable                  Set to @c true if the %Web control uses JavaScript, @n
143          *                                                                      else @c false
144          */
145         void SetJavascriptEnabled(bool enable);
146
147         /**
148          * Decides if a %Web control loads images included in the content.
149          *
150          * @since               2.0
151          *
152          * @param[in]   enable                  Set to @c true if the %Web control must load images included in the content, @n
153          *                                                                      else @c false
154          */
155         void SetAutoImageLoadEnabled(bool enable);
156
157         /**
158          * Sets the input style of the keypad, which is displayed for the <input> or <textarea> tag.
159          *
160          * @since               2.0
161          *
162          * @param[in]   inputStyle              The input style of keypad
163          * @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.
164          *
165          */
166         void SetInputStyle(Tizen::Ui::Controls::InputStyle inputStyle);
167
168         /**
169          * Gets the value of the cache control strategy for a %Web control. @n
170          * The default is @c WEB_CACHE_VALIDATED.
171          *
172          * @since               2.0
173          *
174          * @return              A cache mode
175          */
176         CacheMode GetCacheControl(void) const;
177
178         /**
179          * Gets the font size of the content. @n
180          * The default is @c 17.
181          *
182          * @since               2.0
183          *
184          * @return              The size of the font
185          */
186         int GetFontSize(void) const;
187
188         /**
189          * Gets the text encoding of the content of a %Web control. @n
190          * The default is UTF-8.
191          *
192          * @since               2.0
193          *
194          * @return              The text encoding
195          */
196         Tizen::Base::String GetDefaultTextEncoding(void) const;
197
198         /**
199          * Checks whether a %Web control uses JavaScript. @n
200          * The default is true.
201          *
202          * @since               2.0
203          *
204          * @return              @c true if JavaScript is enabled and used by a %Web control, @n
205          *                                      else @c false
206          */
207         bool IsJavascriptEnabled(void) const;
208
209         /**
210          * Checks whether a %Web control loads images included in the content automatically. @n
211          * The default is true.
212          *
213          * @since               2.0
214          *
215          * @return              @c true if auto image loading is enabled, @n
216          *                                      else @c false
217          */
218         bool IsAutoImageLoadEnabled(void) const;
219
220         /**
221          * Gets the input style of the keypad, which is displayed for the <input> or <textarea> tag. @n
222          * The default is @c INPUT_STYLE_FULLSCREEN.
223          *
224          * @since               2.0
225          *
226          * @return              The input style of keypad
227          */
228         Tizen::Ui::Controls::InputStyle GetInputStyle(void) const;
229
230         /**
231          * Sets a certificate error handling mode for a %Web control.
232          *
233          * @since               2.0
234          *
235          * @privlevel   public
236          * @privilege   %http://tizen.org/privilege/web.service
237          *
238          * @param[in]   mode                    A certificate error handling mode
239          * @exception   E_SUCCESS                       The method is successful.
240          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
241          * @exception   E_USER_NOT_CONSENTED    The user blocks an application from calling this method. @b Since: @b 2.1
242          * @remarks             The specific error code can be accessed using the GetLastResult() method.
243          */
244         void SetCertificateErrorHandlingMode(CertificateErrorHandlingMode mode);
245
246         /**
247          * Gets the value of the certificate error handling mode for a %Web control. @n
248          * The default is @c WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM.
249          *
250          * @since               2.0
251          *
252          * @return              A certificate error handling mode
253          */
254         CertificateErrorHandlingMode GetCertificateErrorHandlingMode(void) const;
255
256         /**
257          * Sets a user agent for a %Web control.
258          *
259          * @since               2.0
260          *
261          * @param[in]   agent                   The user agent
262          */
263         void SetUserAgent(const Tizen::Base::String& agent);
264
265         /**
266          * Gets a value of user agent for a %Web control.
267          *
268          * @since               2.0
269          *
270          * @return              The value of user agent
271          */
272         Tizen::Base::String GetUserAgent(void) const;
273
274         /**
275          * Decides if a %Web control loads the resized contents to fit width automatically.
276          *
277          * @since               2.0
278          *
279          * @param[in]   enable                  Set to @c true if the %Web control should load contents to fit width, @n
280          *                                                                      else @c false
281          */
282         void SetAutoFittingEnabled(bool enable);
283
284         /**
285          * Checks whether a %Web control loads the resize contents to fit width. @n
286          * The default is true.
287          *
288          * @since               2.0
289          *
290          * @return              @c true if auto fitting is enabled, @n
291          *                                      else @c false
292          */
293         bool IsAutoFittingEnabled(void) const;
294
295         /**
296          * Decides if a %Web control allows JavaScript to open new window.
297          *
298          * @since               2.0
299          *
300          * @param[in]   enable                  Set to @c true if the %Web control should allow JavaScript to open new window, @n
301          *                                                                      else @c false
302          */
303         void SetJavaScriptPopupEnabled(bool enable);
304
305         /**
306          * Checks whether a %Web control allows JavaScript to open new window. Returns true if opening new window by JavaScript is enabled. @n
307          * The default is true.
308          *
309          * @since               2.0
310          *
311          * @return              @c true if opening new window by JavaScript is enabled, @n
312          *                                      else @c false
313          */
314         bool IsJavaScriptPopupEnabled(void) const;
315
316         /**
317          * Decides if a %Web control supports html5 geolocation feature.
318          *
319          * @since               2.0
320          *
321          * @privlevel   public
322          * @privilege   %http://tizen.org/privilege/web.service
323          *
324          * @param[in]   enable                  Set to @c true if the %Web control should support html5 geolocation feature, @n
325          *                                                                      else @c false
326          * @exception   E_SUCCESS                       The method is successful.
327          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
328          * @exception   E_USER_NOT_CONSENTED    The user blocks an application from calling this method. @b Since: @b 2.1
329          * @remarks             The specific error code can be accessed using the GetLastResult() method.
330          */
331         void SetGeolocationEnabled(bool enable);
332
333         /**
334          * Checks whether a %Web control supports html5 geolocation feature. Returns true if html5 geolocation feature is enabled. @n
335          * The default is true.
336          *
337          * @since               2.0
338          *
339          * @return              @c true if html5 geolocation feature is enabled, @n
340          *                                      else @c false
341          */
342         bool IsGeolocationEnabled(void) const;
343
344         /**
345          * Decides if a %Web control saves form data automatically and supports autocomplete feature.
346          *
347          * @since               2.1
348          *
349          * @privlevel   public
350          * @privilege   %http://tizen.org/privilege/web.service
351          *
352          * @param[in]   enable                  Set to @c true if the %Web control should save form data automatically and supports autocomplete feature, @n
353          *                                                                      else @c false
354          * @exception   E_SUCCESS                       The method is successful.
355          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
356          * @exception   E_USER_NOT_CONSENTED    The user blocks an application from calling this method.
357          * @remarks             The specific error code can be accessed using the GetLastResult() method.
358          */
359         void SetAutoFormDataShowEnabled(bool enable);
360
361         /**
362          * Checks whether %Web control saves form data automatically and supports autocomplete feature. Returns true if those are enabled. @n
363          * The default is true.
364          *
365          * @since               2.1
366          *
367          * @return              @c true if saving form data and autocomplete feature are enabled, @n
368          *                                      else @c false
369          */
370         bool IsAutoFormDataShowEnabled(void) const;
371
372         /**
373          * Decides if a %Web control saves id/password for login form automatically and supports autofill feature.
374          * 
375          * @since               2.1
376          *
377          * @privlevel   public
378          * @privilege   %http://tizen.org/privilege/web.service
379          *
380          * @param[in]   enable                  Set to @c true if the %Web control should save login id/password automatically and supports autofill feature, @n
381          *                                                                      else @c false
382          * @exception   E_SUCCESS                       The method is successful.
383          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
384          * @exception   E_USER_NOT_CONSENTED    The user blocks an application from calling this method.
385          * @remarks             The specific error code can be accessed using the GetLastResult() method.
386          */
387         void SetAutoLoginFormFillEnabled(bool enable);
388
389         /**
390          * Checks whether %Web control saves id/password for login form automatically and supports autofill feature. Returns true if those are enabled. @n
391          * The default is true.
392          *
393          * @since               2.1
394          *
395          * @return              @c true if saving id/password for login form and autofill feature are enabled, @n
396          *                                      else @c false
397          */
398         bool IsAutoLoginFormFillEnabled(void) const;
399
400         /**
401          * Gets the hash value of the current instance.
402          *
403          * @since               2.0
404          *
405          * @return              The hash value of the current instance
406          */
407         virtual int GetHashCode(void) const;
408
409         /**
410          * Compares two instances of the %WebSetting class.
411          *
412          * @since               2.0
413          *
414          * @return              @c true if the two instances match, @n
415          *                                      else @c false
416          * @param[in]   obj                             The object to compare with the current instance
417          * @remarks             This method returns @c true if and only if the two instances contain the same elements.
418          * @see                 Tizen::Base::Object::Equals()
419          */
420         virtual bool Equals(const Tizen::Base::Object& obj) const;
421
422         /**
423          * Copying of objects using this copy assignment operator is allowed. 
424          *
425          * @since               2.0
426          *
427          * @param[in]   setting                 The instance of the %WebSetting class to assign from
428          */
429         WebSetting& operator =(const WebSetting& setting);
430
431 private:
432         _WebSettingImpl* __pWebSettingImpl;
433
434         friend class _WebSettingImpl;
435 }; // WebSetting
436
437 }}} // Tizen::Web::Control
438 #endif // _FWEB_CTRL_WEB_SETTING_H_