fix: explicitly call GetNativeNSView() on macOS (#46733)

* fix: explicitly call GetNativeNSView() on macOS

* chore: move macOS impl to a .mm file

This is needed in order to access gfx::NativeView::GetNativeNSView()
This commit is contained in:
Charles Kerr 2025-04-23 17:55:18 -05:00 committed by GitHub
parent 686ae47696
commit c7b0bdab7e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 62 additions and 4 deletions

View file

@ -3743,15 +3743,17 @@ void WebContents::SetDevToolsWebContents(const WebContents* devtools) {
inspectable_web_contents_->SetDevToolsWebContents(devtools->web_contents());
}
#if !BUILDFLAG(IS_MAC)
v8::Local<v8::Value> WebContents::GetNativeView(v8::Isolate* isolate) const {
gfx::NativeView ptr = web_contents()->GetNativeView();
auto buffer = node::Buffer::Copy(isolate, reinterpret_cast<char*>(&ptr),
sizeof(gfx::NativeView));
auto buffer =
node::Buffer::Copy(isolate, reinterpret_cast<char*>(&ptr), sizeof(ptr));
if (buffer.IsEmpty())
return v8::Null(isolate);
else
return buffer.ToLocalChecked();
}
#endif
v8::Local<v8::Value> WebContents::DevToolsWebContents(v8::Isolate* isolate) {
if (devtools_web_contents_.IsEmpty())