diff --git a/README.md b/README.md index 755ebe1..7835817 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ By default this crate uses the `WebView2LoaderStatic.lib` static library and doe 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.3124.44"; + const WEBVIEW2_VERSION: &str = "1.0.3296.44"; ``` 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. diff --git a/crates/bindings/arm64/WebView2Loader.dll b/crates/bindings/arm64/WebView2Loader.dll index 6948161..6fc4c8f 100644 Binary files a/crates/bindings/arm64/WebView2Loader.dll and b/crates/bindings/arm64/WebView2Loader.dll differ diff --git a/crates/bindings/arm64/WebView2LoaderStatic.lib b/crates/bindings/arm64/WebView2LoaderStatic.lib index b507363..e834733 100644 Binary files a/crates/bindings/arm64/WebView2LoaderStatic.lib and b/crates/bindings/arm64/WebView2LoaderStatic.lib differ diff --git a/crates/bindings/src/bindings.rs b/crates/bindings/src/bindings.rs index 18123be..011b1a7 100644 --- a/crates/bindings/src/bindings.rs +++ b/crates/bindings/src/bindings.rs @@ -1,4 +1,4 @@ -// Bindings generated by `windows-bindgen` 0.61.0 +// Bindings generated by `windows-bindgen` 0.61.1 #[inline] pub unsafe fn CompareBrowserVersions( @@ -1011,7 +1011,7 @@ pub const COREWEBVIEW2_WEB_RESOURCE_REQUEST_SOURCE_KINDS_SHARED_WORKER: COREWEBVIEW2_WEB_RESOURCE_REQUEST_SOURCE_KINDS = COREWEBVIEW2_WEB_RESOURCE_REQUEST_SOURCE_KINDS(2i32); pub const CORE_WEBVIEW_TARGET_PRODUCT_VERSION: windows_core::PCWSTR = - windows_core::w!("134.0.3124.44"); + windows_core::w!("137.0.3296.44"); windows_core::imp::define_interface!( ICoreWebView2, ICoreWebView2_Vtbl, @@ -10543,6 +10543,116 @@ impl ICoreWebView2ControllerOptions2_Vtbl { } } impl windows_core::RuntimeName for ICoreWebView2ControllerOptions2 {} +windows_core::imp::define_interface!( + ICoreWebView2ControllerOptions3, + ICoreWebView2ControllerOptions3_Vtbl, + 0xb32b191a_8998_57ca_b7cb_e04617e4ce4a +); +impl core::ops::Deref for ICoreWebView2ControllerOptions3 { + type Target = ICoreWebView2ControllerOptions2; + fn deref(&self) -> &Self::Target { + unsafe { core::mem::transmute(self) } + } +} +windows_core::imp::interface_hierarchy!( + ICoreWebView2ControllerOptions3, + windows_core::IUnknown, + ICoreWebView2ControllerOptions, + ICoreWebView2ControllerOptions2 +); +impl ICoreWebView2ControllerOptions3 { + pub unsafe fn DefaultBackgroundColor( + &self, + value: *mut COREWEBVIEW2_COLOR, + ) -> windows_core::Result<()> { + unsafe { + (windows_core::Interface::vtable(self).DefaultBackgroundColor)( + windows_core::Interface::as_raw(self), + value as _, + ) + .ok() + } + } + pub unsafe fn SetDefaultBackgroundColor( + &self, + value: COREWEBVIEW2_COLOR, + ) -> windows_core::Result<()> { + unsafe { + (windows_core::Interface::vtable(self).SetDefaultBackgroundColor)( + windows_core::Interface::as_raw(self), + core::mem::transmute(value), + ) + .ok() + } + } +} +#[repr(C)] +#[doc(hidden)] +pub struct ICoreWebView2ControllerOptions3_Vtbl { + pub base__: ICoreWebView2ControllerOptions2_Vtbl, + pub DefaultBackgroundColor: unsafe extern "system" fn( + *mut core::ffi::c_void, + *mut COREWEBVIEW2_COLOR, + ) -> windows_core::HRESULT, + pub SetDefaultBackgroundColor: unsafe extern "system" fn( + *mut core::ffi::c_void, + COREWEBVIEW2_COLOR, + ) -> windows_core::HRESULT, +} +pub trait ICoreWebView2ControllerOptions3_Impl: ICoreWebView2ControllerOptions2_Impl { + fn DefaultBackgroundColor(&self, value: *mut COREWEBVIEW2_COLOR) -> windows_core::Result<()>; + fn SetDefaultBackgroundColor(&self, value: &COREWEBVIEW2_COLOR) -> windows_core::Result<()>; +} +impl ICoreWebView2ControllerOptions3_Vtbl { + pub const fn new() -> Self + { + unsafe extern "system" fn DefaultBackgroundColor< + Identity: ICoreWebView2ControllerOptions3_Impl, + const OFFSET: isize, + >( + this: *mut core::ffi::c_void, + value: *mut COREWEBVIEW2_COLOR, + ) -> windows_core::HRESULT { + unsafe { + let this: &Identity = + &*((this as *const *const ()).offset(OFFSET) as *const Identity); + ICoreWebView2ControllerOptions3_Impl::DefaultBackgroundColor( + this, + core::mem::transmute_copy(&value), + ) + .into() + } + } + unsafe extern "system" fn SetDefaultBackgroundColor< + Identity: ICoreWebView2ControllerOptions3_Impl, + const OFFSET: isize, + >( + this: *mut core::ffi::c_void, + value: COREWEBVIEW2_COLOR, + ) -> windows_core::HRESULT { + unsafe { + let this: &Identity = + &*((this as *const *const ()).offset(OFFSET) as *const Identity); + ICoreWebView2ControllerOptions3_Impl::SetDefaultBackgroundColor( + this, + core::mem::transmute(&value), + ) + .into() + } + } + Self { + base__: ICoreWebView2ControllerOptions2_Vtbl::new::(), + DefaultBackgroundColor: DefaultBackgroundColor::, + SetDefaultBackgroundColor: SetDefaultBackgroundColor::, + } + } + pub fn matches(iid: &windows_core::GUID) -> bool { + iid == &::IID + || iid == &::IID + || iid == &::IID + } +} +impl windows_core::RuntimeName for ICoreWebView2ControllerOptions3 {} windows_core::imp::define_interface!( ICoreWebView2Cookie, ICoreWebView2Cookie_Vtbl, @@ -18777,6 +18887,206 @@ impl ICoreWebView2Frame6_Vtbl { } } impl windows_core::RuntimeName for ICoreWebView2Frame6 {} +windows_core::imp::define_interface!( + ICoreWebView2Frame7, + ICoreWebView2Frame7_Vtbl, + 0x3598cfa2_d85d_5a9f_9228_4dde1f59ec64 +); +impl core::ops::Deref for ICoreWebView2Frame7 { + type Target = ICoreWebView2Frame6; + fn deref(&self) -> &Self::Target { + unsafe { core::mem::transmute(self) } + } +} +windows_core::imp::interface_hierarchy!( + ICoreWebView2Frame7, + windows_core::IUnknown, + ICoreWebView2Frame, + ICoreWebView2Frame2, + ICoreWebView2Frame3, + ICoreWebView2Frame4, + ICoreWebView2Frame5, + ICoreWebView2Frame6 +); +impl ICoreWebView2Frame7 { + pub unsafe fn add_FrameCreated( + &self, + eventhandler: P0, + token: *mut i64, + ) -> windows_core::Result<()> + where + P0: windows_core::Param, + { + unsafe { + (windows_core::Interface::vtable(self).add_FrameCreated)( + windows_core::Interface::as_raw(self), + eventhandler.param().abi(), + token as _, + ) + .ok() + } + } + pub unsafe fn remove_FrameCreated(&self, token: i64) -> windows_core::Result<()> { + unsafe { + (windows_core::Interface::vtable(self).remove_FrameCreated)( + windows_core::Interface::as_raw(self), + token, + ) + .ok() + } + } +} +#[repr(C)] +#[doc(hidden)] +pub struct ICoreWebView2Frame7_Vtbl { + pub base__: ICoreWebView2Frame6_Vtbl, + pub add_FrameCreated: unsafe extern "system" fn( + *mut core::ffi::c_void, + *mut core::ffi::c_void, + *mut i64, + ) -> windows_core::HRESULT, + pub remove_FrameCreated: + unsafe extern "system" fn(*mut core::ffi::c_void, i64) -> windows_core::HRESULT, +} +pub trait ICoreWebView2Frame7_Impl: ICoreWebView2Frame6_Impl { + fn add_FrameCreated( + &self, + eventhandler: windows_core::Ref<'_, ICoreWebView2FrameChildFrameCreatedEventHandler>, + token: *mut i64, + ) -> windows_core::Result<()>; + fn remove_FrameCreated(&self, token: i64) -> windows_core::Result<()>; +} +impl ICoreWebView2Frame7_Vtbl { + pub const fn new() -> Self { + unsafe extern "system" fn add_FrameCreated< + Identity: ICoreWebView2Frame7_Impl, + const OFFSET: isize, + >( + this: *mut core::ffi::c_void, + eventhandler: *mut core::ffi::c_void, + token: *mut i64, + ) -> windows_core::HRESULT { + unsafe { + let this: &Identity = + &*((this as *const *const ()).offset(OFFSET) as *const Identity); + ICoreWebView2Frame7_Impl::add_FrameCreated( + this, + core::mem::transmute_copy(&eventhandler), + core::mem::transmute_copy(&token), + ) + .into() + } + } + unsafe extern "system" fn remove_FrameCreated< + Identity: ICoreWebView2Frame7_Impl, + const OFFSET: isize, + >( + this: *mut core::ffi::c_void, + token: i64, + ) -> windows_core::HRESULT { + unsafe { + let this: &Identity = + &*((this as *const *const ()).offset(OFFSET) as *const Identity); + ICoreWebView2Frame7_Impl::remove_FrameCreated( + this, + core::mem::transmute_copy(&token), + ) + .into() + } + } + Self { + base__: ICoreWebView2Frame6_Vtbl::new::(), + add_FrameCreated: add_FrameCreated::, + remove_FrameCreated: remove_FrameCreated::, + } + } + pub fn matches(iid: &windows_core::GUID) -> bool { + iid == &::IID + || iid == &::IID + || iid == &::IID + || iid == &::IID + || iid == &::IID + || iid == &::IID + || iid == &::IID + } +} +impl windows_core::RuntimeName for ICoreWebView2Frame7 {} +windows_core::imp::define_interface!( + ICoreWebView2FrameChildFrameCreatedEventHandler, + ICoreWebView2FrameChildFrameCreatedEventHandler_Vtbl, + 0x569e40e7_46b7_563d_83ae_1073155664d7 +); +windows_core::imp::interface_hierarchy!( + ICoreWebView2FrameChildFrameCreatedEventHandler, + windows_core::IUnknown +); +impl ICoreWebView2FrameChildFrameCreatedEventHandler { + pub unsafe fn Invoke(&self, sender: P0, args: P1) -> windows_core::Result<()> + where + P0: windows_core::Param, + P1: windows_core::Param, + { + unsafe { + (windows_core::Interface::vtable(self).Invoke)( + windows_core::Interface::as_raw(self), + sender.param().abi(), + args.param().abi(), + ) + .ok() + } + } +} +#[repr(C)] +#[doc(hidden)] +pub struct ICoreWebView2FrameChildFrameCreatedEventHandler_Vtbl { + pub base__: windows_core::IUnknown_Vtbl, + pub Invoke: unsafe extern "system" fn( + *mut core::ffi::c_void, + *mut core::ffi::c_void, + *mut core::ffi::c_void, + ) -> windows_core::HRESULT, +} +pub trait ICoreWebView2FrameChildFrameCreatedEventHandler_Impl: windows_core::IUnknownImpl { + fn Invoke( + &self, + sender: windows_core::Ref<'_, ICoreWebView2Frame>, + args: windows_core::Ref<'_, ICoreWebView2FrameCreatedEventArgs>, + ) -> windows_core::Result<()>; +} +impl ICoreWebView2FrameChildFrameCreatedEventHandler_Vtbl { + pub const fn new< + Identity: ICoreWebView2FrameChildFrameCreatedEventHandler_Impl, + const OFFSET: isize, + >() -> Self { + unsafe extern "system" fn Invoke< + Identity: ICoreWebView2FrameChildFrameCreatedEventHandler_Impl, + const OFFSET: isize, + >( + this: *mut core::ffi::c_void, + sender: *mut core::ffi::c_void, + args: *mut core::ffi::c_void, + ) -> windows_core::HRESULT { + unsafe { + let this: &Identity = + &*((this as *const *const ()).offset(OFFSET) as *const Identity); + ICoreWebView2FrameChildFrameCreatedEventHandler_Impl::Invoke( + this, + core::mem::transmute_copy(&sender), + core::mem::transmute_copy(&args), + ) + .into() + } + } + Self { + base__: windows_core::IUnknown_Vtbl::new::(), + Invoke: Invoke::, + } + } + pub fn matches(iid: &windows_core::GUID) -> bool { + iid == &::IID + } +} +impl windows_core::RuntimeName for ICoreWebView2FrameChildFrameCreatedEventHandler {} windows_core::imp::define_interface!( ICoreWebView2FrameContentLoadingEventHandler, ICoreWebView2FrameContentLoadingEventHandler_Vtbl, diff --git a/crates/bindings/src/declared_interfaces.rs b/crates/bindings/src/declared_interfaces.rs index e5bd839..0ba3e5d 100644 --- a/crates/bindings/src/declared_interfaces.rs +++ b/crates/bindings/src/declared_interfaces.rs @@ -35,6 +35,7 @@ pub fn all_declared_callbacks() -> BTreeSet<&'static str> { interfaces.insert("ICoreWebView2ExecuteScriptWithResultCompletedHandler"); interfaces.insert("ICoreWebView2FaviconChangedEventHandler"); interfaces.insert("ICoreWebView2FocusChangedEventHandler"); + interfaces.insert("ICoreWebView2FrameChildFrameCreatedEventHandler"); interfaces.insert("ICoreWebView2FrameContentLoadingEventHandler"); interfaces.insert("ICoreWebView2FrameCreatedEventHandler"); interfaces.insert("ICoreWebView2FrameDOMContentLoadedEventHandler"); diff --git a/crates/bindings/x64/WebView2Loader.dll b/crates/bindings/x64/WebView2Loader.dll index 2cc50a9..dd9f929 100644 Binary files a/crates/bindings/x64/WebView2Loader.dll and b/crates/bindings/x64/WebView2Loader.dll differ diff --git a/crates/bindings/x64/WebView2LoaderStatic.lib b/crates/bindings/x64/WebView2LoaderStatic.lib index 9da23e2..c054f8a 100644 Binary files a/crates/bindings/x64/WebView2LoaderStatic.lib and b/crates/bindings/x64/WebView2LoaderStatic.lib differ diff --git a/crates/bindings/x86/WebView2Loader.dll b/crates/bindings/x86/WebView2Loader.dll index c60cb24..4aee582 100644 Binary files a/crates/bindings/x86/WebView2Loader.dll and b/crates/bindings/x86/WebView2Loader.dll differ diff --git a/crates/bindings/x86/WebView2LoaderStatic.lib b/crates/bindings/x86/WebView2LoaderStatic.lib index 9d81e62..d787745 100644 Binary files a/crates/bindings/x86/WebView2LoaderStatic.lib and b/crates/bindings/x86/WebView2LoaderStatic.lib differ diff --git a/crates/update-bindings/src/main.rs b/crates/update-bindings/src/main.rs index 2038068..a37f918 100644 --- a/crates/update-bindings/src/main.rs +++ b/crates/update-bindings/src/main.rs @@ -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.3124.44"; + const WEBVIEW2_VERSION: &str = "1.0.3296.44"; pub fn install() -> super::Result { let out_dir = get_out_dir(); diff --git a/crates/update-bindings/winmd/Microsoft.Web.WebView2.Win32.winmd b/crates/update-bindings/winmd/Microsoft.Web.WebView2.Win32.winmd index cd2513a..5496436 100644 Binary files a/crates/update-bindings/winmd/Microsoft.Web.WebView2.Win32.winmd and b/crates/update-bindings/winmd/Microsoft.Web.WebView2.Win32.winmd differ