mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 06:17:34 +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:
parent
5d0c3bd564
commit
719168a1cd
4 changed files with 228 additions and 151 deletions
38
Userland/Applications/Browser/BrowserWindow.h
Normal file
38
Userland/Applications/Browser/BrowserWindow.h
Normal 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;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue