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

Everywhere: Rename {Deprecated => Byte}String

This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
Ali Mohammad Pur 2023-12-16 17:49:34 +03:30 committed by Ali Mohammad Pur
parent 38d62563b3
commit 5e1499d104
1615 changed files with 10257 additions and 10257 deletions

View file

@ -88,12 +88,12 @@ private:
};
}
DeprecatedString title() const
ByteString title() const
{
return m_title_textbox->text();
}
DeprecatedString url() const
ByteString url() const
{
return m_url_textbox->text();
}
@ -111,7 +111,7 @@ BookmarksBarWidget& BookmarksBarWidget::the()
return *s_the;
}
BookmarksBarWidget::BookmarksBarWidget(DeprecatedString const& bookmarks_file, bool enabled)
BookmarksBarWidget::BookmarksBarWidget(ByteString const& bookmarks_file, bool enabled)
{
s_the = this;
set_layout<GUI::HorizontalBoxLayout>(2, 0);
@ -207,8 +207,8 @@ void BookmarksBarWidget::model_did_update(unsigned)
int width = 0;
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
auto title = model()->index(item_index, 0).data().to_deprecated_string();
auto url = model()->index(item_index, 1).data().to_deprecated_string();
auto title = model()->index(item_index, 0).data().to_byte_string();
auto url = model()->index(item_index, 1).data().to_byte_string();
Gfx::IntRect rect { width, 0, font().width_rounded_up(title) + 32, height() };
@ -216,12 +216,12 @@ void BookmarksBarWidget::model_did_update(unsigned)
m_bookmarks.append(button);
button.set_button_style(Gfx::ButtonStyle::Coolbar);
button.set_text(String::from_deprecated_string(title).release_value_but_fixme_should_propagate_errors());
button.set_text(String::from_byte_string(title).release_value_but_fixme_should_propagate_errors());
button.set_icon(g_icon_bag.filetype_html);
button.set_fixed_size(font().width(title) + 32, 20);
button.set_relative_rect(rect);
button.set_focus_policy(GUI::FocusPolicy::TabFocus);
button.set_tooltip(MUST(String::from_deprecated_string(url)));
button.set_tooltip(MUST(String::from_byte_string(url)));
button.set_allowed_mouse_buttons_for_pressing(GUI::MouseButton::Primary | GUI::MouseButton::Middle);
button.on_click = [title, url, this](auto) {
@ -275,7 +275,7 @@ void BookmarksBarWidget::update_content_size()
for (size_t i = m_last_visible_index; i < m_bookmarks.size(); ++i) {
auto& bookmark = m_bookmarks.at(i);
bookmark->set_visible(false);
m_additional_menu->add_action(GUI::Action::create(bookmark->text().to_deprecated_string(), g_icon_bag.filetype_html, [&](auto&) { bookmark->on_click(0); }));
m_additional_menu->add_action(GUI::Action::create(bookmark->text().to_byte_string(), g_icon_bag.filetype_html, [&](auto&) { bookmark->on_click(0); }));
}
}
}
@ -284,7 +284,7 @@ bool BookmarksBarWidget::contains_bookmark(StringView url)
{
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
auto item_url = model()->index(item_index, 1).data().to_deprecated_string();
auto item_url = model()->index(item_index, 1).data().to_byte_string();
if (item_url == url) {
return true;
}
@ -296,7 +296,7 @@ ErrorOr<void> BookmarksBarWidget::remove_bookmark(StringView url)
{
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
auto item_url = model()->index(item_index, 1).data().to_deprecated_string();
auto item_url = model()->index(item_index, 1).data().to_byte_string();
if (item_url == url) {
auto& json_model = *static_cast<GUI::JsonArrayModel*>(model());
@ -332,7 +332,7 @@ ErrorOr<void> BookmarksBarWidget::add_bookmark(StringView url, StringView title)
auto model_has_updated = false;
for (int item_index = 0; item_index < model()->row_count(); item_index++) {
auto item_url = model()->index(item_index, 1).data().to_deprecated_string();
auto item_url = model()->index(item_index, 1).data().to_byte_string();
if (item_url == url) {
TRY(update_model(values, [item_index](auto& model, auto&& values) {
@ -355,8 +355,8 @@ ErrorOr<void> BookmarksBarWidget::add_bookmark(StringView url, StringView title)
ErrorOr<void> BookmarksBarWidget::edit_bookmark(StringView url)
{
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
auto item_title = model()->index(item_index, 0).data().to_deprecated_string();
auto item_url = model()->index(item_index, 1).data().to_deprecated_string();
auto item_title = model()->index(item_index, 0).data().to_byte_string();
auto item_url = model()->index(item_index, 1).data().to_byte_string();
if (item_url == url) {
auto values = BookmarkEditor::edit_bookmark(window(), item_title, item_url, PerformEditOn::ExistingBookmark);

View file

@ -32,8 +32,8 @@ public:
InNewWindow
};
Function<void(DeprecatedString const& url, Open)> on_bookmark_click;
Function<void(DeprecatedString const&, DeprecatedString const&)> on_bookmark_hover;
Function<void(ByteString const& url, Open)> on_bookmark_click;
Function<void(ByteString const&, ByteString const&)> on_bookmark_hover;
Function<void()> on_bookmark_change;
bool contains_bookmark(StringView url);
@ -48,7 +48,7 @@ public:
}
private:
BookmarksBarWidget(DeprecatedString const&, bool enabled);
BookmarksBarWidget(ByteString const&, bool enabled);
// ^GUI::ModelClient
virtual void model_did_update(unsigned) override;
@ -67,7 +67,7 @@ private:
RefPtr<GUI::Menu> m_context_menu;
RefPtr<GUI::Action> m_context_menu_default_action;
DeprecatedString m_context_menu_url;
ByteString m_context_menu_url;
Vector<NonnullRefPtr<GUI::Button>> m_bookmarks;

View file

@ -6,22 +6,22 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/String.h>
#include <Applications/Browser/IconBag.h>
namespace Browser {
extern DeprecatedString g_home_url;
extern DeprecatedString g_new_tab_url;
extern DeprecatedString g_search_engine;
extern ByteString g_home_url;
extern ByteString g_new_tab_url;
extern ByteString g_search_engine;
extern Vector<String> g_content_filters;
extern bool g_content_filters_enabled;
extern Vector<String> g_autoplay_allowlist;
extern bool g_autoplay_allowed_on_all_websites;
extern Vector<DeprecatedString> g_proxies;
extern HashMap<DeprecatedString, size_t> g_proxy_mappings;
extern Vector<ByteString> g_proxies;
extern HashMap<ByteString, size_t> g_proxy_mappings;
extern IconBag g_icon_bag;
extern DeprecatedString g_webdriver_content_ipc_path;
extern ByteString g_webdriver_content_ipc_path;
}

View file

@ -41,12 +41,12 @@
namespace Browser {
static DeprecatedString bookmarks_file_path()
static ByteString bookmarks_file_path()
{
StringBuilder builder;
builder.append(Core::StandardPaths::config_directory());
builder.append("/bookmarks.json"sv);
return builder.to_deprecated_string();
return builder.to_byte_string();
}
BrowserWindow::BrowserWindow(WebView::CookieJar& cookie_jar, Vector<URL> const& initial_urls)
@ -275,11 +275,11 @@ void BrowserWindow::build_menus()
m_change_homepage_action = GUI::Action::create(
"Set Homepage URL...", g_icon_bag.go_home, [this](auto&) {
String homepage_url = String::from_deprecated_string(Config::read_string("Browser"sv, "Preferences"sv, "Home"sv, Browser::default_homepage_url())).release_value_but_fixme_should_propagate_errors();
String homepage_url = String::from_byte_string(Config::read_string("Browser"sv, "Preferences"sv, "Home"sv, Browser::default_homepage_url())).release_value_but_fixme_should_propagate_errors();
if (GUI::InputBox::show(this, homepage_url, "Enter a URL:"sv, "Change Homepage"sv) == GUI::InputBox::ExecResult::OK) {
if (URL(homepage_url).is_valid()) {
Config::write_string("Browser"sv, "Preferences"sv, "Home"sv, homepage_url);
Browser::g_home_url = homepage_url.to_deprecated_string();
Browser::g_home_url = homepage_url.to_byte_string();
} else {
GUI::MessageBox::show_error(this, "The URL you have entered is not valid"sv);
}
@ -412,7 +412,7 @@ void BrowserWindow::build_menus()
m_disable_user_agent_spoofing->activate();
return;
}
active_tab().view().debug_request("spoof-user-agent", user_agent.to_deprecated_string());
active_tab().view().debug_request("spoof-user-agent", user_agent.to_byte_string());
action.set_status_tip(user_agent);
});
spoof_user_agent_menu->add_action(custom_user_agent);
@ -497,7 +497,7 @@ ErrorOr<void> BrowserWindow::load_search_engines(GUI::Menu& settings_menu)
return;
}
g_search_engine = search_engine.to_deprecated_string();
g_search_engine = search_engine.to_byte_string();
Config::write_string("Browser"sv, "Preferences"sv, "SearchEngine"sv, g_search_engine);
action.set_status_tip(search_engine);
});
@ -506,7 +506,7 @@ ErrorOr<void> BrowserWindow::load_search_engines(GUI::Menu& settings_menu)
if (!search_engine_set && !g_search_engine.is_empty()) {
custom_search_engine_action->set_checked(true);
custom_search_engine_action->set_status_tip(TRY(String::from_deprecated_string(g_search_engine)));
custom_search_engine_action->set_status_tip(TRY(String::from_byte_string(g_search_engine)));
}
return {};
@ -526,7 +526,7 @@ void BrowserWindow::set_window_title_for_tab(Tab const& tab)
{
auto& title = tab.title();
auto url = tab.url();
set_title(DeprecatedString::formatted("{} - Ladybird", title.is_empty() ? url.to_deprecated_string() : title));
set_title(ByteString::formatted("{} - Ladybird", title.is_empty() ? url.to_byte_string() : title));
}
Tab& BrowserWindow::create_new_tab(URL const& url, Web::HTML::ActivateTab activate)
@ -536,7 +536,7 @@ Tab& BrowserWindow::create_new_tab(URL const& url, Web::HTML::ActivateTab activa
m_tab_widget->set_bar_visible(!is_fullscreen() && m_tab_widget->children().size() > 1);
new_tab.on_title_change = [this, &new_tab](auto& title) {
m_tab_widget->set_tab_title(new_tab, String::from_deprecated_string(title).release_value_but_fixme_should_propagate_errors());
m_tab_widget->set_tab_title(new_tab, String::from_byte_string(title).release_value_but_fixme_should_propagate_errors());
if (m_tab_widget->active_widget() == &new_tab)
set_window_title_for_tab(new_tab);
};
@ -582,7 +582,7 @@ Tab& BrowserWindow::create_new_tab(URL const& url, Web::HTML::ActivateTab activa
return m_cookie_jar.get_named_cookie(url, name);
};
new_tab.on_get_cookie = [this](auto& url, auto source) -> DeprecatedString {
new_tab.on_get_cookie = [this](auto& url, auto source) -> ByteString {
return m_cookie_jar.get_cookie(url, source);
};
@ -622,7 +622,7 @@ Tab& BrowserWindow::create_new_tab(URL const& url, Web::HTML::ActivateTab activa
void BrowserWindow::create_new_window(URL const& url)
{
GUI::Process::spawn_or_show_error(this, "/bin/Browser"sv, Array { url.to_deprecated_string() });
GUI::Process::spawn_or_show_error(this, "/bin/Browser"sv, Array { url.to_byte_string() });
}
void BrowserWindow::content_filters_changed()

View file

@ -95,7 +95,7 @@ GUI::Model::MatchResult CookiesModel::data_matches(GUI::ModelIndex const& index,
return { TriState::True };
auto const& cookie = m_cookies[index.row()];
auto haystack = DeprecatedString::formatted("{} {} {} {}", cookie.domain, cookie.path, cookie.name, cookie.value);
auto haystack = ByteString::formatted("{} {} {} {}", cookie.domain, cookie.path, cookie.name, cookie.value);
auto match_result = fuzzy_match(needle, haystack);
if (match_result.score > 0)
return { TriState::True, match_result.score };

View file

@ -35,7 +35,7 @@ DownloadWidget::DownloadWidget(const URL& url)
builder.append(Core::StandardPaths::downloads_directory());
builder.append('/');
builder.append(m_url.basename());
m_destination_path = builder.to_deprecated_string();
m_destination_path = builder.to_byte_string();
}
auto close_on_finish = Config::read_bool("Browser"sv, "Preferences"sv, "CloseDownloadWidgetOnFinish"sv, Browser::default_close_download_widget_on_finish);
@ -50,7 +50,7 @@ DownloadWidget::DownloadWidget(const URL& url)
{
auto file_or_error = Core::File::open(m_destination_path, Core::File::OpenMode::Write);
if (file_or_error.is_error()) {
GUI::MessageBox::show(window(), DeprecatedString::formatted("Cannot open {} for writing", m_destination_path), "Download failed"sv, GUI::MessageBox::Type::Error);
GUI::MessageBox::show(window(), ByteString::formatted("Cannot open {} for writing", m_destination_path), "Download failed"sv, GUI::MessageBox::Type::Error);
window()->close();
return;
}
@ -86,7 +86,7 @@ DownloadWidget::DownloadWidget(const URL& url)
m_progress_label->set_fixed_height(16);
m_progress_label->set_text_wrapping(Gfx::TextWrapping::DontWrap);
auto destination_label_path = LexicalPath(m_destination_path).dirname().to_deprecated_string();
auto destination_label_path = LexicalPath(m_destination_path).dirname().to_byte_string();
auto& destination_label = add<GUI::Label>(String::formatted("To: {}", destination_label_path).release_value_but_fixme_should_propagate_errors());
destination_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
@ -145,7 +145,7 @@ void DownloadWidget::did_progress(Optional<u64> total_size, u64 downloaded_size)
}
builder.append(" of "sv);
builder.append(m_url.basename());
window()->set_title(builder.to_deprecated_string());
window()->set_title(builder.to_byte_string());
}
}
@ -164,7 +164,7 @@ void DownloadWidget::did_finish(bool success)
m_cancel_button->update();
if (!success) {
GUI::MessageBox::show(window(), DeprecatedString::formatted("Download failed for some reason"), "Download failed"sv, GUI::MessageBox::Type::Error);
GUI::MessageBox::show(window(), ByteString::formatted("Download failed for some reason"), "Download failed"sv, GUI::MessageBox::Type::Error);
window()->close();
return;
}

View file

@ -29,7 +29,7 @@ private:
void did_finish(bool success);
URL m_url;
DeprecatedString m_destination_path;
ByteString m_destination_path;
RefPtr<Web::ResourceLoaderConnectorRequest> m_download;
RefPtr<GUI::Progressbar> m_progressbar;
RefPtr<GUI::Label> m_progress_label;

View file

@ -79,7 +79,7 @@ GUI::Model::MatchResult HistoryModel::data_matches(GUI::ModelIndex const& index,
return { TriState::True };
auto const& history_entry = m_entries[index.row()];
auto haystack = DeprecatedString::formatted("{} {}", history_entry.title, history_entry.url.serialize());
auto haystack = ByteString::formatted("{} {}", history_entry.title, history_entry.url.serialize());
auto match_result = fuzzy_match(needle, haystack);
if (match_result.score > 0)
return { TriState::True, match_result.score };

View file

@ -84,7 +84,7 @@ InspectorWidget::InspectorWidget(WebView::OutOfProcessWebView& content_view)
};
m_inspector_client->on_requested_dom_node_tag_context_menu = [this](auto position, auto const& tag) {
m_edit_node_action->set_text(DeprecatedString::formatted("&Edit \"{}\"", tag));
m_edit_node_action->set_text(ByteString::formatted("&Edit \"{}\"", tag));
m_copy_node_action->set_text("&Copy HTML");
m_dom_node_tag_context_menu->popup(to_widget_position(position));
@ -94,9 +94,9 @@ InspectorWidget::InspectorWidget(WebView::OutOfProcessWebView& content_view)
static constexpr size_t MAX_ATTRIBUTE_VALUE_LENGTH = 32;
m_copy_node_action->set_text("&Copy HTML");
m_edit_node_action->set_text(DeprecatedString::formatted("&Edit attribute \"{}\"", attribute.name));
m_remove_attribute_action->set_text(DeprecatedString::formatted("&Remove attribute \"{}\"", attribute.name));
m_copy_attribute_value_action->set_text(DeprecatedString::formatted("Copy attribute &value \"{:.{}}{}\"",
m_edit_node_action->set_text(ByteString::formatted("&Edit attribute \"{}\"", attribute.name));
m_remove_attribute_action->set_text(ByteString::formatted("&Remove attribute \"{}\"", attribute.name));
m_copy_attribute_value_action->set_text(ByteString::formatted("Copy attribute &value \"{:.{}}{}\"",
attribute.value, MAX_ATTRIBUTE_VALUE_LENGTH,
attribute.value.bytes_as_string_view().length() > MAX_ATTRIBUTE_VALUE_LENGTH ? "..."sv : ""sv));

View file

@ -85,7 +85,7 @@ GUI::Model::MatchResult StorageModel::data_matches(GUI::ModelIndex const& index,
auto const& local_storage_key = keys[index.row()];
auto const& local_storage_value = m_local_storage_entries.get(local_storage_key).value_or({});
auto haystack = DeprecatedString::formatted("{} {}", local_storage_key, local_storage_value);
auto haystack = ByteString::formatted("{} {}", local_storage_key, local_storage_value);
auto match_result = fuzzy_match(needle, haystack);
if (match_result.score > 0)
return { TriState::True, match_result.score };

View file

@ -58,13 +58,13 @@ void Tab::start_download(const URL& url)
{
auto window = GUI::Window::construct(&this->window());
window->resize(300, 170);
window->set_title(DeprecatedString::formatted("0% of {}", url.basename()));
window->set_title(ByteString::formatted("0% of {}", url.basename()));
window->set_resizable(false);
(void)window->set_main_widget<DownloadWidget>(url);
window->show();
}
void Tab::view_source(const URL& url, DeprecatedString const& source)
void Tab::view_source(const URL& url, ByteString const& source)
{
auto window = GUI::Window::construct(&this->window());
auto editor = window->set_main_widget<GUI::TextEditor>();
@ -74,7 +74,7 @@ void Tab::view_source(const URL& url, DeprecatedString const& source)
editor->set_ruler_visible(true);
editor->set_visualize_trailing_whitespace(false);
window->resize(640, 480);
window->set_title(url.to_deprecated_string());
window->set_title(url.to_byte_string());
window->set_icon(g_icon_bag.filetype_text);
window->set_window_mode(GUI::WindowMode::Modeless);
window->show();
@ -132,7 +132,7 @@ Tab::Tab(BrowserWindow& window)
m_go_back_context_menu = GUI::Menu::construct();
for (auto& url : m_history.get_back_title_history()) {
i++;
m_go_back_context_menu->add_action(GUI::Action::create(url.to_deprecated_string(), g_icon_bag.filetype_html, [this, i](auto&) { go_back(i); }));
m_go_back_context_menu->add_action(GUI::Action::create(url.to_byte_string(), g_icon_bag.filetype_html, [this, i](auto&) { go_back(i); }));
}
m_go_back_context_menu->popup(go_back_button.screen_relative_rect().bottom_left().moved_up(1));
};
@ -145,7 +145,7 @@ Tab::Tab(BrowserWindow& window)
m_go_forward_context_menu = GUI::Menu::construct();
for (auto& url : m_history.get_forward_title_history()) {
i++;
m_go_forward_context_menu->add_action(GUI::Action::create(url.to_deprecated_string(), g_icon_bag.filetype_html, [this, i](auto&) { go_forward(i); }));
m_go_forward_context_menu->add_action(GUI::Action::create(url.to_byte_string(), g_icon_bag.filetype_html, [this, i](auto&) { go_forward(i); }));
}
m_go_forward_context_menu->popup(go_forward_button.screen_relative_rect().bottom_left().moved_up(1));
};
@ -220,7 +220,7 @@ Tab::Tab(BrowserWindow& window)
update_status();
m_location_box->set_icon(nullptr);
m_location_box->set_text(url.to_deprecated_string());
m_location_box->set_text(url.to_byte_string());
// don't add to history if back or forward is pressed
if (!m_is_history_navigation)
@ -228,7 +228,7 @@ Tab::Tab(BrowserWindow& window)
m_is_history_navigation = false;
update_actions();
update_bookmark_button(url.to_deprecated_string());
update_bookmark_button(url.to_byte_string());
if (m_dom_inspector_widget)
m_dom_inspector_widget->reset();
@ -353,7 +353,7 @@ Tab::Tab(BrowserWindow& window)
GUI::Clipboard::the().set_bitmap(*m_image_context_menu_bitmap.bitmap());
}));
m_image_context_menu->add_action(GUI::Action::create("Copy Image &URL", g_icon_bag.copy, [this](auto&) {
GUI::Clipboard::the().set_plain_text(m_image_context_menu_url.to_deprecated_string());
GUI::Clipboard::the().set_plain_text(m_image_context_menu_url.to_byte_string());
}));
m_image_context_menu->add_separator();
m_image_context_menu->add_action(GUI::Action::create("&Download", g_icon_bag.download, [this](auto&) {
@ -397,7 +397,7 @@ Tab::Tab(BrowserWindow& window)
}));
m_audio_context_menu->add_separator();
m_audio_context_menu->add_action(GUI::Action::create("Copy Audio &URL", g_icon_bag.copy, [this](auto&) {
GUI::Clipboard::the().set_plain_text(m_media_context_menu_url.to_deprecated_string());
GUI::Clipboard::the().set_plain_text(m_media_context_menu_url.to_byte_string());
}));
m_audio_context_menu->add_separator();
m_audio_context_menu->add_action(GUI::Action::create("&Download", g_icon_bag.download, [this](auto&) {
@ -420,7 +420,7 @@ Tab::Tab(BrowserWindow& window)
}));
m_video_context_menu->add_separator();
m_video_context_menu->add_action(GUI::Action::create("Copy Video &URL", g_icon_bag.copy, [this](auto&) {
GUI::Clipboard::the().set_plain_text(m_media_context_menu_url.to_deprecated_string());
GUI::Clipboard::the().set_plain_text(m_media_context_menu_url.to_byte_string());
}));
m_video_context_menu->add_separator();
m_video_context_menu->add_action(GUI::Action::create("&Download", g_icon_bag.download, [this](auto&) {
@ -490,7 +490,7 @@ Tab::Tab(BrowserWindow& window)
return {};
};
view().on_get_cookie = [this](auto& url, auto source) -> DeprecatedString {
view().on_get_cookie = [this](auto& url, auto source) -> ByteString {
if (on_get_cookie)
return on_get_cookie(url, source);
return {};
@ -609,7 +609,7 @@ Tab::Tab(BrowserWindow& window)
m_statusbar = *find_descendant_of_type_named<GUI::Statusbar>("statusbar");
view().on_link_hover = [this](auto& url) {
update_status(String::from_deprecated_string(url.to_deprecated_string()).release_value_but_fixme_should_propagate_errors());
update_status(String::from_byte_string(url.to_byte_string()).release_value_but_fixme_should_propagate_errors());
};
view().on_link_unhover = [this]() {
@ -631,7 +631,7 @@ Tab::Tab(BrowserWindow& window)
};
view().on_insert_clipboard_entry = [](auto const& data, auto const&, auto const& mime_type) {
GUI::Clipboard::the().set_data(data.bytes(), mime_type.to_deprecated_string());
GUI::Clipboard::the().set_data(data.bytes(), mime_type.to_byte_string());
};
m_tab_context_menu = GUI::Menu::construct();
@ -705,7 +705,7 @@ Tab::Tab(BrowserWindow& window)
if (m_page_context_menu_search_text.has_value()) {
auto action_text = WebView::format_search_query_for_display(g_search_engine, *m_page_context_menu_search_text);
search_selected_text_action->set_text(action_text.to_deprecated_string());
search_selected_text_action->set_text(action_text.to_byte_string());
search_selected_text_action->set_visible(true);
} else {
search_selected_text_action->set_visible(false);
@ -719,7 +719,7 @@ Tab::Tab(BrowserWindow& window)
void Tab::select_dropdown_add_item(GUI::Menu& menu, Web::HTML::SelectItem const& item)
{
if (item.type == Web::HTML::SelectItem::Type::OptionGroup) {
auto subtitle = GUI::Action::create(MUST(DeprecatedString::from_utf8(item.label.value_or(""_string))), nullptr);
auto subtitle = GUI::Action::create(MUST(ByteString::from_utf8(item.label.value_or(""_string))), nullptr);
subtitle->set_enabled(false);
menu.add_action(subtitle);
@ -728,7 +728,7 @@ void Tab::select_dropdown_add_item(GUI::Menu& menu, Web::HTML::SelectItem const&
}
}
if (item.type == Web::HTML::SelectItem::Type::Option) {
auto action = GUI::Action::create(MUST(DeprecatedString::from_utf8(item.label.value_or(""_string))), [this, item](GUI::Action&) {
auto action = GUI::Action::create(MUST(ByteString::from_utf8(item.label.value_or(""_string))), [this, item](GUI::Action&) {
m_select_dropdown_closed_by_action = true;
view().select_dropdown_closed(item.value.value_or(""_string));
});
@ -804,7 +804,7 @@ void Tab::update_actions()
ErrorOr<void> Tab::bookmark_current_url()
{
auto url = this->url().to_deprecated_string();
auto url = this->url().to_byte_string();
if (BookmarksBarWidget::the().contains_bookmark(url)) {
TRY(BookmarksBarWidget::the().remove_bookmark(url));
} else {
@ -837,11 +837,11 @@ void Tab::did_become_active()
};
BookmarksBarWidget::the().on_bookmark_hover = [this](auto&, auto& url) {
m_statusbar->set_text(String::from_deprecated_string(url).release_value_but_fixme_should_propagate_errors());
m_statusbar->set_text(String::from_byte_string(url).release_value_but_fixme_should_propagate_errors());
};
BookmarksBarWidget::the().on_bookmark_change = [this]() {
update_bookmark_button(url().to_deprecated_string());
update_bookmark_button(url().to_byte_string());
};
BookmarksBarWidget::the().remove_from_parent();

View file

@ -63,7 +63,7 @@ public:
void window_position_changed(Gfx::IntPoint);
void window_size_changed(Gfx::IntSize);
Function<void(DeprecatedString const&)> on_title_change;
Function<void(ByteString const&)> on_title_change;
Function<void(const URL&)> on_tab_open_request;
Function<void(Tab&)> on_activate_tab_request;
Function<void(Tab&)> on_tab_close_request;
@ -71,8 +71,8 @@ public:
Function<void(const URL&)> on_window_open_request;
Function<void(Gfx::Bitmap const&)> on_favicon_change;
Function<Vector<Web::Cookie::Cookie>(AK::URL const& url)> on_get_all_cookies;
Function<Optional<Web::Cookie::Cookie>(AK::URL const& url, DeprecatedString const& name)> on_get_named_cookie;
Function<DeprecatedString(const URL&, Web::Cookie::Source source)> on_get_cookie;
Function<Optional<Web::Cookie::Cookie>(AK::URL const& url, ByteString const& name)> on_get_named_cookie;
Function<ByteString(const URL&, Web::Cookie::Source source)> on_get_cookie;
Function<void(const URL&, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source)> on_set_cookie;
Function<void()> on_dump_cookies;
Function<void(Web::Cookie::Cookie)> on_update_cookie;
@ -93,7 +93,7 @@ public:
void update_reset_zoom_button();
DeprecatedString const& title() const { return m_title; }
ByteString const& title() const { return m_title; }
Gfx::Bitmap const* icon() const { return m_icon; }
WebView::OutOfProcessWebView& view() { return *m_web_content_view; }
@ -111,7 +111,7 @@ private:
ErrorOr<void> bookmark_current_url();
void update_bookmark_button(StringView url);
void start_download(const URL& url);
void view_source(const URL& url, DeprecatedString const& source);
void view_source(const URL& url, ByteString const& source);
void update_status(Optional<String> text_override = {}, i32 count_waiting = 0);
void close_sub_widgets();
@ -160,7 +160,7 @@ private:
RefPtr<GUI::Menu> m_select_dropdown;
bool m_select_dropdown_closed_by_action { false };
DeprecatedString m_title;
ByteString m_title;
RefPtr<Gfx::Bitmap const> m_icon;
Optional<URL> m_navigating_url;

View file

@ -60,7 +60,7 @@ WindowActions::WindowActions(GUI::Window& window)
for (auto i = 0; i <= 7; ++i) {
m_tab_actions.append(GUI::Action::create(
DeprecatedString::formatted("Tab {}", i + 1), { Mod_Ctrl, static_cast<KeyCode>(Key_1 + i) }, [this, i](auto&) {
ByteString::formatted("Tab {}", i + 1), { Mod_Ctrl, static_cast<KeyCode>(Key_1 + i) }, [this, i](auto&) {
if (on_tabs[i])
on_tabs[i]();
},

View file

@ -33,17 +33,17 @@
namespace Browser {
DeprecatedString g_search_engine;
DeprecatedString g_home_url;
DeprecatedString g_new_tab_url;
ByteString g_search_engine;
ByteString g_home_url;
ByteString g_new_tab_url;
Vector<String> g_content_filters;
bool g_content_filters_enabled { true };
Vector<String> g_autoplay_allowlist;
bool g_autoplay_allowed_on_all_websites { false };
Vector<DeprecatedString> g_proxies;
HashMap<DeprecatedString, size_t> g_proxy_mappings;
Vector<ByteString> g_proxies;
HashMap<ByteString, size_t> g_proxy_mappings;
IconBag g_icon_bag;
DeprecatedString g_webdriver_content_ipc_path;
ByteString g_webdriver_content_ipc_path;
}
@ -182,7 +182,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}
window->content_filters_changed();
};
TRY(content_filters_watcher->add_watch(DeprecatedString::formatted("{}/BrowserContentFilters.txt", Core::StandardPaths::config_directory()), Core::FileWatcherEvent::Type::ContentModified));
TRY(content_filters_watcher->add_watch(ByteString::formatted("{}/BrowserContentFilters.txt", Core::StandardPaths::config_directory()), Core::FileWatcherEvent::Type::ContentModified));
auto autoplay_allowlist_watcher = TRY(Core::FileWatcher::create());
autoplay_allowlist_watcher->on_change = [&](Core::FileWatcherEvent const&) {
@ -193,7 +193,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}
window->autoplay_allowlist_changed();
};
TRY(autoplay_allowlist_watcher->add_watch(DeprecatedString::formatted("{}/BrowserAutoplayAllowlist.txt", Core::StandardPaths::config_directory()), Core::FileWatcherEvent::Type::ContentModified));
TRY(autoplay_allowlist_watcher->add_watch(ByteString::formatted("{}/BrowserAutoplayAllowlist.txt", Core::StandardPaths::config_directory()), Core::FileWatcherEvent::Type::ContentModified));
app->on_action_enter = [&](GUI::Action& action) {
if (auto* browser_window = dynamic_cast<Browser::BrowserWindow*>(app->active_window())) {