2012-04-03 03:34:16 +02:00
|
|
|
// Copyright (c) 2012 The Chromium Embedded Framework Authors.
|
|
|
|
// Portions copyright (c) 2011 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2018-04-19 17:44:42 +02:00
|
|
|
#ifndef CEF_LIBCEF_RENDERER_BLINK_GLUE_H_
|
|
|
|
#define CEF_LIBCEF_RENDERER_BLINK_GLUE_H_
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2016-01-06 20:20:54 +01:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2017-07-06 22:39:37 +02:00
|
|
|
#include <memory>
|
2012-04-03 03:34:16 +02:00
|
|
|
#include <string>
|
2016-01-06 20:20:54 +01:00
|
|
|
|
2015-10-09 17:23:12 +02:00
|
|
|
#include "include/internal/cef_types.h"
|
2017-07-06 22:39:37 +02:00
|
|
|
|
2022-04-05 19:22:32 +02:00
|
|
|
#include "third_party/blink/public/mojom/frame/lifecycle.mojom-blink-forward.h"
|
2018-04-19 17:44:42 +02:00
|
|
|
#include "third_party/blink/public/platform/web_common.h"
|
2016-08-31 13:25:56 +02:00
|
|
|
#include "v8/include/v8.h"
|
2015-10-09 17:23:12 +02:00
|
|
|
|
2013-11-08 22:28:56 +01:00
|
|
|
namespace blink {
|
2016-11-23 21:54:29 +01:00
|
|
|
class WebElement;
|
2017-07-27 01:19:27 +02:00
|
|
|
class WebLocalFrame;
|
2013-10-29 18:53:18 +01:00
|
|
|
class WebNode;
|
|
|
|
class WebString;
|
2021-01-28 00:13:12 +01:00
|
|
|
class WebURLRequest;
|
2018-01-03 22:14:29 +01:00
|
|
|
class WebURLResponse;
|
2012-04-03 03:34:16 +02:00
|
|
|
class WebView;
|
2017-07-27 01:19:27 +02:00
|
|
|
} // namespace blink
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2018-04-19 17:44:42 +02:00
|
|
|
namespace blink_glue {
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2017-07-06 22:39:37 +02:00
|
|
|
BLINK_EXPORT bool CanGoBack(blink::WebView* view);
|
|
|
|
BLINK_EXPORT bool CanGoForward(blink::WebView* view);
|
|
|
|
BLINK_EXPORT void GoBack(blink::WebView* view);
|
|
|
|
BLINK_EXPORT void GoForward(blink::WebView* view);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2022-02-10 22:52:36 +01:00
|
|
|
BLINK_EXPORT bool IsInBackForwardCache(blink::WebLocalFrame* frame);
|
|
|
|
|
2013-06-04 19:41:37 +02:00
|
|
|
// Returns the text of the document element.
|
2021-05-14 18:58:55 +02:00
|
|
|
BLINK_EXPORT blink::WebString DumpDocumentText(blink::WebLocalFrame* frame);
|
2021-03-04 23:36:57 +01:00
|
|
|
// Returns the markup of the document element.
|
2021-05-14 18:58:55 +02:00
|
|
|
BLINK_EXPORT blink::WebString DumpDocumentMarkup(blink::WebLocalFrame* frame);
|
2013-10-29 18:53:18 +01:00
|
|
|
|
2015-10-09 17:23:12 +02:00
|
|
|
// Expose additional actions on WebNode.
|
2017-07-06 22:39:37 +02:00
|
|
|
BLINK_EXPORT cef_dom_node_type_t GetNodeType(const blink::WebNode& node);
|
|
|
|
BLINK_EXPORT blink::WebString GetNodeName(const blink::WebNode& node);
|
|
|
|
BLINK_EXPORT blink::WebString CreateNodeMarkup(const blink::WebNode& node);
|
|
|
|
BLINK_EXPORT bool SetNodeValue(blink::WebNode& node,
|
|
|
|
const blink::WebString& value);
|
2014-09-24 17:38:11 +02:00
|
|
|
|
2017-07-06 22:39:37 +02:00
|
|
|
BLINK_EXPORT bool IsTextControlElement(const blink::WebElement& element);
|
2016-11-23 21:54:29 +01:00
|
|
|
|
2017-07-06 22:39:37 +02:00
|
|
|
BLINK_EXPORT v8::MaybeLocal<v8::Value> CallV8Function(
|
|
|
|
v8::Local<v8::Context> context,
|
|
|
|
v8::Local<v8::Function> function,
|
|
|
|
v8::Local<v8::Object> receiver,
|
|
|
|
int argc,
|
|
|
|
v8::Local<v8::Value> args[],
|
|
|
|
v8::Isolate* isolate);
|
2016-08-31 13:25:56 +02:00
|
|
|
|
2020-10-08 21:54:42 +02:00
|
|
|
BLINK_EXPORT v8::Local<v8::Value> ExecuteV8ScriptAndReturnValue(
|
2016-10-27 18:34:19 +02:00
|
|
|
const blink::WebString& source,
|
|
|
|
const blink::WebString& source_url,
|
|
|
|
int start_line,
|
|
|
|
v8::Local<v8::Context> context,
|
2020-10-08 21:54:42 +02:00
|
|
|
v8::TryCatch& tryCatch);
|
2016-10-27 18:34:19 +02:00
|
|
|
|
2023-01-03 00:34:43 +01:00
|
|
|
BLINK_EXPORT v8::MicrotaskQueue* GetMicrotaskQueue(
|
|
|
|
v8::Local<v8::Context> context);
|
|
|
|
|
2017-07-06 22:39:37 +02:00
|
|
|
BLINK_EXPORT bool IsScriptForbidden();
|
|
|
|
|
2022-04-05 19:22:32 +02:00
|
|
|
class BLINK_EXPORT CefObserverRegistration {
|
|
|
|
public:
|
|
|
|
CefObserverRegistration() = default;
|
|
|
|
|
|
|
|
CefObserverRegistration(const CefObserverRegistration&) = delete;
|
|
|
|
CefObserverRegistration& operator=(const CefObserverRegistration&) = delete;
|
|
|
|
|
|
|
|
virtual ~CefObserverRegistration() = default;
|
|
|
|
};
|
|
|
|
|
|
|
|
class BLINK_EXPORT CefExecutionContextLifecycleStateObserver {
|
|
|
|
public:
|
|
|
|
virtual void ContextLifecycleStateChanged(
|
|
|
|
blink::mojom::blink::FrameLifecycleState state) {}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual ~CefExecutionContextLifecycleStateObserver() = default;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Register an ExecutionContextLifecycleStateObserver. Remains registered until
|
|
|
|
// the returned object is destroyed.
|
|
|
|
BLINK_EXPORT std::unique_ptr<CefObserverRegistration>
|
|
|
|
RegisterExecutionContextLifecycleStateObserver(
|
|
|
|
v8::Local<v8::Context> context,
|
|
|
|
CefExecutionContextLifecycleStateObserver* observer);
|
|
|
|
|
2019-02-04 23:31:31 +01:00
|
|
|
BLINK_EXPORT void RegisterURLSchemeAsSupportingFetchAPI(
|
|
|
|
const blink::WebString& scheme);
|
|
|
|
|
2017-07-06 22:39:37 +02:00
|
|
|
// Wrapper for blink::ScriptForbiddenScope.
|
|
|
|
class BLINK_EXPORT CefScriptForbiddenScope final {
|
|
|
|
public:
|
|
|
|
CefScriptForbiddenScope();
|
2021-12-06 21:40:25 +01:00
|
|
|
|
|
|
|
CefScriptForbiddenScope(const CefScriptForbiddenScope&) = delete;
|
|
|
|
CefScriptForbiddenScope& operator=(const CefScriptForbiddenScope&) = delete;
|
|
|
|
|
2017-07-06 22:39:37 +02:00
|
|
|
~CefScriptForbiddenScope();
|
|
|
|
|
|
|
|
private:
|
|
|
|
struct Impl;
|
|
|
|
std::unique_ptr<Impl> impl_;
|
|
|
|
};
|
2017-01-23 18:36:54 +01:00
|
|
|
|
2018-01-03 22:14:29 +01:00
|
|
|
BLINK_EXPORT bool ResponseWasCached(const blink::WebURLResponse& response);
|
|
|
|
|
2020-01-23 22:58:01 +01:00
|
|
|
// Returns true if the frame owner is a plugin.
|
|
|
|
BLINK_EXPORT bool HasPluginFrameOwner(blink::WebLocalFrame* frame);
|
|
|
|
|
2021-01-28 00:13:12 +01:00
|
|
|
BLINK_EXPORT void StartNavigation(blink::WebLocalFrame* frame,
|
|
|
|
const blink::WebURLRequest& request);
|
|
|
|
|
2018-04-19 17:44:42 +02:00
|
|
|
} // namespace blink_glue
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2018-04-19 17:44:42 +02:00
|
|
|
#endif // CEF_LIBCEF_RENDERER_BLINK_GLUE_H_
|