objc2_web_kit/generated/
WKWebView.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-app-kit")]
7#[cfg(target_os = "macos")]
8use objc2_app_kit::*;
9#[cfg(feature = "objc2-core-foundation")]
10use objc2_core_foundation::*;
11use objc2_foundation::*;
12#[cfg(feature = "objc2-security")]
13use objc2_security::*;
14
15use crate::*;
16
17/// [Apple's documentation](https://developer.apple.com/documentation/webkit/wkmediaplaybackstate?language=objc)
18// NS_ENUM
19#[repr(transparent)]
20#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
21pub struct WKMediaPlaybackState(pub NSInteger);
22impl WKMediaPlaybackState {
23    #[doc(alias = "WKMediaPlaybackStateNone")]
24    pub const None: Self = Self(0);
25    #[doc(alias = "WKMediaPlaybackStatePlaying")]
26    pub const Playing: Self = Self(1);
27    #[doc(alias = "WKMediaPlaybackStatePaused")]
28    pub const Paused: Self = Self(2);
29    #[doc(alias = "WKMediaPlaybackStateSuspended")]
30    pub const Suspended: Self = Self(3);
31}
32
33unsafe impl Encode for WKMediaPlaybackState {
34    const ENCODING: Encoding = NSInteger::ENCODING;
35}
36
37unsafe impl RefEncode for WKMediaPlaybackState {
38    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
39}
40
41/// [Apple's documentation](https://developer.apple.com/documentation/webkit/wkmediacapturestate?language=objc)
42// NS_ENUM
43#[repr(transparent)]
44#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
45pub struct WKMediaCaptureState(pub NSInteger);
46impl WKMediaCaptureState {
47    #[doc(alias = "WKMediaCaptureStateNone")]
48    pub const None: Self = Self(0);
49    #[doc(alias = "WKMediaCaptureStateActive")]
50    pub const Active: Self = Self(1);
51    #[doc(alias = "WKMediaCaptureStateMuted")]
52    pub const Muted: Self = Self(2);
53}
54
55unsafe impl Encode for WKMediaCaptureState {
56    const ENCODING: Encoding = NSInteger::ENCODING;
57}
58
59unsafe impl RefEncode for WKMediaCaptureState {
60    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
61}
62
63/// [Apple's documentation](https://developer.apple.com/documentation/webkit/wkfullscreenstate?language=objc)
64// NS_ENUM
65#[repr(transparent)]
66#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
67pub struct WKFullscreenState(pub NSInteger);
68impl WKFullscreenState {
69    #[doc(alias = "WKFullscreenStateNotInFullscreen")]
70    pub const NotInFullscreen: Self = Self(0);
71    #[doc(alias = "WKFullscreenStateEnteringFullscreen")]
72    pub const EnteringFullscreen: Self = Self(1);
73    #[doc(alias = "WKFullscreenStateInFullscreen")]
74    pub const InFullscreen: Self = Self(2);
75    #[doc(alias = "WKFullscreenStateExitingFullscreen")]
76    pub const ExitingFullscreen: Self = Self(3);
77}
78
79unsafe impl Encode for WKFullscreenState {
80    const ENCODING: Encoding = NSInteger::ENCODING;
81}
82
83unsafe impl RefEncode for WKFullscreenState {
84    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
85}
86
87extern_class!(
88    /// [Apple's documentation](https://developer.apple.com/documentation/webkit/wkwebview?language=objc)
89    #[unsafe(super(NSView, NSResponder, NSObject))]
90    #[thread_kind = MainThreadOnly]
91    #[derive(Debug, PartialEq, Eq, Hash)]
92    #[cfg(feature = "objc2-app-kit")]
93    #[cfg(target_os = "macos")]
94    pub struct WKWebView;
95);
96
97#[cfg(feature = "objc2-app-kit")]
98#[cfg(target_os = "macos")]
99extern_conformance!(
100    unsafe impl NSAccessibility for WKWebView {}
101);
102
103#[cfg(feature = "objc2-app-kit")]
104#[cfg(target_os = "macos")]
105extern_conformance!(
106    unsafe impl NSAccessibilityElementProtocol for WKWebView {}
107);
108
109#[cfg(feature = "objc2-app-kit")]
110#[cfg(target_os = "macos")]
111extern_conformance!(
112    unsafe impl NSAnimatablePropertyContainer for WKWebView {}
113);
114
115#[cfg(feature = "objc2-app-kit")]
116#[cfg(target_os = "macos")]
117extern_conformance!(
118    unsafe impl NSAppearanceCustomization for WKWebView {}
119);
120
121#[cfg(feature = "objc2-app-kit")]
122#[cfg(target_os = "macos")]
123extern_conformance!(
124    unsafe impl NSCoding for WKWebView {}
125);
126
127#[cfg(feature = "objc2-app-kit")]
128#[cfg(target_os = "macos")]
129extern_conformance!(
130    unsafe impl NSDraggingDestination for WKWebView {}
131);
132
133#[cfg(feature = "objc2-app-kit")]
134#[cfg(target_os = "macos")]
135extern_conformance!(
136    unsafe impl NSObjectProtocol for WKWebView {}
137);
138
139#[cfg(feature = "objc2-app-kit")]
140#[cfg(target_os = "macos")]
141extern_conformance!(
142    unsafe impl NSUserInterfaceItemIdentification for WKWebView {}
143);
144
145#[cfg(feature = "objc2-app-kit")]
146#[cfg(target_os = "macos")]
147impl WKWebView {
148    extern_methods!(
149        #[cfg(feature = "WKWebViewConfiguration")]
150        /// A copy of the configuration with which the web view was
151        /// initialized.
152        #[unsafe(method(configuration))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn configuration(&self) -> Retained<WKWebViewConfiguration>;
155
156        #[cfg(feature = "WKNavigationDelegate")]
157        /// The web view's navigation delegate.
158        #[unsafe(method(navigationDelegate))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn navigationDelegate(
161            &self,
162        ) -> Option<Retained<ProtocolObject<dyn WKNavigationDelegate>>>;
163
164        #[cfg(feature = "WKNavigationDelegate")]
165        /// This is a [weak property][objc2::topics::weak_property].
166        /// Setter for [`navigationDelegate`][Self::navigationDelegate].
167        #[unsafe(method(setNavigationDelegate:))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn setNavigationDelegate(
170            &self,
171            navigation_delegate: Option<&ProtocolObject<dyn WKNavigationDelegate>>,
172        );
173
174        #[cfg(feature = "WKUIDelegate")]
175        /// The web view's user interface delegate.
176        #[unsafe(method(UIDelegate))]
177        #[unsafe(method_family = none)]
178        pub unsafe fn UIDelegate(&self) -> Option<Retained<ProtocolObject<dyn WKUIDelegate>>>;
179
180        #[cfg(feature = "WKUIDelegate")]
181        /// This is a [weak property][objc2::topics::weak_property].
182        /// Setter for [`UIDelegate`][Self::UIDelegate].
183        #[unsafe(method(setUIDelegate:))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn setUIDelegate(&self, ui_delegate: Option<&ProtocolObject<dyn WKUIDelegate>>);
186
187        #[cfg(feature = "WKBackForwardList")]
188        /// The web view's back-forward list.
189        #[unsafe(method(backForwardList))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn backForwardList(&self) -> Retained<WKBackForwardList>;
192
193        #[cfg(all(feature = "WKWebViewConfiguration", feature = "objc2-core-foundation"))]
194        /// Returns a web view initialized with a specified frame and
195        /// configuration.
196        ///
197        /// Parameter `frame`: The frame for the new web view.
198        ///
199        /// Parameter `configuration`: The configuration for the new web view.
200        ///
201        /// Returns: An initialized web view, or nil if the object could not be
202        /// initialized.
203        ///
204        /// This is a designated initializer. You can use
205        ///
206        /// ```text
207        ///  -initWithFrame:
208        /// ```
209        ///
210        /// to initialize an instance with the default
211        /// configuration. The initializer copies the specified configuration, so
212        /// mutating the configuration after invoking the initializer has no effect
213        /// on the web view.
214        #[unsafe(method(initWithFrame:configuration:))]
215        #[unsafe(method_family = init)]
216        pub unsafe fn initWithFrame_configuration(
217            this: Allocated<Self>,
218            frame: CGRect,
219            configuration: &WKWebViewConfiguration,
220        ) -> Retained<Self>;
221
222        #[unsafe(method(initWithCoder:))]
223        #[unsafe(method_family = init)]
224        pub unsafe fn initWithCoder(
225            this: Allocated<Self>,
226            coder: &NSCoder,
227        ) -> Option<Retained<Self>>;
228
229        #[cfg(feature = "WKNavigation")]
230        /// Navigates to a requested URL.
231        ///
232        /// Parameter `request`: The request specifying the URL to which to navigate.
233        ///
234        /// Returns: A new navigation for the given request.
235        #[unsafe(method(loadRequest:))]
236        #[unsafe(method_family = none)]
237        pub unsafe fn loadRequest(&self, request: &NSURLRequest) -> Option<Retained<WKNavigation>>;
238
239        #[cfg(feature = "WKNavigation")]
240        /// Navigates to the requested file URL on the filesystem.
241        ///
242        /// Parameter `URL`: The file URL to which to navigate.
243        ///
244        /// Parameter `readAccessURL`: The URL to allow read access to.
245        ///
246        /// If readAccessURL references a single file, only that file may be loaded by WebKit.
247        /// If readAccessURL references a directory, files inside that file may be loaded by WebKit.
248        ///
249        /// Returns: A new navigation for the given file URL.
250        #[unsafe(method(loadFileURL:allowingReadAccessToURL:))]
251        #[unsafe(method_family = none)]
252        pub unsafe fn loadFileURL_allowingReadAccessToURL(
253            &self,
254            url: &NSURL,
255            read_access_url: &NSURL,
256        ) -> Option<Retained<WKNavigation>>;
257
258        #[cfg(feature = "WKNavigation")]
259        /// Sets the webpage contents and base URL.
260        ///
261        /// Parameter `string`: The string to use as the contents of the webpage.
262        ///
263        /// Parameter `baseURL`: A URL that is used to resolve relative URLs within the document.
264        ///
265        /// Returns: A new navigation.
266        #[unsafe(method(loadHTMLString:baseURL:))]
267        #[unsafe(method_family = none)]
268        pub unsafe fn loadHTMLString_baseURL(
269            &self,
270            string: &NSString,
271            base_url: Option<&NSURL>,
272        ) -> Option<Retained<WKNavigation>>;
273
274        #[cfg(feature = "WKNavigation")]
275        /// Sets the webpage contents and base URL.
276        ///
277        /// Parameter `data`: The data to use as the contents of the webpage.
278        ///
279        /// Parameter `MIMEType`: The MIME type of the data.
280        ///
281        /// Parameter `characterEncodingName`: The data's character encoding name.
282        ///
283        /// Parameter `baseURL`: A URL that is used to resolve relative URLs within the document.
284        ///
285        /// Returns: A new navigation.
286        #[unsafe(method(loadData:MIMEType:characterEncodingName:baseURL:))]
287        #[unsafe(method_family = none)]
288        pub unsafe fn loadData_MIMEType_characterEncodingName_baseURL(
289            &self,
290            data: &NSData,
291            mime_type: &NSString,
292            character_encoding_name: &NSString,
293            base_url: &NSURL,
294        ) -> Option<Retained<WKNavigation>>;
295
296        #[cfg(all(feature = "WKBackForwardListItem", feature = "WKNavigation"))]
297        /// Navigates to an item from the back-forward list and sets it
298        /// as the current item.
299        ///
300        /// Parameter `item`: The item to which to navigate. Must be one of the items in the
301        /// web view's back-forward list.
302        ///
303        /// Returns: A new navigation to the requested item, or nil if it is already
304        /// the current item or is not part of the web view's back-forward list.
305        ///
306        /// See also: backForwardList
307        #[unsafe(method(goToBackForwardListItem:))]
308        #[unsafe(method_family = none)]
309        pub unsafe fn goToBackForwardListItem(
310            &self,
311            item: &WKBackForwardListItem,
312        ) -> Option<Retained<WKNavigation>>;
313
314        /// The page title.
315        ///
316        ///
317        /// ```text
318        ///  WKWebView
319        /// ```
320        ///
321        /// is key-value observing (KVO) compliant
322        /// for this property.
323        #[unsafe(method(title))]
324        #[unsafe(method_family = none)]
325        pub unsafe fn title(&self) -> Option<Retained<NSString>>;
326
327        /// The active URL.
328        ///
329        /// This is the URL that should be reflected in the user
330        /// interface.
331        ///
332        /// ```text
333        ///  WKWebView
334        /// ```
335        ///
336        /// is key-value observing (KVO) compliant for this
337        /// property.
338        #[unsafe(method(URL))]
339        #[unsafe(method_family = none)]
340        pub unsafe fn URL(&self) -> Option<Retained<NSURL>>;
341
342        /// A Boolean value indicating whether the view is currently
343        /// loading content.
344        ///
345        ///
346        /// ```text
347        ///  WKWebView
348        /// ```
349        ///
350        /// is key-value observing (KVO) compliant
351        /// for this property.
352        #[unsafe(method(isLoading))]
353        #[unsafe(method_family = none)]
354        pub unsafe fn isLoading(&self) -> bool;
355
356        /// An estimate of what fraction of the current navigation has been completed.
357        ///
358        /// This value ranges from 0.0 to 1.0 based on the total number of
359        /// bytes expected to be received, including the main document and all of its
360        /// potential subresources. After a navigation completes, the value remains at 1.0
361        /// until a new navigation starts, at which point it is reset to 0.0.
362        ///
363        /// ```text
364        ///  WKWebView
365        /// ```
366        ///
367        /// is key-value observing (KVO) compliant for this
368        /// property.
369        #[unsafe(method(estimatedProgress))]
370        #[unsafe(method_family = none)]
371        pub unsafe fn estimatedProgress(&self) -> c_double;
372
373        /// A Boolean value indicating whether all resources on the page
374        /// have been loaded over securely encrypted connections.
375        ///
376        ///
377        /// ```text
378        ///  WKWebView
379        /// ```
380        ///
381        /// is key-value observing (KVO) compliant
382        /// for this property.
383        #[unsafe(method(hasOnlySecureContent))]
384        #[unsafe(method_family = none)]
385        pub unsafe fn hasOnlySecureContent(&self) -> bool;
386
387        #[cfg(feature = "objc2-security")]
388        /// A SecTrustRef for the currently committed navigation.
389        ///
390        ///
391        /// ```text
392        ///  WKWebView
393        /// ```
394        ///
395        /// is key-value observing (KVO) compliant
396        /// for this property.
397        #[unsafe(method(serverTrust))]
398        #[unsafe(method_family = none)]
399        pub unsafe fn serverTrust(&self) -> Option<Retained<SecTrust>>;
400
401        /// A Boolean value indicating whether there is a back item in
402        /// the back-forward list that can be navigated to.
403        ///
404        ///
405        /// ```text
406        ///  WKWebView
407        /// ```
408        ///
409        /// is key-value observing (KVO) compliant
410        /// for this property.
411        ///
412        /// See also: backForwardList.
413        #[unsafe(method(canGoBack))]
414        #[unsafe(method_family = none)]
415        pub unsafe fn canGoBack(&self) -> bool;
416
417        /// A Boolean value indicating whether there is a forward item in
418        /// the back-forward list that can be navigated to.
419        ///
420        ///
421        /// ```text
422        ///  WKWebView
423        /// ```
424        ///
425        /// is key-value observing (KVO) compliant
426        /// for this property.
427        ///
428        /// See also: backForwardList.
429        #[unsafe(method(canGoForward))]
430        #[unsafe(method_family = none)]
431        pub unsafe fn canGoForward(&self) -> bool;
432
433        #[cfg(feature = "WKNavigation")]
434        /// Navigates to the back item in the back-forward list.
435        ///
436        /// Returns: A new navigation to the requested item, or nil if there is no back
437        /// item in the back-forward list.
438        #[unsafe(method(goBack))]
439        #[unsafe(method_family = none)]
440        pub unsafe fn goBack(&self) -> Option<Retained<WKNavigation>>;
441
442        #[cfg(feature = "WKNavigation")]
443        /// Navigates to the forward item in the back-forward list.
444        ///
445        /// Returns: A new navigation to the requested item, or nil if there is no
446        /// forward item in the back-forward list.
447        #[unsafe(method(goForward))]
448        #[unsafe(method_family = none)]
449        pub unsafe fn goForward(&self) -> Option<Retained<WKNavigation>>;
450
451        #[cfg(feature = "WKNavigation")]
452        /// Reloads the current page.
453        ///
454        /// Returns: A new navigation representing the reload.
455        #[unsafe(method(reload))]
456        #[unsafe(method_family = none)]
457        pub unsafe fn reload(&self) -> Option<Retained<WKNavigation>>;
458
459        #[cfg(feature = "WKNavigation")]
460        /// Reloads the current page, performing end-to-end revalidation
461        /// using cache-validating conditionals if possible.
462        ///
463        /// Returns: A new navigation representing the reload.
464        #[unsafe(method(reloadFromOrigin))]
465        #[unsafe(method_family = none)]
466        pub unsafe fn reloadFromOrigin(&self) -> Option<Retained<WKNavigation>>;
467
468        /// Stops loading all resources on the current page.
469        #[unsafe(method(stopLoading))]
470        #[unsafe(method_family = none)]
471        pub unsafe fn stopLoading(&self);
472
473        #[cfg(feature = "block2")]
474        #[unsafe(method(evaluateJavaScript:completionHandler:))]
475        #[unsafe(method_family = none)]
476        pub unsafe fn evaluateJavaScript_completionHandler(
477            &self,
478            java_script_string: &NSString,
479            completion_handler: Option<&block2::DynBlock<dyn Fn(*mut AnyObject, *mut NSError)>>,
480        );
481
482        #[cfg(all(
483            feature = "WKContentWorld",
484            feature = "WKFrameInfo",
485            feature = "block2"
486        ))]
487        #[unsafe(method(evaluateJavaScript:inFrame:inContentWorld:completionHandler:))]
488        #[unsafe(method_family = none)]
489        pub unsafe fn evaluateJavaScript_inFrame_inContentWorld_completionHandler(
490            &self,
491            java_script_string: &NSString,
492            frame: Option<&WKFrameInfo>,
493            content_world: &WKContentWorld,
494            completion_handler: Option<&block2::DynBlock<dyn Fn(*mut AnyObject, *mut NSError)>>,
495        );
496
497        #[cfg(all(
498            feature = "WKContentWorld",
499            feature = "WKFrameInfo",
500            feature = "block2"
501        ))]
502        #[unsafe(method(callAsyncJavaScript:arguments:inFrame:inContentWorld:completionHandler:))]
503        #[unsafe(method_family = none)]
504        pub unsafe fn callAsyncJavaScript_arguments_inFrame_inContentWorld_completionHandler(
505            &self,
506            function_body: &NSString,
507            arguments: Option<&NSDictionary<NSString, AnyObject>>,
508            frame: Option<&WKFrameInfo>,
509            content_world: &WKContentWorld,
510            completion_handler: Option<&block2::DynBlock<dyn Fn(*mut AnyObject, *mut NSError)>>,
511        );
512
513        #[cfg(feature = "block2")]
514        /// Closes all out-of-window media presentations in a WKWebView.
515        ///
516        /// Includes picture-in-picture and fullscreen.
517        #[unsafe(method(closeAllMediaPresentationsWithCompletionHandler:))]
518        #[unsafe(method_family = none)]
519        pub unsafe fn closeAllMediaPresentationsWithCompletionHandler(
520            &self,
521            completion_handler: Option<&block2::DynBlock<dyn Fn()>>,
522        );
523
524        #[deprecated]
525        #[unsafe(method(closeAllMediaPresentations))]
526        #[unsafe(method_family = none)]
527        pub unsafe fn closeAllMediaPresentations(&self);
528
529        #[cfg(feature = "block2")]
530        /// Pauses media playback in WKWebView.
531        ///
532        /// Pauses media playback. Media in the page can be restarted by calling play() on a media element or resume() on an AudioContext in JavaScript. A user can also use media controls to play media content after it has been paused.
533        #[unsafe(method(pauseAllMediaPlaybackWithCompletionHandler:))]
534        #[unsafe(method_family = none)]
535        pub unsafe fn pauseAllMediaPlaybackWithCompletionHandler(
536            &self,
537            completion_handler: Option<&block2::DynBlock<dyn Fn()>>,
538        );
539
540        #[cfg(feature = "block2")]
541        #[deprecated]
542        #[unsafe(method(pauseAllMediaPlayback:))]
543        #[unsafe(method_family = none)]
544        pub unsafe fn pauseAllMediaPlayback(
545            &self,
546            completion_handler: Option<&block2::DynBlock<dyn Fn()>>,
547        );
548
549        #[cfg(feature = "block2")]
550        /// Suspends or resumes all media playback in WKWebView.
551        ///
552        /// Parameter `suspended`: Whether media playback should be suspended or resumed.
553        ///
554        /// If suspended is true, this pauses media playback and blocks all attempts by the page or the user to resume until setAllMediaPlaybackSuspended is called again with suspended set to false. Media playback should always be suspended and resumed in pairs.
555        #[unsafe(method(setAllMediaPlaybackSuspended:completionHandler:))]
556        #[unsafe(method_family = none)]
557        pub unsafe fn setAllMediaPlaybackSuspended_completionHandler(
558            &self,
559            suspended: bool,
560            completion_handler: Option<&block2::DynBlock<dyn Fn()>>,
561        );
562
563        #[cfg(feature = "block2")]
564        #[deprecated]
565        #[unsafe(method(resumeAllMediaPlayback:))]
566        #[unsafe(method_family = none)]
567        pub unsafe fn resumeAllMediaPlayback(
568            &self,
569            completion_handler: Option<&block2::DynBlock<dyn Fn()>>,
570        );
571
572        #[cfg(feature = "block2")]
573        #[deprecated]
574        #[unsafe(method(suspendAllMediaPlayback:))]
575        #[unsafe(method_family = none)]
576        pub unsafe fn suspendAllMediaPlayback(
577            &self,
578            completion_handler: Option<&block2::DynBlock<dyn Fn()>>,
579        );
580
581        #[cfg(feature = "block2")]
582        /// Get the current media playback state of a WKWebView.
583        ///
584        /// Parameter `completionHandler`: A block to invoke with the return value of the function call.
585        ///
586        /// If media playback exists, WKMediaPlaybackState will be one of three
587        /// values: WKMediaPlaybackPaused, WKMediaPlaybackSuspended, or WKMediaPlaybackPlaying.
588        /// If no media playback exists in the current WKWebView, WKMediaPlaybackState will equal
589        /// WKMediaPlaybackStateNone.
590        #[unsafe(method(requestMediaPlaybackStateWithCompletionHandler:))]
591        #[unsafe(method_family = none)]
592        pub unsafe fn requestMediaPlaybackStateWithCompletionHandler(
593            &self,
594            completion_handler: &block2::DynBlock<dyn Fn(WKMediaPlaybackState)>,
595        );
596
597        #[cfg(feature = "block2")]
598        #[deprecated]
599        #[unsafe(method(requestMediaPlaybackState:))]
600        #[unsafe(method_family = none)]
601        pub unsafe fn requestMediaPlaybackState(
602            &self,
603            completion_handler: &block2::DynBlock<dyn Fn(WKMediaPlaybackState)>,
604        );
605
606        /// The state of camera capture on a web page.
607        ///
608        ///
609        /// ```text
610        ///  WKWebView
611        /// ```
612        ///
613        /// is key-value observing (KVO) compliant
614        /// for this property.
615        #[unsafe(method(cameraCaptureState))]
616        #[unsafe(method_family = none)]
617        pub unsafe fn cameraCaptureState(&self) -> WKMediaCaptureState;
618
619        /// The state of microphone capture on a web page.
620        ///
621        ///
622        /// ```text
623        ///  WKWebView
624        /// ```
625        ///
626        /// is key-value observing (KVO) compliant
627        /// for this property.
628        #[unsafe(method(microphoneCaptureState))]
629        #[unsafe(method_family = none)]
630        pub unsafe fn microphoneCaptureState(&self) -> WKMediaCaptureState;
631
632        #[cfg(feature = "block2")]
633        /// Set camera capture state of a WKWebView.
634        ///
635        /// Parameter `state`: State to apply for capture.
636        ///
637        /// Parameter `completionHandler`: A block to invoke after the camera state has been changed.
638        ///
639        /// If value is WKMediaCaptureStateNone, this will stop any camera capture.
640        /// If value is WKMediaCaptureStateMuted, any active camera capture will become muted.
641        /// If value is WKMediaCaptureStateActive, any muted camera capture will become active.
642        #[unsafe(method(setCameraCaptureState:completionHandler:))]
643        #[unsafe(method_family = none)]
644        pub unsafe fn setCameraCaptureState_completionHandler(
645            &self,
646            state: WKMediaCaptureState,
647            completion_handler: Option<&block2::DynBlock<dyn Fn()>>,
648        );
649
650        #[cfg(feature = "block2")]
651        /// Set microphone capture state of a WKWebView.
652        ///
653        /// Parameter `state`: state to apply for capture.
654        ///
655        /// Parameter `completionHandler`: A block to invoke after the microphone state has been changed.
656        ///
657        /// If value is WKMediaCaptureStateNone, this will stop any microphone capture.
658        /// If value is WKMediaCaptureStateMuted, any active microphone capture will become muted.
659        /// If value is WKMediaCaptureStateActive, any muted microphone capture will become active.
660        #[unsafe(method(setMicrophoneCaptureState:completionHandler:))]
661        #[unsafe(method_family = none)]
662        pub unsafe fn setMicrophoneCaptureState_completionHandler(
663            &self,
664            state: WKMediaCaptureState,
665            completion_handler: Option<&block2::DynBlock<dyn Fn()>>,
666        );
667
668        #[cfg(all(feature = "WKSnapshotConfiguration", feature = "block2"))]
669        #[unsafe(method(takeSnapshotWithConfiguration:completionHandler:))]
670        #[unsafe(method_family = none)]
671        pub unsafe fn takeSnapshotWithConfiguration_completionHandler(
672            &self,
673            snapshot_configuration: Option<&WKSnapshotConfiguration>,
674            completion_handler: &block2::DynBlock<dyn Fn(*mut NSImage, *mut NSError)>,
675        );
676
677        #[cfg(all(feature = "WKPDFConfiguration", feature = "block2"))]
678        /// Create a PDF document representation from the web page currently displayed in the WKWebView
679        ///
680        /// Parameter `pdfConfiguration`: An object that specifies how the PDF capture is configured.
681        ///
682        /// Parameter `completionHandler`: A block to invoke when the pdf document data is ready.
683        ///
684        /// If the WKPDFConfiguration is nil, the method will create a PDF document representing the bounds of the currently displayed web page.
685        /// The completionHandler is passed the resulting PDF document data or an error.
686        /// The data can be used to create a PDFDocument object.
687        /// If the data is written to a file the resulting file is a valid PDF document.
688        #[unsafe(method(createPDFWithConfiguration:completionHandler:))]
689        #[unsafe(method_family = none)]
690        pub unsafe fn createPDFWithConfiguration_completionHandler(
691            &self,
692            pdf_configuration: Option<&WKPDFConfiguration>,
693            completion_handler: &block2::DynBlock<dyn Fn(*mut NSData, *mut NSError)>,
694        );
695
696        #[cfg(feature = "block2")]
697        #[unsafe(method(createWebArchiveDataWithCompletionHandler:))]
698        #[unsafe(method_family = none)]
699        pub unsafe fn createWebArchiveDataWithCompletionHandler(
700            &self,
701            completion_handler: &block2::DynBlock<dyn Fn(*mut NSData, *mut NSError)>,
702        );
703
704        /// A Boolean value indicating whether horizontal swipe gestures
705        /// will trigger back-forward list navigations.
706        ///
707        /// The default value is NO.
708        #[unsafe(method(allowsBackForwardNavigationGestures))]
709        #[unsafe(method_family = none)]
710        pub unsafe fn allowsBackForwardNavigationGestures(&self) -> bool;
711
712        /// Setter for [`allowsBackForwardNavigationGestures`][Self::allowsBackForwardNavigationGestures].
713        #[unsafe(method(setAllowsBackForwardNavigationGestures:))]
714        #[unsafe(method_family = none)]
715        pub unsafe fn setAllowsBackForwardNavigationGestures(
716            &self,
717            allows_back_forward_navigation_gestures: bool,
718        );
719
720        /// The custom user agent string or nil if no custom user agent string has been set.
721        #[unsafe(method(customUserAgent))]
722        #[unsafe(method_family = none)]
723        pub unsafe fn customUserAgent(&self) -> Option<Retained<NSString>>;
724
725        /// Setter for [`customUserAgent`][Self::customUserAgent].
726        #[unsafe(method(setCustomUserAgent:))]
727        #[unsafe(method_family = none)]
728        pub unsafe fn setCustomUserAgent(&self, custom_user_agent: Option<&NSString>);
729
730        /// A Boolean value indicating whether link preview is allowed for any
731        /// links inside this WKWebView.
732        ///
733        /// The default value is YES on Mac and iOS.
734        #[unsafe(method(allowsLinkPreview))]
735        #[unsafe(method_family = none)]
736        pub unsafe fn allowsLinkPreview(&self) -> bool;
737
738        /// Setter for [`allowsLinkPreview`][Self::allowsLinkPreview].
739        #[unsafe(method(setAllowsLinkPreview:))]
740        #[unsafe(method_family = none)]
741        pub unsafe fn setAllowsLinkPreview(&self, allows_link_preview: bool);
742
743        #[unsafe(method(allowsMagnification))]
744        #[unsafe(method_family = none)]
745        pub unsafe fn allowsMagnification(&self) -> bool;
746
747        /// Setter for [`allowsMagnification`][Self::allowsMagnification].
748        #[unsafe(method(setAllowsMagnification:))]
749        #[unsafe(method_family = none)]
750        pub unsafe fn setAllowsMagnification(&self, allows_magnification: bool);
751
752        #[cfg(feature = "objc2-core-foundation")]
753        #[unsafe(method(magnification))]
754        #[unsafe(method_family = none)]
755        pub unsafe fn magnification(&self) -> CGFloat;
756
757        #[cfg(feature = "objc2-core-foundation")]
758        /// Setter for [`magnification`][Self::magnification].
759        #[unsafe(method(setMagnification:))]
760        #[unsafe(method_family = none)]
761        pub unsafe fn setMagnification(&self, magnification: CGFloat);
762
763        #[cfg(feature = "objc2-core-foundation")]
764        #[unsafe(method(setMagnification:centeredAtPoint:))]
765        #[unsafe(method_family = none)]
766        pub unsafe fn setMagnification_centeredAtPoint(
767            &self,
768            magnification: CGFloat,
769            point: CGPoint,
770        );
771
772        #[cfg(feature = "objc2-core-foundation")]
773        #[unsafe(method(pageZoom))]
774        #[unsafe(method_family = none)]
775        pub unsafe fn pageZoom(&self) -> CGFloat;
776
777        #[cfg(feature = "objc2-core-foundation")]
778        /// Setter for [`pageZoom`][Self::pageZoom].
779        #[unsafe(method(setPageZoom:))]
780        #[unsafe(method_family = none)]
781        pub unsafe fn setPageZoom(&self, page_zoom: CGFloat);
782
783        #[cfg(all(
784            feature = "WKFindConfiguration",
785            feature = "WKFindResult",
786            feature = "block2"
787        ))]
788        #[unsafe(method(findString:withConfiguration:completionHandler:))]
789        #[unsafe(method_family = none)]
790        pub unsafe fn findString_withConfiguration_completionHandler(
791            &self,
792            string: &NSString,
793            configuration: Option<&WKFindConfiguration>,
794            completion_handler: &block2::DynBlock<dyn Fn(NonNull<WKFindResult>)>,
795        );
796
797        #[unsafe(method(handlesURLScheme:))]
798        #[unsafe(method_family = none)]
799        pub unsafe fn handlesURLScheme(url_scheme: &NSString, mtm: MainThreadMarker) -> bool;
800
801        #[cfg(all(feature = "WKDownload", feature = "block2"))]
802        #[unsafe(method(startDownloadUsingRequest:completionHandler:))]
803        #[unsafe(method_family = none)]
804        pub unsafe fn startDownloadUsingRequest_completionHandler(
805            &self,
806            request: &NSURLRequest,
807            completion_handler: &block2::DynBlock<dyn Fn(NonNull<WKDownload>)>,
808        );
809
810        #[cfg(all(feature = "WKDownload", feature = "block2"))]
811        #[unsafe(method(resumeDownloadFromResumeData:completionHandler:))]
812        #[unsafe(method_family = none)]
813        pub unsafe fn resumeDownloadFromResumeData_completionHandler(
814            &self,
815            resume_data: &NSData,
816            completion_handler: &block2::DynBlock<dyn Fn(NonNull<WKDownload>)>,
817        );
818
819        #[unsafe(method(mediaType))]
820        #[unsafe(method_family = none)]
821        pub unsafe fn mediaType(&self) -> Option<Retained<NSString>>;
822
823        /// Setter for [`mediaType`][Self::mediaType].
824        #[unsafe(method(setMediaType:))]
825        #[unsafe(method_family = none)]
826        pub unsafe fn setMediaType(&self, media_type: Option<&NSString>);
827
828        #[unsafe(method(interactionState))]
829        #[unsafe(method_family = none)]
830        pub unsafe fn interactionState(&self) -> Option<Retained<AnyObject>>;
831
832        /// Setter for [`interactionState`][Self::interactionState].
833        #[unsafe(method(setInteractionState:))]
834        #[unsafe(method_family = none)]
835        pub unsafe fn setInteractionState(&self, interaction_state: Option<&AnyObject>);
836
837        #[cfg(feature = "WKNavigation")]
838        /// Sets the webpage contents from the passed data as if it was the
839        /// response to the supplied request. The request is never actually sent to the
840        /// supplied URL, though loads of resources defined in the NSData object would
841        /// be performed.
842        ///
843        /// Parameter `request`: The request specifying the base URL and other loading details
844        /// to be used while interpreting the supplied data object.
845        ///
846        /// Parameter `response`: A response that is used to interpret the supplied data object.
847        ///
848        /// Parameter `data`: The data to use as the contents of the webpage.
849        ///
850        /// Returns: A new navigation.
851        #[unsafe(method(loadSimulatedRequest:response:responseData:))]
852        #[unsafe(method_family = none)]
853        pub unsafe fn loadSimulatedRequest_response_responseData(
854            &self,
855            request: &NSURLRequest,
856            response: &NSURLResponse,
857            data: &NSData,
858        ) -> Retained<WKNavigation>;
859
860        #[cfg(feature = "WKNavigation")]
861        #[deprecated]
862        #[unsafe(method(loadSimulatedRequest:withResponse:responseData:))]
863        #[unsafe(method_family = none)]
864        pub unsafe fn loadSimulatedRequest_withResponse_responseData(
865            &self,
866            request: &NSURLRequest,
867            response: &NSURLResponse,
868            data: &NSData,
869        ) -> Retained<WKNavigation>;
870
871        #[cfg(feature = "WKNavigation")]
872        /// Navigates to the requested file URL on the filesystem.
873        ///
874        /// Parameter `request`: The request specifying the file URL to which to navigate.
875        ///
876        /// Parameter `readAccessURL`: The URL to allow read access to.
877        ///
878        /// If readAccessURL references a single file, only that file may be
879        /// loaded by WebKit.
880        /// If readAccessURL references a directory, files inside that file may be loaded by WebKit.
881        ///
882        /// Returns: A new navigation for the given file URL.
883        #[unsafe(method(loadFileRequest:allowingReadAccessToURL:))]
884        #[unsafe(method_family = none)]
885        pub unsafe fn loadFileRequest_allowingReadAccessToURL(
886            &self,
887            request: &NSURLRequest,
888            read_access_url: &NSURL,
889        ) -> Retained<WKNavigation>;
890
891        #[cfg(feature = "WKNavigation")]
892        /// Sets the webpage contents from the passed HTML string as if it was
893        /// the response to the supplied request. The request is never actually sent to the
894        /// supplied URL, though loads of resources defined in the HTML string would be
895        /// performed.
896        ///
897        /// Parameter `request`: The request specifying the base URL and other loading details
898        /// to be used while interpreting the supplied data object.
899        ///
900        /// Parameter `string`: The data to use as the contents of the webpage.
901        ///
902        /// Returns: A new navigation.
903        #[unsafe(method(loadSimulatedRequest:responseHTMLString:))]
904        #[unsafe(method_family = none)]
905        pub unsafe fn loadSimulatedRequest_responseHTMLString(
906            &self,
907            request: &NSURLRequest,
908            string: &NSString,
909        ) -> Retained<WKNavigation>;
910
911        #[cfg(feature = "WKNavigation")]
912        #[deprecated]
913        #[unsafe(method(loadSimulatedRequest:withResponseHTMLString:))]
914        #[unsafe(method_family = none)]
915        pub unsafe fn loadSimulatedRequest_withResponseHTMLString(
916            &self,
917            request: &NSURLRequest,
918            string: &NSString,
919        ) -> Retained<WKNavigation>;
920
921        #[unsafe(method(printOperationWithPrintInfo:))]
922        #[unsafe(method_family = none)]
923        pub unsafe fn printOperationWithPrintInfo(
924            &self,
925            print_info: &NSPrintInfo,
926        ) -> Retained<NSPrintOperation>;
927
928        #[unsafe(method(themeColor))]
929        #[unsafe(method_family = none)]
930        pub unsafe fn themeColor(&self) -> Option<Retained<NSColor>>;
931
932        #[unsafe(method(underPageBackgroundColor))]
933        #[unsafe(method_family = none)]
934        pub unsafe fn underPageBackgroundColor(&self) -> Retained<NSColor>;
935
936        /// Setter for [`underPageBackgroundColor`][Self::underPageBackgroundColor].
937        #[unsafe(method(setUnderPageBackgroundColor:))]
938        #[unsafe(method_family = none)]
939        pub unsafe fn setUnderPageBackgroundColor(
940            &self,
941            under_page_background_color: Option<&NSColor>,
942        );
943
944        /// A WKWebView's fullscreen state.
945        ///
946        ///
947        /// ```text
948        ///  WKWebView @link is key-value observing (KVO) compliant for this property. When an element
949        ///  in the WKWebView enters fullscreen, WebKit will replace the WKWebView in the application view hierarchy with
950        ///  a "placeholder" view, and move the WKWebView into a fullscreen window. When the element exits fullscreen later,
951        ///  the WKWebView will be moved back into the application view hierarchy. An application may need to adjust/restore
952        ///  its native UI components when the fullscreen state changes. The application should observe the fullscreenState
953        ///  property of WKWebView in order to receive notifications regarding the fullscreen state change.
954        ///  
955        ///
956        /// ```
957        #[unsafe(method(fullscreenState))]
958        #[unsafe(method_family = none)]
959        pub unsafe fn fullscreenState(&self) -> WKFullscreenState;
960
961        #[unsafe(method(minimumViewportInset))]
962        #[unsafe(method_family = none)]
963        pub unsafe fn minimumViewportInset(&self) -> NSEdgeInsets;
964
965        #[unsafe(method(maximumViewportInset))]
966        #[unsafe(method_family = none)]
967        pub unsafe fn maximumViewportInset(&self) -> NSEdgeInsets;
968
969        #[unsafe(method(setMinimumViewportInset:maximumViewportInset:))]
970        #[unsafe(method_family = none)]
971        pub unsafe fn setMinimumViewportInset_maximumViewportInset(
972            &self,
973            minimum_viewport_inset: NSEdgeInsets,
974            maximum_viewport_inset: NSEdgeInsets,
975        );
976
977        /// Controls whether this
978        ///
979        /// ```text
980        ///  WKWebView
981        /// ```
982        ///
983        /// is inspectable in Web Inspector.
984        ///
985        /// The default value is NO.
986        #[unsafe(method(isInspectable))]
987        #[unsafe(method_family = none)]
988        pub unsafe fn isInspectable(&self) -> bool;
989
990        /// Setter for [`isInspectable`][Self::isInspectable].
991        #[unsafe(method(setInspectable:))]
992        #[unsafe(method_family = none)]
993        pub unsafe fn setInspectable(&self, inspectable: bool);
994
995        /// A Boolean value indicating whether Writing Tools is active for the view.
996        ///
997        ///
998        /// ```text
999        ///  WKWebView
1000        /// ```
1001        ///
1002        /// is key-value observing (KVO) compliant for this property.
1003        #[unsafe(method(isWritingToolsActive))]
1004        #[unsafe(method_family = none)]
1005        pub unsafe fn isWritingToolsActive(&self) -> bool;
1006    );
1007}
1008
1009/// Methods declared on superclass `NSView`.
1010#[cfg(feature = "objc2-app-kit")]
1011#[cfg(target_os = "macos")]
1012impl WKWebView {
1013    extern_methods!(
1014        #[unsafe(method(initWithFrame:))]
1015        #[unsafe(method_family = init)]
1016        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
1017    );
1018}
1019
1020/// Methods declared on superclass `NSResponder`.
1021#[cfg(feature = "objc2-app-kit")]
1022#[cfg(target_os = "macos")]
1023impl WKWebView {
1024    extern_methods!(
1025        #[unsafe(method(init))]
1026        #[unsafe(method_family = init)]
1027        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1028    );
1029}
1030
1031/// Methods declared on superclass `NSObject`.
1032#[cfg(feature = "objc2-app-kit")]
1033#[cfg(target_os = "macos")]
1034impl WKWebView {
1035    extern_methods!(
1036        #[unsafe(method(new))]
1037        #[unsafe(method_family = new)]
1038        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
1039    );
1040}
1041
1042/// WKIBActions.
1043#[cfg(feature = "objc2-app-kit")]
1044#[cfg(target_os = "macos")]
1045impl WKWebView {
1046    extern_methods!(
1047        /// Action method that navigates to the back item in the
1048        /// back-forward list.
1049        ///
1050        /// Parameter `sender`: The object that sent this message.
1051        #[unsafe(method(goBack:))]
1052        #[unsafe(method_family = none)]
1053        pub unsafe fn goBack_(&self, sender: Option<&AnyObject>);
1054
1055        /// Action method that navigates to the forward item in the
1056        /// back-forward list.
1057        ///
1058        /// Parameter `sender`: The object that sent this message.
1059        #[unsafe(method(goForward:))]
1060        #[unsafe(method_family = none)]
1061        pub unsafe fn goForward_(&self, sender: Option<&AnyObject>);
1062
1063        /// Action method that reloads the current page.
1064        ///
1065        /// Parameter `sender`: The object that sent this message.
1066        #[unsafe(method(reload:))]
1067        #[unsafe(method_family = none)]
1068        pub unsafe fn reload_(&self, sender: Option<&AnyObject>);
1069
1070        /// Action method that reloads the current page, performing
1071        /// end-to-end revalidation using cache-validating conditionals if possible.
1072        ///
1073        /// Parameter `sender`: The object that sent this message.
1074        #[unsafe(method(reloadFromOrigin:))]
1075        #[unsafe(method_family = none)]
1076        pub unsafe fn reloadFromOrigin_(&self, sender: Option<&AnyObject>);
1077
1078        /// Action method that stops loading all resources on the current
1079        /// page.
1080        ///
1081        /// Parameter `sender`: The object that sent this message.
1082        #[unsafe(method(stopLoading:))]
1083        #[unsafe(method_family = none)]
1084        pub unsafe fn stopLoading_(&self, sender: Option<&AnyObject>);
1085    );
1086}
1087
1088#[cfg(feature = "objc2-app-kit")]
1089#[cfg(target_os = "macos")]
1090extern_conformance!(
1091    unsafe impl NSUserInterfaceValidations for WKWebView {}
1092);
1093
1094/// WKNSTextFinderClient.
1095#[cfg(feature = "objc2-app-kit")]
1096#[cfg(target_os = "macos")]
1097impl WKWebView {
1098    extern_methods!();
1099}
1100
1101#[cfg(feature = "objc2-app-kit")]
1102#[cfg(target_os = "macos")]
1103extern_conformance!(
1104    unsafe impl NSTextFinderClient for WKWebView {}
1105);
1106
1107/// WKDeprecated.
1108#[cfg(feature = "objc2-app-kit")]
1109#[cfg(target_os = "macos")]
1110impl WKWebView {
1111    extern_methods!(
1112        #[deprecated]
1113        #[unsafe(method(certificateChain))]
1114        #[unsafe(method_family = none)]
1115        pub unsafe fn certificateChain(&self) -> Retained<NSArray>;
1116    );
1117}