chore: remove WebContents.getNativeView()
(#46734)
chore: remove never-used WebContents.getNativeView(). This was added in https://github.com/electron/electron/pull/10308 but was never used and never documented, not even as experimental API.
This commit is contained in:
parent
c7b0bdab7e
commit
e9f279afd1
3 changed files with 0 additions and 33 deletions
|
@ -3743,18 +3743,6 @@ void WebContents::SetDevToolsWebContents(const WebContents* devtools) {
|
||||||
inspectable_web_contents_->SetDevToolsWebContents(devtools->web_contents());
|
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(ptr));
|
|
||||||
if (buffer.IsEmpty())
|
|
||||||
return v8::Null(isolate);
|
|
||||||
else
|
|
||||||
return buffer.ToLocalChecked();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
v8::Local<v8::Value> WebContents::DevToolsWebContents(v8::Isolate* isolate) {
|
v8::Local<v8::Value> WebContents::DevToolsWebContents(v8::Isolate* isolate) {
|
||||||
if (devtools_web_contents_.IsEmpty())
|
if (devtools_web_contents_.IsEmpty())
|
||||||
return v8::Null(isolate);
|
return v8::Null(isolate);
|
||||||
|
@ -4466,7 +4454,6 @@ void WebContents::FillObjectTemplate(v8::Isolate* isolate,
|
||||||
.SetMethod("capturePage", &WebContents::CapturePage)
|
.SetMethod("capturePage", &WebContents::CapturePage)
|
||||||
.SetMethod("setEmbedder", &WebContents::SetEmbedder)
|
.SetMethod("setEmbedder", &WebContents::SetEmbedder)
|
||||||
.SetMethod("setDevToolsWebContents", &WebContents::SetDevToolsWebContents)
|
.SetMethod("setDevToolsWebContents", &WebContents::SetDevToolsWebContents)
|
||||||
.SetMethod("getNativeView", &WebContents::GetNativeView)
|
|
||||||
.SetMethod("isBeingCaptured", &WebContents::IsBeingCaptured)
|
.SetMethod("isBeingCaptured", &WebContents::IsBeingCaptured)
|
||||||
.SetMethod("setWebRTCIPHandlingPolicy",
|
.SetMethod("setWebRTCIPHandlingPolicy",
|
||||||
&WebContents::SetWebRTCIPHandlingPolicy)
|
&WebContents::SetWebRTCIPHandlingPolicy)
|
||||||
|
|
|
@ -250,7 +250,6 @@ class WebContents final : public ExclusiveAccessContext,
|
||||||
bool IsCurrentlyAudible();
|
bool IsCurrentlyAudible();
|
||||||
void SetEmbedder(const WebContents* embedder);
|
void SetEmbedder(const WebContents* embedder);
|
||||||
void SetDevToolsWebContents(const WebContents* devtools);
|
void SetDevToolsWebContents(const WebContents* devtools);
|
||||||
v8::Local<v8::Value> GetNativeView(v8::Isolate* isolate) const;
|
|
||||||
bool IsBeingCaptured();
|
bool IsBeingCaptured();
|
||||||
void HandleNewRenderFrame(content::RenderFrameHost* render_frame_host);
|
void HandleNewRenderFrame(content::RenderFrameHost* render_frame_host);
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
#include "shell/browser/api/electron_api_web_contents.h"
|
#include "shell/browser/api/electron_api_web_contents.h"
|
||||||
#include "shell/browser/ui/cocoa/event_dispatching_window.h"
|
#include "shell/browser/ui/cocoa/event_dispatching_window.h"
|
||||||
#include "shell/browser/web_contents_preferences.h"
|
#include "shell/browser/web_contents_preferences.h"
|
||||||
#include "shell/common/node_includes.h"
|
|
||||||
#include "ui/base/cocoa/command_dispatcher.h"
|
#include "ui/base/cocoa/command_dispatcher.h"
|
||||||
#include "ui/base/cocoa/nsmenu_additions.h"
|
#include "ui/base/cocoa/nsmenu_additions.h"
|
||||||
#include "ui/base/cocoa/nsmenuitem_additions.h"
|
#include "ui/base/cocoa/nsmenuitem_additions.h"
|
||||||
|
@ -93,22 +92,4 @@ bool WebContents::PlatformHandleKeyboardEvent(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
// Converts binary data to Buffer.
|
|
||||||
v8::Local<v8::Value> ToBuffer(v8::Isolate* isolate, void* val, int size) {
|
|
||||||
auto buffer = node::Buffer::Copy(isolate, static_cast<char*>(val), size);
|
|
||||||
if (buffer.IsEmpty())
|
|
||||||
return v8::Null(isolate);
|
|
||||||
else
|
|
||||||
return buffer.ToLocalChecked();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
v8::Local<v8::Value> WebContents::GetNativeView(v8::Isolate* isolate) const {
|
|
||||||
NSView* handle = web_contents()->GetNativeView().GetNativeNSView();
|
|
||||||
return ToBuffer(isolate, &handle, sizeof(handle));
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace electron::api
|
} // namespace electron::api
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue