Skip to content

Commit

Permalink
chore: update WebView2 SDK to 1.0.2903.40
Browse files Browse the repository at this point in the history
  • Loading branch information
wravery committed Dec 16, 2024
1 parent d399920 commit ff20252
Show file tree
Hide file tree
Showing 12 changed files with 5,842 additions and 1,661 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ By default this crate uses the `WebView2LoaderStatic.lib` static library and doe
## Updating the WebView2 SDK
You can tell the `update-bindings` tool to use a different version by updating `WEBVIEW2_VERSION` in `main.rs`:
```rust
const WEBVIEW2_VERSION: &str = "1.0.2592.51";
const WEBVIEW2_VERSION: &str = "1.0.2903.40";
```
It will also regenerate [declared_interfaces.rs](./crates/bindings/src/declared_interfaces.rs) if they change in a new version. This file is used in `webview2-com`, and in particular, the tests in [callback.rs](./crates/webview2-com/src/callback.rs) and [options.rs](./crates/webview2-com/src/options.rs) verify that all of the interfaces listed in `declared_interfaces.rs` are implemented.

Expand Down
Binary file modified crates/bindings/arm64/WebView2Loader.dll
Binary file not shown.
Binary file modified crates/bindings/arm64/WebView2LoaderStatic.lib
Binary file not shown.
7,429 changes: 5,771 additions & 1,658 deletions crates/bindings/src/Microsoft.rs

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion crates/bindings/src/declared_interfaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pub fn all_declared_callbacks() -> BTreeSet<&'static str> {
interfaces.insert("ICoreWebView2FrameNavigationCompletedEventHandler");
interfaces.insert("ICoreWebView2FrameNavigationStartingEventHandler");
interfaces.insert("ICoreWebView2FramePermissionRequestedEventHandler");
interfaces.insert("ICoreWebView2FrameScreenCaptureStartingEventHandler");
interfaces.insert("ICoreWebView2FrameWebMessageReceivedEventHandler");
interfaces.insert("ICoreWebView2GetCookiesCompletedHandler");
interfaces.insert("ICoreWebView2GetFaviconCompletedHandler");
Expand All @@ -59,6 +60,8 @@ pub fn all_declared_callbacks() -> BTreeSet<&'static str> {
interfaces.insert("ICoreWebView2NewBrowserVersionAvailableEventHandler");
interfaces.insert("ICoreWebView2NewWindowRequestedEventHandler");
interfaces.insert("ICoreWebView2NonClientRegionChangedEventHandler");
interfaces.insert("ICoreWebView2NotificationCloseRequestedEventHandler");
interfaces.insert("ICoreWebView2NotificationReceivedEventHandler");
interfaces.insert("ICoreWebView2PermissionRequestedEventHandler");
interfaces.insert("ICoreWebView2PrintCompletedHandler");
interfaces.insert("ICoreWebView2PrintToPdfCompletedHandler");
Expand All @@ -69,9 +72,13 @@ pub fn all_declared_callbacks() -> BTreeSet<&'static str> {
interfaces.insert("ICoreWebView2ProfileDeletedEventHandler");
interfaces.insert("ICoreWebView2ProfileGetBrowserExtensionsCompletedHandler");
interfaces.insert("ICoreWebView2RasterizationScaleChangedEventHandler");
interfaces.insert("ICoreWebView2SaveAsUIShowingEventHandler");
interfaces.insert("ICoreWebView2SaveFileSecurityCheckStartingEventHandler");
interfaces.insert("ICoreWebView2ScreenCaptureStartingEventHandler");
interfaces.insert("ICoreWebView2ScriptDialogOpeningEventHandler");
interfaces.insert("ICoreWebView2ServerCertificateErrorDetectedEventHandler");
interfaces.insert("ICoreWebView2SetPermissionStateCompletedHandler");
interfaces.insert("ICoreWebView2ShowSaveAsUICompletedHandler");
interfaces.insert("ICoreWebView2SourceChangedEventHandler");
interfaces.insert("ICoreWebView2StateChangedEventHandler");
interfaces.insert("ICoreWebView2StatusBarTextChangedEventHandler");
Expand All @@ -85,7 +92,7 @@ pub fn all_declared_callbacks() -> BTreeSet<&'static str> {

