ladybird/Ladybird/Qt/Application.h
Timothy Flynn ed3c450359
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-22.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-22.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
LibWebView+UI: Move the database and cookie jar to WebView::Application
The main motivator here was noticing that --disable-sql-database did not
work with AppKit. Rather than re-implementing this there, move ownership
of these classes to WebView::Application, so that each UI does not need
to individually worry about it.
2024-09-05 19:45:47 -04:00

60 lines
1.8 KiB
C++

/*
* Copyright (c) 2024, Andrew Kaster <akaster@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Function.h>
#include <AK/HashTable.h>
#include <Ladybird/Qt/BrowserWindow.h>
#include <LibImageDecoderClient/Client.h>
#include <LibRequests/RequestClient.h>
#include <LibURL/URL.h>
#include <LibWebView/Application.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;
RefPtr<Requests::RequestClient> request_server_client;
NonnullRefPtr<ImageDecoderClient::Client> image_decoder_client() const { return *m_image_decoder_client; }
ErrorOr<void> initialize_image_decoder();
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_arguments(Core::ArgsParser&) override;
virtual void create_platform_options(WebView::ChromeOptions&, WebView::WebContentOptions&) override;
virtual Optional<ByteString> ask_user_for_download_folder() const override;
bool m_enable_qt_networking { false };
TaskManagerWindow* m_task_manager_window { nullptr };
BrowserWindow* m_active_window { nullptr };
RefPtr<ImageDecoderClient::Client> m_image_decoder_client;
};
}