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.
|
|
|
|
|
|
|
|
#ifndef ATOM_COMMON_NATIVE_MATE_CONVERTERS_BLINK_CONVERTER_H_
|
|
|
|
#define ATOM_COMMON_NATIVE_MATE_CONVERTERS_BLINK_CONVERTER_H_
|
|
|
|
|
|
|
|
#include "native_mate/converter.h"
|
2018-07-20 16:08:18 +00:00
|
|
|
#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"
|
2015-09-18 03:06:38 +00:00
|
|
|
|
|
|
|
namespace blink {
|
2015-09-18 05:33:06 +00:00
|
|
|
class WebMouseEvent;
|
|
|
|
class WebMouseWheelEvent;
|
|
|
|
class WebKeyboardEvent;
|
2015-09-18 03:06:38 +00:00
|
|
|
struct WebDeviceEmulationParams;
|
2015-12-17 23:10:42 +00:00
|
|
|
struct WebFindOptions;
|
2015-09-18 03:06:38 +00:00
|
|
|
struct WebFloatPoint;
|
|
|
|
struct WebPoint;
|
|
|
|
struct WebSize;
|
2015-12-21 12:54:55 +00:00
|
|
|
} // namespace blink
|
2015-09-18 03:06:38 +00:00
|
|
|
|
2015-09-18 05:33:06 +00:00
|
|
|
namespace content {
|
|
|
|
struct NativeWebKeyboardEvent;
|
|
|
|
}
|
|
|
|
|
2015-09-18 03:06:38 +00:00
|
|
|
namespace mate {
|
|
|
|
|
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);
|
|
|
|
};
|
|
|
|
|
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);
|
2016-12-13 23:52:37 +00:00
|
|
|
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 <>
|
2015-09-18 03:06:38 +00:00
|
|
|
struct Converter<blink::WebFloatPoint> {
|
2018-04-18 01:44:10 +00:00
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
2015-09-18 03:06:38 +00:00
|
|
|
blink::WebFloatPoint* out);
|
|
|
|
};
|
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2015-09-18 03:06:38 +00:00
|
|
|
struct Converter<blink::WebPoint> {
|
2018-04-18 01:44:10 +00:00
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
2015-09-18 03:06:38 +00:00
|
|
|
blink::WebPoint* out);
|
|
|
|
};
|
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2015-09-18 03:06:38 +00:00
|
|
|
struct Converter<blink::WebSize> {
|
2018-04-18 01:44:10 +00:00
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
2015-09-18 03:06:38 +00:00
|
|
|
blink::WebSize* out);
|
|
|
|
};
|
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2015-09-18 03:06:38 +00:00
|
|
|
struct Converter<blink::WebDeviceEmulationParams> {
|
2018-04-18 01:44:10 +00:00
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
2015-09-18 03:06:38 +00:00
|
|
|
blink::WebDeviceEmulationParams* out);
|
|
|
|
};
|
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2015-12-17 17:27:56 +00:00
|
|
|
struct Converter<blink::WebFindOptions> {
|
2018-04-18 01:44:10 +00:00
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
2015-12-17 17:27:56 +00:00
|
|
|
blink::WebFindOptions* out);
|
|
|
|
};
|
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2016-05-03 00:02:33 +00:00
|
|
|
struct Converter<blink::WebContextMenuData::MediaType> {
|
2018-04-18 01:44:10 +00:00
|
|
|
static v8::Local<v8::Value> ToV8(
|
|
|
|
v8::Isolate* isolate,
|
2016-05-03 00:02:33 +00:00
|
|
|
const blink::WebContextMenuData::MediaType& in);
|
|
|
|
};
|
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2016-05-03 00:02:33 +00:00
|
|
|
struct Converter<blink::WebContextMenuData::InputFieldType> {
|
2018-04-18 01:44:10 +00:00
|
|
|
static v8::Local<v8::Value> ToV8(
|
|
|
|
v8::Isolate* isolate,
|
2016-05-03 00:02:33 +00:00
|
|
|
const blink::WebContextMenuData::InputFieldType& in);
|
|
|
|
};
|
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2016-05-12 20:48:01 +00:00
|
|
|
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);
|
2016-05-12 20:48:01 +00:00
|
|
|
};
|
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2016-05-12 20:48:01 +00:00
|
|
|
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);
|
2016-05-12 20:48:01 +00:00
|
|
|
};
|
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2018-04-05 23:13:24 +00:00
|
|
|
struct Converter<blink::WebReferrerPolicy> {
|
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
2018-04-18 01:44:10 +00:00
|
|
|
const blink::WebReferrerPolicy& in);
|
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
2018-04-05 23:13:24 +00:00
|
|
|
blink::WebReferrerPolicy* 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);
|
|
|
|
|
2015-09-18 03:06:38 +00:00
|
|
|
} // namespace mate
|
|
|
|
|
|
|
|
#endif // ATOM_COMMON_NATIVE_MATE_CONVERTERS_BLINK_CONVERTER_H_
|