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

@ -6,15 +6,13 @@
#include <vector>
#include "native_mate/arguments.h"
#include "native_mate/dictionary.h"
#include "native_mate/object_template_builder_deprecated.h"
#include "native_mate/wrappable.h"
#include "shell/common/asar/archive.h"
#include "shell/common/asar/asar_util.h"
#include "shell/common/gin_converters/callback_converter.h"
#include "shell/common/gin_converters/file_path_converter.h"
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/native_mate_converters/file_path_converter.h"
#include "shell/common/gin_helper/object_template_builder.h"
#include "shell/common/node_includes.h"
#include "shell/common/node_util.h"
namespace {
@ -31,8 +29,8 @@ class Archive : public mate::Wrappable<Archive> {
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype) {
prototype->SetClassName(mate::StringToV8(isolate, "Archive"));
mate::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
prototype->SetClassName(gin::StringToV8(isolate, "Archive"));
gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
.SetProperty("path", &Archive::GetPath)
.SetMethod("getFileInfo", &Archive::GetFileInfo)
.SetMethod("stat", &Archive::Stat)
@ -84,7 +82,7 @@ class Archive : public mate::Wrappable<Archive> {
std::vector<base::FilePath> files;
if (!archive_ || !archive_->Readdir(path, &files))
return v8::False(isolate);
return mate::ConvertToV8(isolate, files);
return gin::ConvertToV8(isolate, files);
}
// Returns the path of file with symbol link resolved.
@ -93,7 +91,7 @@ class Archive : public mate::Wrappable<Archive> {
base::FilePath realpath;
if (!archive_ || !archive_->Realpath(path, &realpath))
return v8::False(isolate);
return mate::ConvertToV8(isolate, realpath);
return gin::ConvertToV8(isolate, realpath);
}
// Copy the file out into a temporary file and returns the new path.
@ -102,7 +100,7 @@ class Archive : public mate::Wrappable<Archive> {
base::FilePath new_path;
if (!archive_ || !archive_->CopyFileOut(path, &new_path))
return v8::False(isolate);
return mate::ConvertToV8(isolate, new_path);
return gin::ConvertToV8(isolate, new_path);
}
// Return the file descriptor.
@ -130,7 +128,7 @@ void InitAsarSupport(v8::Isolate* isolate, v8::Local<v8::Value> require) {
v8::Local<v8::Value> SplitPath(v8::Isolate* isolate,
const base::FilePath& path) {
mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate);
gin_helper::Dictionary dict = gin::Dictionary::CreateEmpty(isolate);
base::FilePath asar_path, file_path;
if (asar::GetAsarArchivePath(path, &asar_path, &file_path, true)) {
dict.Set("isAsar", true);