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>
|
|
|
|
|
2016-01-30 11:19:18 +00:00
|
|
|
#include "content/public/browser/permission_type.h"
|
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"
|
2021-03-06 00:39:01 +00:00
|
|
|
#include "third_party/blink/public/mojom/choosers/popup_menu.mojom.h"
|
2019-03-22 02:53:21 +00:00
|
|
|
#include "third_party/blink/public/mojom/permissions/permission_status.mojom.h"
|
2015-10-28 12:13:06 +00:00
|
|
|
|
2015-10-31 13:39:07 +00:00
|
|
|
namespace content {
|
|
|
|
struct ContextMenuParams;
|
2019-10-25 13:03:28 +00:00
|
|
|
struct NativeWebKeyboardEvent;
|
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
|
|
|
|
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
|
|
|
};
|
|
|
|
|
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 <>
|
2016-01-30 11:19:18 +00:00
|
|
|
struct Converter<content::PermissionType> {
|
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
|
|
|
const content::PermissionType& val);
|
|
|
|
};
|
|
|
|
|
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 <>
|
|
|
|
struct Converter<content::NativeWebKeyboardEvent> {
|
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
|
|
|
content::NativeWebKeyboardEvent* out);
|
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
|
|
|
const content::NativeWebKeyboardEvent& in);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // 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_
|