ladybird/UI/Qt/Application.h
Timothy Flynn bb7dff7dfe LibWebView+UI: Move ownership of application services to LibWebView
LibWebView now knows how to launch RequestServer and ImageDecoderServer
without help from the UI, so let's move ownership of these services over
to LibWebView for de-duplication.
2024-11-14 11:47:32 +01:00

48 lines
1.3 KiB
C++

/*
* Copyright (c) 2024, Andrew Kaster <akaster@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Function.h>
#include <LibURL/URL.h>
#include <LibWebView/Application.h>
#include <UI/Qt/BrowserWindow.h>
#include <QApplication>
namespace Ladybird {
class Application
: public QApplication
, public WebView::Application {
Q_OBJECT
WEB_VIEW_APPLICATION(Application)
public:
virtual ~Application() override;
virtual bool event(QEvent* event) override;
Function<void(URL::URL)> on_open_file;
BrowserWindow& new_window(Vector<URL::URL> const& initial_urls, BrowserWindow::IsPopupWindow is_popup_window = BrowserWindow::IsPopupWindow::No, Tab* parent_tab = nullptr, Optional<u64> page_index = {});
void show_task_manager_window();
void close_task_manager_window();
BrowserWindow& active_window() { return *m_active_window; }
void set_active_window(BrowserWindow& w) { m_active_window = &w; }
private:
virtual void create_platform_options(WebView::ChromeOptions&, WebView::WebContentOptions&) override;
virtual Optional<ByteString> ask_user_for_download_folder() const override;
TaskManagerWindow* m_task_manager_window { nullptr };
BrowserWindow* m_active_window { nullptr };
};
}