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

AK+Everywhere: Rename String to DeprecatedString

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 :^)
This commit is contained in:
Linus Groh 2022-12-04 18:02:33 +00:00 committed by Andreas Kling
parent f74251606d
commit 6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions

View file

@ -74,12 +74,12 @@ private:
};
}
String title() const
DeprecatedString title() const
{
return m_title_textbox->text();
}
String url() const
DeprecatedString url() const
{
return m_url_textbox->text();
}
@ -97,7 +97,7 @@ BookmarksBarWidget& BookmarksBarWidget::the()
return *s_the;
}
BookmarksBarWidget::BookmarksBarWidget(String const& bookmarks_file, bool enabled)
BookmarksBarWidget::BookmarksBarWidget(DeprecatedString const& bookmarks_file, bool enabled)
{
s_the = this;
set_layout<GUI::HorizontalBoxLayout>();
@ -259,7 +259,7 @@ void BookmarksBarWidget::update_content_size()
}
}
bool BookmarksBarWidget::contains_bookmark(String const& url)
bool BookmarksBarWidget::contains_bookmark(DeprecatedString const& url)
{
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
@ -272,7 +272,7 @@ bool BookmarksBarWidget::contains_bookmark(String const& url)
return false;
}
bool BookmarksBarWidget::remove_bookmark(String const& url)
bool BookmarksBarWidget::remove_bookmark(DeprecatedString const& url)
{
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
@ -292,7 +292,7 @@ bool BookmarksBarWidget::remove_bookmark(String const& url)
return false;
}
bool BookmarksBarWidget::add_bookmark(String const& url, String const& title)
bool BookmarksBarWidget::add_bookmark(DeprecatedString const& url, DeprecatedString const& title)
{
Vector<JsonValue> values;
values.append(title);
@ -306,7 +306,7 @@ bool BookmarksBarWidget::add_bookmark(String const& url, String const& title)
return false;
}
bool BookmarksBarWidget::edit_bookmark(String const& url)
bool BookmarksBarWidget::edit_bookmark(DeprecatedString const& url)
{
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
auto item_title = model()->index(item_index, 0).data().to_string();

View file

@ -31,13 +31,13 @@ public:
No
};
Function<void(String const& url, OpenInNewTab)> on_bookmark_click;
Function<void(String const&, String const&)> on_bookmark_hover;
Function<void(DeprecatedString const& url, OpenInNewTab)> on_bookmark_click;
Function<void(DeprecatedString const&, DeprecatedString const&)> on_bookmark_hover;
bool contains_bookmark(String const& url);
bool remove_bookmark(String const& url);
bool add_bookmark(String const& url, String const& title);
bool edit_bookmark(String const& url);
bool contains_bookmark(DeprecatedString const& url);
bool remove_bookmark(DeprecatedString const& url);
bool add_bookmark(DeprecatedString const& url, DeprecatedString const& title);
bool edit_bookmark(DeprecatedString const& url);
virtual Optional<GUI::UISize> calculated_min_size() const override
{
@ -46,7 +46,7 @@ public:
}
private:
BookmarksBarWidget(String const&, bool enabled);
BookmarksBarWidget(DeprecatedString const&, bool enabled);
// ^GUI::ModelClient
virtual void model_did_update(unsigned) override;
@ -63,7 +63,7 @@ private:
RefPtr<GUI::Menu> m_context_menu;
RefPtr<GUI::Action> m_context_menu_default_action;
String m_context_menu_url;
DeprecatedString m_context_menu_url;
NonnullRefPtrVector<GUI::Button> m_bookmarks;

View file

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

View file

