2015-10-28 12:13:06 +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.
|
|
|
|
|
2021-11-22 07:34:31 +00:00
|
|
|
#ifndef ELECTRON_SHELL_COMMON_GIN_CONVERTERS_CONTENT_CONVERTER_H_
|
|
|
|
#define ELECTRON_SHELL_COMMON_GIN_CONVERTERS_CONTENT_CONVERTER_H_
|
2015-10-28 12:13:06 +00:00
|
|
|
|
2015-11-02 15:28:45 +00:00
|
|
|
#include <utility>
|
|
|
|
|
2018-04-05 23:13:24 +00:00
|
|
|
#include "content/public/common/referrer.h"
|
2015-12-17 17:27:56 +00:00
|
|
|
#include "content/public/common/stop_find_action.h"
|
2019-10-25 13:03:28 +00:00
|
|
|
#include "gin/converter.h"
|
2022-05-17 16:48:40 +00:00
|
|
|
#include "third_party/blink/public/common/permissions/permission_utils.h"
|
2021-03-06 00:39:01 +00:00
|
|
|
#include "third_party/blink/public/mojom/choosers/popup_menu.mojom.h"
|
2024-09-17 19:58:56 +00:00
|
|
|
#include "third_party/blink/public/mojom/permissions/permission_status.mojom-forward.h"
|
2023-06-29 22:54:06 +00:00
|
|
|
#include "ui/base/ui_base_types.h"
|
2015-10-28 12:13:06 +00:00
|
|
|
|
2015-10-31 13:39:07 +00:00
|
|
|
namespace content {
|
|
|
|
struct ContextMenuParams;
|
2021-09-21 23:52:49 +00:00
|
|
|
class RenderFrameHost;
|
2015-11-02 15:28:45 +00:00
|
|
|
class WebContents;
|
2018-04-18 01:44:10 +00:00
|
|
|
} // namespace content
|
2015-10-28 12:13:06 +00:00
|
|
|
|
2024-06-07 21:18:35 +00:00
|
|
|
namespace input {
|
|
|
|
struct NativeWebKeyboardEvent;
|
|
|
|
}
|
|
|
|
|
2021-09-21 23:52:49 +00:00
|
|
|
using ContextMenuParamsWithRenderFrameHost =
|
|
|
|
std::pair<content::ContextMenuParams, content::RenderFrameHost*>;
|
2015-11-02 15:28:45 +00:00
|
|
|
|
2019-10-25 13:03:28 +00:00
|
|
|
namespace gin {
|
2015-10-28 12:13:06 +00:00
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2021-03-05 23:36:52 +00:00
|
|
|
struct Converter<blink::mojom::MenuItem::Type> {
|
2015-10-28 12:13:06 +00:00
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
2021-03-05 23:36:52 +00:00
|
|
|
const blink::mojom::MenuItem::Type& val);
|
2015-10-28 12:13:06 +00:00
|
|
|
};
|
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2021-09-21 23:52:49 +00:00
|
|
|
struct Converter<ContextMenuParamsWithRenderFrameHost> {
|
|
|
|
static v8::Local<v8::Value> ToV8(
|
|
|
|
v8::Isolate* isolate,
|
|
|
|
const ContextMenuParamsWithRenderFrameHost& val);
|
2015-10-28 12:13:06 +00:00
|
|
|
};
|
|
|
|
|
2023-06-29 22:54:06 +00:00
|
|
|
template <>
|
|
|
|
struct Converter<ui::MenuSourceType> {
|
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
|
|
|
const ui::MenuSourceType& val);
|
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
|
|
|
ui::MenuSourceType* out);
|
|
|
|
};
|
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2016-05-23 01:59:39 +00:00
|
|
|
struct Converter<blink::mojom::PermissionStatus> {
|
2018-04-18 01:44:10 +00:00
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
2016-05-23 01:59:39 +00:00
|
|
|
blink::mojom::PermissionStatus* out);
|
2016-01-30 11:19:18 +00:00
|
|
|
};
|
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2022-05-17 16:48:40 +00:00
|
|
|
struct Converter<blink::PermissionType> {
|
2016-01-30 11:19:18 +00:00
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
2022-05-17 16:48:40 +00:00
|
|
|
const blink::PermissionType& val);
|
2016-01-30 11:19:18 +00:00
|
|
|
};
|
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2015-12-17 17:27:56 +00:00
|
|
|
struct Converter<content::StopFindAction> {
|
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
|
|
|
content::StopFindAction* out);
|
|
|
|
};
|
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2016-01-31 21:35:34 +00:00
|
|
|
struct Converter<content::WebContents*> {
|
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
|
|
|
content::WebContents* val);
|
2018-04-18 01:44:10 +00:00
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
2016-04-26 07:10:27 +00:00
|
|
|
content::WebContents** out);
|
2016-01-31 21:35:34 +00:00
|
|
|
};
|
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2018-04-05 23:13:24 +00:00
|
|
|
struct Converter<content::Referrer> {
|
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
|
|
|
const content::Referrer& val);
|
2018-04-18 01:44:10 +00:00
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
2018-04-05 23:13:24 +00:00
|
|
|
content::Referrer* out);
|
|
|
|
};
|
|
|
|
|
2019-10-25 13:03:28 +00:00
|
|
|
template <>
|
2024-06-07 21:18:35 +00:00
|
|
|
struct Converter<input::NativeWebKeyboardEvent> {
|
2019-10-25 13:03:28 +00:00
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
2024-06-07 21:18:35 +00:00
|
|
|
input::NativeWebKeyboardEvent* out);
|
2019-10-25 13:03:28 +00:00
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
2024-06-07 21:18:35 +00:00
|
|
|
const input::NativeWebKeyboardEvent& in);
|
2019-10-25 13:03:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace gin
|
2015-10-28 12:13:06 +00:00
|
|
|
|
2021-11-22 07:34:31 +00:00
|
|
|
#endif // ELECTRON_SHELL_COMMON_GIN_CONVERTERS_CONTENT_CONVERTER_H_
|