mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-27 19:59:17 +00:00
51 lines
1.1 KiB
C++
51 lines
1.1 KiB
C++
/*
|
|
* Copyright (c) 2025, Tim Flynn <trflynn89@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <AK/JsonObject.h>
|
|
#include <LibDevTools/Actors/HighlighterActor.h>
|
|
|
|
namespace DevTools {
|
|
|
|
NonnullRefPtr<HighlighterActor> HighlighterActor::create(DevToolsServer& devtools, String name)
|
|
{
|
|
return adopt_ref(*new HighlighterActor(devtools, move(name)));
|
|
}
|
|
|
|
HighlighterActor::HighlighterActor(DevToolsServer& devtools, String name)
|
|
: Actor(devtools, move(name))
|
|
{
|
|
}
|
|
|
|
HighlighterActor::~HighlighterActor() = default;
|
|
|
|
void HighlighterActor::handle_message(StringView type, JsonObject const&)
|
|
{
|
|
JsonObject response;
|
|
response.set("from"sv, name());
|
|
|
|
if (type == "show"sv) {
|
|
response.set("value"sv, true);
|
|
send_message(move(response));
|
|
return;
|
|
}
|
|
|
|
if (type == "hide"sv) {
|
|
send_message(move(response));
|
|
return;
|
|
}
|
|
|
|
send_unrecognized_packet_type_error(type);
|
|
}
|
|
|
|
JsonValue HighlighterActor::serialize_highlighter() const
|
|
{
|
|
JsonObject highlighter;
|
|
highlighter.set("actor"sv, name());
|
|
return highlighter;
|
|
}
|
|
|
|
}
|