9e0a3c44dd
* chore: bump chromium in DEPS to 105.0.5179.0 * chore: update patches * 3758224: Reland^2 "[flags] Enable freezing of flags" https://chromium-review.googlesource.com/c/v8/v8/+/3758224 * chore: bump chromium in DEPS to 105.0.5181.0 * chore: update patches * chore: bump chromium in DEPS to 105.0.5183.0 * chore: bump chromium in DEPS to 105.0.5185.0 * chore: bump chromium in DEPS to 105.0.5187.0 * chore: update patches * 3723298: Pass RemoteFrame mojo channels through its creation messages. https://chromium-review.googlesource.com/c/chromium/src/+/3723298 * 3737382: [Code Heath] Replace base::{ListValue,DictionaryValue} in skia et al https://chromium-review.googlesource.com/c/chromium/src/+/3737382 * Pass RemoteFrame mojo channels through its creation messages. https://chromium-review.googlesource.com/c/chromium/src/+/3723298 * Changed PrintRenderFrame.PrintWithParams mojo interface to use callback. https://chromium-review.googlesource.com/c/chromium/src/+/3761203 * 3738183: [CSP] Add support for `DisableWasmEval` https://chromium-review.googlesource.com/c/chromium/src/+/3738183 * 3740498: Move LinuxUI from //ui/views/linux_ui to //ui/linux https://chromium-review.googlesource.com/c/chromium/src/+/3740498 * 3558277: Moves subsystem and semantics to enum class https://chromium-review.googlesource.com/c/chromium/src/+/3558277 * chore: fix broken steps-electron-gn-check * 3749583: [arm64] Fix undefined symbol linker error https://chromium-review.googlesource.com/c/v8/v8/+/3749583 Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
78 lines
2.4 KiB
C++
78 lines
2.4 KiB
C++
// Copyright (c) 2014 GitHub, Inc.
|
|
// Use of this source code is governed by the MIT license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "shell/common/gin_converters/value_converter.h"
|
|
|
|
#include <memory>
|
|
#include <utility>
|
|
|
|
#include "content/public/renderer/v8_value_converter.h"
|
|
|
|
namespace gin {
|
|
|
|
bool Converter<base::Value::Dict>::FromV8(v8::Isolate* isolate,
|
|
v8::Local<v8::Value> val,
|
|
base::Value::Dict* out) {
|
|
std::unique_ptr<base::Value> value =
|
|
content::V8ValueConverter::Create()->FromV8Value(
|
|
val, isolate->GetCurrentContext());
|
|
if (value && value->is_dict()) {
|
|
*out = std::move(value->GetDict());
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
v8::Local<v8::Value> Converter<base::Value::Dict>::ToV8(
|
|
v8::Isolate* isolate,
|
|
const base::Value::Dict& val) {
|
|
base::Value value(val.Clone());
|
|
return content::V8ValueConverter::Create()->ToV8Value(
|
|
value, isolate->GetCurrentContext());
|
|
}
|
|
|
|
bool Converter<base::Value>::FromV8(v8::Isolate* isolate,
|
|
v8::Local<v8::Value> val,
|
|
base::Value* out) {
|
|
std::unique_ptr<base::Value> value =
|
|
content::V8ValueConverter::Create()->FromV8Value(
|
|
val, isolate->GetCurrentContext());
|
|
if (value) {
|
|
*out = std::move(*value);
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
v8::Local<v8::Value> Converter<base::Value>::ToV8(v8::Isolate* isolate,
|
|
const base::Value& val) {
|
|
return content::V8ValueConverter::Create()->ToV8Value(
|
|
val, isolate->GetCurrentContext());
|
|
}
|
|
|
|
bool Converter<base::Value::List>::FromV8(v8::Isolate* isolate,
|
|
v8::Local<v8::Value> val,
|
|
base::Value::List* out) {
|
|
std::unique_ptr<base::Value> value =
|
|
content::V8ValueConverter::Create()->FromV8Value(
|
|
val, isolate->GetCurrentContext());
|
|
if (value && value->is_list()) {
|
|
*out = std::move(value->GetList());
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
v8::Local<v8::Value> Converter<base::Value::List>::ToV8(
|
|
v8::Isolate* isolate,
|
|
const base::Value::List& val) {
|
|
base::Value value(val.Clone());
|
|
return content::V8ValueConverter::Create()->ToV8Value(
|
|
value, isolate->GetCurrentContext());
|
|
}
|
|
|
|
} // namespace gin
|