2021-05-17 17:15:20 -04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
2022-02-10 14:28:48 -05:00
|
|
|
* Copyright (c) 2022, the SerenityOS developers.
|
2021-05-17 17:15:20 -04:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "BookmarksBarWidget.h"
|
2021-08-17 12:00:27 -04:00
|
|
|
#include "Tab.h"
|
2021-05-17 17:15:20 -04:00
|
|
|
#include "WindowActions.h"
|
2022-01-31 15:40:48 -05:00
|
|
|
#include <LibConfig/Listener.h>
|
2021-05-18 11:32:28 -04:00
|
|
|
#include <LibGUI/ActionGroup.h>
|
2021-05-17 17:15:20 -04:00
|
|
|
#include <LibGUI/Window.h>
|
2023-03-20 18:39:20 -04:00
|
|
|
#include <LibWeb/HTML/ActivateTab.h>
|
2023-08-31 07:07:07 -04:00
|
|
|
#include <LibWebView/Forward.h>
|
2021-05-17 17:15:20 -04:00
|
|
|
|
|
|
|
namespace Browser {
|
|
|
|
|
|
|
|
class Tab;
|
|
|
|
|
2022-01-31 15:40:48 -05:00
|
|
|
class BrowserWindow final : public GUI::Window
|
|
|
|
, public Config::Listener {
|
2021-05-17 17:15:20 -04:00
|
|
|
C_OBJECT(BrowserWindow);
|
|
|
|
|
|
|
|
public:
|
2022-02-10 14:28:48 -05:00
|
|
|
virtual ~BrowserWindow() override = default;
|
2021-05-17 17:15:20 -04:00
|
|
|
|
|
|
|
GUI::TabWidget& tab_widget();
|
2021-05-18 11:32:28 -04:00
|
|
|
Tab& active_tab();
|
2024-03-17 23:22:27 -04:00
|
|
|
Tab& create_new_tab(URL::URL const&, Web::HTML::ActivateTab activate);
|
|
|
|
void create_new_window(URL::URL const&);
|
2021-05-17 17:15:20 -04:00
|
|
|
|
2021-05-18 13:23:53 -04:00
|
|
|
GUI::Action& go_back_action() { return *m_go_back_action; }
|
|
|
|
GUI::Action& go_forward_action() { return *m_go_forward_action; }
|
|
|
|
GUI::Action& go_home_action() { return *m_go_home_action; }
|
|
|
|
GUI::Action& reload_action() { return *m_reload_action; }
|
2021-07-14 08:33:35 -04:00
|
|
|
GUI::Action& copy_selection_action() { return *m_copy_selection_action; }
|
2024-03-24 18:23:37 -04:00
|
|
|
GUI::Action& paste_action() { return *m_paste_action; }
|
2021-07-14 08:55:36 -04:00
|
|
|
GUI::Action& select_all_action() { return *m_select_all_action; }
|
2021-05-18 13:23:53 -04:00
|
|
|
GUI::Action& view_source_action() { return *m_view_source_action; }
|
|
|
|
GUI::Action& inspect_dom_tree_action() { return *m_inspect_dom_tree_action; }
|
2021-08-17 12:00:27 -04:00
|
|
|
GUI::Action& inspect_dom_node_action() { return *m_inspect_dom_node_action; }
|
2021-05-18 13:23:53 -04:00
|
|
|
|
2022-02-01 05:17:37 -05:00
|
|
|
void content_filters_changed();
|
2023-04-17 13:37:36 -04:00
|
|
|
void autoplay_allowlist_changed();
|
2022-04-07 17:16:47 -04:00
|
|
|
void proxy_mappings_changed();
|
2023-08-04 07:37:52 -04:00
|
|
|
void update_zoom_menu();
|
2022-02-01 05:17:37 -05:00
|
|
|
|
2022-12-06 15:27:44 -05:00
|
|
|
void broadcast_window_position(Gfx::IntPoint);
|
2022-12-06 16:35:32 -05:00
|
|
|
void broadcast_window_size(Gfx::IntSize);
|
2022-11-01 15:43:53 -04:00
|
|
|
|
2021-05-17 17:15:20 -04:00
|
|
|
private:
|
2024-03-17 23:22:27 -04:00
|
|
|
BrowserWindow(WebView::CookieJar&, Vector<URL::URL> const&, StringView const);
|
2021-05-17 17:15:20 -04:00
|
|
|
|
2024-01-03 22:55:09 -05:00
|
|
|
void build_menus(StringView const);
|
2022-01-20 06:17:17 -05:00
|
|
|
ErrorOr<void> load_search_engines(GUI::Menu& settings_menu);
|
2021-05-17 17:15:20 -04:00
|
|
|
void set_window_title_for_tab(Tab const&);
|
|
|
|
|
2023-06-26 15:05:53 -04:00
|
|
|
virtual void config_string_did_change(StringView domain, StringView group, StringView key, StringView value) override;
|
|
|
|
virtual void config_bool_did_change(StringView domain, StringView group, StringView key, bool value) override;
|
2022-01-31 15:40:48 -05:00
|
|
|
|
2022-11-01 15:43:53 -04:00
|
|
|
virtual void event(Core::Event&) override;
|
|
|
|
|
2023-03-28 18:10:00 -04:00
|
|
|
void update_displayed_zoom_level();
|
2023-03-26 14:41:06 -04:00
|
|
|
|
2024-03-27 13:50:24 -04:00
|
|
|
void show_task_manager_window();
|
|
|
|
void close_task_manager_window();
|
|
|
|
|
2021-05-18 13:23:53 -04:00
|
|
|
RefPtr<GUI::Action> m_go_back_action;
|
|
|
|
RefPtr<GUI::Action> m_go_forward_action;
|
|
|
|
RefPtr<GUI::Action> m_go_home_action;
|
|
|
|
RefPtr<GUI::Action> m_reload_action;
|
2021-07-14 08:33:35 -04:00
|
|
|
RefPtr<GUI::Action> m_copy_selection_action;
|
2024-03-24 18:23:37 -04:00
|
|
|
RefPtr<GUI::Action> m_paste_action;
|
2021-07-14 08:55:36 -04:00
|
|
|
RefPtr<GUI::Action> m_select_all_action;
|
2021-05-18 13:23:53 -04:00
|
|
|
RefPtr<GUI::Action> m_view_source_action;
|
|
|
|
RefPtr<GUI::Action> m_inspect_dom_tree_action;
|
2021-08-17 12:00:27 -04:00
|
|
|
RefPtr<GUI::Action> m_inspect_dom_node_action;
|
2024-03-27 13:50:24 -04:00
|
|
|
RefPtr<GUI::Action> m_task_manager_action;
|
2021-05-18 13:23:53 -04:00
|
|
|
|
2023-03-26 14:41:06 -04:00
|
|
|
RefPtr<GUI::Menu> m_zoom_menu;
|
|
|
|
|
2023-08-31 07:07:07 -04:00
|
|
|
WebView::CookieJar& m_cookie_jar;
|
2021-05-17 17:15:20 -04:00
|
|
|
WindowActions m_window_actions;
|
|
|
|
RefPtr<GUI::TabWidget> m_tab_widget;
|
|
|
|
RefPtr<BookmarksBarWidget> m_bookmarks_bar;
|
2021-05-18 11:32:28 -04:00
|
|
|
|
2024-03-27 13:50:24 -04:00
|
|
|
// FIXME: This should be owned at a higher level in case we have multiple browser windows
|
|
|
|
RefPtr<GUI::Window> m_task_manager_window;
|
|
|
|
|
2021-05-18 11:32:28 -04:00
|
|
|
GUI::ActionGroup m_user_agent_spoof_actions;
|
|
|
|
GUI::ActionGroup m_search_engine_actions;
|
2021-10-23 12:35:14 -04:00
|
|
|
GUI::ActionGroup m_color_scheme_actions;
|
2021-05-18 11:32:28 -04:00
|
|
|
RefPtr<GUI::Action> m_disable_user_agent_spoofing;
|
2021-05-19 07:31:33 -04:00
|
|
|
RefPtr<GUI::Action> m_disable_search_engine_action;
|
2021-06-15 16:49:34 -04:00
|
|
|
RefPtr<GUI::Action> m_change_homepage_action;
|
2021-05-17 17:15:20 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|