Trait WebResourceLoadDelegate

Source
pub unsafe trait WebResourceLoadDelegate: NSObjectProtocol {
    // Provided methods
    unsafe fn webView_identifierForInitialRequest_fromDataSource(
        &self,
        sender: Option<&WebView>,
        request: Option<&NSURLRequest>,
        data_source: Option<&WebDataSource>,
    ) -> Option<Retained<AnyObject>>
       where Self: Sized + Message { ... }
    unsafe fn webView_resource_willSendRequest_redirectResponse_fromDataSource(
        &self,
        sender: Option<&WebView>,
        identifier: Option<&AnyObject>,
        request: Option<&NSURLRequest>,
        redirect_response: Option<&NSURLResponse>,
        data_source: Option<&WebDataSource>,
    ) -> Option<Retained<NSURLRequest>>
       where Self: Sized + Message { ... }
    unsafe fn webView_resource_didReceiveAuthenticationChallenge_fromDataSource(
        &self,
        sender: Option<&WebView>,
        identifier: Option<&AnyObject>,
        challenge: Option<&NSURLAuthenticationChallenge>,
        data_source: Option<&WebDataSource>,
    )
       where Self: Sized + Message { ... }
    unsafe fn webView_resource_didCancelAuthenticationChallenge_fromDataSource(
        &self,
        sender: Option<&WebView>,
        identifier: Option<&AnyObject>,
        challenge: Option<&NSURLAuthenticationChallenge>,
        data_source: Option<&WebDataSource>,
    )
       where Self: Sized + Message { ... }
    unsafe fn webView_resource_didReceiveResponse_fromDataSource(
        &self,
        sender: Option<&WebView>,
        identifier: Option<&AnyObject>,
        response: Option<&NSURLResponse>,
        data_source: Option<&WebDataSource>,
    )
       where Self: Sized + Message { ... }
    unsafe fn webView_resource_didReceiveContentLength_fromDataSource(
        &self,
        sender: Option<&WebView>,
        identifier: Option<&AnyObject>,
        length: NSInteger,
        data_source: Option<&WebDataSource>,
    )
       where Self: Sized + Message { ... }
    unsafe fn webView_resource_didFinishLoadingFromDataSource(
        &self,
        sender: Option<&WebView>,
        identifier: Option<&AnyObject>,
        data_source: Option<&WebDataSource>,
    )
       where Self: Sized + Message { ... }
    unsafe fn webView_resource_didFailLoadingWithError_fromDataSource(
        &self,
        sender: Option<&WebView>,
        identifier: Option<&AnyObject>,
        error: Option<&NSError>,
        data_source: Option<&WebDataSource>,
    )
       where Self: Sized + Message { ... }
    unsafe fn webView_plugInFailedWithError_dataSource(
        &self,
        sender: Option<&WebView>,
        error: Option<&NSError>,
        data_source: Option<&WebDataSource>,
    )
       where Self: Sized + Message { ... }
}
👎Deprecated
Available on crate feature WebResourceLoadDelegate only.
Expand description

Implementors of this protocol will receive messages indicating that a resource is about to be loaded, data has been received for a resource, an error has been received for a resource, and completion of a resource load. Implementors are also given the opportunity to mutate requests before they are sent. The various progress methods of this protocol all receive an identifier as the parameter. This identifier can be used to track messages associated with a single resource. For example, a single resource may generate multiple resource:willSendRequest:redirectResponse:fromDataSource: messages as it’s URL is redirected.

See also Apple’s documentation

Provided Methods§

Source

unsafe fn webView_identifierForInitialRequest_fromDataSource( &self, sender: Option<&WebView>, request: Option<&NSURLRequest>, data_source: Option<&WebDataSource>, ) -> Option<Retained<AnyObject>>
where Self: Sized + Message,

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

Parameter sender: The WebView sending the message.

Parameter request: The request about to be sent.

Parameter dataSource: The datasource that initiated the load.

An implementor of WebResourceLoadDelegate should provide an identifier that can be used to track the load of a single resource. This identifier will be passed as the first argument for all of the other WebResourceLoadDelegate methods. The identifier is useful to track changes to a resources request, which will be provided by one or more calls to resource:willSendRequest:redirectResponse:fromDataSource:.

Returns: An identifier that will be passed back to the implementor for each callback. The identifier will be retained.

Source

unsafe fn webView_resource_willSendRequest_redirectResponse_fromDataSource( &self, sender: Option<&WebView>, identifier: Option<&AnyObject>, request: Option<&NSURLRequest>, redirect_response: Option<&NSURLResponse>, data_source: Option<&WebDataSource>, ) -> Option<Retained<NSURLRequest>>
where Self: Sized + Message,

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

This message is sent before a load is initiated. The request may be modified as necessary by the receiver.

Parameter sender: The WebView sending the message.

Parameter identifier: An identifier that can be used to track the progress of a resource load across multiple call backs.

