mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-23 04:55:15 +00:00
Android: Use LibWebView for command line flags
On Android there's really no real way to provide command line flags. We are using a dummy Main::Argument that only contains "ladybird" as a name of the program. The strings of Main::Argument cannot be empty, otherwise the program throws an error. However the argc and argv can be set to 0 and nullptr
This commit is contained in:
parent
7cee53fad6
commit
bf84a681a5
Notes:
github-actions[bot]
2024-09-03 06:19:09 +00:00
Author: https://github.com/Olekoop Commit: https://github.com/LadybirdBrowser/ladybird/commit/bf84a681a54 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1006 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/AtkinsSJ
1 changed files with 15 additions and 1 deletions
|
@ -30,6 +30,13 @@ static OwnPtr<Core::EventLoop> s_main_event_loop;
|
|||
static jobject s_java_instance;
|
||||
static jmethodID s_schedule_event_loop_method;
|
||||
|
||||
struct Application : public WebView::Application {
|
||||
WEB_VIEW_APPLICATION(Application);
|
||||
};
|
||||
|
||||
Application::Application(Badge<WebView::Application>, Main::Arguments&)
|
||||
{
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
Java_org_serenityos_ladybird_LadybirdActivity_initNativeCode(JNIEnv*, jobject, jstring, jstring, jobject);
|
||||
|
@ -76,10 +83,17 @@ Java_org_serenityos_ladybird_LadybirdActivity_initNativeCode(JNIEnv* env, jobjec
|
|||
Core::EventLoopManager::install(*event_loop_manager);
|
||||
s_main_event_loop = make<Core::EventLoop>();
|
||||
|
||||
// The strings cannot be empty
|
||||
Main::Arguments arguments = {
|
||||
.argc = 0,
|
||||
.argv = nullptr,
|
||||
.strings = Span<StringView> { new StringView("ladybird"sv), 1 }
|
||||
};
|
||||
|
||||
// FIXME: We are not making use of this Application object to track our processes.
|
||||
// So, right now, the Application's ProcessManager is constantly empty.
|
||||
// (However, LibWebView depends on an Application object existing, so we do have to actually create one.)
|
||||
s_application = make<WebView::Application>(0, nullptr);
|
||||
s_application = Application::create(arguments, "about:newtab"sv);
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
|
|
Loading…
Add table
Reference in a new issue