Merge "Implement some new ewk apis in web view." into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / controls / web-view / web-settings.h
1 #ifndef DALI_TOOLKIT_WEB_SETTINGS_H
2 #define DALI_TOOLKIT_WEB_SETTINGS_H
3
4 /*
5  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <string>
23
24 // INTERNAL INCLUDES
25 #include <dali-toolkit/public-api/dali-toolkit-common.h>
26
27 namespace Dali
28 {
29 class WebEngineSettings;
30
31 namespace Toolkit
32 {
33
34 /**
35  * @addtogroup dali_toolkit_controls_web_view
36  * @{
37  */
38
39 /**
40  * @brief WebEngineSettings is a control for settings of WebView.
41  *
42  *
43  * For working WebEngineSettings, a WebView should be provided.
44  *
45  */
46 class DALI_TOOLKIT_API WebSettings
47 {
48 public:
49   /**
50    * @brief Creates a WebEngineSettings.
51    *
52    * @param[in] settings A settings of web engine.
53    */
54   WebSettings( Dali::WebEngineSettings& settings );
55
56   /**
57    * @brief Destructor.
58    */
59   virtual ~WebSettings() final;
60
61   /**
62    *@brief Allow running mixed contents or not.
63    *
64    * @param[in] allowed if true, allow to run mixed contents,
65    *      otherwise not allow
66    */
67   void AllowMixedContents( bool allowed );
68
69   /**
70    * @brief Enable the spatial navigation or not.
71    *
72    * @param[in] enabled if true, use spatial navigation,
73    *       otherwise to disable
74    */
75   void EnableSpatialNavigation( bool enabled );
76
77   /**
78    * @brief Returns the default font size in pixel. The default value is 16.
79    *
80    * @return The default font size
81    */
82   int GetDefaultFontSize() const;
83
84   /**
85    * @brief Sets the default font size in pixel. The default value is 16.
86    *
87    * @param[in] defaultFontSize A new default font size to set
88    */
89   void SetDefaultFontSize( int defaultFontSize );
90
91   /**
92    * @brief Enables/disables web security.
93    *
94    * @param[in] enabled if true, to enable the web security
95    *       otherwise to disable
96    */
97   void EnableWebSecurity( bool enabled );
98
99   /**
100    * @brief Allow/Disallow file access from external url
101    *
102    * @param[in] allowed if true, to allow file access from external url
103    *       otherwise to disallow
104    */
105   void AllowFileAccessFromExternalUrl( bool allowed );
106
107   /**
108    * @brief Returns whether JavaScript can be executable. The default is true.
109    *
110    * @return true if JavaScript executing is enabled, false otherwise
111    */
112   bool IsJavaScriptEnabled() const;
113
114   /**
115    * @brief Enables/disables JavaScript executing. The default is enabled.
116    *
117    * @param[in] enabled True if JavaScript executing is enabled, false otherwise
118    */
119   void EnableJavaScript( bool enabled );
120
121   /**
122    * @brief Allow if the scripts can open new windows.
123    *
124    * @param[in] allowed if true, the scripts can open new windows,
125    *       otherwise not
126    */
127   void AllowScriptsOpenWindows( bool allowed );
128
129   /**
130    * @brief Returns whether images can be loaded automatically. The default is true.
131    *
132    * @return true if images are loaded automatically, false otherwise
133    */
134   bool AreImagesLoadedAutomatically() const;
135
136   /**
137    * @brief Enables/disables auto loading of images. The default is enabled.
138    *
139    * @param[in] automatic True if images are loaded automatically, false otherwise
140    */
141   void AllowImagesLoadAutomatically( bool automatic );
142
143   /**
144    * @brief Gets the default text encoding name (e.g. UTF-8).
145    *
146    * @return The default text encoding name
147    */
148   std::string GetDefaultTextEncodingName() const;
149
150   /**
151    * @brief Sets the default text encoding name (e.g. UTF-8).
152    *
153    * @param[in] defaultTextEncodingName The default text encoding name
154    */
155   void SetDefaultTextEncodingName( const std::string& defaultTextEncodingName );
156
157 private:
158   Dali::WebEngineSettings& mWebEngineSettings;
159 };
160
161 /**
162  * @}
163  */
164
165 } // namespace Toolkit
166
167 } // namespace Dali
168
169 #endif // DALI_TOOLKIT_WEB_SETTINGS_H