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>
|
|
|
|
|
|
|
|
namespace Browser {
|
|
|
|
|
|
|
|
class CookieJar;
|
|
|
|
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();
|
2021-05-17 17:15:20 -04:00
|
|
|
void create_new_tab(URL, bool activate);
|
|
|
|
|
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; }
|
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();
|
|
|
|
|
2021-05-17 17:15:20 -04:00
|
|
|
private:
|
|
|
|
explicit BrowserWindow(CookieJar&, URL);
|
|
|
|
|
2021-05-18 11:32:28 -04:00
|
|
|
void build_menus();
|
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&);
|
|
|
|
|
2022-01-31 15:40:48 -05:00
|
|
|
virtual void config_string_did_change(String const& domain, String const& group, String const& key, String const& value) override;
|
|
|
|
virtual void config_bool_did_change(String const& domain, String const& group, String const& key, bool value) override;
|
|
|
|
|
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;
|
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;
|
2021-05-18 13:23:53 -04:00
|
|
|
|
2021-05-17 17:15:20 -04:00
|
|
|
CookieJar& m_cookie_jar;
|
|
|
|
WindowActions m_window_actions;
|
|
|
|
RefPtr<GUI::TabWidget> m_tab_widget;
|
|
|
|
RefPtr<BookmarksBarWidget> m_bookmarks_bar;
|
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
|
|
|
};
|
|
|
|
|
|
|
|
}
|