106 lines
3 KiB
C++
106 lines
3 KiB
C++
// 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"
|
|
#include "third_party/WebKit/public/platform/WebVector.h"
|
|
|
|
namespace blink {
|
|
class WebInputEvent;
|
|
class WebMouseEvent;
|
|
class WebMouseWheelEvent;
|
|
class WebKeyboardEvent;
|
|
struct WebDeviceEmulationParams;
|
|
struct WebFindOptions;
|
|
struct WebFloatPoint;
|
|
struct WebPoint;
|
|
struct WebSize;
|
|
} // namespace blink
|
|
|
|
namespace content {
|
|
struct NativeWebKeyboardEvent;
|
|
}
|
|
|
|
namespace mate {
|
|
|
|
int GetWebInputEventType(v8::Isolate* isolate, v8::Local<v8::Value> val);
|
|
|
|
template<>
|
|
struct Converter<blink::WebInputEvent> {
|
|
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
|
|
blink::WebInputEvent* out);
|
|
};
|
|
|
|
template<>
|
|
struct Converter<blink::WebKeyboardEvent> {
|
|
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
|
|
blink::WebKeyboardEvent* out);
|
|
};
|
|
|
|
template<>
|
|
struct Converter<content::NativeWebKeyboardEvent> {
|
|
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
|
|
content::NativeWebKeyboardEvent* out);
|
|
};
|
|
|
|
template<>
|
|
struct Converter<blink::WebMouseEvent> {
|
|
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
|
|
blink::WebMouseEvent* out);
|
|
};
|
|
|
|
template<>
|
|
struct Converter<blink::WebMouseWheelEvent> {
|
|
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
|
|
blink::WebMouseWheelEvent* out);
|
|
};
|
|
|
|
template<>
|
|
struct Converter<blink::WebFloatPoint> {
|
|
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
|
|
blink::WebFloatPoint* out);
|
|
};
|
|
|
|
template<>
|
|
struct Converter<blink::WebPoint> {
|
|
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
|
|
blink::WebPoint* out);
|
|
};
|
|
|
|
template<>
|
|
struct Converter<blink::WebSize> {
|
|
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
|
|
blink::WebSize* out);
|
|
};
|
|
|
|
template<>
|
|
struct Converter<blink::WebDeviceEmulationParams> {
|
|
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
|
|
blink::WebDeviceEmulationParams* out);
|
|
};
|
|
|
|
template<>
|
|
struct Converter<blink::WebFindOptions> {
|
|
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
|
|
blink::WebFindOptions* out);
|
|
};
|
|
|
|
template<typename T>
|
|
struct Converter<blink::WebVector<T> > {
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
|
const blink::WebVector<T>& val) {
|
|
v8::Local<v8::Array> result(
|
|
MATE_ARRAY_NEW(isolate, static_cast<int>(val.size())));
|
|
for (size_t i = 0; i < val.size(); ++i) {
|
|
result->Set(static_cast<int>(i), Converter<T>::ToV8(isolate, val[i]));
|
|
}
|
|
return result;
|
|
}
|
|
};
|
|
|
|
} // namespace mate
|
|
|
|
#endif // ATOM_COMMON_NATIVE_MATE_CONVERTERS_BLINK_CONVERTER_H_
|