use crate::common::*;
use crate::AppKit::*;
use crate::Foundation::*;
use crate::WebKit::*;
ns_enum!(
#[underlying(NSInteger)]
pub enum WKNavigationActionPolicy {
WKNavigationActionPolicyCancel = 0,
WKNavigationActionPolicyAllow = 1,
WKNavigationActionPolicyDownload = 2,
}
);
ns_enum!(
#[underlying(NSInteger)]
pub enum WKNavigationResponsePolicy {
WKNavigationResponsePolicyCancel = 0,
WKNavigationResponsePolicyAllow = 1,
WKNavigationResponsePolicyDownload = 2,
}
);
extern_protocol!(
pub unsafe trait WKNavigationDelegate: NSObjectProtocol {
#[cfg(all(feature = "WebKit_WKNavigationAction", feature = "WebKit_WKWebView"))]
#[optional]
#[method(webView:decidePolicyForNavigationAction:decisionHandler:)]
unsafe fn webView_decidePolicyForNavigationAction_decisionHandler(
&self,
web_view: &WKWebView,
navigation_action: &WKNavigationAction,
decision_handler: &Block<(WKNavigationActionPolicy,), ()>,
);
#[cfg(all(
feature = "WebKit_WKNavigationAction",
feature = "WebKit_WKWebView",
feature = "WebKit_WKWebpagePreferences"
))]
#[optional]
#[method(webView:decidePolicyForNavigationAction:preferences:decisionHandler:)]
unsafe fn webView_decidePolicyForNavigationAction_preferences_decisionHandler(
&self,
web_view: &WKWebView,
navigation_action: &WKNavigationAction,
preferences: &WKWebpagePreferences,
decision_handler: &Block<(WKNavigationActionPolicy, NonNull<WKWebpagePreferences>), ()>,
);
#[cfg(all(feature = "WebKit_WKNavigationResponse", feature = "WebKit_WKWebView"))]
#[optional]
#[method(webView:decidePolicyForNavigationResponse:decisionHandler:)]
unsafe fn webView_decidePolicyForNavigationResponse_decisionHandler(
&self,
web_view: &WKWebView,
navigation_response: &WKNavigationResponse,
decision_handler: &Block<(WKNavigationResponsePolicy,), ()>,
);
#[cfg(all(feature = "WebKit_WKNavigation", feature = "WebKit_WKWebView"))]
#[optional]
#[method(webView:didStartProvisionalNavigation:)]
unsafe fn webView_didStartProvisionalNavigation(
&self,
web_view: &WKWebView,
navigation: Option<&WKNavigation>,
);
#[cfg(all(feature = "WebKit_WKNavigation", feature = "WebKit_WKWebView"))]
#[optional]
#[method(webView:didReceiveServerRedirectForProvisionalNavigation:)]
unsafe fn webView_didReceiveServerRedirectForProvisionalNavigation(
&self,
web_view: &WKWebView,
navigation: Option<&WKNavigation>,
);
#[cfg(all(
feature = "Foundation_NSError",
feature = "WebKit_WKNavigation",
feature = "WebKit_WKWebView"
))]
#[optional]
#[method(webView:didFailProvisionalNavigation:withError:)]
unsafe fn webView_didFailProvisionalNavigation_withError(
&self,
web_view: &WKWebView,
navigation: Option<&WKNavigation>,
error: &NSError,
);
#[cfg(all(feature = "WebKit_WKNavigation", feature = "WebKit_WKWebView"))]
#[optional]
#[method(webView:didCommitNavigation:)]
unsafe fn webView_didCommitNavigation(
&self,
web_view: &WKWebView,
navigation: Option<&WKNavigation>,
);
#[cfg(all(feature = "WebKit_WKNavigation", feature = "WebKit_WKWebView"))]
#[optional]
#[method(webView:didFinishNavigation:)]
unsafe fn webView_didFinishNavigation(
&self,
web_view: &WKWebView,
navigation: Option<&WKNavigation>,
);
#[cfg(all(
feature = "Foundation_NSError",
feature = "WebKit_WKNavigation",
feature = "WebKit_WKWebView"
))]
#[optional]
#[method(webView:didFailNavigation:withError:)]
unsafe fn webView_didFailNavigation_withError(
&self,
web_view: &WKWebView,
navigation: Option<&WKNavigation>,
error: &NSError,
);
#[cfg(all(
feature = "Foundation_NSURLAuthenticationChallenge",
feature = "Foundation_NSURLCredential",
feature = "WebKit_WKWebView"
))]
#[optional]
#[method(webView:didReceiveAuthenticationChallenge:completionHandler:)]
unsafe fn webView_didReceiveAuthenticationChallenge_completionHandler(
&self,
web_view: &WKWebView,
challenge: &NSURLAuthenticationChallenge,
completion_handler: &Block<
(NSURLSessionAuthChallengeDisposition, *mut NSURLCredential),
(),
>,
);
#[cfg(feature = "WebKit_WKWebView")]
#[optional]
#[method(webViewWebContentProcessDidTerminate:)]
unsafe fn webViewWebContentProcessDidTerminate(&self, web_view: &WKWebView);
#[cfg(all(
feature = "Foundation_NSURLAuthenticationChallenge",
feature = "WebKit_WKWebView"
))]
#[optional]
#[method(webView:authenticationChallenge:shouldAllowDeprecatedTLS:)]
unsafe fn webView_authenticationChallenge_shouldAllowDeprecatedTLS(
&self,
web_view: &WKWebView,
challenge: &NSURLAuthenticationChallenge,
decision_handler: &Block<(Bool,), ()>,
);
#[cfg(all(
feature = "WebKit_WKDownload",
feature = "WebKit_WKNavigationAction",
feature = "WebKit_WKWebView"
))]
#[optional]
#[method(webView:navigationAction:didBecomeDownload:)]
unsafe fn webView_navigationAction_didBecomeDownload(
&self,
web_view: &WKWebView,
navigation_action: &WKNavigationAction,
download: &WKDownload,
);
#[cfg(all(
feature = "WebKit_WKDownload",
feature = "WebKit_WKNavigationResponse",
feature = "WebKit_WKWebView"
))]
#[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 {}
);