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

@ -16,10 +16,8 @@
#include "base/numerics/safe_conversions.h"
#include "base/threading/thread_task_runner_handle.h"
#include "components/spellcheck/renderer/spellcheck_worditerator.h"
#include "native_mate/converter.h"
#include "native_mate/dictionary.h"
#include "native_mate/function_template.h"
#include "shell/common/native_mate_converters/string16_converter.h"
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/gin_helper/function_template.h"
#include "third_party/blink/public/web/web_text_checking_completion.h"
#include "third_party/blink/public/web/web_text_checking_result.h"
#include "third_party/icu/source/common/unicode/uscript.h"
@ -84,8 +82,9 @@ SpellCheckClient::SpellCheckClient(const std::string& language,
character_attributes_.SetDefaultLanguage(language);
// Persistent the method.
mate::Dictionary dict(isolate, provider);
dict.Get("spellCheck", &spell_check_);
v8::Local<v8::Function> spell_check;
gin_helper::Dictionary(isolate, provider).Get("spellCheck", &spell_check);
spell_check_.Reset(isolate, spell_check);
}
SpellCheckClient::~SpellCheckClient() {
@ -221,12 +220,12 @@ void SpellCheckClient::SpellCheckWords(const SpellCheckScope& scope,
const std::set<base::string16>& words) {
DCHECK(!scope.spell_check_.IsEmpty());
v8::Local<v8::FunctionTemplate> templ = mate::CreateFunctionTemplate(
v8::Local<v8::FunctionTemplate> templ = gin_helper::CreateFunctionTemplate(
isolate_,
base::BindRepeating(&SpellCheckClient::OnSpellCheckDone, AsWeakPtr()));
auto context = isolate_->GetCurrentContext();
v8::Local<v8::Value> args[] = {mate::ConvertToV8(isolate_, words),
v8::Local<v8::Value> args[] = {gin::ConvertToV8(isolate_, words),
templ->GetFunction(context).ToLocalChecked()};
// Call javascript with the words and the callback function
scope.spell_check_->Call(context, scope.provider_, 2, args).IsEmpty();
@ -267,8 +266,9 @@ SpellCheckClient::SpellCheckScope::SpellCheckScope(
: handle_scope_(client.isolate_),
context_scope_(
v8::Local<v8::Context>::New(client.isolate_, client.context_)),
provider_(client.provider_.NewHandle()),
spell_check_(client.spell_check_.NewHandle()) {}
provider_(v8::Local<v8::Object>::New(client.isolate_, client.provider_)),
spell_check_(
v8::Local<v8::Function>::New(client.isolate_, client.spell_check_)) {}
SpellCheckClient::SpellCheckScope::~SpellCheckScope() = default;