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 <memory>
10#include <string>
11#include <vector>
12
13#include "molybden/js/js_value.hpp"
14
15namespace molybden {
16
17class Browser;
18class RenderProcess;
19
20struct EditorCommand;
21
29class Frame {
30 public:
34 virtual std::shared_ptr<Browser> browser() = 0;
35
42 virtual std::shared_ptr<RenderProcess> renderProcess() = 0;
43
47 virtual bool isMain() = 0;
48
53 virtual std::string name() = 0;
54
61 virtual std::string html() = 0;
62
84 virtual std::string text() = 0;
85
92 virtual void loadUrl(const std::string& url) = 0;
93
104 virtual bool executeCommand(const EditorCommand& command) = 0;
105
116 virtual bool isCommandEnabled(const std::string& command_name) = 0;
117
121 virtual void print() = 0;
122
129 virtual std::shared_ptr<Frame> parent() = 0;
130
144 virtual JsValue executeJavaScript(const std::string& script) = 0;
145
156 virtual void executeJavaScript(const std::string& script,
157 std::function<void(JsValue)> callback) = 0;
158
163 virtual std::vector<std::shared_ptr<Frame>> children() = 0;
164};
165
166} // namespace molybden
167
168#endif // MOLYBDEN_FRAME_HPP
A web frame that provides access to DOM and JavaScript.
Definition frame.hpp:29
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 isCommandEnabled(const std::string &command_name)=0
Returns true if the command with the given command_name can be executed in the frame.
virtual bool isMain()=0
Checks if it is a main frame.
virtual bool executeCommand(const EditorCommand &command)=0
Executes the given command in the 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
Definition editor_command.hpp:15