Make AccessibilityManager::SetCurrentFocusActor more usable
[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) 2021 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  * @addtogroup dali_toolkit_controls_web_view
35  * @{
36  */
37
38 /**
39  * @brief WebEngineSettings is a control for settings of WebView.
40  *
41  *
42  * For working WebEngineSettings, a WebView should be provided.
43  *
44  */
45 class DALI_TOOLKIT_API WebSettings
46 {
47 public:
48   /**
49    * @brief Creates a WebEngineSettings.
50    *
51    * @param[in] settings A settings of web engine.
52    */
53   WebSettings(Dali::WebEngineSettings& settings);
54
55   /**
56    * @brief Destructor.
57    */
58   virtual ~WebSettings() final;
59
60   /**
61    *@brief Allow running mixed contents or not.
62    *
63    * @param[in] allowed if true, allow to run mixed contents,
64    *      otherwise not allow
65    */
66   void AllowMixedContents(bool allowed);
67
68   /**
69    * @brief Enable the spatial navigation or not.
70    *
71    * @param[in] enabled if true, use spatial navigation,
72    *       otherwise to disable
73    */
74   void EnableSpatialNavigation(bool enabled);
75
76   /**
77    * @brief Returns the default font size in pixel. The default value is 16.
78    *
79    * @return The default font size
80    */
81   int GetDefaultFontSize() const;
82
83   /**
84    * @brief Sets the default font size in pixel. The default value is 16.
85    *
86    * @param[in] defaultFontSize A new default font size to set
87    */
88   void SetDefaultFontSize(int defaultFontSize);
89
90   /**
91    * @brief Enables/disables web security.
92    *
93    * @param[in] enabled if true, to enable the web security
94    *       otherwise to disable
95    */
96   void EnableWebSecurity(bool enabled);
97
98   /**
99    * @brief Allow/Disallow file access from external url
100    *
101    * @param[in] allowed if true, to allow file access from external url
102    *       otherwise to disallow
103    */
104   void AllowFileAccessFromExternalUrl(bool allowed);
105
106   /**
107    * @brief Returns whether JavaScript can be executable. The default is true.
108    *
109    * @return true if JavaScript executing is enabled, false otherwise
110    */
111   bool IsJavaScriptEnabled() const;
112
113   /**
114    * @brief Enables/disables JavaScript executing. The default is enabled.
115    *
116    * @param[in] enabled True if JavaScript executing is enabled, false otherwise
117    */
118   void EnableJavaScript(bool enabled);
119
120   /**
121    * @brief Allow if the scripts can open new windows.
122    *
123    * @param[in] allowed if true, the scripts can open new windows,
124    *       otherwise not
125    */
126   void AllowScriptsOpenWindows(bool allowed);
127
128   /**
129    * @brief Returns whether images can be loaded automatically. The default is true.
130    *
131    * @return true if images are loaded automatically, false otherwise
132    */
133   bool AreImagesLoadedAutomatically() const;
134
135   /**
136    * @brief Enables/disables auto loading of images. The default is enabled.
137    *
138    * @param[in] automatic True if images are loaded automatically, false otherwise
139    */
140   void AllowImagesLoadAutomatically(bool automatic);
141
142   /**
143    * @brief Gets the default text encoding name (e.g. UTF-8).
144    *
145    * @return The default text encoding name
146    */
147   std::string GetDefaultTextEncodingName() const;
148
149   /**
150    * @brief Sets the default text encoding name (e.g. UTF-8).
151    *
152    * @param[in] defaultTextEncodingName The default text encoding name
153    */
154   void SetDefaultTextEncodingName(const std::string& defaultTextEncodingName);
155
156 private:
157   Dali::WebEngineSettings& mWebEngineSettings;
158 };
159
160 /**
161  * @}
162  */
163
164 } // namespace Toolkit
165
166 } // namespace Dali
167
168 #endif // DALI_TOOLKIT_WEB_SETTINGS_H