2 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.ComponentModel;
23 /// WebSettings is a class for settings of web view.
25 [EditorBrowsable(EditorBrowsableState.Never)]
26 public class WebSettings : Disposable
28 private bool allowMixedContents;
29 private bool enableSpatialNavigation;
30 private bool enableWebSecurity;
31 private bool enableCacheBuilder;
32 private bool enableDoNotTrack;
33 private bool allowFileAccessFromExternalUrl;
34 private bool allowScriptsOpenWindows;
35 private bool useScrollbarThumbFocusNotifications;
37 internal WebSettings(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
42 /// Allow Mixed Contents
44 [EditorBrowsable(EditorBrowsableState.Never)]
45 public bool AllowMixedContents
49 return allowMixedContents;
53 allowMixedContents = value;
54 Interop.WebSettings.AllowMixedContents(SwigCPtr, value);
59 /// Enable Spatial Navigation.
61 [EditorBrowsable(EditorBrowsableState.Never)]
62 public bool EnableSpatialNavigation
66 return enableSpatialNavigation;
70 enableSpatialNavigation = value;
71 Interop.WebSettings.EnableSpatialNavigation(SwigCPtr, value);
76 /// Default Font Size.
78 [EditorBrowsable(EditorBrowsableState.Never)]
79 public int DefaultFontSize
83 return Interop.WebSettings.GetDefaultFontSize(SwigCPtr);
87 Interop.WebSettings.SetDefaultFontSize(SwigCPtr, value);
92 /// Enable web security.
94 [EditorBrowsable(EditorBrowsableState.Never)]
95 public bool EnableWebSecurity
99 return enableWebSecurity;
103 enableWebSecurity = value;
104 Interop.WebSettings.EnableWebSecurity(SwigCPtr, value);
109 /// Enable cache builer
111 [EditorBrowsable(EditorBrowsableState.Never)]
112 public bool CacheBuilderEnabled
116 return enableCacheBuilder;
120 enableCacheBuilder = value;
121 Interop.WebSettings.EnableCacheBuilder(SwigCPtr, value);
126 /// Enable do not track, to protect user privacy security.
128 public bool DoNotTrackEnabled
132 return enableDoNotTrack;
136 enableDoNotTrack = value;
137 Interop.WebSettings.EnableDoNotTrack(SwigCPtr, value);
142 /// Use scrollbar thumb focus notifications
144 [EditorBrowsable(EditorBrowsableState.Never)]
145 public bool ScrollbarThumbFocusNotificationsUsed
149 return useScrollbarThumbFocusNotifications;
153 useScrollbarThumbFocusNotifications = value;
154 Interop.WebSettings.UseScrollbarThumbFocusNotifications(SwigCPtr, value);
159 /// Allow File Access From External Url.
161 [EditorBrowsable(EditorBrowsableState.Never)]
162 public bool AllowFileAccessFromExternalUrl
166 return allowFileAccessFromExternalUrl;
170 allowFileAccessFromExternalUrl = value;
171 Interop.WebSettings.AllowFileAccessFromExternalUrl(SwigCPtr, value);
176 /// Enable JavaScript.
178 [EditorBrowsable(EditorBrowsableState.Never)]
179 public bool EnableJavaScript
183 return Interop.WebSettings.IsJavaScriptEnabled(SwigCPtr);
187 Interop.WebSettings.EnableJavaScript(SwigCPtr, value);
192 /// Enable auto fitting
194 [EditorBrowsable(EditorBrowsableState.Never)]
195 public bool AutoFittingEnabled
199 return Interop.WebSettings.IsAutoFittingEnabled(SwigCPtr);
203 Interop.WebSettings.EnableAutoFitting(SwigCPtr, value);
210 [EditorBrowsable(EditorBrowsableState.Never)]
211 public bool PluginsEnabled
215 return Interop.WebSettings.ArePluginsEnabled(SwigCPtr);
219 Interop.WebSettings.EnablePlugins(SwigCPtr, value);
224 /// Enable private browsing
226 [EditorBrowsable(EditorBrowsableState.Never)]
227 public bool PrivateBrowsingEnabled
231 return Interop.WebSettings.IsPrivateBrowsingEnabled(SwigCPtr);
235 Interop.WebSettings.EnablePrivateBrowsing(SwigCPtr, value);
240 /// Enable link magnifier
242 [EditorBrowsable(EditorBrowsableState.Never)]
243 public bool LinkMagnifierEnabled
247 return Interop.WebSettings.IsLinkMagnifierEnabled(SwigCPtr);
251 Interop.WebSettings.EnableLinkMagnifier(SwigCPtr, value);
256 /// Use keypad without user action
258 [EditorBrowsable(EditorBrowsableState.Never)]
259 public bool KeypadWithoutUserActionUsed
263 return Interop.WebSettings.IsKeypadWithoutUserActionUsed(SwigCPtr);
267 Interop.WebSettings.UseKeypadWithoutUserAction(SwigCPtr, value);
272 /// Enable autofill password form
274 [EditorBrowsable(EditorBrowsableState.Never)]
275 public bool AutofillPasswordFormEnabled
279 return Interop.WebSettings.IsAutofillPasswordFormEnabled(SwigCPtr);
283 Interop.WebSettings.EnableAutofillPasswordForm(SwigCPtr, value);
288 /// Enable form candidate data
290 [EditorBrowsable(EditorBrowsableState.Never)]
291 public bool FormCandidateDataEnabled
295 return Interop.WebSettings.IsFormCandidateDataEnabled(SwigCPtr);
299 Interop.WebSettings.EnableFormCandidateData(SwigCPtr, value);
304 /// Enable text selection
306 [EditorBrowsable(EditorBrowsableState.Never)]
307 public bool TextSelectionEnabled
311 return Interop.WebSettings.IsTextSelectionEnabled(SwigCPtr);
315 Interop.WebSettings.EnableTextSelection(SwigCPtr, value);
320 /// Enable text autosizing
322 [EditorBrowsable(EditorBrowsableState.Never)]
323 public bool TextAutosizingEnabled
327 return Interop.WebSettings.IsTextAutosizingEnabled(SwigCPtr);
331 Interop.WebSettings.EnableTextAutosizing(SwigCPtr, value);
336 /// Enable arrow scroll
338 [EditorBrowsable(EditorBrowsableState.Never)]
339 public bool ArrowScrollEnabled
343 return Interop.WebSettings.IsArrowScrollEnabled(SwigCPtr);
347 Interop.WebSettings.EnableArrowScroll(SwigCPtr, value);
354 [EditorBrowsable(EditorBrowsableState.Never)]
355 public bool ClipboardEnabled
359 return Interop.WebSettings.IsClipboardEnabled(SwigCPtr);
363 Interop.WebSettings.EnableClipboard(SwigCPtr, value);
370 [EditorBrowsable(EditorBrowsableState.Never)]
371 public bool ImePanelEnabled
375 return Interop.WebSettings.IsImePanelEnabled(SwigCPtr);
379 Interop.WebSettings.EnableImePanel(SwigCPtr, value);
384 /// Allow Scripts Open Windows.
386 [EditorBrowsable(EditorBrowsableState.Never)]
387 public bool AllowScriptsOpenWindows
391 return allowScriptsOpenWindows;
395 allowScriptsOpenWindows = value;
396 Interop.WebSettings.AllowScriptsOpenWindows(SwigCPtr, value);
401 /// Allow Images Load Automatically.
403 [EditorBrowsable(EditorBrowsableState.Never)]
404 public bool AllowImagesLoadAutomatically
408 return Interop.WebSettings.AreImagesAutomaticallyLoaded(SwigCPtr);
412 Interop.WebSettings.AllowImagesLoadAutomatically(SwigCPtr, value);
417 /// Default Text Encoding Name.
419 [EditorBrowsable(EditorBrowsableState.Never)]
420 public string DefaultTextEncodingName
424 return Interop.WebSettings.GetDefaultTextEncodingName(SwigCPtr);
428 Interop.WebSettings.SetDefaultTextEncodingName(SwigCPtr, value);
432 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WebSettings obj)
434 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;