2024-04-12 21:15:09 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2024, Andrew Kaster <akaster@serenityos.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/Function.h>
|
|
|
|
#include <LibURL/URL.h>
|
2024-07-30 18:01:05 +00:00
|
|
|
#include <LibWebView/Application.h>
|
2024-11-09 17:50:33 +00:00
|
|
|
#include <UI/Qt/BrowserWindow.h>
|
|
|
|
|
2024-04-12 21:15:09 +00:00
|
|
|
#include <QApplication>
|
|
|
|
|
|
|
|
namespace Ladybird {
|
|
|
|
|
2024-07-30 18:01:05 +00:00
|
|
|
class Application
|
|
|
|
: public QApplication
|
|
|
|
, public WebView::Application {
|
2024-04-12 21:15:09 +00:00
|
|
|
Q_OBJECT
|
2024-07-30 18:01:05 +00:00
|
|
|
WEB_VIEW_APPLICATION(Application)
|
2024-04-12 21:15:09 +00:00
|
|
|
|
|
|
|
public:
|
2024-04-27 00:53:55 +00:00
|
|
|
virtual ~Application() override;
|
2024-04-12 21:15:09 +00:00
|
|
|
|
|
|
|
virtual bool event(QEvent* event) override;
|
|
|
|
|
|
|
|
Function<void(URL::URL)> on_open_file;
|
2024-06-26 19:44:42 +00:00
|
|
|
|
2024-09-05 22:19:51 +00:00
|
|
|
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 = {});
|
2024-04-27 00:53:55 +00:00
|
|
|
|
2024-07-30 18:01:05 +00:00
|
|
|
void show_task_manager_window();
|
2024-04-27 00:53:55 +00:00
|
|
|
void close_task_manager_window();
|
|
|
|
|
|
|
|
BrowserWindow& active_window() { return *m_active_window; }
|
|
|
|
void set_active_window(BrowserWindow& w) { m_active_window = &w; }
|
|
|
|
|
|
|
|
private:
|
2024-07-30 18:01:05 +00:00
|
|
|
virtual void create_platform_options(WebView::ChromeOptions&, WebView::WebContentOptions&) override;
|
|
|
|
|
2024-08-28 19:32:30 +00:00
|
|
|
virtual Optional<ByteString> ask_user_for_download_folder() const override;
|
|
|
|
|
2024-04-27 00:53:55 +00:00
|
|
|
TaskManagerWindow* m_task_manager_window { nullptr };
|
|
|
|
BrowserWindow* m_active_window { nullptr };
|
2024-04-12 21:15:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|