mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user