chore: remove native_mate (Part 12) (#20869)

* refactor: move mate::Event to gin

* refactor: move mate::Locker to gin

* refactor: convert contextBridge to gin

* refactor: convert contentTracing to gin

* refactor: remove callback converter of native_mate

* refactor: remove file_dialog_converter and native_window_converter from native_mate

* refactor: convert webFrame to gin

* refactor: move blink_converter to gin

* refactor: remove net_converter from native_mate

* refactor: remove event_emitter_caller_deprecated

* refactor: remove gurl_converter from native_mate

* refactor: remove file_path and string16_converter from native_mate

* refactor: remove image_converter from native_mate

* refactor: move value_converter to gin
This commit is contained in:
Cheng Zhao 2019-10-31 16:56:00 +09:00 committed by GitHub
parent 6781d5e3c8
commit 3ae3233e65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
96 changed files with 622 additions and 1711 deletions

View file

@ -12,11 +12,10 @@
#include "content/public/renderer/render_frame_observer.h"
#include "content/public/renderer/render_frame_visitor.h"
#include "content/public/renderer/render_view.h"
#include "native_mate/dictionary.h"
#include "services/service_manager/public/cpp/interface_provider.h"
#include "shell/common/api/api.mojom.h"
#include "shell/common/native_mate_converters/blink_converter.h"
#include "shell/common/native_mate_converters/string16_converter.h"
#include "shell/common/gin_converters/blink_converter.h"
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/node_includes.h"
#include "shell/common/promise_util.h"
#include "shell/renderer/api/atom_api_spell_check_client.h"
@ -36,7 +35,7 @@
#include "third_party/blink/public/web/web_view.h"
#include "url/url_util.h"
namespace mate {
namespace gin {
template <>
struct Converter<blink::WebLocalFrame::ScriptExecutionType> {
@ -78,7 +77,7 @@ struct Converter<blink::WebDocument::CSSOrigin> {
}
};
} // namespace mate
} // namespace gin
namespace electron {
@ -308,12 +307,12 @@ int GetWebFrameId(v8::Local<v8::Value> window,
return render_frame->GetRoutingID();
}
void SetSpellCheckProvider(mate::Arguments* args,
void SetSpellCheckProvider(gin_helper::Arguments* args,
v8::Local<v8::Value> window,
const std::string& language,
v8::Local<v8::Object> provider) {
auto context = args->isolate()->GetCurrentContext();
if (!provider->Has(context, mate::StringToV8(args->isolate(), "spellCheck"))
if (!provider->Has(context, gin::StringToV8(args->isolate(), "spellCheck"))
.ToChecked()) {
args->ThrowError("\"spellCheck\" has to be defined");
return;
@ -349,11 +348,11 @@ void InsertText(v8::Local<v8::Value> window, const std::string& text) {
base::string16 InsertCSS(v8::Local<v8::Value> window,
const std::string& css,
mate::Arguments* args) {
gin_helper::Arguments* args) {
blink::WebDocument::CSSOrigin css_origin =
blink::WebDocument::CSSOrigin::kAuthorOrigin;
mate::Dictionary options;
gin_helper::Dictionary options;
if (args->GetNext(&options))
options.Get("cssOrigin", &css_origin);
@ -375,7 +374,7 @@ void RemoveInsertedCSS(v8::Local<v8::Value> window, const base::string16& key) {
}
}
v8::Local<v8::Promise> ExecuteJavaScript(mate::Arguments* args,
v8::Local<v8::Promise> ExecuteJavaScript(gin_helper::Arguments* args,
v8::Local<v8::Value> window,
const base::string16& code) {
v8::Isolate* isolate = args->isolate();
@ -393,10 +392,10 @@ v8::Local<v8::Promise> ExecuteJavaScript(mate::Arguments* args,
}
v8::Local<v8::Promise> ExecuteJavaScriptInIsolatedWorld(
mate::Arguments* args,
gin_helper::Arguments* args,
v8::Local<v8::Value> window,
int world_id,
const std::vector<mate::Dictionary>& scripts) {
const std::vector<gin_helper::Dictionary>& scripts) {
v8::Isolate* isolate = args->isolate();
util::Promise<v8::Local<v8::Value>> promise(isolate);
v8::Local<v8::Promise> handle = promise.GetHandle();
@ -439,8 +438,8 @@ v8::Local<v8::Promise> ExecuteJavaScriptInIsolatedWorld(
void SetIsolatedWorldInfo(v8::Local<v8::Value> window,
int world_id,
const mate::Dictionary& options,
mate::Arguments* args) {
const gin_helper::Dictionary& options,
gin_helper::Arguments* args) {
std::string origin_url, security_policy, name;
options.Get("securityOrigin", &origin_url);
options.Get("csp", &security_policy);
@ -574,7 +573,7 @@ void Initialize(v8::Local<v8::Object> exports,
using namespace electron::api; // NOLINT(build/namespaces)
v8::Isolate* isolate = context->GetIsolate();
mate::Dictionary dict(isolate, exports);
gin_helper::Dictionary dict(isolate, exports);
dict.SetMethod("setName", &SetName);
dict.SetMethod("setZoomLevel", &SetZoomLevel);
dict.SetMethod("getZoomLevel", &GetZoomLevel);