interfaces
}

/// Generate a list of all `ICoreWebView2EnvironmentOptions` interfaces declared in `WebView2.h`.
/// This is for testing purposes to make sure they are all covered in
/// [options.rs](../../webview2-com/src/options.rs).
Expand Down
Binary file modified crates/bindings/x64/WebView2Loader.dll
Binary file not shown.
Binary file modified crates/bindings/x64/WebView2LoaderStatic.lib
Binary file not shown.
Binary file modified crates/bindings/x86/WebView2Loader.dll
Binary file not shown.
Binary file modified crates/bindings/x86/WebView2LoaderStatic.lib
Binary file not shown.
2 changes: 1 addition & 1 deletion crates/update-bindings/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ mod webview2_nuget {
include!("../../bindings/src/declared_interfaces.rs");

const WEBVIEW2_NAME: &str = "Microsoft.Web.WebView2";
const WEBVIEW2_VERSION: &str = "1.0.2592.51";
const WEBVIEW2_VERSION: &str = "1.0.2903.40";

pub fn install() -> super::Result<PathBuf> {
let out_dir = get_out_dir();
Expand Down
Binary file not shown.
61 changes: 61 additions & 0 deletions crates/webview2-com/src/callback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,67 @@ pub struct NonClientRegionChangedEventHandler(
Option<ICoreWebView2NonClientRegionChangedEventArgs>,
);

#[event_callback]
pub struct FrameScreenCaptureStartingEventHandler(
ICoreWebView2FrameScreenCaptureStartingEventHandler,
Option<ICoreWebView2Frame>,
Option<ICoreWebView2ScreenCaptureStartingEventArgs>,
);

#[event_callback]
pub struct NotificationCloseRequestedEventHandler(
ICoreWebView2NotificationCloseRequestedEventHandler,
Option<ICoreWebView2Notification>,
Option<IUnknown>,
);

#[event_callback]
pub struct NotificationReceivedEventHandler(
ICoreWebView2NotificationReceivedEventHandler,
Option<ICoreWebView2>,
Option<ICoreWebView2NotificationReceivedEventArgs>,
);

#[event_callback]
pub struct SaveAsUIShowingEventHandler(
ICoreWebView2SaveAsUIShowingEventHandler,
Option<ICoreWebView2>,
Option<ICoreWebView2SaveAsUIShowingEventArgs>,
);

#[event_callback]
pub struct SaveFileSecurityCheckStartingEventHandler(
ICoreWebView2SaveFileSecurityCheckStartingEventHandler,
Option<ICoreWebView2>,
Option<ICoreWebView2SaveFileSecurityCheckStartingEventArgs>,
);

#[event_callback]
pub struct ScreenCaptureStartingEventHandler(
ICoreWebView2ScreenCaptureStartingEventHandler,
Option<ICoreWebView2>,
Option<ICoreWebView2ScreenCaptureStartingEventArgs>,
);

impl ClosureArg for COREWEBVIEW2_SAVE_AS_UI_RESULT {
type Output = Self;
}

impl<'a> InvokeArg<'a> for COREWEBVIEW2_SAVE_AS_UI_RESULT {
type Input = Self;

fn convert(input: Self) -> Self {
input
}
}

#[completed_callback]
pub struct ShowSaveAsUICompletedHandler(
ICoreWebView2ShowSaveAsUICompletedHandler,
HRESULT,
COREWEBVIEW2_SAVE_AS_UI_RESULT,
);

#[cfg(test)]
mod test {
use std::collections::BTreeSet;
Expand Down

0 comments on commit ff20252

Please sign in to comment.