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

@ -42,7 +42,7 @@
#include "shell/browser/relauncher.h"
#include "shell/common/application_info.h"
#include "shell/common/atom_command_line.h"
#include "shell/common/native_mate_converters/callback.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"
#include "shell/common/native_mate_converters/image_converter.h"

View file

@ -28,7 +28,7 @@
#include "shell/browser/browser.h"
#include "shell/browser/browser_observer.h"
#include "shell/common/error_util.h"
#include "shell/common/native_mate_converters/callback.h"
#include "shell/common/native_mate_converters/callback_converter_deprecated.h"
#include "shell/common/promise_util.h"
#if defined(USE_NSS_CERTS)

View file

@ -11,7 +11,7 @@
#include "shell/browser/native_window.h"
#include "shell/browser/window_list.h"
#include "shell/common/api/event_emitter_caller.h"
#include "shell/common/native_mate_converters/callback.h"
#include "shell/common/native_mate_converters/callback_converter_deprecated.h"
#include "shell/common/node_includes.h"
namespace mate {

View file

@ -19,7 +19,7 @@
#include "shell/browser/window_list.h"
#include "shell/common/api/constructor.h"
#include "shell/common/color_util.h"
#include "shell/common/native_mate_converters/callback.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"
#include "shell/common/options_switches.h"

View file

@ -12,7 +12,7 @@
#include "base/threading/thread_restrictions.h"
#include "content/public/browser/tracing_controller.h"
#include "native_mate/dictionary.h"
#include "shell/common/native_mate_converters/callback.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/value_converter.h"
#include "shell/common/node_includes.h"

View file

@ -20,7 +20,7 @@
#include "net/cookies/cookie_util.h"
#include "shell/browser/atom_browser_context.h"
#include "shell/browser/cookie_change_notifier.h"
#include "shell/common/native_mate_converters/callback.h"
#include "shell/common/native_mate_converters/callback_converter_deprecated.h"
#include "shell/common/native_mate_converters/gurl_converter.h"
#include "shell/common/native_mate_converters/value_converter.h"

View file

@ -13,7 +13,7 @@
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/web_contents.h"
#include "native_mate/dictionary.h"
#include "shell/common/native_mate_converters/callback.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"

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
}

View file

@ -11,7 +11,7 @@
#include "native_mate/dictionary.h"
#include "net/base/filename_util.h"
#include "shell/browser/atom_browser_main_parts.h"
#include "shell/common/native_mate_converters/callback.h"
#include "shell/common/native_mate_converters/callback_converter_deprecated.h"
#include "shell/common/native_mate_converters/file_dialog_converter.h"
#include "shell/common/native_mate_converters/file_path_converter.h"
#include "shell/common/native_mate_converters/gurl_converter.h"

View file

@ -12,7 +12,7 @@
#include "native_mate/dictionary.h"
#include "shell/browser/api/atom_api_system_preferences.h"
#include "shell/common/native_mate_converters/accelerator_converter.h"
#include "shell/common/native_mate_converters/callback.h"
#include "shell/common/native_mate_converters/callback_converter_deprecated.h"
#include "shell/common/node_includes.h"
#if defined(OS_MACOSX)

View file

@ -9,7 +9,7 @@
#include <vector>
#include "native_mate/dictionary.h"
#include "shell/common/native_mate_converters/callback.h"
#include "shell/common/native_mate_converters/callback_converter_deprecated.h"
#include "shell/common/node_includes.h"
namespace mate {

View file

@ -11,7 +11,7 @@
#include "native_mate/object_template_builder.h"
#include "shell/browser/native_window.h"
#include "shell/common/native_mate_converters/accelerator_converter.h"
#include "shell/common/native_mate_converters/callback.h"
#include "shell/common/native_mate_converters/callback_converter_deprecated.h"
#include "shell/common/native_mate_converters/image_converter.h"
#include "shell/common/native_mate_converters/string16_converter.h"
#include "shell/common/node_includes.h"

View file

@ -16,7 +16,7 @@
#include "native_mate/handle.h"
#include "shell/browser/atom_browser_context.h"
#include "shell/browser/net/system_network_context_manager.h"
#include "shell/common/native_mate_converters/callback.h"
#include "shell/common/native_mate_converters/callback_converter_deprecated.h"
#include "shell/common/native_mate_converters/file_path_converter.h"
#include "shell/common/node_includes.h"

View file

@ -8,7 +8,7 @@
#include "base/power_monitor/power_monitor_device_source.h"
#include "native_mate/dictionary.h"
#include "shell/browser/browser.h"
#include "shell/common/native_mate_converters/callback.h"
#include "shell/common/native_mate_converters/callback_converter_deprecated.h"
#include "shell/common/node_includes.h"
namespace mate {

View file

@ -53,7 +53,7 @@
#include "shell/browser/media/media_device_id_salt.h"
#include "shell/browser/net/cert_verifier_client.h"
#include "shell/browser/session_preferences.h"
#include "shell/common/native_mate_converters/callback.h"
#include "shell/common/native_mate_converters/callback_converter_deprecated.h"
#include "shell/common/native_mate_converters/content_converter.h"
#include "shell/common/native_mate_converters/file_path_converter.h"
#include "shell/common/native_mate_converters/gurl_converter.h"

View file

@ -5,7 +5,7 @@
#include "shell/browser/api/atom_api_system_preferences.h"
#include "native_mate/dictionary.h"
#include "shell/common/native_mate_converters/callback.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"
#include "ui/gfx/animation/animation.h"

View file

@ -16,7 +16,7 @@
#include "shell/browser/api/atom_api_view.h"
#include "shell/browser/api/atom_api_web_contents.h"
#include "shell/common/color_util.h"
#include "shell/common/native_mate_converters/callback.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/gfx_converter.h"
#include "shell/common/native_mate_converters/image_converter.h"

View file

@ -16,7 +16,7 @@
#include "shell/browser/api/atom_api_session.h"
#include "shell/browser/api/atom_api_web_contents.h"
#include "shell/browser/atom_browser_context.h"
#include "shell/common/gin_converters/callback_converter_gin_adapter.h"
#include "shell/common/gin_converters/callback_converter.h"
#include "shell/common/gin_converters/gurl_converter.h"
#include "shell/common/gin_converters/net_converter.h"
#include "shell/common/gin_converters/std_converter.h"