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 mixedContentsAllowed;
29 private bool spatialNavigationEnabled;
30 private bool webSecurityEnabled;
31 private bool cacheBuilderEnabled;
32 private bool doNotTrackEnabled;
33 private bool fileAccessFromExternalUrlAllowed;
34 private bool scriptsOpenWindowsAllowed;
35 private bool scrollbarThumbFocusNotificationsUsed;
36 private bool viewportMetaTag;
38 internal WebSettings(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
43 /// Allows mixed contents or not.
45 [EditorBrowsable(EditorBrowsableState.Never)]
46 public bool MixedContentsAllowed
50 return mixedContentsAllowed;
54 Interop.WebSettings.AllowMixedContents(SwigCPtr, value);
55 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
56 mixedContentsAllowed = value;
61 /// Enables spatial navigation or not.
63 [EditorBrowsable(EditorBrowsableState.Never)]
64 public bool SpatialNavigationEnabled
68 return spatialNavigationEnabled;
72 Interop.WebSettings.EnableSpatialNavigation(SwigCPtr, value);
73 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
74 spatialNavigationEnabled = value;
79 /// Default Font Size.
81 [EditorBrowsable(EditorBrowsableState.Never)]
82 public int DefaultFontSize
86 return Interop.WebSettings.GetDefaultFontSize(SwigCPtr);
90 Interop.WebSettings.SetDefaultFontSize(SwigCPtr, value);
91 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
96 /// Enables web security or not.
98 [EditorBrowsable(EditorBrowsableState.Never)]
99 public bool WebSecurityEnabled
103 return webSecurityEnabled;
107 Interop.WebSettings.EnableWebSecurity(SwigCPtr, value);
108 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
109 webSecurityEnabled = value;
114 /// Enable cache builer
116 [EditorBrowsable(EditorBrowsableState.Never)]
117 public bool CacheBuilderEnabled
121 return cacheBuilderEnabled;
125 Interop.WebSettings.EnableCacheBuilder(SwigCPtr, value);
126 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
127 cacheBuilderEnabled = value;
132 /// Enable do not track, to protect user privacy security.
134 public bool DoNotTrackEnabled
138 return doNotTrackEnabled;
142 Interop.WebSettings.EnableDoNotTrack(SwigCPtr, value);
143 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
144 doNotTrackEnabled = value;
149 /// Use scrollbar thumb focus notifications
151 [EditorBrowsable(EditorBrowsableState.Never)]
152 public bool ScrollbarThumbFocusNotificationsUsed
156 return scrollbarThumbFocusNotificationsUsed;
160 Interop.WebSettings.UseScrollbarThumbFocusNotifications(SwigCPtr, value);
161 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
162 scrollbarThumbFocusNotificationsUsed = value;
167 /// Allows file access from external url or not.
169 [EditorBrowsable(EditorBrowsableState.Never)]
170 public bool FileAccessFromExternalUrlAllowed
174 return fileAccessFromExternalUrlAllowed;
178 Interop.WebSettings.AllowFileAccessFromExternalUrl(SwigCPtr, value);
179 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
180 fileAccessFromExternalUrlAllowed = value;
185 /// Enables JavaScript or not.
187 [EditorBrowsable(EditorBrowsableState.Never)]
188 public bool JavaScriptEnabled
192 return Interop.WebSettings.IsJavaScriptEnabled(SwigCPtr);
196 Interop.WebSettings.EnableJavaScript(SwigCPtr, value);
197 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
202 /// Enable auto fitting
204 [EditorBrowsable(EditorBrowsableState.Never)]
205 public bool AutoFittingEnabled
209 return Interop.WebSettings.IsAutoFittingEnabled(SwigCPtr);
213 Interop.WebSettings.EnableAutoFitting(SwigCPtr, value);
214 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
221 [EditorBrowsable(EditorBrowsableState.Never)]
222 public bool PluginsEnabled
226 return Interop.WebSettings.ArePluginsEnabled(SwigCPtr);
230 Interop.WebSettings.EnablePlugins(SwigCPtr, value);
231 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
236 /// Enable private browsing
238 [EditorBrowsable(EditorBrowsableState.Never)]
239 public bool PrivateBrowsingEnabled
243 return Interop.WebSettings.IsPrivateBrowsingEnabled(SwigCPtr);
247 Interop.WebSettings.EnablePrivateBrowsing(SwigCPtr, value);
248 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
253 /// Enable link magnifier
255 [EditorBrowsable(EditorBrowsableState.Never)]
256 public bool LinkMagnifierEnabled
260 return Interop.WebSettings.IsLinkMagnifierEnabled(SwigCPtr);
264 Interop.WebSettings.EnableLinkMagnifier(SwigCPtr, value);
265 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
270 /// Use keypad without user action
272 [EditorBrowsable(EditorBrowsableState.Never)]
273 public bool KeypadWithoutUserActionUsed
277 return Interop.WebSettings.IsKeypadWithoutUserActionUsed(SwigCPtr);
281 Interop.WebSettings.UseKeypadWithoutUserAction(SwigCPtr, value);
282 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
287 /// Enable autofill password form
289 [EditorBrowsable(EditorBrowsableState.Never)]
290 public bool AutofillPasswordFormEnabled
294 return Interop.WebSettings.IsAutofillPasswordFormEnabled(SwigCPtr);
298 Interop.WebSettings.EnableAutofillPasswordForm(SwigCPtr, value);
299 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
304 /// Enable form candidate data
306 [EditorBrowsable(EditorBrowsableState.Never)]
307 public bool FormCandidateDataEnabled
311 return Interop.WebSettings.IsFormCandidateDataEnabled(SwigCPtr);
315 Interop.WebSettings.EnableFormCandidateData(SwigCPtr, value);
316 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
321 /// Enable text selection
323 [EditorBrowsable(EditorBrowsableState.Never)]
324 public bool TextSelectionEnabled
328 return Interop.WebSettings.IsTextSelectionEnabled(SwigCPtr);
332 Interop.WebSettings.EnableTextSelection(SwigCPtr, value);
333 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
338 /// Enable text autosizing
340 [EditorBrowsable(EditorBrowsableState.Never)]
341 public bool TextAutosizingEnabled
345 return Interop.WebSettings.IsTextAutosizingEnabled(SwigCPtr);
349 Interop.WebSettings.EnableTextAutosizing(SwigCPtr, value);
350 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
355 /// Enable arrow scroll
357 [EditorBrowsable(EditorBrowsableState.Never)]
358 public bool ArrowScrollEnabled
362 return Interop.WebSettings.IsArrowScrollEnabled(SwigCPtr);
366 Interop.WebSettings.EnableArrowScroll(SwigCPtr, value);
367 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
374 [EditorBrowsable(EditorBrowsableState.Never)]
375 public bool ClipboardEnabled
379 return Interop.WebSettings.IsClipboardEnabled(SwigCPtr);
383 Interop.WebSettings.EnableClipboard(SwigCPtr, value);
384 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
391 [EditorBrowsable(EditorBrowsableState.Never)]
392 public bool ImePanelEnabled
396 return Interop.WebSettings.IsImePanelEnabled(SwigCPtr);
400 Interop.WebSettings.EnableImePanel(SwigCPtr, value);
401 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
406 /// Allows scripts open windows or not.
408 [EditorBrowsable(EditorBrowsableState.Never)]
409 public bool ScriptsOpenWindowsAllowed
413 return scriptsOpenWindowsAllowed;
417 Interop.WebSettings.AllowScriptsOpenWindows(SwigCPtr, value);
418 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
419 scriptsOpenWindowsAllowed = value;
424 /// Allow images load automatically or not.
426 [EditorBrowsable(EditorBrowsableState.Never)]
427 public bool AutomaticImageLoadingAllowed
431 return Interop.WebSettings.AreImagesLoadedAutomatically(SwigCPtr);
435 Interop.WebSettings.AllowImagesLoadAutomatically(SwigCPtr, value);
436 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
441 /// Default text encoding name.
443 [EditorBrowsable(EditorBrowsableState.Never)]
444 public string DefaultTextEncodingName
448 return Interop.WebSettings.GetDefaultTextEncodingName(SwigCPtr);
452 Interop.WebSettings.SetDefaultTextEncodingName(SwigCPtr, value);
453 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
458 /// Viewport meta tag.
460 [EditorBrowsable(EditorBrowsableState.Never)]
461 public bool ViewportMetaTag
465 return viewportMetaTag;
469 Interop.WebSettings.SetViewportMetaTag(SwigCPtr, value);
470 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
471 viewportMetaTag = value;
478 [EditorBrowsable(EditorBrowsableState.Never)]
479 public bool ZoomForced
483 return Interop.WebSettings.IsZoomForced(SwigCPtr);
487 Interop.WebSettings.SetForceZoom(SwigCPtr, value);
488 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
495 [EditorBrowsable(EditorBrowsableState.Never)]
496 public bool TextZoomEnabled
500 return Interop.WebSettings.IsTextZoomEnabled(SwigCPtr);
504 Interop.WebSettings.SetTextZoomEnabled(SwigCPtr, value);
505 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
510 /// Enable extra feature
512 /// <param name="str">The string of extra feature.</param>
513 /// <param name="tag">Enable or disable.</param>
514 [EditorBrowsable(EditorBrowsableState.Never)]
515 public void EnableExtraFeature(string str, bool tag)
517 Interop.WebSettings.SetExtraFeature(SwigCPtr, str, tag);
518 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
522 /// Enable extra feature
524 /// <param name="str">The string of extra feature.</param>
525 [EditorBrowsable(EditorBrowsableState.Never)]
526 public bool IsExtraFeatureEnabled(string str)
528 bool ret = Interop.WebSettings.IsExtraFeatureEnabled(SwigCPtr, str);
529 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();