2015-09-18 03:06:38 +00: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.
|
|
|
|
|
2019-10-31 07:56:00 +00:00
|
|
|
#ifndef SHELL_COMMON_GIN_CONVERTERS_BLINK_CONVERTER_H_
|
|
|
|
#define SHELL_COMMON_GIN_CONVERTERS_BLINK_CONVERTER_H_
|
2015-09-18 03:06:38 +00:00
|
|
|
|
2019-10-31 07:56:00 +00:00
|
|
|
#include "gin/converter.h"
|
2021-02-09 20:16:21 +00:00
|
|
|
#include "third_party/blink/public/common/context_menu_data/context_menu_data.h"
|
2020-01-17 18:41:52 +00:00
|
|
|
#include "third_party/blink/public/common/input/web_input_event.h"
|
2019-10-09 17:59:08 +00:00
|
|
|
#include "third_party/blink/public/common/messaging/cloneable_message.h"
|
2019-10-18 19:57:34 +00:00
|
|
|
#include "third_party/blink/public/common/web_cache/web_cache_resource_type_stats.h"
|
2021-04-13 19:35:27 +00:00
|
|
|
#include "third_party/blink/public/mojom/loader/referrer.mojom-forward.h"
|
2015-09-18 03:06:38 +00:00
|
|
|
|
|
|
|
namespace blink {
|
2015-09-18 05:33:06 +00:00
|
|
|
class WebMouseEvent;
|
|
|
|
class WebMouseWheelEvent;
|
|
|
|
class WebKeyboardEvent;
|
2020-08-12 18:33:58 +00:00
|
|
|
struct DeviceEmulationParams;
|
2015-12-21 12:54:55 +00:00
|
|
|
} // namespace blink
|
2015-09-18 03:06:38 +00:00
|
|
|
|
2019-10-31 07:56:00 +00:00
|
|
|
namespace gin {
|
2015-09-18 03:06:38 +00:00
|
|
|
|
2017-08-08 01:06:31 +00:00
|
|
|
blink::WebInputEvent::Type GetWebInputEventType(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val);
|
2015-09-18 06:09:31 +00:00
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2015-09-18 05:33:06 +00:00
|
|
|
struct Converter<blink::WebInputEvent> {
|
2018-04-18 01:44:10 +00:00
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
2015-09-18 05:33:06 +00:00
|
|
|
blink::WebInputEvent* out);
|
|
|
|
};
|
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2015-09-18 05:33:06 +00:00
|
|
|
struct Converter<blink::WebKeyboardEvent> {
|
2018-04-18 01:44:10 +00:00
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
2015-09-18 05:33:06 +00:00
|
|
|
blink::WebKeyboardEvent* out);
|
2021-07-14 11:50:02 +00:00
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
|
|
|
const blink::WebKeyboardEvent& in);
|
2015-09-18 05:33:06 +00:00
|
|
|
};
|
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2015-09-18 05:33:06 +00:00
|
|
|
struct Converter<blink::WebMouseEvent> {
|
2018-04-18 01:44:10 +00:00
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
2015-09-18 05:33:06 +00:00
|
|
|
blink::WebMouseEvent* out);
|
|
|
|
};
|
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2015-09-18 05:33:06 +00:00
|
|
|
struct Converter<blink::WebMouseWheelEvent> {
|
2018-04-18 01:44:10 +00:00
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
2015-09-18 05:33:06 +00:00
|
|
|
blink::WebMouseWheelEvent* out);
|
|
|
|
};
|
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2020-08-12 18:33:58 +00:00
|
|
|
struct Converter<blink::DeviceEmulationParams> {
|
2018-04-18 01:44:10 +00:00
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
2020-08-12 18:33:58 +00:00
|
|
|
blink::DeviceEmulationParams* out);
|
2015-09-18 03:06:38 +00:00
|
|
|
};
|
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2021-01-12 23:31:23 +00:00
|
|
|
struct Converter<blink::mojom::ContextMenuDataMediaType> {
|
|
|
|
static v8::Local<v8::Value> ToV8(
|
|
|
|
v8::Isolate* isolate,
|
|
|
|
const blink::mojom::ContextMenuDataMediaType& in);
|
2016-05-03 00:02:33 +00:00
|
|
|
};
|
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2021-02-09 20:16:21 +00:00
|
|
|
struct Converter<blink::mojom::ContextMenuDataInputFieldType> {
|
2018-04-18 01:44:10 +00:00
|
|
|
static v8::Local<v8::Value> ToV8(
|
|
|
|
v8::Isolate* isolate,
|
2021-02-09 20:16:21 +00:00
|
|
|
const blink::mojom::ContextMenuDataInputFieldType& in);
|
2016-05-03 00:02:33 +00:00
|
|
|
};
|
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2019-10-18 19:57:34 +00:00
|
|
|
struct Converter<blink::WebCacheResourceTypeStat> {
|
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
|
|
|
const blink::WebCacheResourceTypeStat& stat);
|
2016-05-12 20:48:01 +00:00
|
|
|
};
|
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2019-10-18 19:57:34 +00:00
|
|
|
struct Converter<blink::WebCacheResourceTypeStats> {
|
2016-05-14 13:40:18 +00:00
|
|
|
static v8::Local<v8::Value> ToV8(
|
|
|
|
v8::Isolate* isolate,
|
2019-10-18 19:57:34 +00:00
|
|
|
const blink::WebCacheResourceTypeStats& stats);
|
2016-05-12 20:48:01 +00:00
|
|
|
};
|
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2019-01-09 20:13:49 +00:00
|
|
|
struct Converter<network::mojom::ReferrerPolicy> {
|
2018-04-05 23:13:24 +00:00
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
2019-01-09 20:13:49 +00:00
|
|
|
const network::mojom::ReferrerPolicy& in);
|
2018-04-18 01:44:10 +00:00
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
2019-01-09 20:13:49 +00:00
|
|
|
network::mojom::ReferrerPolicy* out);
|
2018-04-05 23:13:24 +00:00
|
|
|
};
|
|
|
|
|
2021-04-13 19:35:27 +00: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 17:59:08 +00: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);
|
|
|
|
};
|
|
|
|
|
2016-05-14 13:40:18 +00:00
|
|
|
v8::Local<v8::Value> EditFlagsToV8(v8::Isolate* isolate, int editFlags);
|
|
|
|
v8::Local<v8::Value> MediaFlagsToV8(v8::Isolate* isolate, int mediaFlags);
|
|
|
|
|
2019-10-31 07:56:00 +00:00
|
|
|
} // namespace gin
|
2015-09-18 03:06:38 +00:00
|
|
|
|
2019-10-31 07:56:00 +00:00
|
|
|
#endif // SHELL_COMMON_GIN_CONVERTERS_BLINK_CONVERTER_H_
|