electron/shell/common/gin_converters/blink_converter.h
Jeremy Rose dba4df9326
feat: add more info in setWindowOpenHandler details (#28518)
* fix: invoke the window open handler for _blank links

* feat: add disposition to setWindowOpenHandler details

* fix: pass postData to new-window event

* postData can be heterogeneous

* fix type of postBody

* fix type of UploadFile and UploadRawData to be discriminated unions

* exclude the empty string from additionalFeatures

* add a test

* add postBody and referrer to setWindowOpenHandler args

* appease typescript

* Update api-browser-window-spec.ts

* update snapshots
2021-04-13 15:35:27 -04:00

122 lines
3.9 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 SHELL_COMMON_GIN_CONVERTERS_BLINK_CONVERTER_H_
#define SHELL_COMMON_GIN_CONVERTERS_BLINK_CONVERTER_H_
#include "gin/converter.h"
#include "third_party/blink/public/common/context_menu_data/context_menu_data.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "third_party/blink/public/common/messaging/cloneable_message.h"
#include "third_party/blink/public/common/web_cache/web_cache_resource_type_stats.h"
#include "third_party/blink/public/mojom/loader/referrer.mojom-forward.h"
namespace blink {
class WebMouseEvent;
class WebMouseWheelEvent;
class WebKeyboardEvent;
struct DeviceEmulationParams;
struct WebSize;
} // namespace blink
namespace gin {
blink::WebInputEvent::Type 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<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::DeviceEmulationParams> {
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
blink::DeviceEmulationParams* out);
};
template <>
struct Converter<blink::mojom::ContextMenuDataMediaType> {
static v8::Local<v8::Value> ToV8(
v8::Isolate* isolate,
const blink::mojom::ContextMenuDataMediaType& in);
};
template <>
struct Converter<blink::mojom::ContextMenuDataInputFieldType> {
static v8::Local<v8::Value> ToV8(
v8::Isolate* isolate,
const blink::mojom::ContextMenuDataInputFieldType& in);
};
template <>
struct Converter<blink::WebCacheResourceTypeStat> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const blink::WebCacheResourceTypeStat& stat);
};
template <>
struct Converter<blink::WebCacheResourceTypeStats> {
static v8::Local<v8::Value> ToV8(
v8::Isolate* isolate,
const blink::WebCacheResourceTypeStats& stats);
};
template <>
struct Converter<network::mojom::ReferrerPolicy> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const network::mojom::ReferrerPolicy& in);
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
network::mojom::ReferrerPolicy* out);
};
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);
};
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);
};
v8::Local<v8::Value> EditFlagsToV8(v8::Isolate* isolate, int editFlags);
v8::Local<v8::Value> MediaFlagsToV8(v8::Isolate* isolate, int mediaFlags);
} // namespace gin
#endif // SHELL_COMMON_GIN_CONVERTERS_BLINK_CONVERTER_H_