@ -46,7 +46,7 @@
namespace Browser {
static String bookmarks_file_path()
static DeprecatedString bookmarks_file_path()
{
StringBuilder builder;
builder.append(Core::StandardPaths::config_directory());
@ -54,7 +54,7 @@ static String bookmarks_file_path()
return builder.to_string();
}
static String search_engines_file_path()
static DeprecatedString search_engines_file_path()
{
StringBuilder builder;
builder.append(Core::StandardPaths::config_directory());
@ -247,7 +247,7 @@ void BrowserWindow::build_menus()
m_take_visible_screenshot_action = GUI::Action::create(
"Take &Visible Screenshot"sv, g_icon_bag.filetype_image, [this](auto&) {
if (auto result = take_screenshot(ScreenshotType::Visible); result.is_error())
GUI::MessageBox::show_error(this, String::formatted("{}", result.error()));
GUI::MessageBox::show_error(this, DeprecatedString::formatted("{}", result.error()));
},
this);
m_take_visible_screenshot_action->set_status_tip("Save a screenshot of the visible portion of the current tab to the Downloads directory"sv);
@ -255,7 +255,7 @@ void BrowserWindow::build_menus()
m_take_full_screenshot_action = GUI::Action::create(
"Take &Full Screenshot"sv, g_icon_bag.filetype_image, [this](auto&) {
if (auto result = take_screenshot(ScreenshotType::Full); result.is_error())
GUI::MessageBox::show_error(this, String::formatted("{}", result.error()));
GUI::MessageBox::show_error(this, DeprecatedString::formatted("{}", result.error()));
},
this);
m_take_full_screenshot_action->set_status_tip("Save a screenshot of the entirety of the current tab to the Downloads directory"sv);
@ -410,7 +410,7 @@ void BrowserWindow::build_menus()
add_user_agent("Safari iOS Mobile", "Mozilla/5.0 (iPhone; CPU iPhone OS 14_4_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15E148 Safari/604.1");
auto custom_user_agent = GUI::Action::create_checkable("Custom...", [this](auto& action) {
String user_agent;
DeprecatedString user_agent;
if (GUI::InputBox::show(this, user_agent, "Enter User Agent:"sv, "Custom User Agent"sv) != GUI::InputBox::ExecResult::OK || user_agent.is_empty() || user_agent.is_null()) {
m_disable_user_agent_spoofing->activate();
return;
@ -501,7 +501,7 @@ ErrorOr<void> BrowserWindow::load_search_engines(GUI::Menu& settings_menu)
}
auto custom_search_engine_action = GUI::Action::create_checkable("Custom...", [&](auto& action) {
String search_engine;
DeprecatedString search_engine;
if (GUI::InputBox::show(this, search_engine, "Enter URL template:"sv, "Custom Search Engine"sv, "https://host/search?q={}"sv) != GUI::InputBox::ExecResult::OK || search_engine.is_empty()) {
m_disable_search_engine_action->activate();
return;
@ -543,7 +543,7 @@ void BrowserWindow::set_window_title_for_tab(Tab const& tab)
{
auto& title = tab.title();
auto url = tab.url();
set_title(String::formatted("{} - Browser", title.is_empty() ? url.to_string() : title));
set_title(DeprecatedString::formatted("{} - Browser", title.is_empty() ? url.to_string() : title));
}
void BrowserWindow::create_new_tab(URL url, bool activate)
@ -591,7 +591,7 @@ void BrowserWindow::create_new_tab(URL url, bool activate)
return m_cookie_jar.get_named_cookie(url, name);
};
new_tab.on_get_cookie = [this](auto& url, auto source) -> String {
new_tab.on_get_cookie = [this](auto& url, auto source) -> DeprecatedString {
return m_cookie_jar.get_cookie(url, source);
};
@ -647,7 +647,7 @@ void BrowserWindow::proxy_mappings_changed()
});
}
void BrowserWindow::config_string_did_change(String const& domain, String const& group, String const& key, String const& value)
void BrowserWindow::config_string_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value)
{
if (domain != "Browser")
return;
@ -673,7 +673,7 @@ void BrowserWindow::config_string_did_change(String const& domain, String const&
// TODO: ColorScheme
}
void BrowserWindow::config_bool_did_change(String const& domain, String const& group, String const& key, bool value)
void BrowserWindow::config_bool_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, bool value)
{
dbgln("{} {} {} {}", domain, group, key, value);
if (domain != "Browser" || group != "Preferences")

View file

@ -55,8 +55,8 @@ private:
ErrorOr<void> load_search_engines(GUI::Menu& settings_menu);
void set_window_title_for_tab(Tab const&);
virtual void config_string_did_change(String const& domain, String const& group, String const& key, String const& value) override;
virtual void config_bool_did_change(String const& domain, String const& group, String const& key, bool value) override;
virtual void config_string_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value) override;
virtual void config_bool_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, bool value) override;
virtual void event(Core::Event&) override;

View file

@ -92,7 +92,7 @@ void ConsoleWidget::notify_about_new_console_message(i32 message_index)
request_console_messages();
}
void ConsoleWidget::handle_console_messages(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages)
void ConsoleWidget::handle_console_messages(i32 start_index, Vector<DeprecatedString> const& message_types, Vector<DeprecatedString> const& messages)
{
i32 end_index = start_index + message_types.size() - 1;
if (end_index <= m_highest_received_message_index) {

View file

@ -21,12 +21,12 @@ public:
virtual ~ConsoleWidget() = default;
void notify_about_new_console_message(i32 message_index);
void handle_console_messages(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages);
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(String const&)> on_js_input;
Function<void(DeprecatedString const&)> on_js_input;
Function<void(i32)> on_request_messages;
private:
@ -46,7 +46,7 @@ private:
struct Group {
int id { 0 };
String label;
DeprecatedString label;
};
Vector<Group> m_group_stack;
int m_next_group_id { 1 };

View file

@ -16,7 +16,7 @@
namespace Browser {
String CookieJar::get_cookie(const URL& url, Web::Cookie::Source source)
DeprecatedString CookieJar::get_cookie(const URL& url, Web::Cookie::Source source)
{
purge_expired_cookies();
@ -134,7 +134,7 @@ Vector<Web::Cookie::Cookie> CookieJar::get_all_cookies(URL const& url)
return cookies;
}
Optional<Web::Cookie::Cookie> CookieJar::get_named_cookie(URL const& url, String const& name)
Optional<Web::Cookie::Cookie> CookieJar::get_named_cookie(URL const& url, DeprecatedString const& name)
{
auto domain = canonicalize_domain(url);
if (!domain.has_value())
@ -150,7 +150,7 @@ Optional<Web::Cookie::Cookie> CookieJar::get_named_cookie(URL const& url, String
return {};
}
Optional<String> CookieJar::canonicalize_domain(const URL& url)
Optional<DeprecatedString> CookieJar::canonicalize_domain(const URL& url)
{
// https://tools.ietf.org/html/rfc6265#section-5.1.2
if (!url.is_valid())
@ -160,7 +160,7 @@ Optional<String> CookieJar::canonicalize_domain(const URL& url)
return url.host().to_lowercase();
}
bool CookieJar::domain_matches(String const& string, String const& domain_string)
bool CookieJar::domain_matches(DeprecatedString const& string, DeprecatedString const& domain_string)
{
// https://tools.ietf.org/html/rfc6265#section-5.1.3
@ -184,7 +184,7 @@ bool CookieJar::domain_matches(String const& string, String const& domain_string
return true;
}
bool CookieJar::path_matches(String const& request_path, String const& cookie_path)
bool CookieJar::path_matches(DeprecatedString const& request_path, DeprecatedString const& cookie_path)
{
// https://tools.ietf.org/html/rfc6265#section-5.1.4
@ -207,12 +207,12 @@ bool CookieJar::path_matches(String const& request_path, String const& cookie_pa
return false;
}
String CookieJar::default_path(const URL& url)
DeprecatedString CookieJar::default_path(const URL& url)
{
// https://tools.ietf.org/html/rfc6265#section-5.1.4
// 1. Let uri-path be the path portion of the request-uri if such a portion exists (and empty otherwise).
String uri_path = url.path();
DeprecatedString uri_path = url.path();
// 2. If the uri-path is empty or if the first character of the uri-path is not a %x2F ("/") character, output %x2F ("/") and skip the remaining steps.
if (uri_path.is_empty() || (uri_path[0] != '/'))
@ -229,7 +229,7 @@ String CookieJar::default_path(const URL& url)
return uri_path.substring(0, last_separator);
}
void CookieJar::store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, const URL& url, String canonicalized_domain, Web::Cookie::Source source)
void CookieJar::store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, const URL& url, DeprecatedString canonicalized_domain, Web::Cookie::Source source)
{
// https://tools.ietf.org/html/rfc6265#section-5.3
@ -315,7 +315,7 @@ void CookieJar::store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, con
m_cookies.set(key, move(cookie));
}
Vector<Web::Cookie::Cookie&> CookieJar::get_matching_cookies(const URL& url, String const& canonicalized_domain, Web::Cookie::Source source, MatchingCookiesSpecMode mode)
Vector<Web::Cookie::Cookie&> CookieJar::get_matching_cookies(const URL& url, DeprecatedString const& canonicalized_domain, Web::Cookie::Source source, MatchingCookiesSpecMode mode)
{
// https://tools.ietf.org/html/rfc6265#section-5.4

View file

@ -6,9 +6,9 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/HashMap.h>
#include <AK/Optional.h>
#include <AK/String.h>
#include <AK/Traits.h>
#include <LibCore/DateTime.h>
#include <LibWeb/Cookie/Cookie.h>
@ -19,34 +19,34 @@ namespace Browser {
struct CookieStorageKey {
bool operator==(CookieStorageKey const&) const = default;
String name;
String domain;
String path;
DeprecatedString name;
DeprecatedString domain;
DeprecatedString path;
};
class CookieJar {
public:
String get_cookie(const URL& url, Web::Cookie::Source source);
DeprecatedString get_cookie(const URL& url, Web::Cookie::Source source);
void set_cookie(const URL& url, Web::Cookie::ParsedCookie const& parsed_cookie, Web::Cookie::Source source);
void update_cookie(URL const&, Web::Cookie::Cookie);
void dump_cookies() const;
Vector<Web::Cookie::Cookie> get_all_cookies() const;
Vector<Web::Cookie::Cookie> get_all_cookies(URL const& url);
Optional<Web::Cookie::Cookie> get_named_cookie(URL const& url, String const& name);
Optional<Web::Cookie::Cookie> get_named_cookie(URL const& url, DeprecatedString const& name);
private:
static Optional<String> canonicalize_domain(const URL& url);
static bool domain_matches(String const& string, String const& domain_string);
static bool path_matches(String const& request_path, String const& cookie_path);
static String default_path(const URL& url);
static Optional<DeprecatedString> canonicalize_domain(const URL& url);
static bool domain_matches(DeprecatedString const& string, DeprecatedString const& domain_string);
static bool path_matches(DeprecatedString const& request_path, DeprecatedString const& cookie_path);
static DeprecatedString default_path(const URL& url);
enum class MatchingCookiesSpecMode {
RFC6265,
WebDriver,
};
void store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, const URL& url, String canonicalized_domain, Web::Cookie::Source source);
Vector<Web::Cookie::Cookie&> get_matching_cookies(const URL& url, String const& canonicalized_domain, Web::Cookie::Source source, MatchingCookiesSpecMode mode = MatchingCookiesSpecMode::RFC6265);
void store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, const URL& url, DeprecatedString canonicalized_domain, Web::Cookie::Source source);
Vector<Web::Cookie::Cookie&> get_matching_cookies(const URL& url, DeprecatedString const& canonicalized_domain, Web::Cookie::Source source, MatchingCookiesSpecMode mode = MatchingCookiesSpecMode::RFC6265);
void purge_expired_cookies();
HashMap<CookieStorageKey, Web::Cookie::Cookie> m_cookies;

View file

@ -34,7 +34,7 @@ int CookiesModel::row_count(GUI::ModelIndex const& index) const
return 0;
}
String CookiesModel::column_name(int column) const
DeprecatedString CookiesModel::column_name(int column) const
{
switch (column) {
case Column::Domain:
@ -95,7 +95,7 @@ TriState CookiesModel::data_matches(GUI::ModelIndex const& index, GUI::Variant c
return TriState::True;
auto const& cookie = m_cookies[index.row()];
auto haystack = String::formatted("{} {} {} {}", cookie.domain, cookie.path, cookie.name, cookie.value);
auto haystack = DeprecatedString::formatted("{} {} {} {}", cookie.domain, cookie.path, cookie.name, cookie.value);
if (fuzzy_match(needle, haystack).score > 0)
return TriState::True;
return TriState::False;

View file

@ -30,7 +30,7 @@ public:
void clear_items();
virtual int row_count(GUI::ModelIndex const&) const override;
virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; }
virtual String column_name(int column) const override;
virtual DeprecatedString column_name(int column) const override;
virtual GUI::ModelIndex index(int row, int column = 0, GUI::ModelIndex const& = GUI::ModelIndex()) const override;
virtual GUI::Variant data(GUI::ModelIndex const& index, GUI::ModelRole role = GUI::ModelRole::Display) const override;
virtual TriState data_matches(GUI::ModelIndex const& index, GUI::Variant const& term) const override;

View file

@ -49,7 +49,7 @@ DownloadWidget::DownloadWidget(const URL& url)
{
auto file_or_error = Core::Stream::File::open(m_destination_path, Core::Stream::OpenMode::Write);
if (file_or_error.is_error()) {
GUI::MessageBox::show(window(), String::formatted("Cannot open {} for writing", m_destination_path), "Download failed"sv, GUI::MessageBox::Type::Error);
GUI::MessageBox::show(window(), DeprecatedString::formatted("Cannot open {} for writing", m_destination_path), "Download failed"sv, GUI::MessageBox::Type::Error);
window()->close();
return;
}
@ -71,7 +71,7 @@ DownloadWidget::DownloadWidget(const URL& url)
m_browser_image->load_from_file("/res/graphics/download-animation.gif"sv);
animation_layout.add_spacer();
auto& source_label = add<GUI::Label>(String::formatted("From: {}", url));
auto& source_label = add<GUI::Label>(DeprecatedString::formatted("From: {}", url));
source_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
source_label.set_fixed_height(16);
@ -82,7 +82,7 @@ DownloadWidget::DownloadWidget(const URL& url)
m_progress_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
m_progress_label->set_fixed_height(16);
auto& destination_label = add<GUI::Label>(String::formatted("To: {}", m_destination_path));
auto& destination_label = add<GUI::Label>(DeprecatedString::formatted("To: {}", m_destination_path));
destination_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
destination_label.set_fixed_height(16);
@ -161,7 +161,7 @@ void DownloadWidget::did_finish(bool success)
m_cancel_button->update();
if (!success) {
GUI::MessageBox::show(window(), String::formatted("Download failed for some reason"), "Download failed"sv, GUI::MessageBox::Type::Error);
GUI::MessageBox::show(window(), DeprecatedString::formatted("Download failed for some reason"), "Download failed"sv, GUI::MessageBox::Type::Error);
window()->close();
return;
}

View file

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

View file

@ -21,13 +21,13 @@ void ElementSizePreviewWidget::paint_event(GUI::PaintEvent& event)
int content_width_padding = 8;
int content_height_padding = 8;
auto content_size_text = String::formatted("{}x{}", m_node_content_width, m_node_content_height);
auto content_size_text = DeprecatedString::formatted("{}x{}", m_node_content_width, m_node_content_height);
int inner_content_width = max(100, font().width(content_size_text) + 2 * content_width_padding);
int inner_content_height = max(15, font().glyph_height() + 2 * content_height_padding);
auto format_size_text = [&](float size) {
return String::formatted("{:.4f}", size);
return DeprecatedString::formatted("{:.4f}", size);
};
auto compute_text_string_width = [&](float size) {

View file

@ -18,7 +18,7 @@ void History::dump() const
}
}
void History::push(const URL& url, String const& title)
void History::push(const URL& url, DeprecatedString const& title)
{
if (!m_items.is_empty() && m_items[m_current].url == url)
return;
@ -30,7 +30,7 @@ void History::push(const URL& url, String const& title)
m_current++;
}
void History::replace_current(const URL& url, String const& title)
void History::replace_current(const URL& url, DeprecatedString const& title)
{
if (m_current == -1)
return;
@ -65,7 +65,7 @@ void History::clear()
m_current = -1;
}
void History::update_title(String const& title)
void History::update_title(DeprecatedString const& title)
{
if (m_current == -1)
return;

View file

@ -15,13 +15,13 @@ class History {
public:
struct URLTitlePair {
URL url;
String title;
DeprecatedString title;
};
void dump() const;
void push(const URL& url, String const& title);
void replace_current(const URL& url, String const& title);
void update_title(String const& title);
void push(const URL& url, DeprecatedString const& title);
void replace_current(const URL& url, DeprecatedString const& title);
void update_title(DeprecatedString const& title);
URLTitlePair current() const;
Vector<StringView> const get_back_title_history();

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/String.h>
#include <AK/DeprecatedString.h>
#include <Applications/Browser/IconBag.h>
namespace Browser {

View file

@ -126,7 +126,7 @@ void InspectorWidget::select_default_node()
m_dom_tree_view->set_cursor({}, GUI::AbstractView::SelectionUpdate::ClearIfNotSelected);
}
void InspectorWidget::set_dom_json(String json)
void InspectorWidget::set_dom_json(DeprecatedString json)
{
if (m_dom_json.has_value() && m_dom_json.value() == json)
return;
@ -148,7 +148,7 @@ void InspectorWidget::clear_dom_json()
clear_style_json();
}
void InspectorWidget::set_dom_node_properties_json(Selection selection, String specified_values_json, String computed_values_json, String custom_properties_json, String node_box_sizing_json)
void InspectorWidget::set_dom_node_properties_json(Selection selection, DeprecatedString specified_values_json, DeprecatedString computed_values_json, DeprecatedString custom_properties_json, DeprecatedString node_box_sizing_json)
{
if (selection != m_selection) {
dbgln("Got data for the wrong node id! Wanted ({}), got ({})", m_selection.to_string(), selection.to_string());
@ -159,7 +159,7 @@ void InspectorWidget::set_dom_node_properties_json(Selection selection, String s
update_node_box_model(node_box_sizing_json);
}
void InspectorWidget::load_style_json(String specified_values_json, String computed_values_json, String custom_properties_json)
void InspectorWidget::load_style_json(DeprecatedString specified_values_json, DeprecatedString computed_values_json, DeprecatedString custom_properties_json)
{
m_selection_specified_values_json = specified_values_json;
m_computed_style_table_view->set_model(WebView::StylePropertiesModel::create(m_selection_specified_values_json.value().view()));
@ -174,7 +174,7 @@ void InspectorWidget::load_style_json(String specified_values_json, String compu
m_custom_properties_table_view->set_searchable(true);
}
void InspectorWidget::update_node_box_model(Optional<String> node_box_sizing_json)
void InspectorWidget::update_node_box_model(Optional<DeprecatedString> node_box_sizing_json)
{
if (!node_box_sizing_json.has_value()) {
return;

View file

@ -29,20 +29,20 @@ public:
return dom_node_id == other.dom_node_id && pseudo_element == other.pseudo_element;
}
String to_string() const
DeprecatedString to_string() const
{
if (pseudo_element.has_value())
return String::formatted("id: {}, pseudo: {}", dom_node_id, Web::CSS::pseudo_element_name(pseudo_element.value()));
return String::formatted("id: {}", dom_node_id);
return DeprecatedString::formatted("id: {}, pseudo: {}", dom_node_id, Web::CSS::pseudo_element_name(pseudo_element.value()));
return DeprecatedString::formatted("id: {}", dom_node_id);
}
};
virtual ~InspectorWidget() = default;
void set_web_view(NonnullRefPtr<WebView::OutOfProcessWebView> web_view) { m_web_view = web_view; }
void set_dom_json(String);
void set_dom_json(DeprecatedString);
void clear_dom_json();
void set_dom_node_properties_json(Selection, String specified_values_json, String computed_values_json, String custom_properties_json, String node_box_sizing_json);
void set_dom_node_properties_json(Selection, DeprecatedString specified_values_json, DeprecatedString computed_values_json, DeprecatedString custom_properties_json, DeprecatedString node_box_sizing_json);
void set_selection(Selection);
void select_default_node();
@ -51,8 +51,8 @@ private:
InspectorWidget();
void set_selection(GUI::ModelIndex);
void load_style_json(String specified_values_json, String computed_values_json, String custom_properties_json);
void update_node_box_model(Optional<String> node_box_sizing_json);
void load_style_json(DeprecatedString specified_values_json, DeprecatedString computed_values_json, DeprecatedString custom_properties_json);
void update_node_box_model(Optional<DeprecatedString> node_box_sizing_json);
void clear_style_json();
void clear_node_box_model();
@ -66,12 +66,12 @@ private:
Web::Layout::BoxModelMetrics m_node_box_sizing;
Optional<String> m_dom_json;
Optional<DeprecatedString> m_dom_json;
Optional<Selection> m_pending_selection;
Selection m_selection;
Optional<String> m_selection_specified_values_json;
Optional<String> m_selection_computed_values_json;
Optional<String> m_selection_custom_properties_json;
Optional<DeprecatedString> m_selection_specified_values_json;
Optional<DeprecatedString> m_selection_computed_values_json;
Optional<DeprecatedString> m_selection_custom_properties_json;
};
}

View file

@ -10,7 +10,7 @@
namespace Browser {
void StorageModel::set_items(OrderedHashMap<String, String> map)
void StorageModel::set_items(OrderedHashMap<DeprecatedString, DeprecatedString> map)
{
begin_insert_rows({}, m_local_storage_entries.size(), m_local_storage_entries.size());
m_local_storage_entries = map;
@ -35,7 +35,7 @@ int StorageModel::row_count(GUI::ModelIndex const& index) const
return 0;
}
String StorageModel::column_name(int column) const
DeprecatedString StorageModel::column_name(int column) const
{
switch (column) {
case Column::Key:
@ -85,7 +85,7 @@ TriState StorageModel::data_matches(GUI::ModelIndex const& index, GUI::Variant c
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 = String::formatted("{} {}", local_storage_key, local_storage_value);
auto haystack = DeprecatedString::formatted("{} {}", local_storage_key, local_storage_value);
if (fuzzy_match(needle, haystack).score > 0)
return TriState::True;
return TriState::False;

View file

@ -18,17 +18,17 @@ public:
__Count,
};
void set_items(OrderedHashMap<String, String> map);
void set_items(OrderedHashMap<DeprecatedString, DeprecatedString> map);
void clear_items();
virtual int row_count(GUI::ModelIndex const&) const override;
virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; }
virtual String column_name(int column) const override;
virtual DeprecatedString column_name(int column) const override;
virtual GUI::ModelIndex index(int row, int column = 0, GUI::ModelIndex const& = GUI::ModelIndex()) const override;
virtual GUI::Variant data(GUI::ModelIndex const& index, GUI::ModelRole role = GUI::ModelRole::Display) const override;
virtual TriState data_matches(GUI::ModelIndex const& index, GUI::Variant const& term) const override;
private:
OrderedHashMap<String, String> m_local_storage_entries;
OrderedHashMap<DeprecatedString, DeprecatedString> m_local_storage_entries;
};
}

View file

@ -107,7 +107,7 @@ void StorageWidget::clear_cookies()
m_cookies_model->clear_items();
}
void StorageWidget::set_local_storage_entries(OrderedHashMap<String, String> entries)
void StorageWidget::set_local_storage_entries(OrderedHashMap<DeprecatedString, DeprecatedString> entries)
{
m_local_storage_model->set_items(entries);
}
@ -117,7 +117,7 @@ void StorageWidget::clear_local_storage_entries()
m_local_storage_model->clear_items();
}
void StorageWidget::set_session_storage_entries(OrderedHashMap<String, String> entries)
void StorageWidget::set_session_storage_entries(OrderedHashMap<DeprecatedString, DeprecatedString> entries)
{
m_session_storage_model->set_items(entries);
}

View file

@ -26,10 +26,10 @@ public:
Function<void(Web::Cookie::Cookie)> on_update_cookie;
void set_local_storage_entries(OrderedHashMap<String, String> entries);
void set_local_storage_entries(OrderedHashMap<DeprecatedString, DeprecatedString> entries);
void clear_local_storage_entries();
void set_session_storage_entries(OrderedHashMap<String, String> entries);
void set_session_storage_entries(OrderedHashMap<DeprecatedString, DeprecatedString> entries);
void clear_session_storage_entries();
private:

View file

@ -42,12 +42,12 @@
namespace Browser {
URL url_from_user_input(String const& input)
URL url_from_user_input(DeprecatedString const& input)
{
if (input.starts_with('?') && !g_search_engine.is_empty())
return URL(g_search_engine.replace("{}"sv, URL::percent_encode(input.substring_view(1)), ReplaceMode::FirstOnly));
URL url_with_http_schema = URL(String::formatted("http://{}", input));
URL url_with_http_schema = URL(DeprecatedString::formatted("http://{}", input));
if (url_with_http_schema.is_valid() && url_with_http_schema.port().has_value())
return url_with_http_schema;
@ -62,13 +62,13 @@ void Tab::start_download(const URL& url)
{
auto window = GUI::Window::construct(&this->window());
window->resize(300, 170);
window->set_title(String::formatted("0% of {}", url.basename()));
window->set_title(DeprecatedString::formatted("0% of {}", url.basename()));
window->set_resizable(false);
window->set_main_widget<DownloadWidget>(url);
window->show();
}
void Tab::view_source(const URL& url, String const& source)
void Tab::view_source(const URL& url, DeprecatedString const& source)
{
auto window = GUI::Window::construct(&this->window());
auto& editor = window->set_main_widget<GUI::TextEditor>();
@ -83,7 +83,7 @@ void Tab::view_source(const URL& url, String const& source)
window->show();
}
void Tab::update_status(Optional<String> text_override, i32 count_waiting)
void Tab::update_status(Optional<DeprecatedString> text_override, i32 count_waiting)
{
if (text_override.has_value()) {
m_statusbar->set_text(*text_override);
@ -99,10 +99,10 @@ void Tab::update_status(Optional<String> text_override, i32 count_waiting)
if (count_waiting == 0) {
// ex: "Loading google.com"
m_statusbar->set_text(String::formatted("Loading {}", m_navigating_url->host()));
m_statusbar->set_text(DeprecatedString::formatted("Loading {}", m_navigating_url->host()));
} else {
// ex: "google.com is waiting on 5 resources"
m_statusbar->set_text(String::formatted("{} is waiting on {} resource{}", m_navigating_url->host(), count_waiting, count_waiting == 1 ? ""sv : "s"sv));
m_statusbar->set_text(DeprecatedString::formatted("{} is waiting on {} resource{}", m_navigating_url->host(), count_waiting, count_waiting == 1 ? ""sv : "s"sv));
}
}
@ -386,7 +386,7 @@ Tab::Tab(BrowserWindow& window)
return {};
};
view().on_get_cookie = [this](auto& url, auto source) -> String {
view().on_get_cookie = [this](auto& url, auto source) -> DeprecatedString {
if (on_get_cookie)
return on_get_cookie(url, source);
return {};
@ -485,7 +485,7 @@ Optional<URL> Tab::url_from_location_bar(MayAppendTLD may_append_tld)
return {};
}
String text = m_location_box->text();
DeprecatedString text = m_location_box->text();
StringBuilder builder;
builder.append(text);
@ -495,7 +495,7 @@ Optional<URL> Tab::url_from_location_bar(MayAppendTLD may_append_tld)
builder.append(".com"sv);
}
}
String final_text = builder.to_string();
DeprecatedString final_text = builder.to_string();
auto url = url_from_user_input(final_text);
return url;
@ -552,7 +552,7 @@ void Tab::bookmark_current_url()
update_bookmark_button(url);
}
void Tab::update_bookmark_button(String const& url)
void Tab::update_bookmark_button(DeprecatedString const& url)
{
if (BookmarksBarWidget::the().contains_bookmark(url)) {
m_bookmark_button->set_icon(g_icon_bag.bookmark_filled);
@ -672,7 +672,7 @@ void Tab::show_console_window()
console_window->set_title("JS Console");
console_window->set_icon(g_icon_bag.filetype_javascript);
m_console_widget = console_window->set_main_widget<ConsoleWidget>();
m_console_widget->on_js_input = [this](String const& js_source) {
m_console_widget->on_js_input = [this](DeprecatedString const& js_source) {
m_web_content_view->js_console_input(js_source);
};
m_console_widget->on_request_messages = [this](i32 start_index) {

View file

@ -59,20 +59,20 @@ public:
void window_position_changed(Gfx::IntPoint const&);
void window_size_changed(Gfx::IntSize const&);
Function<void(String const&)> on_title_change;
Function<void(DeprecatedString const&)> on_title_change;
Function<void(const URL&)> on_tab_open_request;
Function<void(Tab&)> on_tab_close_request;
Function<void(Tab&)> on_tab_close_other_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, String const& name)> on_get_named_cookie;
Function<String(const URL&, Web::Cookie::Source source)> on_get_cookie;
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<void(const URL&, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source)> on_set_cookie;
Function<void()> on_dump_cookies;
Function<void(URL const&, Web::Cookie::Cookie)> on_update_cookie;
Function<Vector<Web::Cookie::Cookie>()> on_get_cookies_entries;
Function<OrderedHashMap<String, String>()> on_get_local_storage_entries;
Function<OrderedHashMap<String, String>()> on_get_session_storage_entries;
Function<OrderedHashMap<DeprecatedString, DeprecatedString>()> on_get_local_storage_entries;
Function<OrderedHashMap<DeprecatedString, DeprecatedString>()> on_get_session_storage_entries;
Function<Gfx::ShareableBitmap()> on_take_screenshot;
void enable_webdriver_mode();
@ -86,7 +86,7 @@ public:
void show_console_window();
void show_storage_inspector();
String const& title() const { return m_title; }
DeprecatedString const& title() const { return m_title; }
Gfx::Bitmap const* icon() const { return m_icon; }
WebView::OutOfProcessWebView& view() { return *m_web_content_view; }
@ -102,10 +102,10 @@ private:
void update_actions();
void bookmark_current_url();
void update_bookmark_button(String const& url);
void update_bookmark_button(DeprecatedString const& url);
void start_download(const URL& url);
void view_source(const URL& url, String const& source);
void update_status(Optional<String> text_override = {}, i32 count_waiting = 0);
void view_source(const URL& url, DeprecatedString const& source);
void update_status(Optional<DeprecatedString> text_override = {}, i32 count_waiting = 0);
enum class MayAppendTLD {
No,
@ -138,7 +138,7 @@ private:
RefPtr<GUI::Menu> m_page_context_menu;
RefPtr<GUI::Menu> m_go_back_context_menu;
RefPtr<GUI::Menu> m_go_forward_context_menu;
String m_title;
DeprecatedString m_title;
RefPtr<const Gfx::Bitmap> m_icon;
Optional<URL> m_navigating_url;
@ -147,6 +147,6 @@ private:
bool m_is_history_navigation { false };
};
URL url_from_user_input(String const& input);
URL url_from_user_input(DeprecatedString const& input);
}

View file

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

View file

@ -31,21 +31,21 @@
namespace Browser {
String g_search_engine;
String g_home_url;
String g_new_tab_url;
Vector<String> g_content_filters;
DeprecatedString g_search_engine;
DeprecatedString g_home_url;
DeprecatedString g_new_tab_url;
Vector<DeprecatedString> g_content_filters;
bool g_content_filters_enabled { true };
Vector<String> g_proxies;
HashMap<String, size_t> g_proxy_mappings;
Vector<DeprecatedString> g_proxies;
HashMap<DeprecatedString, size_t> g_proxy_mappings;
IconBag g_icon_bag;
String g_webdriver_content_ipc_path;
DeprecatedString g_webdriver_content_ipc_path;
}
static ErrorOr<void> load_content_filters()
{
auto file = TRY(Core::Stream::File::open(String::formatted("{}/BrowserContentFilters.txt", Core::StandardPaths::config_directory()), Core::Stream::OpenMode::Read));
auto file = TRY(Core::Stream::File::open(DeprecatedString::formatted("{}/BrowserContentFilters.txt", Core::StandardPaths::config_directory()), Core::Stream::OpenMode::Read));
auto ad_filter_list = TRY(Core::Stream::BufferedFile::create(move(file)));
auto buffer = TRY(ByteBuffer::create_uninitialized(4096));
while (TRY(ad_filter_list->can_read_line())) {
@ -66,7 +66,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::pledge("stdio recvfd sendfd unix fattr cpath rpath wpath proc exec"));
Vector<String> specified_urls;
Vector<DeprecatedString> specified_urls;
Core::ArgsParser args_parser;
args_parser.add_positional_argument(specified_urls, "URLs to open", "url", Core::ArgsParser::Required::No);
@ -129,7 +129,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}
}
auto url_from_argument_string = [](String const& string) -> URL {
auto url_from_argument_string = [](DeprecatedString const& string) -> URL {
if (Core::File::exists(string)) {
return URL::create_with_file_scheme(Core::File::real_path_for(string));
}
@ -153,7 +153,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}
window->content_filters_changed();
};
TRY(content_filters_watcher->add_watch(String::formatted("{}/BrowserContentFilters.txt", Core::StandardPaths::config_directory()), Core::FileWatcherEvent::Type::ContentModified));
TRY(content_filters_watcher->add_watch(DeprecatedString::formatted("{}/BrowserContentFilters.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())) {