mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-25 05:55:13 +00:00
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
55 lines
1.5 KiB
C++
55 lines
1.5 KiB
C++
/*
|
|
* Copyright (c) 2020, Hunter Salyer <thefalsehonesty@gmail.com>
|
|
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
|
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
|
|
* Copyright (c) 2022, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "History.h"
|
|
#include <LibGUI/Widget.h>
|
|
#include <LibWebView/OutOfProcessWebView.h>
|
|
|
|
namespace Browser {
|
|
|
|
class ConsoleWidget final : public GUI::Widget {
|
|
C_OBJECT(ConsoleWidget)
|
|
public:
|
|
virtual ~ConsoleWidget() = default;
|
|
|
|
void notify_about_new_console_message(i32 message_index);
|
|
void handle_console_messages(i32 start_index, Vector<DeprecatedString> const& message_types, Vector<DeprecatedString> const& messages);
|
|
void print_source_line(StringView);
|
|
void print_html(StringView);
|
|
void reset();
|
|
|
|
Function<void(DeprecatedString const&)> on_js_input;
|
|
Function<void(i32)> on_request_messages;
|
|
|
|
private:
|
|
ConsoleWidget();
|
|
|
|
void request_console_messages();
|
|
void clear_output();
|
|
void begin_group(StringView label, bool start_expanded);
|
|
void end_group();
|
|
|
|
RefPtr<GUI::TextBox> m_input;
|
|
RefPtr<WebView::OutOfProcessWebView> m_output_view;
|
|
|
|
i32 m_highest_notified_message_index { -1 };
|
|
i32 m_highest_received_message_index { -1 };
|
|
bool m_waiting_for_messages { false };
|
|
|
|
struct Group {
|
|
int id { 0 };
|
|
DeprecatedString label;
|
|
};
|
|
Vector<Group> m_group_stack;
|
|
int m_next_group_id { 1 };
|
|
};
|
|
|
|
}
|