chore: remove native_mate (Part 4) (#20146)
* avoid patching gin::Dictionary by using our wrapper * remove SetHidden from mate::Dictionary
This commit is contained in:
parent
d395799917
commit
49bd74ff0e
24 changed files with 190 additions and 162 deletions
|
@ -43,6 +43,7 @@
|
|||
#include "shell/browser/relauncher.h"
|
||||
#include "shell/common/application_info.h"
|
||||
#include "shell/common/atom_command_line.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/native_mate_converters/callback_converter_deprecated.h"
|
||||
#include "shell/common/native_mate_converters/file_path_converter.h"
|
||||
#include "shell/common/native_mate_converters/gurl_converter.h"
|
||||
|
@ -1207,8 +1208,11 @@ std::vector<mate::Dictionary> App::GetAppMetrics(v8::Isolate* isolate) {
|
|||
mate::Dictionary pid_dict = mate::Dictionary::CreateEmpty(isolate);
|
||||
mate::Dictionary cpu_dict = mate::Dictionary::CreateEmpty(isolate);
|
||||
|
||||
pid_dict.SetHidden("simple", true);
|
||||
cpu_dict.SetHidden("simple", true);
|
||||
// TODO(zcbenz): Just call SetHidden when this file is converted to gin.
|
||||
gin_helper::Dictionary(isolate, pid_dict.GetHandle())
|
||||
.SetHidden("simple", true);
|
||||
gin_helper::Dictionary(isolate, cpu_dict.GetHandle())
|
||||
.SetHidden("simple", true);
|
||||
|
||||
cpu_dict.Set(
|
||||
"percentCPUUsage",
|
||||
|
@ -1236,7 +1240,9 @@ std::vector<mate::Dictionary> App::GetAppMetrics(v8::Isolate* isolate) {
|
|||
auto memory_info = process_metric.second->GetMemoryInfo();
|
||||
|
||||
mate::Dictionary memory_dict = mate::Dictionary::CreateEmpty(isolate);
|
||||
memory_dict.SetHidden("simple", true);
|
||||
// TODO(zcbenz): Just call SetHidden when this file is converted to gin.
|
||||
gin_helper::Dictionary(isolate, memory_dict.GetHandle())
|
||||
.SetHidden("simple", true);
|
||||
memory_dict.Set("workingSetSize",
|
||||
static_cast<double>(memory_info.working_set_size >> 10));
|
||||
memory_dict.Set(
|
||||
|
|
|
@ -25,11 +25,12 @@ int ShowMessageBoxSync(const electron::MessageBoxSettings& settings) {
|
|||
return electron::ShowMessageBoxSync(settings);
|
||||
}
|
||||
|
||||
void ResolvePromiseObject(electron::util::Promise<gin::Dictionary> promise,
|
||||
int result,
|
||||
bool checkbox_checked) {
|
||||
void ResolvePromiseObject(
|
||||
electron::util::Promise<gin_helper::Dictionary> promise,
|
||||
int result,
|
||||
bool checkbox_checked) {
|
||||
v8::Isolate* isolate = promise.isolate();
|
||||
gin::Dictionary dict = gin::Dictionary::CreateEmpty(isolate);
|
||||
gin_helper::Dictionary dict = gin::Dictionary::CreateEmpty(isolate);
|
||||
|
||||
dict.Set("response", result);
|
||||
dict.Set("checkboxChecked", checkbox_checked);
|
||||
|
@ -41,7 +42,7 @@ v8::Local<v8::Promise> ShowMessageBox(
|
|||
const electron::MessageBoxSettings& settings,
|
||||
gin::Arguments* args) {
|
||||
v8::Isolate* isolate = args->isolate();
|
||||
electron::util::Promise<gin::Dictionary> promise(isolate);
|
||||
electron::util::Promise<gin_helper::Dictionary> promise(isolate);
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
electron::ShowMessageBox(
|
||||
|
@ -60,7 +61,7 @@ void ShowOpenDialogSync(const file_dialog::DialogSettings& settings,
|
|||
v8::Local<v8::Promise> ShowOpenDialog(
|
||||
const file_dialog::DialogSettings& settings,
|
||||
gin::Arguments* args) {
|
||||
electron::util::Promise<gin::Dictionary> promise(args->isolate());
|
||||
electron::util::Promise<gin_helper::Dictionary> promise(args->isolate());
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
file_dialog::ShowOpenDialog(settings, std::move(promise));
|
||||
return handle;
|
||||
|
@ -76,7 +77,7 @@ void ShowSaveDialogSync(const file_dialog::DialogSettings& settings,
|
|||
v8::Local<v8::Promise> ShowSaveDialog(
|
||||
const file_dialog::DialogSettings& settings,
|
||||
gin::Arguments* args) {
|
||||
electron::util::Promise<gin::Dictionary> promise(args->isolate());
|
||||
electron::util::Promise<gin_helper::Dictionary> promise(args->isolate());
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
file_dialog::ShowSaveDialog(settings, std::move(promise));
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "native_mate/dictionary.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
|
||||
namespace mate {
|
||||
|
@ -18,7 +19,8 @@ struct Converter<in_app_purchase::Payment> {
|
|||
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
||||
const in_app_purchase::Payment& payment) {
|
||||
mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate);
|
||||
dict.SetHidden("simple", true);
|
||||
// TODO(zcbenz): Just call SetHidden when this file is converted to gin.
|
||||
gin_helper::Dictionary(isolate, dict.GetHandle()).SetHidden("simple", true);
|
||||
dict.Set("productIdentifier", payment.productIdentifier);
|
||||
dict.Set("quantity", payment.quantity);
|
||||
return dict.GetHandle();
|
||||
|
@ -30,7 +32,8 @@ struct Converter<in_app_purchase::Transaction> {
|
|||
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
||||
const in_app_purchase::Transaction& val) {
|
||||
mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate);
|
||||
dict.SetHidden("simple", true);
|
||||
// TODO(zcbenz): Just call SetHidden when this file is converted to gin.
|
||||
gin_helper::Dictionary(isolate, dict.GetHandle()).SetHidden("simple", true);
|
||||
dict.Set("transactionIdentifier", val.transactionIdentifier);
|
||||
dict.Set("transactionDate", val.transactionDate);
|
||||
dict.Set("originalTransactionIdentifier",
|
||||
|
@ -48,7 +51,8 @@ struct Converter<in_app_purchase::Product> {
|
|||
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
||||
const in_app_purchase::Product& val) {
|
||||
mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate);
|
||||
dict.SetHidden("simple", true);
|
||||
// TODO(zcbenz): Just call SetHidden when this file is converted to gin.
|
||||
gin_helper::Dictionary(isolate, dict.GetHandle()).SetHidden("simple", true);
|
||||
dict.Set("productIdentifier", val.productIdentifier);
|
||||
dict.Set("localizedDescription", val.localizedDescription);
|
||||
dict.Set("localizedTitle", val.localizedTitle);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "shell/browser/api/atom_api_system_preferences.h"
|
||||
|
||||
#include "native_mate/dictionary.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/native_mate_converters/callback_converter_deprecated.h"
|
||||
#include "shell/common/native_mate_converters/value_converter.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
|
@ -45,7 +46,7 @@ bool SystemPreferences::IsHighContrastColorScheme() {
|
|||
|
||||
v8::Local<v8::Value> SystemPreferences::GetAnimationSettings(
|
||||
v8::Isolate* isolate) {
|
||||
mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate);
|
||||
gin_helper::Dictionary dict = gin::Dictionary::CreateEmpty(isolate);
|
||||
dict.SetHidden("simple", true);
|
||||
dict.Set("shouldRenderRichAnimation",
|
||||
gfx::Animation::ShouldRenderRichAnimation());
|
||||
|
|
|
@ -47,7 +47,7 @@ struct Converter<electron::TaskbarHost::ThumbarButton> {
|
|||
static bool FromV8(v8::Isolate* isolate,
|
||||
v8::Handle<v8::Value> val,
|
||||
electron::TaskbarHost::ThumbarButton* out) {
|
||||
gin::Dictionary dict;
|
||||
gin::Dictionary dict(isolate);
|
||||
if (!gin::ConvertFromV8(isolate, val, &dict))
|
||||
return false;
|
||||
dict.Get("click", &(out->clicked_callback));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue