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.
|
|
|
|
|
2019-10-31 16:56:00 +09:00
|
|
|
#ifndef SHELL_COMMON_GIN_CONVERTERS_BLINK_CONVERTER_H_
|
|
|
|
#define 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"
|
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"
|
2018-07-20 18:08:18 +02:00
|
|
|
#include "third_party/blink/public/web/web_context_menu_data.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;
|
2015-09-18 11:06:38 +08:00
|
|
|
struct WebDeviceEmulationParams;
|
|
|
|
struct WebSize;
|
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
|
|
|
|
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);
|
|
|
|
};
|
|
|
|
|
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);
|
|
|
|
};
|
|
|
|
|
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 <>
|
2015-09-18 11:06:38 +08:00
|
|
|
struct Converter<blink::WebSize> {
|
2018-04-17 21:44:10 -04:00
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
2015-09-18 11:06:38 +08:00
|
|
|
blink::WebSize* out);
|
|
|
|
};
|
|
|
|
|
2018-04-17 21:44:10 -04:00
|
|
|
template <>
|
2015-09-18 11:06:38 +08:00
|
|
|
struct Converter<blink::WebDeviceEmulationParams> {
|
2018-04-17 21:44:10 -04:00
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
2015-09-18 11:06:38 +08:00
|
|
|
blink::WebDeviceEmulationParams* out);
|
|
|
|
};
|
|
|
|
|
2018-04-17 21:44:10 -04:00
|
|
|
template <>
|
2019-11-05 18:41:20 -05:00
|
|
|
struct Converter<blink::ContextMenuDataMediaType> {
|
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
|
|
|
const blink::ContextMenuDataMediaType& in);
|
2016-05-02 20:02:33 -04:00
|
|
|
};
|
|
|
|
|
2018-04-17 21:44:10 -04:00
|
|
|
template <>
|
2019-11-05 18:41:20 -05:00
|
|
|
struct Converter<blink::ContextMenuDataInputFieldType> {
|
2018-04-17 21:44:10 -04:00
|
|
|
static v8::Local<v8::Value> ToV8(
|
|
|
|
v8::Isolate* isolate,
|
2019-11-05 18:41:20 -05:00
|
|
|
const blink::ContextMenuDataInputFieldType& 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
|
|
|
};
|
|
|
|
|
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);
|
|
|
|
};
|
|
|
|
|
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
|
|
|
|
2019-10-31 16:56:00 +09:00
|
|
|
#endif // SHELL_COMMON_GIN_CONVERTERS_BLINK_CONVERTER_H_
|