Molybden
Loading...
Searching...
No Matches
browser.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_BROWSER_HPP
6#define MOLYBDEN_BROWSER_HPP
7
8#include <memory>
9#include <unordered_set>
10
11#include "molybden/app/app.hpp"
12#include "molybden/browser/browser_delegates.hpp"
13#include "molybden/browser/browser_events.hpp"
14#include "molybden/ui/geometry.hpp"
15
16namespace molybden {
17
18class CaptureSession;
19class BrowserSettings;
20class DevTools;
21class Frame;
22class FullScreen;
23class Media;
24class Navigation;
25class Profile;
26class TextFinder;
27class Zoom;
28class JavaScript;
29class JsValue;
30
46class Browser : public BrowserEvents, public BrowserDelegates {
47 public:
53 static std::shared_ptr<Browser> create(std::shared_ptr<App> app);
54
60 static std::shared_ptr<Browser> create(std::shared_ptr<Profile> profile);
61
65 virtual std::shared_ptr<App> app() = 0;
66
70 virtual std::shared_ptr<Profile> profile() = 0;
71
75 virtual std::shared_ptr<BrowserSettings> settings() = 0;
76
80 virtual std::shared_ptr<Media> media() = 0;
81
85 virtual std::shared_ptr<Navigation> navigation() = 0;
86
90 virtual std::shared_ptr<FullScreen> fullScreen() = 0;
91
95 virtual std::shared_ptr<DevTools> devTools() = 0;
96
100 virtual std::shared_ptr<TextFinder> textFinder() = 0;
101
106 virtual std::shared_ptr<Zoom> zoom() = 0;
107
112 virtual std::string pageUrl() = 0;
113
118 virtual std::string pageTitle() = 0;
119
124 virtual std::shared_ptr<Frame> mainFrame() = 0;
125
130 virtual std::shared_ptr<Frame> focusedFrame() = 0;
131
136 virtual std::unordered_set<std::shared_ptr<Frame>> frames() = 0;
137
141 virtual std::vector<std::shared_ptr<CaptureSession>> captureSessions() = 0;
142
155 virtual void loadUrl(const std::string& url) = 0;
156
160 virtual void setSize(const Size& size) = 0;
161
165 virtual void setSize(uint32_t width, uint32_t height) = 0;
166
170 virtual void setPosition(const Point& position_on_screen) = 0;
171
177 virtual void setBounds(const Rect& bounds) = 0;
178
182 virtual Rect bounds() = 0;
183
187 virtual void centerWindow() = 0;
188
192 virtual void show() = 0;
193
197 virtual bool isShown() = 0;
198
202 virtual void hide() = 0;
203
216 virtual void close() = 0;
217
221 virtual bool isClosed() = 0;
222
227 virtual void activate() = 0;
228
232 virtual bool isActive() = 0;
233
238 virtual void deactivate() = 0;
239
243 virtual void maximize() = 0;
244
248 virtual bool isMaximized() = 0;
249
253 virtual void minimize() = 0;
254
258 virtual bool isMinimized() = 0;
259
263 virtual void restore() = 0;
264
271 virtual void enterFullScreen() = 0;
272
276 virtual bool isFullScreen() = 0;
277
284 virtual void exitFullScreen() = 0;
285
296 virtual void setTitle(const std::string& title) = 0;
297
304 virtual std::string title() = 0;
305};
306
307} // namespace molybden
308
309#endif // MOLYBDEN_BROWSER_HPP
A class that contains all browser delegates.
Definition browser_delegates.hpp:1434
A class that contains all browser events.
Definition browser_events.hpp:310
An object that displays web content inside a native window.
Definition browser.hpp:46
virtual void setPosition(const Point &position_on_screen)=0
Sets the browser window's position on screen.
virtual std::string title()=0
Returns the current browser window title.
virtual std::shared_ptr< DevTools > devTools()=0
Returns the DevTools of this browser.
virtual std::shared_ptr< Zoom > zoom()=0
Returns a service that allows zooming content of a web page loaded in the current browser.
virtual std::shared_ptr< App > app()=0
Returns the application instance for this browser.
virtual void exitFullScreen()=0
Brings the browser window out of full screen mode.
virtual bool isShown()=0
Indicates whether the browser window is visible.
virtual void deactivate()=0
Deactivates the browser window, making the next window in the Z order the active window.
virtual void close()=0
Hides and destroys the browser window and releases all allocated resources including the browser inst...
virtual bool isFullScreen()=0
Indicates whether the browser window is running in full screen mode.
virtual std::shared_ptr< Navigation > navigation()=0
Returns the navigation controller of this browser.
virtual std::shared_ptr< BrowserSettings > settings()=0
Returns the content settings of this browser.
static std::shared_ptr< Browser > create(std::shared_ptr< Profile > profile)
Creates a new browser instance.
virtual void setTitle(const std::string &title)=0
Updates the browser window title.
virtual std::vector< std::shared_ptr< CaptureSession > > captureSessions()=0
Returns the list of all active capture sessions initiated by this browser.
virtual void restore()=0
Restores the browser window.
virtual void hide()=0
Hides the browser window.
virtual std::string pageTitle()=0
Returns a string that represents the title of the currently loaded web page or an empty string if the...
virtual void minimize()=0
Minimizes the browser window.
virtual void setBounds(const Rect &bounds)=0
Sets the browser window's size and location on screen.
virtual bool isActive()=0
Indicates if the browser window is currently the active/focused window.
virtual bool isMaximized()=0
Indicates whether the browser window is maximized.
virtual void centerWindow()=0
Centers the browser window on the primary screen.
virtual void maximize()=0
Maximizes the browser window.
static std::shared_ptr< Browser > create(std::shared_ptr< App > app)
Creates a new browser instance.
virtual bool isMinimized()=0
Indicates whether the browser window is minimized.
virtual void loadUrl(const std::string &url)=0
Starts a navigation to the resource identified by the given url.
virtual std::string pageUrl()=0
Gets URL of the currently loaded web page or an empty string if the browser hasn't loaded any web pag...
virtual Rect bounds()=0
Returns the browser window's size and position on screen.
virtual bool isClosed()=0
Checks if the browser window is closed.
virtual void enterFullScreen()=0
Sets the browser window to full screen.
virtual void setSize(const Size &size)=0
Sets the browser window's size.
virtual std::shared_ptr< TextFinder > textFinder()=0
Returns the text finder of this browser.
virtual std::shared_ptr< FullScreen > fullScreen()=0
Returns the fullscreen controller of this browser.
virtual std::shared_ptr< Profile > profile()=0
Returns the profile of this browser.
virtual std::unordered_set< std::shared_ptr< Frame > > frames()=0
Returns all the frames on the currently loaded web page or an empty set if the current browser did no...
virtual std::shared_ptr< Frame > focusedFrame()=0
Returns the focused frame of the currently loaded web page if it exists, otherwise an empty std::shar...
virtual void activate()=0
Activates (brings to front) the browser window.
virtual std::shared_ptr< Frame > mainFrame()=0
Returns the main frame of the currently loaded web page if it exists, otherwise an empty std::shared_...
virtual void show()=0
Shows the browser window, or activates it if it's already visible.
virtual std::shared_ptr< Media > media()=0
Returns the media controller of this browser.
virtual void setSize(uint32_t width, uint32_t height)=0
Sets the browser window's size.
A pair of numbers that in general are used to define coordinates in the two-dimensional space.
Definition geometry.hpp:16
A rectangle described by the location and dimensions.
Definition geometry.hpp:75
A pair of numbers that in general are used to define dimensions in the two-dimensional space.
Definition geometry.hpp:35