chore: remove native_mate (Part 2) (#20106)

* add notice to files being removed

* add gin version of function_template.h

* rename callback.h to avoid confliction

* add gin version of callback_converter

* add gin converter for OnceCallback

* remove callback_converter_gin_adapter.h

* remove gin_util.h and gin_utils.h

* fix lint warning

* add helper for setting methods
This commit is contained in:
Cheng Zhao 2019-09-05 00:45:25 +09:00 committed by Robo
parent 504cdb13f0
commit 81ae154714
42 changed files with 866 additions and 202 deletions

View file

@ -6,15 +6,15 @@
#include <utility>
#include <vector>
#include "gin/dictionary.h"
#include "shell/browser/ui/certificate_trust.h"
#include "shell/browser/ui/file_dialog.h"
#include "shell/browser/ui/message_box.h"
#include "shell/common/api/gin_utils.h"
#include "shell/common/gin_converters/callback_converter.h"
#include "shell/common/gin_converters/file_dialog_converter.h"
#include "shell/common/gin_converters/message_box_converter.h"
#include "shell/common/gin_converters/native_window_converter.h"
#include "shell/common/gin_converters/net_converter.h"
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/node_includes.h"
#include "shell/common/promise_util.h"
@ -87,33 +87,17 @@ void Initialize(v8::Local<v8::Object> exports,
v8::Local<v8::Context> context,
void* priv) {
v8::Isolate* isolate = context->GetIsolate();
gin::Dictionary dict(isolate, exports);
dict.Set("showMessageBoxSync",
gin::ConvertCallbackToV8Leaked(
isolate, base::BindRepeating(&ShowMessageBoxSync)));
dict.Set("showMessageBox",
gin::ConvertCallbackToV8Leaked(
isolate, base::BindRepeating(&ShowMessageBox)));
dict.Set("showErrorBox",
gin::ConvertCallbackToV8Leaked(
isolate, base::BindRepeating(&electron::ShowErrorBox)));
dict.Set("showOpenDialogSync",
gin::ConvertCallbackToV8Leaked(
isolate, base::BindRepeating(&ShowOpenDialogSync)));
dict.Set("showOpenDialog",
gin::ConvertCallbackToV8Leaked(
isolate, base::BindRepeating(&ShowOpenDialog)));
dict.Set("showSaveDialogSync",
gin::ConvertCallbackToV8Leaked(
isolate, base::BindRepeating(&ShowSaveDialogSync)));
dict.Set("showSaveDialog",
gin::ConvertCallbackToV8Leaked(
isolate, base::BindRepeating(&ShowSaveDialog)));
gin_helper::Dictionary dict(isolate, exports);
dict.SetMethod("showMessageBoxSync", &ShowMessageBoxSync);
dict.SetMethod("showMessageBox", &ShowMessageBox);
dict.SetMethod("showErrorBox", &electron::ShowErrorBox);
dict.SetMethod("showOpenDialogSync", &ShowOpenDialogSync);
dict.SetMethod("showOpenDialog", &ShowOpenDialog);
dict.SetMethod("showSaveDialogSync", &ShowSaveDialogSync);
dict.SetMethod("showSaveDialog", &ShowSaveDialog);
#if defined(OS_MACOSX) || defined(OS_WIN)
dict.Set("showCertificateTrustDialog",
gin::ConvertCallbackToV8Leaked(
isolate,
base::BindRepeating(&certificate_trust::ShowCertificateTrust)));
dict.SetMethod("showCertificateTrustDialog",
&certificate_trust::ShowCertificateTrust);
#endif
}