use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
use objc2_app_kit::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct WKNavigationActionPolicy(pub NSInteger);
impl WKNavigationActionPolicy {
#[doc(alias = "WKNavigationActionPolicyCancel")]
pub const Cancel: Self = Self(0);
#[doc(alias = "WKNavigationActionPolicyAllow")]
pub const Allow: Self = Self(1);
#[doc(alias = "WKNavigationActionPolicyDownload")]
pub const Download: Self = Self(2);
}
unsafe impl Encode for WKNavigationActionPolicy {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for WKNavigationActionPolicy {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct WKNavigationResponsePolicy(pub NSInteger);
impl WKNavigationResponsePolicy {
#[doc(alias = "WKNavigationResponsePolicyCancel")]
pub const Cancel: Self = Self(0);
#[doc(alias = "WKNavigationResponsePolicyAllow")]
pub const Allow: Self = Self(1);
#[doc(alias = "WKNavigationResponsePolicyDownload")]
pub const Download: Self = Self(2);
}
unsafe impl Encode for WKNavigationResponsePolicy {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for WKNavigationResponsePolicy {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_protocol!(
pub unsafe trait WKNavigationDelegate: NSObjectProtocol {
#[cfg(all(
feature = "WKNavigationAction",
feature = "WKWebView",
feature = "block2",
feature = "objc2-app-kit"
))]
#[cfg(target_os = "macos")]
#[optional]
#[method(webView:decidePolicyForNavigationAction:decisionHandler:)]
unsafe fn webView_decidePolicyForNavigationAction_decisionHandler(
&self,
web_view: &WKWebView,
navigation_action: &WKNavigationAction,
decision_handler: &block2::Block<dyn Fn(WKNavigationActionPolicy)>,
);
#[cfg(all(
feature = "WKNavigationAction",
feature = "WKWebView",
feature = "WKWebpagePreferences",
feature = "block2",
feature = "objc2-app-kit"
))]
#[cfg(target_os = "macos")]
#[optional]
#[method(webView:decidePolicyForNavigationAction:preferences:decisionHandler:)]
unsafe fn webView_decidePolicyForNavigationAction_preferences_decisionHandler(
&self,
web_view: &WKWebView,
navigation_action: &WKNavigationAction,
preferences: &WKWebpagePreferences,
decision_handler: &block2::Block<
dyn Fn(WKNavigationActionPolicy, NonNull<WKWebpagePreferences>),
>,
);
#[cfg(all(
feature = "WKNavigationResponse",
feature = "WKWebView",
feature = "block2",
feature = "objc2-app-kit"
))]
#[cfg(target_os = "macos")]
#[optional]
#[method(webView:decidePolicyForNavigationResponse:decisionHandler:)]
unsafe fn webView_decidePolicyForNavigationResponse_decisionHandler(
&self,
web_view: &WKWebView,
navigation_response: &WKNavigationResponse,
decision_handler: &block2::Block<dyn Fn(WKNavigationResponsePolicy)>,
);
#[cfg(all(
feature = "WKNavigation",
feature = "WKWebView",
feature = "objc2-app-kit"
))]
#[cfg(target_os = "macos")]
#[optional]
#[method(webView:didStartProvisionalNavigation:)]
unsafe fn webView_didStartProvisionalNavigation(
&self,
web_view: &WKWebView,
navigation: Option<&WKNavigation>,
);
#[cfg(all(
feature = "WKNavigation",
feature = "WKWebView",
feature = "objc2-app-kit"
))]
#[cfg(target_os = "macos")]
#[optional]
#[method(webView:didReceiveServerRedirectForProvisionalNavigation:)]
unsafe fn webView_didReceiveServerRedirectForProvisionalNavigation(
&self,
web_view: &WKWebView,
navigation: Option<&WKNavigation>,
);
#[cfg(all(
feature = "WKNavigation",
feature = "WKWebView",
feature = "objc2-app-kit"
))]
#[cfg(target_os = "macos")]
#[optional]
#[method(webView:didFailProvisionalNavigation:withError:)]
unsafe fn webView_didFailProvisionalNavigation_withError(
&self,
web_view: &WKWebView,
navigation: Option<&WKNavigation>,
error: &NSError,
);
#[cfg(all(
feature = "WKNavigation",
feature = "WKWebView",
feature = "objc2-app-kit"
))]
#[cfg(target_os = "macos")]
#[optional]
#[method(webView:didCommitNavigation:)]
unsafe fn webView_didCommitNavigation(
&self,
web_view: &WKWebView,
navigation: Option<&WKNavigation>,
);
#[cfg(all(
feature = "WKNavigation",
feature = "WKWebView",
feature = "objc2-app-kit"
))]
#[cfg(target_os = "macos")]
#[optional]
#[method(webView:didFinishNavigation:)]
unsafe fn webView_didFinishNavigation(
&self,
web_view: &WKWebView,
navigation: Option<&WKNavigation>,
);
#[cfg(all(
feature = "WKNavigation",
feature = "WKWebView",
feature = "objc2-app-kit"
))]
#[cfg(target_os = "macos")]
#[optional]
#[method(webView:didFailNavigation:withError:)]
unsafe fn webView_didFailNavigation_withError(
&self,
web_view: &WKWebView,
navigation: Option<&WKNavigation>,
error: &NSError,
);
#[cfg(all(feature = "WKWebView", feature = "block2", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
#[optional]
#[method(webView:didReceiveAuthenticationChallenge:completionHandler:)]
unsafe fn webView_didReceiveAuthenticationChallenge_completionHandler(
&self,
web_view: &WKWebView,
challenge: &NSURLAuthenticationChallenge,
completion_handler: &block2::Block<
dyn Fn(NSURLSessionAuthChallengeDisposition, *mut NSURLCredential),
>,
);
#[cfg(all(feature = "WKWebView", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
#[optional]
#[method(webViewWebContentProcessDidTerminate:)]
unsafe fn webViewWebContentProcessDidTerminate(&self, web_view: &WKWebView);
#[cfg(all(feature = "WKWebView", feature = "block2", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
#[optional]
#[method(webView:authenticationChallenge:shouldAllowDeprecatedTLS:)]
unsafe fn webView_authenticationChallenge_shouldAllowDeprecatedTLS(
&self,
web_view: &WKWebView,
challenge: &NSURLAuthenticationChallenge,
decision_handler: &block2::Block<dyn Fn(Bool)>,
);
#[cfg(all(
feature = "WKDownload",
feature = "WKNavigationAction",
feature = "WKWebView",
feature = "objc2-app-kit"
))]
#[cfg(target_os = "macos")]
#[optional]
#[method(webView:navigationAction:didBecomeDownload:)]
unsafe fn webView_navigationAction_didBecomeDownload(
&self,
web_view: &WKWebView,
navigation_action: &WKNavigationAction,
download: &WKDownload,
);
#[cfg(all(
feature = "WKDownload",
feature = "WKNavigationResponse",
feature = "WKWebView",
feature = "objc2-app-kit"
))]
#[cfg(target_os = "macos")]
#[optional]
#[method(webView:navigationResponse:didBecomeDownload:)]
unsafe fn webView_navigationResponse_didBecomeDownload(
&self,
web_view: &WKWebView,
navigation_response: &WKNavigationResponse,
download: &WKDownload,
);
}
unsafe impl ProtocolType for dyn WKNavigationDelegate {}
);