2015-10-28 20:13:06 +08: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.
|
|
|
|
|
2019-10-25 22:03:28 +09:00
|
|
|
#ifndef SHELL_COMMON_GIN_CONVERTERS_CONTENT_CONVERTER_H_
|
|
|
|
#define SHELL_COMMON_GIN_CONVERTERS_CONTENT_CONVERTER_H_
|
2015-10-28 20:13:06 +08:00
|
|
|
|
2015-11-02 23:28:45 +08:00
|
|
|
#include <utility>
|
|
|
|
|
2016-01-30 16:49:18 +05:30
|
|
|
#include "content/public/browser/permission_type.h"
|
2015-11-02 23:28:45 +08:00
|
|
|
#include "content/public/common/menu_item.h"
|
2018-04-05 16:13:24 -07:00
|
|
|
#include "content/public/common/referrer.h"
|
2015-12-17 22:57:56 +05:30
|
|
|
#include "content/public/common/stop_find_action.h"
|
2019-10-25 22:03:28 +09:00
|
|
|
#include "gin/converter.h"
|
2019-03-21 19:53:21 -07:00
|
|
|
#include "third_party/blink/public/mojom/permissions/permission_status.mojom.h"
|
2015-10-28 20:13:06 +08:00
|
|
|
|
2015-10-31 19:09:07 +05:30
|
|
|
namespace content {
|
|
|
|
struct ContextMenuParams;
|
2019-10-25 22:03:28 +09:00
|
|
|
struct NativeWebKeyboardEvent;
|
2015-11-02 23:28:45 +08:00
|
|
|
class WebContents;
|
2018-04-17 21:44:10 -04:00
|
|
|
} // namespace content
|
2015-10-28 20:13:06 +08:00
|
|
|
|
2015-11-02 23:28:45 +08:00
|
|
|
using ContextMenuParamsWithWebContents =
|
|
|
|
std::pair<content::ContextMenuParams, content::WebContents*>;
|
|
|
|
|
2019-10-25 22:03:28 +09:00
|
|
|
namespace gin {
|
2015-10-28 20:13:06 +08:00
|
|
|
|
2018-04-17 21:44:10 -04:00
|
|
|
template <>
|
2015-11-02 23:28:45 +08:00
|
|
|
struct Converter<content::MenuItem::Type> {
|
2015-10-28 20:13:06 +08:00
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
2015-11-02 23:28:45 +08:00
|
|
|
const content::MenuItem::Type& val);
|
2015-10-28 20:13:06 +08:00
|
|
|
};
|
|
|
|
|
2018-04-17 21:44:10 -04:00
|
|
|
template <>
|
2015-11-02 23:28:45 +08:00
|
|
|
struct Converter<ContextMenuParamsWithWebContents> {
|
2015-10-28 20:13:06 +08:00
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
2015-11-02 23:28:45 +08:00
|
|
|
const ContextMenuParamsWithWebContents& val);
|
2015-10-28 20:13:06 +08:00
|
|
|
};
|
|
|
|
|
2018-04-17 21:44:10 -04:00
|
|
|
template <>
|
2016-05-23 10:59:39 +09:00
|
|
|
struct Converter<blink::mojom::PermissionStatus> {
|
2018-04-17 21:44:10 -04:00
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
2016-05-23 10:59:39 +09:00
|
|
|
blink::mojom::PermissionStatus* out);
|
2016-01-30 16:49:18 +05:30
|
|
|
};
|
|
|
|
|
2018-04-17 21:44:10 -04:00
|
|
|
template <>
|
2016-01-30 16:49:18 +05:30
|
|
|
struct Converter<content::PermissionType> {
|
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
|
|
|
const content::PermissionType& val);
|
|
|
|
};
|
|
|
|
|
2018-04-17 21:44:10 -04:00
|
|
|
template <>
|
2015-12-17 22:57:56 +05:30
|
|
|
struct Converter<content::StopFindAction> {
|
2018-04-17 21:44:10 -04:00
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
2015-12-17 22:57:56 +05:30
|
|
|
content::StopFindAction* out);
|
|
|
|
};
|
|
|
|
|
2018-04-17 21:44:10 -04:00
|
|
|
template <>
|
2016-02-01 03:05:34 +05:30
|
|
|
struct Converter<content::WebContents*> {
|
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
|
|
|
content::WebContents* val);
|
2018-04-17 21:44:10 -04:00
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
2016-04-26 16:10:27 +09:00
|
|
|
content::WebContents** out);
|
2016-02-01 03:05:34 +05:30
|
|
|
};
|
|
|
|
|
2018-04-17 21:44:10 -04:00
|
|
|
template <>
|
2018-04-05 16:13:24 -07:00
|
|
|
struct Converter<content::Referrer> {
|
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
|
|
|
const content::Referrer& val);
|
2018-04-17 21:44:10 -04:00
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
2018-04-05 16:13:24 -07:00
|
|
|
content::Referrer* out);
|
|
|
|
};
|
|
|
|
|
2019-10-25 22:03:28 +09: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 20:13:06 +08:00
|
|
|
|
2019-10-25 22:03:28 +09:00
|
|
|
#endif // SHELL_COMMON_GIN_CONVERTERS_CONTENT_CONVERTER_H_
|