1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 02:07:35 +00:00

Browser: Move main browser window logic into a BrowserWindow class

Having so much the logic and lambdas in main() was getting unwieldy.
Moving it into a class simplifies this, and also opens up a path
towards supporting "Open in New Window" :^)
This commit is contained in:
Andreas Kling 2021-05-17 23:15:20 +02:00
parent 5d0c3bd564
commit 719168a1cd
4 changed files with 228 additions and 151 deletions

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "BookmarksBarWidget.h"
#include "WindowActions.h"
#include <LibGUI/Window.h>
namespace Browser {
class CookieJar;
class Tab;
class BrowserWindow final : public GUI::Window {
C_OBJECT(BrowserWindow);
public:
virtual ~BrowserWindow() override;
GUI::TabWidget& tab_widget();
void create_new_tab(URL, bool activate);
private:
explicit BrowserWindow(CookieJar&, URL);
void set_window_title_for_tab(Tab const&);
CookieJar& m_cookie_jar;
WindowActions m_window_actions;
RefPtr<GUI::TabWidget> m_tab_widget;
RefPtr<BookmarksBarWidget> m_bookmarks_bar;
};
}