feat: add webFrameMain API to the main process (#25464)
This commit is contained in:
parent
647df1e547
commit
704d69a8f9
18 changed files with 778 additions and 8 deletions
28
shell/common/gin_converters/frame_converter.cc
Normal file
28
shell/common/gin_converters/frame_converter.cc
Normal file
|
@ -0,0 +1,28 @@
|
|||
// Copyright (c) 2020 Samuel Maddock <sam@samuelmaddock.com>.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "shell/common/gin_converters/frame_converter.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
#include "shell/browser/api/electron_api_web_frame_main.h"
|
||||
#include "shell/common/gin_converters/blink_converter.h"
|
||||
#include "shell/common/gin_converters/callback_converter.h"
|
||||
#include "shell/common/gin_converters/gurl_converter.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
|
||||
namespace gin {
|
||||
|
||||
// static
|
||||
v8::Local<v8::Value> Converter<content::RenderFrameHost*>::ToV8(
|
||||
v8::Isolate* isolate,
|
||||
content::RenderFrameHost* val) {
|
||||
if (!val)
|
||||
return v8::Null(isolate);
|
||||
return electron::api::WebFrameMain::From(isolate, val).ToV8();
|
||||
}
|
||||
|
||||
} // namespace gin
|
26
shell/common/gin_converters/frame_converter.h
Normal file
26
shell/common/gin_converters/frame_converter.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
// Copyright (c) 2020 Samuel Maddock <sam@samuelmaddock.com>.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef SHELL_COMMON_GIN_CONVERTERS_FRAME_CONVERTER_H_
|
||||
#define SHELL_COMMON_GIN_CONVERTERS_FRAME_CONVERTER_H_
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "gin/converter.h"
|
||||
|
||||
namespace content {
|
||||
class RenderFrameHost;
|
||||
} // namespace content
|
||||
|
||||
namespace gin {
|
||||
|
||||
template <>
|
||||
struct Converter<content::RenderFrameHost*> {
|
||||
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
||||
content::RenderFrameHost* val);
|
||||
};
|
||||
|
||||
} // namespace gin
|
||||
|
||||
#endif // SHELL_COMMON_GIN_CONVERTERS_FRAME_CONVERTER_H_
|
|
@ -63,6 +63,7 @@
|
|||
V(electron_browser_view) \
|
||||
V(electron_browser_web_contents) \
|
||||
V(electron_browser_web_contents_view) \
|
||||
V(electron_browser_web_frame_main) \
|
||||
V(electron_browser_web_view_manager) \
|
||||
V(electron_browser_window) \
|
||||
V(electron_common_asar) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue