Repository: servo/servo
File: components/servo/webview_delegate.rs (Rust)

Code before:
        _: Vec<String>,
        response_sender: GenericSender<Option<String>>,
    ) {
        let _ = response_sender.send(None);
    }

    /// Request that the embedder show UI elements for form controls that are not integrated
    /// into page content, such as dropdowns for `<select>` elements.
    fn show_embedder_control(&self, _webview: WebView, _embedder_control: EmbedderControl) {}

    /// Request that the embedder hide and ignore a previous [`EmbedderControl`] request, if it hasn’t
    /// already responded to it.
    ///
    /// After this point, any further responses to that request will be ignored.
    fn hide_embedder_control(&self, _webview: WebView, _control_id: EmbedderControlId) {}

    /// Request to play a haptic effect on a connected gamepad.
    fn play_gamepad_haptic_effect(
        &self,
        _webview: WebView,
        _: usize,
        _: GamepadHapticEffectType,
        _: Box<dyn Fn(bool)>,
    ) {
    }
    /// Request to stop a haptic effect on a connected gamepad.
    fn stop_gamepad_haptic_effect(&self, _webview: WebView, _: usize, _: Box<dyn Fn(bool)>) {}

    /// Triggered when this [`WebView`] will load a web (HTTP/HTTPS) resource. The load may be
    /// intercepted and alternate contents can be loaded by the client by calling
    /// [`WebResourceLoad::intercept`]. If not handled, the load will continue as normal.
    ///
    /// Note: This delegate method is called for all resource loads associated with a [`WebView`].
    /// For loads not associated with a [`WebView`], such as those for service workers, Servo
    /// will call [`crate::ServoDelegate::load_web_resource`].
    fn load_web_resource(&self, _webview: WebView, _load: WebResourceLoad) {}

    /// Request to display a notification.
    fn show_notification(&self, _webview: WebView, _notification: Notification) {}

    /// A console message was logged by content in this [`WebView`].
    /// <https://developer.mozilla.org/en-US/docs/Web/API/Console_API>
    fn show_console_message(&self, _webview: WebView, _level: ConsoleLogLevel, _message: String) {}
}

pub(crate) struct DefaultWebViewDelegate;
impl WebViewDelegate for DefaultWebViewDelegate {}

#[cfg(test)]
mod test {
    use super::*;

Review comment (bug):
```suggestion
    /// Request to stop a haptic effect on a connected gamepad. The embedder is expected to
    /// call the provided callback when the effect is complete with `true` for success
    /// and `false` for failure.
```

Code after:
        &self,
        _webview: WebView,
        _: Vec<String>,
        response_sender: GenericSender<Option<String>>,
    ) {
        let _ = response_sender.send(None);
    }

    /// Request that the embedder show UI elements for form controls that are not integrated
    /// into page content, such as dropdowns for `<select>` elements.
    fn show_embedder_control(&self, _webview: WebView, _embedder_control: EmbedderControl) {}

    /// Request that the embedder hide and ignore a previous [`EmbedderControl`] request, if it hasn’t
    /// already responded to it.
    ///
    /// After this point, any further responses to that request will be ignored.
    fn hide_embedder_control(&self, _webview: WebView, _control_id: EmbedderControlId) {}

    /// Request to play a haptic effect on a connected gamepad. The embedder is expected to
    /// call the provided callback when the effect is complete with `true` for success
    /// and `false` for failure.
    #[cfg(feature = "gamepad")]
    fn play_gamepad_haptic_effect(
        &self,
        _webview: WebView,
        _: usize,
        _: GamepadHapticEffectType,
        _: Box<dyn FnOnce(bool)>,
    ) {
    }
    /// Request to stop a haptic effect on a connected gamepad. The embedder is expected to
    /// call the provided callback when the effect is complete with `true` for success
    /// and `false` for failure.
    #[cfg(feature = "gamepad")]
    fn stop_gamepad_haptic_effect(&self, _webview: WebView, _: usize, _: Box<dyn FnOnce(bool)>) {}

    /// Triggered when this [`WebView`] will load a web (HTTP/HTTPS) resource. The load may be
    /// intercepted and alternate contents can be loaded by the client by calling
    /// [`WebResourceLoad::intercept`]. If not handled, the load will continue as normal.
    ///
    /// Note: This delegate method is called for all resource loads associated with a [`WebView`].
    /// For loads not associated with a [`WebView`], such as those for service workers, Servo
    /// will call [`crate::ServoDelegate::load_web_resource`].
    fn load_web_resource(&self, _webview: WebView, _load: WebResourceLoad) {}

    /// Request to display a notification.
    fn show_notification(&self, _webview: WebView, _notification: Notification) {}

    /// A console message was logged by content in this [`WebView`].
    /// <https://developer.mozilla.org/en-US/docs/Web/API/Console_API>
    fn show_console_message(&self, _webview: WebView, _level: ConsoleLogLevel, _message: String) {}