2015-09-18 11:06:38 +08:00
|
|
|
// Copyright (c) 2015 GitHub, Inc.
|
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2021-11-22 08:34:31 +01:00
|
|
|
#ifndef ELECTRON_SHELL_COMMON_GIN_CONVERTERS_BLINK_CONVERTER_H_
|
|
|
|
#define ELECTRON_SHELL_COMMON_GIN_CONVERTERS_BLINK_CONVERTER_H_
|
2015-09-18 11:06:38 +08:00
|
|
|
|
2019-10-31 16:56:00 +09:00
|
|
|
#include "gin/converter.h"
|
2021-02-09 12:16:21 -08:00
|
|
|
#include "third_party/blink/public/common/context_menu_data/context_menu_data.h"
|
2020-01-17 10:41:52 -08:00
|
|
|
#include "third_party/blink/public/common/input/web_input_event.h"
|
2019-10-09 10:59:08 -07:00
|
|
|
#include "third_party/blink/public/common/messaging/cloneable_message.h"
|
2019-10-18 15:57:34 -04:00
|
|
|
#include "third_party/blink/public/common/web_cache/web_cache_resource_type_stats.h"
|
2024-10-18 16:07:06 -04:00
|
|
|
#include "third_party/blink/public/mojom/devtools/console_message.mojom-forward.h"
|
2021-04-13 12:35:27 -07:00
|
|
|
#include "third_party/blink/public/mojom/loader/referrer.mojom-forward.h"
|
2015-09-18 11:06:38 +08:00
|
|
|
|
|
|
|
namespace blink {
|
2015-09-18 13:33:06 +08:00
|
|
|
class WebMouseEvent;
|
|
|
|
class WebMouseWheelEvent;
|
|
|
|
class WebKeyboardEvent;
|
2020-08-12 11:33:58 -07:00
|
|
|
struct DeviceEmulationParams;
|
2015-12-21 18:24:55 +05:30
|
|
|
} // namespace blink
|
2015-09-18 11:06:38 +08:00
|
|
|
|
2019-10-31 16:56:00 +09:00
|
|
|
namespace gin {
|
2015-09-18 11:06:38 +08:00
|
|
|
|
2017-08-08 04:06:31 +03:00
|
|
|
blink::WebInputEvent::Type GetWebInputEventType(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val);
|
2015-09-18 14:09:31 +08:00
|
|
|
|
2022-09-27 14:47:46 -05:00
|
|
|
template <>
|
|
|
|
struct Converter<blink::WebInputEvent::Type> {
|
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
|
|
|
blink::WebInputEvent::Type* out);
|
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
|
|
|
const blink::WebInputEvent::Type& in);
|
|
|
|
};
|
|
|
|
|
2018-04-17 21:44:10 -04:00
|
|
|
template <>
|
2015-09-18 13:33:06 +08:00
|
|
|
struct Converter<blink::WebInputEvent> {
|
2018-04-17 21:44:10 -04:00
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
2015-09-18 13:33:06 +08:00
|
|
|
blink::WebInputEvent* out);
|
2022-09-27 14:47:46 -05:00
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
|
|
|
const blink::WebInputEvent& in);
|
2015-09-18 13:33:06 +08:00
|
|
|
};
|
|
|
|
|
2018-04-17 21:44:10 -04:00
|
|
|
template <>
|
2015-09-18 13:33:06 +08:00
|
|
|
struct Converter<blink::WebKeyboardEvent> {
|
2018-04-17 21:44:10 -04:00
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
2015-09-18 13:33:06 +08:00
|
|
|
blink::WebKeyboardEvent* out);
|
2021-07-14 04:50:02 -07:00
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
|
|
|
const blink::WebKeyboardEvent& in);
|
2015-09-18 13:33:06 +08:00
|
|
|
};
|
|
|
|
|
2018-04-17 21:44:10 -04:00
|
|
|
template <>
|
2015-09-18 13:33:06 +08:00
|
|
|
struct Converter<blink::WebMouseEvent> {
|
2018-04-17 21:44:10 -04:00
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
2015-09-18 13:33:06 +08:00
|
|
|
blink::WebMouseEvent* out);
|
|
|
|
};
|
|
|
|
|
2018-04-17 21:44:10 -04:00
|
|
|
template <>
|
2015-09-18 13:33:06 +08:00
|
|
|
struct Converter<blink::WebMouseWheelEvent> {
|
2018-04-17 21:44:10 -04:00
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
2015-09-18 13:33:06 +08:00
|
|
|
blink::WebMouseWheelEvent* out);
|
|
|
|
};
|
|
|
|
|
2018-04-17 21:44:10 -04:00
|
|
|
template <>
|
2020-08-12 11:33:58 -07:00
|
|
|
struct Converter<blink::DeviceEmulationParams> {
|
2018-04-17 21:44:10 -04:00
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
2020-08-12 11:33:58 -07:00
|
|
|
blink::DeviceEmulationParams* out);
|
2015-09-18 11:06:38 +08:00
|
|
|
};
|
|
|
|
|
2018-04-17 21:44:10 -04:00
|
|
|
template <>
|
2021-01-12 15:31:23 -08:00
|
|
|
struct Converter<blink::mojom::ContextMenuDataMediaType> {
|
|
|
|
static v8::Local<v8::Value> ToV8(
|
|
|
|
v8::Isolate* isolate,
|
|
|
|
const blink::mojom::ContextMenuDataMediaType& in);
|
2016-05-02 20:02:33 -04:00
|
|
|
};
|
|
|
|
|
2018-04-17 21:44:10 -04:00
|
|
|
template <>
|
2024-01-10 23:23:35 +01:00
|
|
|
struct Converter<std::optional<blink::mojom::FormControlType>> {
|
2018-04-17 21:44:10 -04:00
|
|
|
static v8::Local<v8::Value> ToV8(
|
|
|
|
v8::Isolate* isolate,
|
2024-01-10 23:23:35 +01:00
|
|
|
const std::optional<blink::mojom::FormControlType>& in);
|
2016-05-02 20:02:33 -04:00
|
|
|
};
|
|
|
|
|
2018-04-17 21:44:10 -04:00
|
|
|
template <>
|
2019-10-18 15:57:34 -04:00
|
|
|
struct Converter<blink::WebCacheResourceTypeStat> {
|
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
|
|
|
const blink::WebCacheResourceTypeStat& stat);
|
2016-05-12 13:48:01 -07:00
|
|
|
};
|
|
|
|
|
2018-04-17 21:44:10 -04:00
|
|
|
template <>
|
2019-10-18 15:57:34 -04:00
|
|
|
struct Converter<blink::WebCacheResourceTypeStats> {
|
2016-05-14 22:40:18 +09:00
|
|
|
static v8::Local<v8::Value> ToV8(
|
|
|
|
v8::Isolate* isolate,
|
2019-10-18 15:57:34 -04:00
|
|
|
const blink::WebCacheResourceTypeStats& stats);
|
2016-05-12 13:48:01 -07:00
|
|
|
};
|
|
|
|
|
2018-04-17 21:44:10 -04:00
|
|
|
template <>
|
2019-01-09 12:13:49 -08:00
|
|
|
struct Converter<network::mojom::ReferrerPolicy> {
|
2018-04-05 16:13:24 -07:00
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
2019-01-09 12:13:49 -08:00
|
|
|
const network::mojom::ReferrerPolicy& in);
|
2018-04-17 21:44:10 -04:00
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
2019-01-09 12:13:49 -08:00
|
|
|
network::mojom::ReferrerPolicy* out);
|
2018-04-05 16:13:24 -07:00
|
|
|
};
|
|
|
|
|
2021-04-13 12:35:27 -07:00
|
|
|
template <>
|
|
|
|
struct Converter<blink::mojom::Referrer> {
|
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
|
|
|
const blink::mojom::Referrer& val);
|
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
|
|
|
blink::mojom::Referrer* out);
|
|
|
|
};
|
|
|
|
|
2019-10-09 10:59:08 -07:00
|
|
|
template <>
|
|
|
|
struct Converter<blink::CloneableMessage> {
|
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
|
|
|
const blink::CloneableMessage& in);
|
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
|
|
|
blink::CloneableMessage* out);
|
|
|
|
};
|
|
|
|
|
2024-10-18 16:07:06 -04:00
|
|
|
template <>
|
|
|
|
struct Converter<blink::mojom::ConsoleMessageLevel> {
|
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
|
|
|
const blink::mojom::ConsoleMessageLevel& in);
|
|
|
|
};
|
|
|
|
|
2016-05-14 22:40:18 +09:00
|
|
|
v8::Local<v8::Value> EditFlagsToV8(v8::Isolate* isolate, int editFlags);
|
|
|
|
v8::Local<v8::Value> MediaFlagsToV8(v8::Isolate* isolate, int mediaFlags);
|
|
|
|
|
2019-10-31 16:56:00 +09:00
|
|
|
} // namespace gin
|
2015-09-18 11:06:38 +08:00
|
|
|
|
2021-11-22 08:34:31 +01:00
|
|
|
#endif // ELECTRON_SHELL_COMMON_GIN_CONVERTERS_BLINK_CONVERTER_H_
|