chore: remove native_mate (Part 11) (#20719)
* refactor: convert Menu and globalShortcut to gin * refactor: convert api::Cookies to gin * refactor: convert View and WebContentsView to gin * refactor: convert WebContents related classes to gin * refactor: convert powerMonitor to gin * refactor: prepare for header change * refactor: remove last uses of mate::EventEmitter * refactor: remove mate::EventEmitter * refactor: move trackable_object to gin_helper * fix: custom converter should not use Handle * fix: no more need to check if icon is empty It was a bug that the Handle<NativeImage> can be non-empty when the image file does not exist. The bug was caused by the converter code writing out the image even when the convertion fails. The bug was work-arounded by adding an additional check, but since the original bug had been fixed, the additional check is no longer needed. * fix: should always set frameId even when callback is null * fix: do not mix gin/mate handles for NativeImage
This commit is contained in:
parent
0e0d4fe990
commit
0fe6767d6b
80 changed files with 823 additions and 1087 deletions
|
@ -5,11 +5,11 @@
|
|||
#include "shell/browser/api/atom_api_web_contents_view.h"
|
||||
|
||||
#include "content/public/browser/web_contents_user_data.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
#include "shell/browser/api/atom_api_web_contents.h"
|
||||
#include "shell/browser/browser.h"
|
||||
#include "shell/browser/ui/inspectable_web_contents_view.h"
|
||||
#include "shell/common/api/constructor.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
|
@ -44,7 +44,7 @@ namespace electron {
|
|||
namespace api {
|
||||
|
||||
WebContentsView::WebContentsView(v8::Isolate* isolate,
|
||||
mate::Handle<WebContents> web_contents,
|
||||
gin::Handle<WebContents> web_contents,
|
||||
InspectableWebContents* iwc)
|
||||
#if defined(OS_MACOSX)
|
||||
: View(new DelayedNativeViewHost(iwc->GetView()->GetNativeView())),
|
||||
|
@ -80,22 +80,18 @@ void WebContentsView::WebContentsDestroyed() {
|
|||
|
||||
// static
|
||||
mate::WrappableBase* WebContentsView::New(
|
||||
gin::Arguments* args,
|
||||
mate::Handle<WebContents> web_contents) {
|
||||
gin_helper::Arguments* args,
|
||||
gin::Handle<WebContents> web_contents) {
|
||||
// Currently we only support InspectableWebContents, e.g. the WebContents
|
||||
// created by users directly. To support devToolsWebContents we need to create
|
||||
// a wrapper view.
|
||||
if (!web_contents->managed_web_contents()) {
|
||||
const char* error = "The WebContents must be created by user";
|
||||
args->isolate()->ThrowException(
|
||||
v8::Exception::Error(mate::StringToV8(args->isolate(), error)));
|
||||
args->ThrowError("The WebContents must be created by user");
|
||||
return nullptr;
|
||||
}
|
||||
// Check if the WebContents has already been added to a view.
|
||||
if (WebContentsViewRelay::FromWebContents(web_contents->web_contents())) {
|
||||
const char* error = "The WebContents has already been added to a View";
|
||||
args->isolate()->ThrowException(
|
||||
v8::Exception::Error(mate::StringToV8(args->isolate(), error)));
|
||||
args->ThrowError("The WebContents has already been added to a View");
|
||||
return nullptr;
|
||||
}
|
||||
// Constructor call.
|
||||
|
@ -123,7 +119,7 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
mate::Dictionary dict(isolate, exports);
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
dict.Set("WebContentsView",
|
||||
mate::CreateConstructor<WebContentsView>(
|
||||
isolate, base::BindRepeating(&WebContentsView::New)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue