Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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.
314 changes: 312 additions & 2 deletions crates/bindings/src/bindings.rs
Original file line number Diff line number Diff line change
@@ -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<P0, P1>(
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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<Identity: ICoreWebView2ControllerOptions3_Impl, const OFFSET: isize>() -> 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::<Identity, OFFSET>(),
DefaultBackgroundColor: DefaultBackgroundColor::<Identity, OFFSET>,
SetDefaultBackgroundColor: SetDefaultBackgroundColor::<Identity, OFFSET>,
}
}
pub fn matches(iid: &windows_core::GUID) -> bool {
iid == &<ICoreWebView2ControllerOptions3 as windows_core::Interface>::IID
|| iid == &<ICoreWebView2ControllerOptions as windows_core::Interface>::IID
|| iid == &<ICoreWebView2ControllerOptions2 as windows_core::Interface>::IID
}
}
impl windows_core::RuntimeName for ICoreWebView2ControllerOptions3 {}
windows_core::imp::define_interface!(
ICoreWebView2Cookie,
ICoreWebView2Cookie_Vtbl,
Expand Down Expand Up @@ -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<P0>(
&self,
eventhandler: P0,
token: *mut i64,
) -> windows_core::Result<()>
where
P0: windows_core::Param<ICoreWebView2FrameChildFrameCreatedEventHandler>,
{
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<Identity: ICoreWebView2Frame7_Impl, const OFFSET: isize>() -> 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::<Identity, OFFSET>(),
add_FrameCreated: add_FrameCreated::<Identity, OFFSET>,
remove_FrameCreated: remove_FrameCreated::<Identity, OFFSET>,
}
}
pub fn matches(iid: &windows_core::GUID) -> bool {
iid == &<ICoreWebView2Frame7 as windows_core::Interface>::IID
|| iid == &<ICoreWebView2Frame as windows_core::Interface>::IID
|| iid == &<ICoreWebView2Frame2 as windows_core::Interface>::IID
|| iid == &<ICoreWebView2Frame3 as windows_core::Interface>::IID
|| iid == &<ICoreWebView2Frame4 as windows_core::Interface>::IID
|| iid == &<ICoreWebView2Frame5 as windows_core::Interface>::IID
|| iid == &<ICoreWebView2Frame6 as windows_core::Interface>::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<P0, P1>(&self, sender: P0, args: P1) -> windows_core::Result<()>
where
P0: windows_core::Param<ICoreWebView2Frame>,
P1: windows_core::Param<ICoreWebView2FrameCreatedEventArgs>,
{
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::<Identity, OFFSET>(),
Invoke: Invoke::<Identity, OFFSET>,
}
}
pub fn matches(iid: &windows_core::GUID) -> bool {
iid == &<ICoreWebView2FrameChildFrameCreatedEventHandler as windows_core::Interface>::IID
}
}
impl windows_core::RuntimeName for ICoreWebView2FrameChildFrameCreatedEventHandler {}
windows_core::imp::define_interface!(
ICoreWebView2FrameContentLoadingEventHandler,
ICoreWebView2FrameContentLoadingEventHandler_Vtbl,
Expand Down
1 change: 1 addition & 0 deletions crates/bindings/src/declared_interfaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
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.3124.44";
const WEBVIEW2_VERSION: &str = "1.0.3296.44";

pub fn install() -> super::Result<PathBuf> {
let out_dir = get_out_dir();
Expand Down
Binary file modified crates/update-bindings/winmd/Microsoft.Web.WebView2.Win32.winmd
Binary file not shown.
Loading