electron/shell/common/native_mate_converters/blink_converter.h

140 lines
4.1 KiB
C
Raw Normal View History

// 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-06-19 20:56:58 +00:00
#ifndef SHELL_COMMON_NATIVE_MATE_CONVERTERS_BLINK_CONVERTER_H_
#define SHELL_COMMON_NATIVE_MATE_CONVERTERS_BLINK_CONVERTER_H_
#include "native_mate/converter.h"
#include "third_party/blink/public/platform/web_cache.h"
#include "third_party/blink/public/platform/web_input_event.h"
#include "third_party/blink/public/web/web_context_menu_data.h"
namespace blink {
2015-09-18 05:33:06 +00:00
class WebMouseEvent;
class WebMouseWheelEvent;
class WebKeyboardEvent;
struct WebDeviceEmulationParams;
struct WebFloatPoint;
struct WebPoint;
struct WebSize;
2015-12-21 12:54:55 +00:00
} // namespace blink
2015-09-18 05:33:06 +00:00
namespace content {
struct NativeWebKeyboardEvent;
}
namespace mate {
blink::WebInputEvent::Type GetWebInputEventType(v8::Isolate* isolate,
v8::Local<v8::Value> val);
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);
};
2018-04-18 01:44:10 +00:00
template <>
2015-09-18 05:33:06 +00:00
struct Converter<content::NativeWebKeyboardEvent> {
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
content::NativeWebKeyboardEvent* out);
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const content::NativeWebKeyboardEvent& 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 <>
struct Converter<blink::WebFloatPoint> {
2018-04-18 01:44:10 +00:00
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
blink::WebFloatPoint* out);
};
2018-04-18 01:44:10 +00:00
template <>
struct Converter<blink::WebPoint> {
2018-04-18 01:44:10 +00:00
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
blink::WebPoint* out);
};
2018-04-18 01:44:10 +00:00
template <>
struct Converter<blink::WebSize> {
2018-04-18 01:44:10 +00:00
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
blink::WebSize* out);
};
2018-04-18 01:44:10 +00:00
template <>
struct Converter<blink::WebDeviceEmulationParams> {
2018-04-18 01:44:10 +00:00
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
blink::WebDeviceEmulationParams* out);
};
2018-04-18 01:44:10 +00:00
template <>
struct Converter<blink::WebContextMenuData::MediaType> {
2018-04-18 01:44:10 +00:00
static v8::Local<v8::Value> ToV8(
v8::Isolate* isolate,
const blink::WebContextMenuData::MediaType& in);
};
2018-04-18 01:44:10 +00:00
template <>
struct Converter<blink::WebContextMenuData::InputFieldType> {
2018-04-18 01:44:10 +00:00
static v8::Local<v8::Value> ToV8(
v8::Isolate* isolate,
const blink::WebContextMenuData::InputFieldType& in);
};
2018-04-18 01:44:10 +00:00
template <>
struct Converter<blink::WebCache::ResourceTypeStat> {
2016-05-14 13:40:18 +00:00
static v8::Local<v8::Value> ToV8(
v8::Isolate* isolate,
const blink::WebCache::ResourceTypeStat& stat);
};
2018-04-18 01:44:10 +00:00
template <>
struct Converter<blink::WebCache::ResourceTypeStats> {
2016-05-14 13:40:18 +00:00
static v8::Local<v8::Value> ToV8(
v8::Isolate* isolate,
const blink::WebCache::ResourceTypeStats& stats);
};
2018-04-18 01:44:10 +00:00
template <>
struct Converter<network::mojom::ReferrerPolicy> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const network::mojom::ReferrerPolicy& in);
2018-04-18 01:44:10 +00:00
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
network::mojom::ReferrerPolicy* 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);
} // namespace mate
2019-06-19 20:56:58 +00:00
#endif // SHELL_COMMON_NATIVE_MATE_CONVERTERS_BLINK_CONVERTER_H_