Parameter request: The request about to be sent.

Parameter redirectResponse: If the request is being made in response to a redirect we received, the response that conveyed that redirect.

Parameter dataSource: The dataSource that initiated the load.

Returns: Returns the request, which may be mutated by the implementor, although typically will be request.

Source

unsafe fn webView_resource_didReceiveAuthenticationChallenge_fromDataSource( &self, sender: Option<&WebView>, identifier: Option<&AnyObject>, challenge: Option<&NSURLAuthenticationChallenge>, data_source: Option<&WebDataSource>, )
where Self: Sized + Message,

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

Start authentication for the resource, providing a challenge

Call useCredential::, continueWithoutCredential or cancel on the challenge when done.

Parameter challenge: The NSURLAuthenticationChallenge to start authentication for

If you do not implement this delegate method, WebKit will handle authentication automatically by prompting with a sheet on the window that the WebView is associated with.

Source

unsafe fn webView_resource_didCancelAuthenticationChallenge_fromDataSource( &self, sender: Option<&WebView>, identifier: Option<&AnyObject>, challenge: Option<&NSURLAuthenticationChallenge>, data_source: Option<&WebDataSource>, )
where Self: Sized + Message,

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

Cancel authentication for a given request

Parameter challenge: The NSURLAuthenticationChallenge for which to cancel authentication

Source

unsafe fn webView_resource_didReceiveResponse_fromDataSource( &self, sender: Option<&WebView>, identifier: Option<&AnyObject>, response: Option<&NSURLResponse>, data_source: Option<&WebDataSource>, )
where Self: Sized + Message,

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

This message is sent after a response has been received for this load.

Parameter sender: The WebView sending the message.

Parameter identifier: An identifier that can be used to track the progress of a resource load across multiple call backs.

Parameter response: The response for the request.

Parameter dataSource: The dataSource that initiated the load.

In some rare cases, multiple responses may be received for a single load. This occurs with multipart/x-mixed-replace, or “server push”. In this case, the client should assume that each new response resets progress so far for the resource back to 0, and should check the new response for the expected content length.

Source

unsafe fn webView_resource_didReceiveContentLength_fromDataSource( &self, sender: Option<&WebView>, identifier: Option<&AnyObject>, length: NSInteger, data_source: Option<&WebDataSource>, )
where Self: Sized + Message,

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

Multiple of these messages may be sent as data arrives.

Parameter sender: The WebView sending the message.

Parameter identifier: An identifier that can be used to track the progress of a resource load across multiple call backs.

Parameter length: The amount of new data received. This is not the total amount, just the new amount received.

Parameter dataSource: The dataSource that initiated the load.

Source

unsafe fn webView_resource_didFinishLoadingFromDataSource( &self, sender: Option<&WebView>, identifier: Option<&AnyObject>, data_source: Option<&WebDataSource>, )
where Self: Sized + Message,

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

This message is sent after a load has successfully completed.

Parameter sender: The WebView sending the message.

Parameter identifier: An identifier that can be used to track the progress of a resource load across multiple call backs.

Parameter dataSource: The dataSource that initiated the load.

Source

unsafe fn webView_resource_didFailLoadingWithError_fromDataSource( &self, sender: Option<&WebView>, identifier: Option<&AnyObject>, error: Option<&NSError>, data_source: Option<&WebDataSource>, )
where Self: Sized + Message,

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

This message is sent after a load has failed to load due to an error.

Parameter sender: The WebView sending the message.

Parameter identifier: An identifier that can be used to track the progress of a resource load across multiple call backs.

Parameter error: The error associated with this load.

Parameter dataSource: The dataSource that initiated the load.

Source

unsafe fn webView_plugInFailedWithError_dataSource( &self, sender: Option<&WebView>, error: Option<&NSError>, data_source: Option<&WebDataSource>, )
where Self: Sized + Message,

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

Called when a plug-in is not found, fails to load or is not available for some reason.

Parameter sender: The WebView sending the message.

Parameter error: The plug-in error. In the userInfo dictionary of the error, the object for the NSErrorFailingURLKey key is a URL string of the SRC attribute, the object for the WebKitErrorPlugInNameKey key is a string of the plug-in’s name, the object for the WebKitErrorPlugInPageURLStringKey key is a URL string of the PLUGINSPAGE attribute and the object for the WebKitErrorMIMETypeKey key is a string of the TYPE attribute. Some, none or all of the mentioned attributes can be present in the userInfo. The error returns nil for userInfo when none are present.

Parameter dataSource: The dataSource that contains the plug-in.

Trait Implementations§

Source§

impl ProtocolType for dyn WebResourceLoadDelegate

Source§

const NAME: &'static str = "WebResourceLoadDelegate"

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 WebResourceLoadDelegate

Implementations on Foreign Types§

Source§

impl<T> WebResourceLoadDelegate for ProtocolObject<T>

Implementors§