Molybden
Loading...
Searching...
No Matches
app.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_APP_HPP
6#define MOLYBDEN_APP_HPP
7
8#include <functional>
9#include <memory>
10#include <string>
11#include <unordered_set>
12#include <vector>
13
14#include "molybden/app/password_store_type.hpp"
15#include "molybden/app/ui_language.hpp"
16#include "molybden/base/logging.hpp"
17
18namespace molybden {
19
20class Menu;
21class Browser;
22class Profile;
23
24enum class AppTheme;
25
29struct AppOptions {
41 std::string user_data_dir;
42
46 UiLanguage ui_language = UiLanguage::kEnglishUs;
47
52
62
68 bool disable_sandbox = false;
69
75 bool disable_gpu = false;
76
80 bool enable_autoplay = false;
81
91 bool enable_incognito = false;
92
102 bool enable_h264 = false;
103
113 bool enable_aac = false;
114
123 bool enable_widevine = false;
124
129
134
143
150
158 PasswordStoreType password_store_type = PasswordStoreType::kBasic;
159
163 std::string user_agent;
164
168 std::vector<std::string> schemes;
169
174 std::unordered_set<std::string> switches;
175};
176
180class App {
181 public:
185 static void init(
186 const std::function<void(std::shared_ptr<App> app)>& callback);
187
192 static void init(
193 const AppOptions& options,
194 const std::function<void(std::shared_ptr<App> app)>& callback);
195
199 virtual const AppOptions& options() = 0;
200
204 virtual bool isProduction() = 0;
205
209 virtual std::string baseUrl() = 0;
210
216 virtual void quit() = 0;
217
225 virtual std::shared_ptr<Profile> profile() = 0;
226
232 virtual std::shared_ptr<Profile> profile(const std::string& name) = 0;
233
237 virtual std::vector<std::shared_ptr<Profile>> profiles() = 0;
238
252 virtual void deleteProfile(std::shared_ptr<Profile> profile) = 0;
253
257 virtual void setMainMenu(std::shared_ptr<Menu> menu) = 0;
258
266 virtual void setTheme(AppTheme theme) = 0;
267
273 virtual AppTheme theme() = 0;
274};
275
276} // namespace molybden
277
278#endif // MOLYBDEN_APP_HPP
Provides access to Molybden app.
Definition app.hpp:180
static void init(const AppOptions &options, const std::function< void(std::shared_ptr< App > app)> &callback)
Initializes this application and creates an application instance with the given options.
static void init(const std::function< void(std::shared_ptr< App > app)> &callback)
Initializes this application and creates an application instance.
virtual void setMainMenu(std::shared_ptr< Menu > menu)=0
Sets the given menu as the application menu on macOS.
virtual std::string baseUrl()=0
Returns the base URL of the resource that represents app user interface.
virtual AppTheme theme()=0
Returns the application theme.
virtual std::shared_ptr< Profile > profile()=0
Returns the default app profile.
virtual const AppOptions & options()=0
Returns the app options.
virtual bool isProduction()=0
Indicates whether the app is running in the production or development mode.
virtual void setTheme(AppTheme theme)=0
Sets the given theme to the app.
virtual void quit()=0
Terminates this app instance.
virtual std::shared_ptr< Profile > profile(const std::string &name)=0
Returns the profile with the given name if it exists.
virtual std::vector< std::shared_ptr< Profile > > profiles()=0
Returns the list of the profiles in this app including the default profile.
virtual void deleteProfile(std::shared_ptr< Profile > profile)=0
Deletes the given profile from the list of available profiles, closes all browsers associated with it...
The Molybden app options.
Definition app.hpp:29
std::string user_data_dir
The absolute path to the directory where the user data such as cache, cookies, history,...
Definition app.hpp:41
uint32_t remote_debugging_port
The remote debugging port number.
Definition app.hpp:61
bool enable_autoplay
Allows automatically starting video and audio playbacks on the web pages.
Definition app.hpp:80
bool warn_before_quitting
Enables the warning on quitting the application via Cmd+Q.
Definition app.hpp:142
bool disable_sandbox
Disables Chromium Sandbox.
Definition app.hpp:68
bool enable_remote_debugging_port
Enables the remote debugging port in the production mode.
Definition app.hpp:51
Logging logging
Allows configuring the application logging.
Definition app.hpp:128
bool enable_h264
Enables support of the H.264 codec.
Definition app.hpp:102
std::vector< std::string > schemes
The schemes that will be intercepted.
Definition app.hpp:168
PasswordStoreType password_store_type
Configures the password store type that specifies which storage backend to use to encrypt cookies on ...
Definition app.hpp:158
std::string user_agent
A string used to override the default user agent with a custom one.
Definition app.hpp:163
UiLanguage ui_language
The language used on the default error pages and the message dialogs.
Definition app.hpp:46
bool disable_gpu
Disables GPU rendering.
Definition app.hpp:75
bool enable_aac
Enables support of the AAC codec.
Definition app.hpp:113
bool enable_incognito
Enables the incognito mode for the default profile.
Definition app.hpp:91
std::unordered_set< std::string > switches
The Chromium command line switches that will be passed to the Main Chromium process.
Definition app.hpp:174
ChromiumLogging chromium_logging
Allows configuring the Chromium logging.
Definition app.hpp:133
bool quit_when_last_browser_closed
Indicates if the app should quit when the last browser is closed.
Definition app.hpp:149
bool enable_widevine
Enables support of the Widevine DRM decryption.
Definition app.hpp:123
Definition logging.hpp:31
Definition logging.hpp:14