Trait WebPolicyDelegate

Source
pub unsafe trait WebPolicyDelegate: NSObjectProtocol {
    // Provided methods
    unsafe fn webView_decidePolicyForNavigationAction_request_frame_decisionListener(
        &self,
        web_view: Option<&WebView>,
        action_information: Option<&NSDictionary>,
        request: Option<&NSURLRequest>,
        frame: Option<&WebFrame>,
        listener: Option<&ProtocolObject<dyn WebPolicyDecisionListener>>,
    )
       where Self: Sized + Message { ... }
    unsafe fn webView_decidePolicyForNewWindowAction_request_newFrameName_decisionListener(
        &self,
        web_view: Option<&WebView>,
        action_information: Option<&NSDictionary>,
        request: Option<&NSURLRequest>,
        frame_name: Option<&NSString>,
        listener: Option<&ProtocolObject<dyn WebPolicyDecisionListener>>,
    )
       where Self: Sized + Message { ... }
    unsafe fn webView_decidePolicyForMIMEType_request_frame_decisionListener(
        &self,
        web_view: Option<&WebView>,
        type: Option<&NSString>,
        request: Option<&NSURLRequest>,
        frame: Option<&WebFrame>,
        listener: Option<&ProtocolObject<dyn WebPolicyDecisionListener>>,
    )
       where Self: Sized + Message { ... }
    unsafe fn webView_unableToImplementPolicyWithError_frame(
        &self,
        web_view: Option<&WebView>,
        error: Option<&NSError>,
        frame: Option<&WebFrame>,
    )
       where Self: Sized + Message { ... }
}
👎Deprecated
Available on crate feature WebPolicyDelegate only.
Expand description

While loading a URL, WebKit asks the WebPolicyDelegate for policies that determine the action of what to do with the URL or the data that the URL represents. Typically, the policy handler methods are called in this order:

decidePolicyForNewWindowAction:request:newFrameName:decisionListener: (at most once) <BR

decidePolicyForNavigationAction:request:frame:decisionListener: (zero or more times) <BR

decidePolicyForMIMEType:request:frame: (zero or more times) <BR

New window policy is always checked. Navigation policy is checked for the initial load and every redirect unless blocked by an earlier policy. Content policy is checked once the content type is known, unless an earlier policy prevented it.

In rare cases, content policy might be checked more than once. This occurs when loading a “multipart/x-mixed-replace” document, also known as “server push”. In this case, multiple documents come in one navigation, with each replacing the last. In this case, conent policy will be checked for each one.

See also Apple’s documentation

Provided Methods§

Source

unsafe fn webView_decidePolicyForNavigationAction_request_frame_decisionListener( &self, web_view: Option<&WebView>, action_information: Option<&NSDictionary>, request: Option<&NSURLRequest>, frame: Option<&WebFrame>, listener: Option<&ProtocolObject<dyn WebPolicyDecisionListener>>, )
where Self: Sized + Message,

👎Deprecated
Available on crate feature WebFrame and crate feature WebView and crate feature objc2-app-kit and macOS only.

This method is called to decide what to do with a proposed navigation.

Parameter actionInformation: Dictionary that describes the action that triggered this navigation.

Parameter request: The request for the proposed navigation

Parameter frame: The WebFrame in which the navigation is happening

Parameter listener: The object to call when the decision is made

This method will be called before loading starts, and on every redirect.

Source

unsafe fn webView_decidePolicyForNewWindowAction_request_newFrameName_decisionListener( &self, web_view: Option<&WebView>, action_information: Option<&NSDictionary>, request: Option<&NSURLRequest>, frame_name: Option<&NSString>, listener: Option<&ProtocolObject<dyn WebPolicyDecisionListener>>, )
where Self: Sized + Message,

👎Deprecated
Available on crate feature WebView and crate feature objc2-app-kit and macOS only.

This method is called to decide what to do with an targetted nagivation that would open a new window.

Parameter actionInformation: Dictionary that describes the action that triggered this navigation.

Parameter request: The request for the proposed navigation

Parameter frameName: The frame in which the navigation is taking place

Parameter listener: The object to call when the decision is made

This method is provided so that modified clicks on a targetted link which opens a new frame can prevent the new window from being opened if they decide to do something else, like download or present the new frame in a specialized way.

If this method picks a policy of Use, the new window will be opened, and decidePolicyForNavigationAction:request:frame:decisionListner: will be called with a WebNavigationType of WebNavigationTypeOther in its action. This is to avoid possible confusion about the modifiers.

Source

unsafe fn webView_decidePolicyForMIMEType_request_frame_decisionListener( &self, web_view: Option<&WebView>, type: Option<&NSString>, request: Option<&NSURLRequest>, frame: Option<&WebFrame>, listener: Option<&ProtocolObject<dyn WebPolicyDecisionListener>>, )
where Self: Sized + Message,

👎Deprecated
Available on crate feature WebFrame and crate feature WebView and crate feature objc2-app-kit and macOS only.

Returns the policy for content which has been partially loaded. Sent after webView:didStartProvisionalLoadForFrame: is sent on the WebFrameLoadDelegate.

Parameter type: MIME type for the resource.

Parameter request: A NSURLRequest for the partially loaded content.

Parameter frame: The frame which is loading the URL.

Parameter listener: The object to call when the decision is made

Source

unsafe fn webView_unableToImplementPolicyWithError_frame( &self, web_view: Option<&WebView>, error: Option<&NSError>, frame: Option<&WebFrame>, )
where Self: Sized + Message,

👎Deprecated
Available on crate feature WebFrame and crate feature WebView and crate feature objc2-app-kit and macOS only.

Called when a WebPolicy could not be implemented. It is up to the client to display appropriate feedback.

Parameter error: The error that caused the policy to not be implemented.

Parameter frame: The frame in which the policy could not be implemented.

Trait Implementations§

Source§

impl ProtocolType for dyn WebPolicyDelegate

Source§

const NAME: &'static str = "WebPolicyDelegate"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn WebPolicyDelegate

Implementations on Foreign Types§

Source§

impl<T> WebPolicyDelegate for ProtocolObject<T>

Implementors§