Molybden API
Loading...
Searching...
No Matches
frame.hpp
1// Copyright (c) 2000-2023 TeamDev Ltd. All rights reserved.
2// TeamDev PROPRIETARY and CONFIDENTIAL.
3// Use is subject to license terms.
4
5#ifndef MOLYBDEN_FRAME_HPP
6#define MOLYBDEN_FRAME_HPP
7
8#include <functional>
9#include <string>
10#include <vector>
11
12#include "molybden/js/js_value.hpp"
13
14namespace molybden {
15
16class Browser;
17class RenderProcess;
18
26class Frame {
27 public:
28 virtual ~Frame() = default;
29
33 virtual std::shared_ptr<Browser> browser() = 0;
34
41 virtual std::shared_ptr<RenderProcess> renderProcess() = 0;
42
46 virtual bool isMain() = 0;
47
52 virtual std::string name() = 0;
53
60 virtual std::string html() = 0;
61
82 virtual std::string text() = 0;
83
90 virtual void loadUrl(const std::string& url) = 0;
91
95 virtual void print() = 0;
96
103 virtual std::shared_ptr<Frame> parent() = 0;
104
118 virtual JsValue executeJavaScript(const std::string& script) = 0;
119
130 virtual void executeJavaScript(const std::string& script,
131 std::function<void(JsValue)> callback) = 0;
132
137 virtual std::vector<std::shared_ptr<Frame>> children() = 0;
138};
139
140} // namespace molybden
141
142#endif // MOLYBDEN_FRAME_HPP
A web frame that provides access to DOM and JavaScript.
Definition frame.hpp:26
virtual JsValue executeJavaScript(const std::string &script)=0
Executes the given script in the frame and returns the result of the execution.
virtual std::string text()=0
Returns content of the frame and its sub-frames as plain text or an empty string if the frame does no...
virtual std::string name()=0
Returns the name of the frame or an empty string if the frame does not have a name.
virtual std::shared_ptr< Browser > browser()=0
The browser instance of the frame.
virtual bool isMain()=0
Checks if it is a main frame.
virtual std::shared_ptr< RenderProcess > renderProcess()=0
Returns the render process associated with this frame.
virtual void loadUrl(const std::string &url)=0
Navigates the frame to a resource identified by the given URL.
virtual std::vector< std::shared_ptr< Frame > > children()=0
Returns a list of child frames or an empty list if this frame does not have any children.
virtual void print()=0
Requests printing of the currently loaded web page in this frame.
virtual std::string html()=0
Returns content of the frame in the HTML format or an empty string if the frame does not have a conte...
virtual std::shared_ptr< Frame > parent()=0
Returns the parent frame instance or nullptr if the frame is a main (top-level) frame that doesn't ha...
virtual void executeJavaScript(const std::string &script, std::function< void(JsValue)> callback)=0
Executes the given script in the frame and returns the result of the execution.
A JavaScript value.
Definition js_value.hpp:44