ladybird/Libraries/LibDevTools/Actors/TabActor.h
Timothy Flynn 24a5e4e7d5 LibDevTools: Move message data into a structure
This is to prepare for an upcoming change where we will need to track
replies to messages by ID. We will be able to add parameters to this
structure without having to edit every single actor subclass header
file.
2025-03-13 16:56:28 -04:00

42 lines
887 B
C++

/*
* Copyright (c) 2025, Tim Flynn <trflynn89@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/NonnullRefPtr.h>
#include <AK/String.h>
#include <LibDevTools/Actor.h>
namespace DevTools {
struct TabDescription {
u64 id { 0 };
String title;
String url;
};
class TabActor final : public Actor {
public:
static constexpr auto base_name = "tab"sv;
static NonnullRefPtr<TabActor> create(DevToolsServer&, String name, TabDescription);
virtual ~TabActor() override;
TabDescription const& description() const { return m_description; }
JsonObject serialize_description() const;
void reset_selected_node();
private:
TabActor(DevToolsServer&, String name, TabDescription);
virtual void handle_message(Message const&) override;
TabDescription m_description;
WeakPtr<WatcherActor> m_watcher;
};
}