diff options
author | Linus Groh <mail@linusgroh.de> | 2022-12-04 18:02:33 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-12-06 08:54:33 +0100 |
commit | 6e19ab2bbce0b113b628e6f8e9b5c0640053933e (patch) | |
tree | 372d21b2f5dcff112f5d0089559c6af5798680d4 /Userland/Services | |
parent | f74251606d74b504a1379ebb893fdb5529054ea5 (diff) | |
download | serenity-6e19ab2bbce0b113b628e6f8e9b5c0640053933e.zip |
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 :^)
Diffstat (limited to 'Userland/Services')
152 files changed, 823 insertions, 823 deletions
diff --git a/Userland/Services/ChessEngine/MCTSTree.cpp b/Userland/Services/ChessEngine/MCTSTree.cpp index bcd00747bc..bd3dfc985f 100644 --- a/Userland/Services/ChessEngine/MCTSTree.cpp +++ b/Userland/Services/ChessEngine/MCTSTree.cpp @@ -5,7 +5,7 @@ */ #include "MCTSTree.h" -#include <AK/String.h> +#include <AK/DeprecatedString.h> #include <stdlib.h> MCTSTree::MCTSTree(Chess::Board const& board, MCTSTree* parent) diff --git a/Userland/Services/Clipboard/ClipboardClient.ipc b/Userland/Services/Clipboard/ClipboardClient.ipc index d0548d7460..c21c666c59 100644 --- a/Userland/Services/Clipboard/ClipboardClient.ipc +++ b/Userland/Services/Clipboard/ClipboardClient.ipc @@ -2,5 +2,5 @@ endpoint ClipboardClient { - clipboard_data_changed([UTF8] String mime_type) =| + clipboard_data_changed([UTF8] DeprecatedString mime_type) =| } diff --git a/Userland/Services/Clipboard/ClipboardServer.ipc b/Userland/Services/Clipboard/ClipboardServer.ipc index 731a1b2de2..8145a9f7a6 100644 --- a/Userland/Services/Clipboard/ClipboardServer.ipc +++ b/Userland/Services/Clipboard/ClipboardServer.ipc @@ -2,6 +2,6 @@ endpoint ClipboardServer { - get_clipboard_data() => (Core::AnonymousBuffer data, [UTF8] String mime_type, IPC::Dictionary metadata) - set_clipboard_data(Core::AnonymousBuffer data, [UTF8] String mime_type, IPC::Dictionary metadata) =| + get_clipboard_data() => (Core::AnonymousBuffer data, [UTF8] DeprecatedString mime_type, IPC::Dictionary metadata) + set_clipboard_data(Core::AnonymousBuffer data, [UTF8] DeprecatedString mime_type, IPC::Dictionary metadata) =| } diff --git a/Userland/Services/Clipboard/ConnectionFromClient.cpp b/Userland/Services/Clipboard/ConnectionFromClient.cpp index f152b609b0..2924515d45 100644 --- a/Userland/Services/Clipboard/ConnectionFromClient.cpp +++ b/Userland/Services/Clipboard/ConnectionFromClient.cpp @@ -30,7 +30,7 @@ void ConnectionFromClient::die() s_connections.remove(client_id()); } -void ConnectionFromClient::set_clipboard_data(Core::AnonymousBuffer const& data, String const& mime_type, IPC::Dictionary const& metadata) +void ConnectionFromClient::set_clipboard_data(Core::AnonymousBuffer const& data, DeprecatedString const& mime_type, IPC::Dictionary const& metadata) { Storage::the().set_data(data, mime_type, metadata.entries()); } diff --git a/Userland/Services/Clipboard/ConnectionFromClient.h b/Userland/Services/Clipboard/ConnectionFromClient.h index 7761d83838..11e748f31a 100644 --- a/Userland/Services/Clipboard/ConnectionFromClient.h +++ b/Userland/Services/Clipboard/ConnectionFromClient.h @@ -30,7 +30,7 @@ private: explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); virtual Messages::ClipboardServer::GetClipboardDataResponse get_clipboard_data() override; - virtual void set_clipboard_data(Core::AnonymousBuffer const&, String const&, IPC::Dictionary const&) override; + virtual void set_clipboard_data(Core::AnonymousBuffer const&, DeprecatedString const&, IPC::Dictionary const&) override; }; } diff --git a/Userland/Services/Clipboard/Storage.cpp b/Userland/Services/Clipboard/Storage.cpp index 29c027fa82..1b89344197 100644 --- a/Userland/Services/Clipboard/Storage.cpp +++ b/Userland/Services/Clipboard/Storage.cpp @@ -14,7 +14,7 @@ Storage& Storage::the() return s_the; } -void Storage::set_data(Core::AnonymousBuffer data, String const& mime_type, HashMap<String, String> const& metadata) +void Storage::set_data(Core::AnonymousBuffer data, DeprecatedString const& mime_type, HashMap<DeprecatedString, DeprecatedString> const& metadata) { m_buffer = move(data); m_data_size = data.size(); diff --git a/Userland/Services/Clipboard/Storage.h b/Userland/Services/Clipboard/Storage.h index ecd4f510c4..eb1dbeeb98 100644 --- a/Userland/Services/Clipboard/Storage.h +++ b/Userland/Services/Clipboard/Storage.h @@ -6,9 +6,9 @@ #pragma once +#include <AK/DeprecatedString.h> #include <AK/Function.h> #include <AK/HashMap.h> -#include <AK/String.h> #include <LibCore/AnonymousBuffer.h> namespace Clipboard { @@ -20,8 +20,8 @@ public: bool has_data() const { return m_buffer.is_valid(); } - String const& mime_type() const { return m_mime_type; } - HashMap<String, String> const& metadata() const { return m_metadata; } + DeprecatedString const& mime_type() const { return m_mime_type; } + HashMap<DeprecatedString, DeprecatedString> const& metadata() const { return m_metadata; } u8 const* data() const { @@ -37,7 +37,7 @@ public: return 0; } - void set_data(Core::AnonymousBuffer, String const& mime_type, HashMap<String, String> const& metadata); + void set_data(Core::AnonymousBuffer, DeprecatedString const& mime_type, HashMap<DeprecatedString, DeprecatedString> const& metadata); Function<void()> on_content_change; @@ -46,10 +46,10 @@ public: private: Storage() = default; - String m_mime_type; + DeprecatedString m_mime_type; Core::AnonymousBuffer m_buffer; size_t m_data_size { 0 }; - HashMap<String, String> m_metadata; + HashMap<DeprecatedString, DeprecatedString> m_metadata; }; } diff --git a/Userland/Services/ConfigServer/ConfigClient.ipc b/Userland/Services/ConfigServer/ConfigClient.ipc index 0700c1ec5a..db5a2a411a 100644 --- a/Userland/Services/ConfigServer/ConfigClient.ipc +++ b/Userland/Services/ConfigServer/ConfigClient.ipc @@ -1,9 +1,9 @@ endpoint ConfigClient { - notify_changed_string_value(String domain, String group, String key, String value) =| - notify_changed_i32_value(String domain, String group, String key, i32 value) =| - notify_changed_bool_value(String domain, String group, String key, bool value) =| - notify_removed_key(String domain, String group, String key) =| - notify_removed_group(String domain, String group) =| - notify_added_group(String domain, String group) =| + notify_changed_string_value(DeprecatedString domain, DeprecatedString group, DeprecatedString key, DeprecatedString value) =| + notify_changed_i32_value(DeprecatedString domain, DeprecatedString group, DeprecatedString key, i32 value) =| + notify_changed_bool_value(DeprecatedString domain, DeprecatedString group, DeprecatedString key, bool value) =| + notify_removed_key(DeprecatedString domain, DeprecatedString group, DeprecatedString key) =| + notify_removed_group(DeprecatedString domain, DeprecatedString group) =| + notify_added_group(DeprecatedString domain, DeprecatedString group) =| } diff --git a/Userland/Services/ConfigServer/ConfigServer.ipc b/Userland/Services/ConfigServer/ConfigServer.ipc index e68dd2b2eb..4a7bd1a428 100644 --- a/Userland/Services/ConfigServer/ConfigServer.ipc +++ b/Userland/Services/ConfigServer/ConfigServer.ipc @@ -1,20 +1,20 @@ endpoint ConfigServer { - pledge_domains(Vector<String> domains) =| + pledge_domains(Vector<DeprecatedString> domains) =| - monitor_domain(String domain) =| + monitor_domain(DeprecatedString domain) =| - list_config_groups(String domain) => (Vector<String> groups) - list_config_keys(String domain, String group) => (Vector<String> keys) + list_config_groups(DeprecatedString domain) => (Vector<DeprecatedString> groups) + list_config_keys(DeprecatedString domain, DeprecatedString group) => (Vector<DeprecatedString> keys) - read_string_value(String domain, String group, String key) => (Optional<String> value) - read_i32_value(String domain, String group, String key) => (Optional<i32> value) - read_bool_value(String domain, String group, String key) => (Optional<bool> value) + read_string_value(DeprecatedString domain, DeprecatedString group, DeprecatedString key) => (Optional<DeprecatedString> value) + read_i32_value(DeprecatedString domain, DeprecatedString group, DeprecatedString key) => (Optional<i32> value) + read_bool_value(DeprecatedString domain, DeprecatedString group, DeprecatedString key) => (Optional<bool> value) - write_string_value(String domain, String group, String key, String value) => () - write_i32_value(String domain, String group, String key, i32 value) => () - write_bool_value(String domain, String group, String key, bool value) => () - remove_key_entry(String domain, String group, String key) => () - remove_group_entry(String domain, String group) => () - add_group_entry(String domain, String group) => () + write_string_value(DeprecatedString domain, DeprecatedString group, DeprecatedString key, DeprecatedString value) => () + write_i32_value(DeprecatedString domain, DeprecatedString group, DeprecatedString key, i32 value) => () + write_bool_value(DeprecatedString domain, DeprecatedString group, DeprecatedString key, bool value) => () + remove_key_entry(DeprecatedString domain, DeprecatedString group, DeprecatedString key) => () + remove_group_entry(DeprecatedString domain, DeprecatedString group) => () + add_group_entry(DeprecatedString domain, DeprecatedString group) => () } diff --git a/Userland/Services/ConfigServer/ConnectionFromClient.cpp b/Userland/Services/ConfigServer/ConnectionFromClient.cpp index 264cd7ead1..ccc7ba188c 100644 --- a/Userland/Services/ConfigServer/ConnectionFromClient.cpp +++ b/Userland/Services/ConfigServer/ConnectionFromClient.cpp @@ -15,15 +15,15 @@ namespace ConfigServer { static HashMap<int, RefPtr<ConnectionFromClient>> s_connections; struct CachedDomain { - String domain; + DeprecatedString domain; NonnullRefPtr<Core::ConfigFile> config; RefPtr<Core::FileWatcher> watcher; }; -static HashMap<String, NonnullOwnPtr<CachedDomain>> s_cache; +static HashMap<DeprecatedString, NonnullOwnPtr<CachedDomain>> s_cache; static constexpr int s_disk_sync_delay_ms = 5'000; -static void for_each_monitoring_connection(String const& domain, ConnectionFromClient* excluded_connection, Function<void(ConnectionFromClient&)> callback) +static void for_each_monitoring_connection(DeprecatedString const& domain, ConnectionFromClient* excluded_connection, Function<void(ConnectionFromClient&)> callback) { for (auto& it : s_connections) { if (it.value->is_monitoring_domain(domain) && (!excluded_connection || it.value != excluded_connection)) @@ -31,7 +31,7 @@ static void for_each_monitoring_connection(String const& domain, ConnectionFromC } } -static Core::ConfigFile& ensure_domain_config(String const& domain) +static Core::ConfigFile& ensure_domain_config(DeprecatedString const& domain) { auto it = s_cache.find(domain); if (it != s_cache.end()) @@ -88,7 +88,7 @@ void ConnectionFromClient::die() sync_dirty_domains_to_disk(); } -void ConnectionFromClient::pledge_domains(Vector<String> const& domains) +void ConnectionFromClient::pledge_domains(Vector<DeprecatedString> const& domains) { if (m_has_pledged) { did_misbehave("Tried to pledge domains twice."); @@ -99,7 +99,7 @@ void ConnectionFromClient::pledge_domains(Vector<String> const& domains) m_pledged_domains.set(domain); } -void ConnectionFromClient::monitor_domain(String const& domain) +void ConnectionFromClient::monitor_domain(DeprecatedString const& domain) { if (m_has_pledged && !m_pledged_domains.contains(domain)) { did_misbehave("Attempt to monitor non-pledged domain"); @@ -109,13 +109,13 @@ void ConnectionFromClient::monitor_domain(String const& domain) m_monitored_domains.set(domain); } -bool ConnectionFromClient::validate_access(String const& domain, String const& group, String const& key) +bool ConnectionFromClient::validate_access(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key) { if (!m_has_pledged) return true; if (m_pledged_domains.contains(domain)) return true; - did_misbehave(String::formatted("Blocked attempt to access domain '{}', group={}, key={}", domain, group, key).characters()); + did_misbehave(DeprecatedString::formatted("Blocked attempt to access domain '{}', group={}, key={}", domain, group, key).characters()); return false; } @@ -135,34 +135,34 @@ void ConnectionFromClient::sync_dirty_domains_to_disk() } } -Messages::ConfigServer::ListConfigKeysResponse ConnectionFromClient::list_config_keys(String const& domain, String const& group) +Messages::ConfigServer::ListConfigKeysResponse ConnectionFromClient::list_config_keys(DeprecatedString const& domain, DeprecatedString const& group) { if (!validate_access(domain, group, "")) - return Vector<String> {}; + return Vector<DeprecatedString> {}; auto& config = ensure_domain_config(domain); return { config.keys(group) }; } -Messages::ConfigServer::ListConfigGroupsResponse ConnectionFromClient::list_config_groups(String const& domain) +Messages::ConfigServer::ListConfigGroupsResponse ConnectionFromClient::list_config_groups(DeprecatedString const& domain) { if (!validate_access(domain, "", "")) - return Vector<String> {}; + return Vector<DeprecatedString> {}; auto& config = ensure_domain_config(domain); return { config.groups() }; } -Messages::ConfigServer::ReadStringValueResponse ConnectionFromClient::read_string_value(String const& domain, String const& group, String const& key) +Messages::ConfigServer::ReadStringValueResponse ConnectionFromClient::read_string_value(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key) { if (!validate_access(domain, group, key)) return nullptr; auto& config = ensure_domain_config(domain); if (!config.has_key(group, key)) - return Optional<String> {}; - return Optional<String> { config.read_entry(group, key) }; + return Optional<DeprecatedString> {}; + return Optional<DeprecatedString> { config.read_entry(group, key) }; } -Messages::ConfigServer::ReadI32ValueResponse ConnectionFromClient::read_i32_value(String const& domain, String const& group, String const& key) +Messages::ConfigServer::ReadI32ValueResponse ConnectionFromClient::read_i32_value(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key) { if (!validate_access(domain, group, key)) return nullptr; @@ -173,7 +173,7 @@ Messages::ConfigServer::ReadI32ValueResponse ConnectionFromClient::read_i32_valu return Optional<i32> { config.read_num_entry(group, key) }; } -Messages::ConfigServer::ReadBoolValueResponse ConnectionFromClient::read_bool_value(String const& domain, String const& group, String const& key) +Messages::ConfigServer::ReadBoolValueResponse ConnectionFromClient::read_bool_value(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key) { if (!validate_access(domain, group, key)) return nullptr; @@ -192,7 +192,7 @@ void ConnectionFromClient::start_or_restart_sync_timer() m_sync_timer->start(); } -void ConnectionFromClient::write_string_value(String const& domain, String const& group, String const& key, String const& value) +void ConnectionFromClient::write_string_value(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value) { if (!validate_access(domain, group, key)) return; @@ -211,7 +211,7 @@ void ConnectionFromClient::write_string_value(String const& domain, String const }); } -void ConnectionFromClient::write_i32_value(String const& domain, String const& group, String const& key, i32 value) +void ConnectionFromClient::write_i32_value(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, i32 value) { if (!validate_access(domain, group, key)) return; @@ -230,7 +230,7 @@ void ConnectionFromClient::write_i32_value(String const& domain, String const& g }); } -void ConnectionFromClient::write_bool_value(String const& domain, String const& group, String const& key, bool value) +void ConnectionFromClient::write_bool_value(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, bool value) { if (!validate_access(domain, group, key)) return; @@ -249,7 +249,7 @@ void ConnectionFromClient::write_bool_value(String const& domain, String const& }); } -void ConnectionFromClient::remove_key_entry(String const& domain, String const& group, String const& key) +void ConnectionFromClient::remove_key_entry(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key) { if (!validate_access(domain, group, key)) return; @@ -267,7 +267,7 @@ void ConnectionFromClient::remove_key_entry(String const& domain, String const& }); } -void ConnectionFromClient::remove_group_entry(String const& domain, String const& group) +void ConnectionFromClient::remove_group_entry(DeprecatedString const& domain, DeprecatedString const& group) { if (!validate_access(domain, group, {})) return; @@ -285,7 +285,7 @@ void ConnectionFromClient::remove_group_entry(String const& domain, String const }); } -void ConnectionFromClient::add_group_entry(String const& domain, String const& group) +void ConnectionFromClient::add_group_entry(DeprecatedString const& domain, DeprecatedString const& group) { if (!validate_access(domain, group, {})) return; diff --git a/Userland/Services/ConfigServer/ConnectionFromClient.h b/Userland/Services/ConfigServer/ConnectionFromClient.h index a5ca6a5762..c500ce3ccd 100644 --- a/Userland/Services/ConfigServer/ConnectionFromClient.h +++ b/Userland/Services/ConfigServer/ConnectionFromClient.h @@ -20,36 +20,36 @@ public: virtual void die() override; - bool is_monitoring_domain(String const& domain) const { return m_monitored_domains.contains(domain); } + bool is_monitoring_domain(DeprecatedString const& domain) const { return m_monitored_domains.contains(domain); } private: explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); - virtual void pledge_domains(Vector<String> const&) override; - virtual void monitor_domain(String const&) override; - virtual Messages::ConfigServer::ListConfigGroupsResponse list_config_groups([[maybe_unused]] String const& domain) override; - virtual Messages::ConfigServer::ListConfigKeysResponse list_config_keys([[maybe_unused]] String const& domain, [[maybe_unused]] String const& group) override; - virtual Messages::ConfigServer::ReadStringValueResponse read_string_value([[maybe_unused]] String const& domain, [[maybe_unused]] String const& group, [[maybe_unused]] String const& key) override; - virtual Messages::ConfigServer::ReadI32ValueResponse read_i32_value([[maybe_unused]] String const& domain, [[maybe_unused]] String const& group, [[maybe_unused]] String const& key) override; - virtual Messages::ConfigServer::ReadBoolValueResponse read_bool_value([[maybe_unused]] String const& domain, [[maybe_unused]] String const& group, [[maybe_unused]] String const& key) override; - virtual void write_string_value([[maybe_unused]] String const& domain, [[maybe_unused]] String const& group, [[maybe_unused]] String const& key, [[maybe_unused]] String const& value) override; - virtual void write_i32_value([[maybe_unused]] String const& domain, [[maybe_unused]] String const& group, [[maybe_unused]] String const& key, [[maybe_unused]] i32 value) override; - virtual void write_bool_value([[maybe_unused]] String const& domain, [[maybe_unused]] String const& group, [[maybe_unused]] String const& key, [[maybe_unused]] bool value) override; - virtual void remove_key_entry([[maybe_unused]] String const& domain, [[maybe_unused]] String const& group, [[maybe_unused]] String const& key) override; - virtual void remove_group_entry([[maybe_unused]] String const& domain, [[maybe_unused]] String const& group) override; - virtual void add_group_entry([[maybe_unused]] String const& domain, [[maybe_unused]] String const& group) override; - - bool validate_access(String const& domain, String const& group, String const& key); + virtual void pledge_domains(Vector<DeprecatedString> const&) override; + virtual void monitor_domain(DeprecatedString const&) override; + virtual Messages::ConfigServer::ListConfigGroupsResponse list_config_groups([[maybe_unused]] DeprecatedString const& domain) override; + virtual Messages::ConfigServer::ListConfigKeysResponse list_config_keys([[maybe_unused]] DeprecatedString const& domain, [[maybe_unused]] DeprecatedString const& group) override; + virtual Messages::ConfigServer::ReadStringValueResponse read_string_value([[maybe_unused]] DeprecatedString const& domain, [[maybe_unused]] DeprecatedString const& group, [[maybe_unused]] DeprecatedString const& key) override; + virtual Messages::ConfigServer::ReadI32ValueResponse read_i32_value([[maybe_unused]] DeprecatedString const& domain, [[maybe_unused]] DeprecatedString const& group, [[maybe_unused]] DeprecatedString const& key) override; + virtual Messages::ConfigServer::ReadBoolValueResponse read_bool_value([[maybe_unused]] DeprecatedString const& domain, [[maybe_unused]] DeprecatedString const& group, [[maybe_unused]] DeprecatedString const& key) override; + virtual void write_string_value([[maybe_unused]] DeprecatedString const& domain, [[maybe_unused]] DeprecatedString const& group, [[maybe_unused]] DeprecatedString const& key, [[maybe_unused]] DeprecatedString const& value) override; + virtual void write_i32_value([[maybe_unused]] DeprecatedString const& domain, [[maybe_unused]] DeprecatedString const& group, [[maybe_unused]] DeprecatedString const& key, [[maybe_unused]] i32 value) override; + virtual void write_bool_value([[maybe_unused]] DeprecatedString const& domain, [[maybe_unused]] DeprecatedString const& group, [[maybe_unused]] DeprecatedString const& key, [[maybe_unused]] bool value) override; + virtual void remove_key_entry([[maybe_unused]] DeprecatedString const& domain, [[maybe_unused]] DeprecatedString const& group, [[maybe_unused]] DeprecatedString const& key) override; + virtual void remove_group_entry([[maybe_unused]] DeprecatedString const& domain, [[maybe_unused]] DeprecatedString const& group) override; + virtual void add_group_entry([[maybe_unused]] DeprecatedString const& domain, [[maybe_unused]] DeprecatedString const& group) override; + + bool validate_access(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key); void sync_dirty_domains_to_disk(); void start_or_restart_sync_timer(); bool m_has_pledged { false }; - HashTable<String> m_pledged_domains; + HashTable<DeprecatedString> m_pledged_domains; - HashTable<String> m_monitored_domains; + HashTable<DeprecatedString> m_monitored_domains; NonnullRefPtr<Core::Timer> m_sync_timer; - HashTable<String> m_dirty_domains; + HashTable<DeprecatedString> m_dirty_domains; }; } diff --git a/Userland/Services/CrashDaemon/main.cpp b/Userland/Services/CrashDaemon/main.cpp index dfd2ca0cf4..96662f2ae5 100644 --- a/Userland/Services/CrashDaemon/main.cpp +++ b/Userland/Services/CrashDaemon/main.cpp @@ -17,7 +17,7 @@ #include <time.h> #include <unistd.h> -static void wait_until_coredump_is_ready(String const& coredump_path) +static void wait_until_coredump_is_ready(DeprecatedString const& coredump_path) { while (true) { struct stat statbuf; @@ -32,7 +32,7 @@ static void wait_until_coredump_is_ready(String const& coredump_path) } } -static void launch_crash_reporter(String const& coredump_path, bool unlink_on_exit) +static void launch_crash_reporter(DeprecatedString const& coredump_path, bool unlink_on_exit) { auto pid = Core::Process::spawn("/bin/CrashReporter"sv, unlink_on_exit diff --git a/Userland/Services/DHCPClient/DHCPv4.h b/Userland/Services/DHCPClient/DHCPv4.h index 8cf3ce2e9f..50403abd9d 100644 --- a/Userland/Services/DHCPClient/DHCPv4.h +++ b/Userland/Services/DHCPClient/DHCPv4.h @@ -151,7 +151,7 @@ struct ParsedDHCPv4Options { return values; } - String to_string() const + DeprecatedString to_string() const { StringBuilder builder; builder.append("DHCP Options ("sv); diff --git a/Userland/Services/DHCPClient/DHCPv4Client.cpp b/Userland/Services/DHCPClient/DHCPv4Client.cpp index 91af46a8be..9631b33cb5 100644 --- a/Userland/Services/DHCPClient/DHCPv4Client.cpp +++ b/Userland/Services/DHCPClient/DHCPv4Client.cpp @@ -18,14 +18,14 @@ #include <LibCore/Timer.h> #include <stdio.h> -static u8 mac_part(Vector<String> const& parts, size_t index) +static u8 mac_part(Vector<DeprecatedString> const& parts, size_t index) { auto result = AK::StringUtils::convert_to_uint_from_hex(parts.at(index)); VERIFY(result.has_value()); return result.value(); } -static MACAddress mac_from_string(String const& str) +static MACAddress mac_from_string(DeprecatedString const& str) { auto chunks = str.split(':'); VERIFY(chunks.size() == 6); // should we...worry about this? @@ -117,7 +117,7 @@ static void set_params(InterfaceDescriptor const& iface, IPv4Address const& ipv4 } } -DHCPv4Client::DHCPv4Client(Vector<String> interfaces_with_dhcp_enabled) +DHCPv4Client::DHCPv4Client(Vector<DeprecatedString> interfaces_with_dhcp_enabled) : m_interfaces_with_dhcp_enabled(move(interfaces_with_dhcp_enabled)) { m_server = Core::UDPServer::construct(this); diff --git a/Userland/Services/DHCPClient/DHCPv4Client.h b/Userland/Services/DHCPClient/DHCPv4Client.h index 7cf6fb1392..ec318b18de 100644 --- a/Userland/Services/DHCPClient/DHCPv4Client.h +++ b/Userland/Services/DHCPClient/DHCPv4Client.h @@ -7,10 +7,10 @@ #pragma once #include "DHCPv4.h" +#include <AK/DeprecatedString.h> #include <AK/Error.h> #include <AK/HashMap.h> #include <AK/OwnPtr.h> -#include <AK/String.h> #include <AK/Vector.h> #include <LibCore/UDPServer.h> #include <net/if.h> @@ -19,7 +19,7 @@ #include <sys/socket.h> struct InterfaceDescriptor { - String ifname; + DeprecatedString ifname; MACAddress mac_address; IPv4Address current_ip_address; }; @@ -54,11 +54,11 @@ public: static ErrorOr<Interfaces> get_discoverable_interfaces(); private: - explicit DHCPv4Client(Vector<String> interfaces_with_dhcp_enabled); + explicit DHCPv4Client(Vector<DeprecatedString> interfaces_with_dhcp_enabled); void try_discover_ifs(); - Vector<String> m_interfaces_with_dhcp_enabled; + Vector<DeprecatedString> m_interfaces_with_dhcp_enabled; HashMap<u32, OwnPtr<DHCPv4Transaction>> m_ongoing_transactions; RefPtr<Core::UDPServer> m_server; RefPtr<Core::Timer> m_check_timer; diff --git a/Userland/Services/DHCPClient/main.cpp b/Userland/Services/DHCPClient/main.cpp index a4dc24865e..cfcb2118d4 100644 --- a/Userland/Services/DHCPClient/main.cpp +++ b/Userland/Services/DHCPClient/main.cpp @@ -12,7 +12,7 @@ ErrorOr<int> serenity_main(Main::Arguments args) { - Vector<String> interfaces; + Vector<DeprecatedString> interfaces; Core::ArgsParser parser; parser.add_positional_argument(interfaces, "Interfaces to run DHCP server on", "interfaces"); diff --git a/Userland/Services/FileOperation/main.cpp b/Userland/Services/FileOperation/main.cpp index 00dc0aa607..522505bbb0 100644 --- a/Userland/Services/FileOperation/main.cpp +++ b/Userland/Services/FileOperation/main.cpp @@ -5,9 +5,9 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include <AK/DeprecatedString.h> #include <AK/Format.h> #include <AK/LexicalPath.h> -#include <AK/String.h> #include <AK/StringView.h> #include <LibCore/ArgsParser.h> #include <LibCore/DirIterator.h> @@ -27,23 +27,23 @@ struct WorkItem { DeleteFile, }; Type type; - String source; - String destination; + DeprecatedString source; + DeprecatedString destination; off_t size; }; static void report_warning(StringView message); static void report_error(StringView message); -static ErrorOr<int> perform_copy(Vector<StringView> const& sources, String const& destination); -static ErrorOr<int> perform_move(Vector<StringView> const& sources, String const& destination); +static ErrorOr<int> perform_copy(Vector<StringView> const& sources, DeprecatedString const& destination); +static ErrorOr<int> perform_move(Vector<StringView> const& sources, DeprecatedString const& destination); static ErrorOr<int> perform_delete(Vector<StringView> const& sources); static ErrorOr<int> execute_work_items(Vector<WorkItem> const& items); -static ErrorOr<NonnullOwnPtr<Core::Stream::File>> open_destination_file(String const& destination); -static String deduplicate_destination_file_name(String const& destination); +static ErrorOr<NonnullOwnPtr<Core::Stream::File>> open_destination_file(DeprecatedString const& destination); +static DeprecatedString deduplicate_destination_file_name(DeprecatedString const& destination); ErrorOr<int> serenity_main(Main::Arguments arguments) { - String operation; + DeprecatedString operation; Vector<StringView> paths; Core::ArgsParser args_parser; @@ -54,7 +54,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) if (operation == "Delete") return perform_delete(paths); - String destination = paths.take_last(); + DeprecatedString destination = paths.take_last(); if (paths.is_empty()) return Error::from_string_literal("At least one source and destination are required"); @@ -64,7 +64,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) return perform_move(paths, destination); // FIXME: Return the formatted string directly. There is no way to do this right now without the temporary going out of scope and being destroyed. - report_error(String::formatted("Unknown operation '{}'", operation)); + report_error(DeprecatedString::formatted("Unknown operation '{}'", operation)); return Error::from_string_literal("Unknown operation"); } @@ -78,7 +78,7 @@ static void report_error(StringView message) outln("ERROR {}", message); } -static ErrorOr<int> collect_copy_work_items(String const& source, String const& destination, Vector<WorkItem>& items) +static ErrorOr<int> collect_copy_work_items(DeprecatedString const& source, DeprecatedString const& destination, Vector<WorkItem>& items) { if (auto const st = TRY(Core::System::lstat(source)); !S_ISDIR(st.st_mode)) { // It's a file. @@ -111,7 +111,7 @@ static ErrorOr<int> collect_copy_work_items(String const& source, String const& return 0; } -ErrorOr<int> perform_copy(Vector<StringView> const& sources, String const& destination) +ErrorOr<int> perform_copy(Vector<StringView> const& sources, DeprecatedString const& destination) { Vector<WorkItem> items; @@ -122,7 +122,7 @@ ErrorOr<int> perform_copy(Vector<StringView> const& sources, String const& desti return execute_work_items(items); } -static ErrorOr<int> collect_move_work_items(String const& source, String const& destination, Vector<WorkItem>& items) +static ErrorOr<int> collect_move_work_items(DeprecatedString const& source, DeprecatedString const& destination, Vector<WorkItem>& items) { if (auto const st = TRY(Core::System::lstat(source)); !S_ISDIR(st.st_mode)) { // It's a file. @@ -162,7 +162,7 @@ static ErrorOr<int> collect_move_work_items(String const& source, String const& return 0; } -ErrorOr<int> perform_move(Vector<StringView> const& sources, String const& destination) +ErrorOr<int> perform_move(Vector<StringView> const& sources, DeprecatedString const& destination) { Vector<WorkItem> items; @@ -173,7 +173,7 @@ ErrorOr<int> perform_move(Vector<StringView> const& sources, String const& desti return execute_work_items(items); } -static ErrorOr<int> collect_delete_work_items(String const& source, Vector<WorkItem>& items) +static ErrorOr<int> collect_delete_work_items(DeprecatedString const& source, Vector<WorkItem>& items) { if (auto const st = TRY(Core::System::lstat(source)); !S_ISDIR(st.st_mode)) { // It's a file. @@ -229,7 +229,7 @@ ErrorOr<int> execute_work_items(Vector<WorkItem> const& items) outln("PROGRESS {} {} {} {} {} {} {}", i, items.size(), executed_work_bytes, total_work_bytes, item_done, item.size, item.source); }; - auto copy_file = [&](String const& source, String const& destination) -> ErrorOr<int> { + auto copy_file = [&](DeprecatedString const& source, DeprecatedString const& destination) -> ErrorOr<int> { auto source_file = TRY(Core::Stream::File::open(source, Core::Stream::OpenMode::Read)); // FIXME: When the file already exists, let the user choose the next action instead of renaming it by default. auto destination_file = TRY(open_destination_file(destination)); @@ -242,7 +242,7 @@ ErrorOr<int> execute_work_items(Vector<WorkItem> const& items) break; if (auto result = destination_file->write(bytes_read); result.is_error()) { // FIXME: Return the formatted string directly. There is no way to do this right now without the temporary going out of scope and being destroyed. - report_warning(String::formatted("Failed to write to destination file: {}", result.error())); + report_warning(DeprecatedString::formatted("Failed to write to destination file: {}", result.error())); return result.error(); } item_done += bytes_read.size(); @@ -278,7 +278,7 @@ ErrorOr<int> execute_work_items(Vector<WorkItem> const& items) } case WorkItem::Type::MoveFile: { - String destination = item.destination; + DeprecatedString destination = item.destination; while (true) { if (rename(item.source.characters(), destination.characters()) == 0) { item_done += item.size; @@ -295,7 +295,7 @@ ErrorOr<int> execute_work_items(Vector<WorkItem> const& items) if (original_errno != EXDEV) { // FIXME: Return the formatted string directly. There is no way to do this right now without the temporary going out of scope and being destroyed. - report_warning(String::formatted("Failed to move {}: {}", item.source, strerror(original_errno))); + report_warning(DeprecatedString::formatted("Failed to move {}: {}", item.source, strerror(original_errno))); return Error::from_errno(original_errno); } @@ -327,7 +327,7 @@ ErrorOr<int> execute_work_items(Vector<WorkItem> const& items) return 0; } -ErrorOr<NonnullOwnPtr<Core::Stream::File>> open_destination_file(String const& destination) +ErrorOr<NonnullOwnPtr<Core::Stream::File>> open_destination_file(DeprecatedString const& destination) { auto destination_file_or_error = Core::Stream::File::open(destination, (Core::Stream::OpenMode)(Core::Stream::OpenMode::Write | Core::Stream::OpenMode::Truncate | Core::Stream::OpenMode::MustBeNew)); if (destination_file_or_error.is_error() && destination_file_or_error.error().code() == EEXIST) { @@ -336,7 +336,7 @@ ErrorOr<NonnullOwnPtr<Core::Stream::File>> open_destination_file(String const& d return destination_file_or_error; } -String deduplicate_destination_file_name(String const& destination) +DeprecatedString deduplicate_destination_file_name(DeprecatedString const& destination) { LexicalPath destination_path(destination); auto title_without_counter = destination_path.title(); diff --git a/Userland/Services/FileSystemAccessServer/ConnectionFromClient.cpp b/Userland/Services/FileSystemAccessServer/ConnectionFromClient.cpp index 2669a59abf..71e8439f78 100644 --- a/Userland/Services/FileSystemAccessServer/ConnectionFromClient.cpp +++ b/Userland/Services/FileSystemAccessServer/ConnectionFromClient.cpp @@ -43,7 +43,7 @@ RefPtr<GUI::Window> ConnectionFromClient::create_dummy_child_window(i32 window_s return window; } -void ConnectionFromClient::request_file_handler(i32 request_id, i32 window_server_client_id, i32 parent_window_id, String const& path, Core::OpenMode const& requested_access, ShouldPrompt prompt) +void ConnectionFromClient::request_file_handler(i32 request_id, i32 window_server_client_id, i32 parent_window_id, DeprecatedString const& path, Core::OpenMode const& requested_access, ShouldPrompt prompt) { VERIFY(path.starts_with("/"sv)); @@ -57,7 +57,7 @@ void ConnectionFromClient::request_file_handler(i32 request_id, i32 window_serve approved = has_flag(maybe_permissions.value(), relevant_permissions); if (!approved) { - String access_string; + DeprecatedString access_string; if (has_flag(requested_access, Core::OpenMode::ReadWrite)) access_string = "read and write"; @@ -67,14 +67,14 @@ void ConnectionFromClient::request_file_handler(i32 request_id, i32 window_serve access_string = "write to"; auto pid = this->socket().peer_pid().release_value_but_fixme_should_propagate_errors(); - auto exe_link = LexicalPath("/proc").append(String::number(pid)).append("exe"sv).string(); + auto exe_link = LexicalPath("/proc").append(DeprecatedString::number(pid)).append("exe"sv).string(); auto exe_path = Core::File::real_path_for(exe_link); auto main_window = create_dummy_child_window(window_server_client_id, parent_window_id); if (prompt == ShouldPrompt::Yes) { auto exe_name = LexicalPath::basename(exe_path); - auto result = GUI::MessageBox::show(main_window, String::formatted("Allow {} ({}) to {} \"{}\"?", exe_name, pid, access_string, path), "File Permissions Requested"sv, GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::YesNo); + auto result = GUI::MessageBox::show(main_window, DeprecatedString::formatted("Allow {} ({}) to {} \"{}\"?", exe_name, pid, access_string, path), "File Permissions Requested"sv, GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::YesNo); approved = result == GUI::MessageBox::ExecResult::Yes; } else { approved = true; @@ -104,17 +104,17 @@ void ConnectionFromClient::request_file_handler(i32 request_id, i32 window_serve } } -void ConnectionFromClient::request_file_read_only_approved(i32 request_id, i32 window_server_client_id, i32 parent_window_id, String const& path) +void ConnectionFromClient::request_file_read_only_approved(i32 request_id, i32 window_server_client_id, i32 parent_window_id, DeprecatedString const& path) { request_file_handler(request_id, window_server_client_id, parent_window_id, path, Core::OpenMode::ReadOnly, ShouldPrompt::No); } -void ConnectionFromClient::request_file(i32 request_id, i32 window_server_client_id, i32 parent_window_id, String const& path, Core::OpenMode const& requested_access) +void ConnectionFromClient::request_file(i32 request_id, i32 window_server_client_id, i32 parent_window_id, DeprecatedString const& path, Core::OpenMode const& requested_access) { request_file_handler(request_id, window_server_client_id, parent_window_id, path, requested_access, ShouldPrompt::Yes); } -void ConnectionFromClient::prompt_open_file(i32 request_id, i32 window_server_client_id, i32 parent_window_id, String const& window_title, String const& path_to_view, Core::OpenMode const& requested_access) +void ConnectionFromClient::prompt_open_file(i32 request_id, i32 window_server_client_id, i32 parent_window_id, DeprecatedString const& window_title, DeprecatedString const& path_to_view, Core::OpenMode const& requested_access) { auto relevant_permissions = requested_access & (Core::OpenMode::ReadOnly | Core::OpenMode::WriteOnly); VERIFY(relevant_permissions != Core::OpenMode::NotOpen); @@ -126,7 +126,7 @@ void ConnectionFromClient::prompt_open_file(i32 request_id, i32 window_server_cl prompt_helper(request_id, user_picked_file, requested_access); } -void ConnectionFromClient::prompt_save_file(i32 request_id, i32 window_server_client_id, i32 parent_window_id, String const& name, String const& ext, String const& path_to_view, Core::OpenMode const& requested_access) +void ConnectionFromClient::prompt_save_file(i32 request_id, i32 window_server_client_id, i32 parent_window_id, DeprecatedString const& name, DeprecatedString const& ext, DeprecatedString const& path_to_view, Core::OpenMode const& requested_access) { auto relevant_permissions = requested_access & (Core::OpenMode::ReadOnly | Core::OpenMode::WriteOnly); VERIFY(relevant_permissions != Core::OpenMode::NotOpen); @@ -138,7 +138,7 @@ void ConnectionFromClient::prompt_save_file(i32 request_id, i32 window_server_cl prompt_helper(request_id, user_picked_file, requested_access); } -void ConnectionFromClient::prompt_helper(i32 request_id, Optional<String> const& user_picked_file, Core::OpenMode const& requested_access) +void ConnectionFromClient::prompt_helper(i32 request_id, Optional<DeprecatedString> const& user_picked_file, Core::OpenMode const& requested_access) { if (user_picked_file.has_value()) { VERIFY(user_picked_file->starts_with("/"sv)); @@ -159,7 +159,7 @@ void ConnectionFromClient::prompt_helper(i32 request_id, Optional<String> const& async_handle_prompt_end(request_id, 0, IPC::File(file.value()->leak_fd(), IPC::File::CloseAfterSending), user_picked_file); } } else { - async_handle_prompt_end(request_id, -1, Optional<IPC::File> {}, Optional<String> {}); + async_handle_prompt_end(request_id, -1, Optional<IPC::File> {}, Optional<DeprecatedString> {}); } } diff --git a/Userland/Services/FileSystemAccessServer/ConnectionFromClient.h b/Userland/Services/FileSystemAccessServer/ConnectionFromClient.h index 8037788e1b..47bafde95d 100644 --- a/Userland/Services/FileSystemAccessServer/ConnectionFromClient.h +++ b/Userland/Services/FileSystemAccessServer/ConnectionFromClient.h @@ -27,23 +27,23 @@ public: private: explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>); - virtual void request_file_read_only_approved(i32, i32, i32, String const&) override; - virtual void request_file(i32, i32, i32, String const&, Core::OpenMode const&) override; - virtual void prompt_open_file(i32, i32, i32, String const&, String const&, Core::OpenMode const&) override; - virtual void prompt_save_file(i32, i32, i32, String const&, String const&, String const&, Core::OpenMode const&) override; + virtual void request_file_read_only_approved(i32, i32, i32, DeprecatedString const&) override; + virtual void request_file(i32, i32, i32, DeprecatedString const&, Core::OpenMode const&) override; + virtual void prompt_open_file(i32, i32, i32, DeprecatedString const&, DeprecatedString const&, Core::OpenMode const&) override; + virtual void prompt_save_file(i32, i32, i32, DeprecatedString const&, DeprecatedString const&, DeprecatedString const&, Core::OpenMode const&) override; - void prompt_helper(i32, Optional<String> const&, Core::OpenMode const&); + void prompt_helper(i32, Optional<DeprecatedString> const&, Core::OpenMode const&); RefPtr<GUI::Window> create_dummy_child_window(i32, i32); enum class ShouldPrompt { No, Yes }; - void request_file_handler(i32, i32, i32, String const&, Core::OpenMode const&, ShouldPrompt); + void request_file_handler(i32, i32, i32, DeprecatedString const&, Core::OpenMode const&, ShouldPrompt); virtual Messages::FileSystemAccessServer::ExposeWindowServerClientIdResponse expose_window_server_client_id() override; - HashMap<String, Core::OpenMode> m_approved_files; + HashMap<DeprecatedString, Core::OpenMode> m_approved_files; }; } diff --git a/Userland/Services/FileSystemAccessServer/FileSystemAccessClient.ipc b/Userland/Services/FileSystemAccessServer/FileSystemAccessClient.ipc index 11e521c609..ef9b3c5205 100644 --- a/Userland/Services/FileSystemAccessServer/FileSystemAccessClient.ipc +++ b/Userland/Services/FileSystemAccessServer/FileSystemAccessClient.ipc @@ -1,4 +1,4 @@ endpoint FileSystemAccessClient { - handle_prompt_end(i32 request_id, i32 error, Optional<IPC::File> fd, Optional<String> chosen_file) =| + handle_prompt_end(i32 request_id, i32 error, Optional<IPC::File> fd, Optional<DeprecatedString> chosen_file) =| } diff --git a/Userland/Services/FileSystemAccessServer/FileSystemAccessServer.ipc b/Userland/Services/FileSystemAccessServer/FileSystemAccessServer.ipc index c0671249ec..6e4b7dc9fd 100644 --- a/Userland/Services/FileSystemAccessServer/FileSystemAccessServer.ipc +++ b/Userland/Services/FileSystemAccessServer/FileSystemAccessServer.ipc @@ -3,10 +3,10 @@ endpoint FileSystemAccessServer { - request_file_read_only_approved(i32 request_id, i32 window_server_client_id, i32 window_id, String path) =| - request_file(i32 request_id, i32 window_server_client_id, i32 window_id, String path, Core::OpenMode requested_access) =| - prompt_open_file(i32 request_id, i32 window_server_client_id, i32 window_id, String window_title, String path_to_view, Core::OpenMode requested_access) =| - prompt_save_file(i32 request_id, i32 window_server_client_id, i32 window_id, String title, String ext, String path_to_view, Core::OpenMode requested_access) =| + request_file_read_only_approved(i32 request_id, i32 window_server_client_id, i32 window_id, DeprecatedString path) =| + request_file(i32 request_id, i32 window_server_client_id, i32 window_id, DeprecatedString path, Core::OpenMode requested_access) =| + prompt_open_file(i32 request_id, i32 window_server_client_id, i32 window_id, DeprecatedString window_title, DeprecatedString path_to_view, Core::OpenMode requested_access) =| + prompt_save_file(i32 request_id, i32 window_server_client_id, i32 window_id, DeprecatedString title, DeprecatedString ext, DeprecatedString path_to_view, Core::OpenMode requested_access) =| expose_window_server_client_id() => (i32 client_id) } diff --git a/Userland/Services/InspectorServer/ConnectionFromClient.cpp b/Userland/Services/InspectorServer/ConnectionFromClient.cpp index c8204cc804..345fa963ab 100644 --- a/Userland/Services/InspectorServer/ConnectionFromClient.cpp +++ b/Userland/Services/InspectorServer/ConnectionFromClient.cpp @@ -27,7 +27,7 @@ Messages::InspectorServer::GetAllObjectsResponse ConnectionFromClient::get_all_o { auto process = InspectableProcess::from_pid(pid); if (!process) - return String {}; + return DeprecatedString {}; JsonObject request; request.set("type", "GetAllObjects"); @@ -49,7 +49,7 @@ Messages::InspectorServer::SetInspectedObjectResponse ConnectionFromClient::set_ return true; } -Messages::InspectorServer::SetObjectPropertyResponse ConnectionFromClient::set_object_property(pid_t pid, u64 object_id, String const& name, String const& value) +Messages::InspectorServer::SetObjectPropertyResponse ConnectionFromClient::set_object_property(pid_t pid, u64 object_id, DeprecatedString const& name, DeprecatedString const& value) { auto process = InspectableProcess::from_pid(pid); if (!process) @@ -68,7 +68,7 @@ Messages::InspectorServer::IdentifyResponse ConnectionFromClient::identify(pid_t { auto process = InspectableProcess::from_pid(pid); if (!process) - return String {}; + return DeprecatedString {}; JsonObject request; request.set("type", "Identify"); diff --git a/Userland/Services/InspectorServer/ConnectionFromClient.h b/Userland/Services/InspectorServer/ConnectionFromClient.h index f68b5dac75..4fcdb2b922 100644 --- a/Userland/Services/InspectorServer/ConnectionFromClient.h +++ b/Userland/Services/InspectorServer/ConnectionFromClient.h @@ -27,7 +27,7 @@ private: virtual Messages::InspectorServer::GetAllObjectsResponse get_all_objects(pid_t) override; virtual Messages::InspectorServer::SetInspectedObjectResponse set_inspected_object(pid_t, u64 object_id) override; - virtual Messages::InspectorServer::SetObjectPropertyResponse set_object_property(pid_t, u64 object_id, String const& name, String const& value) override; + virtual Messages::InspectorServer::SetObjectPropertyResponse set_object_property(pid_t, u64 object_id, DeprecatedString const& name, DeprecatedString const& value) override; virtual Messages::InspectorServer::IdentifyResponse identify(pid_t) override; virtual Messages::InspectorServer::IsInspectableResponse is_inspectable(pid_t) override; }; diff --git a/Userland/Services/InspectorServer/InspectableProcess.cpp b/Userland/Services/InspectorServer/InspectableProcess.cpp index a709d180fe..260b95a43b 100644 --- a/Userland/Services/InspectorServer/InspectableProcess.cpp +++ b/Userland/Services/InspectorServer/InspectableProcess.cpp @@ -34,7 +34,7 @@ InspectableProcess::InspectableProcess(pid_t pid, NonnullOwnPtr<Core::Stream::Lo }; } -String InspectableProcess::wait_for_response() +DeprecatedString InspectableProcess::wait_for_response() { if (m_socket->is_eof()) { dbgln("InspectableProcess disconnected: PID {}", m_pid); @@ -70,7 +70,7 @@ String InspectableProcess::wait_for_response() VERIFY(data_buffer.size() == length); dbgln("Got data size {} and read that many bytes", length); - return String::copy(data_buffer); + return DeprecatedString::copy(data_buffer); } void InspectableProcess::send_request(JsonObject const& request) diff --git a/Userland/Services/InspectorServer/InspectableProcess.h b/Userland/Services/InspectorServer/InspectableProcess.h index bdd61e712a..1945e32c5c 100644 --- a/Userland/Services/InspectorServer/InspectableProcess.h +++ b/Userland/Services/InspectorServer/InspectableProcess.h @@ -16,7 +16,7 @@ public: ~InspectableProcess() = default; void send_request(JsonObject const& request); - String wait_for_response(); + DeprecatedString wait_for_response(); static InspectableProcess* from_pid(pid_t); diff --git a/Userland/Services/InspectorServer/InspectorServer.ipc b/Userland/Services/InspectorServer/InspectorServer.ipc index bd3c847709..cb1e316d76 100644 --- a/Userland/Services/InspectorServer/InspectorServer.ipc +++ b/Userland/Services/InspectorServer/InspectorServer.ipc @@ -1,8 +1,8 @@ endpoint InspectorServer { - get_all_objects(i32 pid) => (String json) + get_all_objects(i32 pid) => (DeprecatedString json) set_inspected_object(i32 pid, u64 object_id) => (bool success) - set_object_property(i32 pid, u64 object_id, String name, String value) => (bool success) - identify(i32 pid) => (String json) + set_object_property(i32 pid, u64 object_id, DeprecatedString name, DeprecatedString value) => (bool success) + identify(i32 pid) => (DeprecatedString json) is_inspectable(i32 pid) => (bool inspectable) } diff --git a/Userland/Services/LaunchServer/ConnectionFromClient.cpp b/Userland/Services/LaunchServer/ConnectionFromClient.cpp index 2140193a7a..f5c8ef1a2d 100644 --- a/Userland/Services/LaunchServer/ConnectionFromClient.cpp +++ b/Userland/Services/LaunchServer/ConnectionFromClient.cpp @@ -24,7 +24,7 @@ void ConnectionFromClient::die() s_connections.remove(client_id()); } -Messages::LaunchServer::OpenUrlResponse ConnectionFromClient::open_url(URL const& url, String const& handler_name) +Messages::LaunchServer::OpenUrlResponse ConnectionFromClient::open_url(URL const& url, DeprecatedString const& handler_name) { if (!m_allowlist.is_empty()) { bool allowed = false; @@ -39,7 +39,7 @@ Messages::LaunchServer::OpenUrlResponse ConnectionFromClient::open_url(URL const } if (!allowed) { // You are not on the list, go home! - did_misbehave(String::formatted("Client requested a combination of handler/URL that was not on the list: '{}' with '{}'", handler_name, url).characters()); + did_misbehave(DeprecatedString::formatted("Client requested a combination of handler/URL that was not on the list: '{}' with '{}'", handler_name, url).characters()); return nullptr; } } @@ -69,10 +69,10 @@ void ConnectionFromClient::add_allowed_url(URL const& url) return; } - m_allowlist.empend(String(), false, Vector<URL> { url }); + m_allowlist.empend(DeprecatedString(), false, Vector<URL> { url }); } -void ConnectionFromClient::add_allowed_handler_with_any_url(String const& handler_name) +void ConnectionFromClient::add_allowed_handler_with_any_url(DeprecatedString const& handler_name) { if (m_allowlist_is_sealed) { did_misbehave("Got request to add more allowed handlers after list was sealed"); @@ -87,7 +87,7 @@ void ConnectionFromClient::add_allowed_handler_with_any_url(String const& handle m_allowlist.empend(handler_name, true, Vector<URL>()); } -void ConnectionFromClient::add_allowed_handler_with_only_specific_urls(String const& handler_name, Vector<URL> const& urls) +void ConnectionFromClient::add_allowed_handler_with_only_specific_urls(DeprecatedString const& handler_name, Vector<URL> const& urls) { if (m_allowlist_is_sealed) { did_misbehave("Got request to add more allowed handlers after list was sealed"); diff --git a/Userland/Services/LaunchServer/ConnectionFromClient.h b/Userland/Services/LaunchServer/ConnectionFromClient.h index 1deb25982a..0c1e4f65c1 100644 --- a/Userland/Services/LaunchServer/ConnectionFromClient.h +++ b/Userland/Services/LaunchServer/ConnectionFromClient.h @@ -22,16 +22,16 @@ public: private: explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); - virtual Messages::LaunchServer::OpenUrlResponse open_url(URL const&, String const&) override; + virtual Messages::LaunchServer::OpenUrlResponse open_url(URL const&, DeprecatedString const&) override; virtual Messages::LaunchServer::GetHandlersForUrlResponse get_handlers_for_url(URL const&) override; virtual Messages::LaunchServer::GetHandlersWithDetailsForUrlResponse get_handlers_with_details_for_url(URL const&) override; virtual void add_allowed_url(URL const&) override; - virtual void add_allowed_handler_with_any_url(String const&) override; - virtual void add_allowed_handler_with_only_specific_urls(String const&, Vector<URL> const&) override; + virtual void add_allowed_handler_with_any_url(DeprecatedString const&) override; + virtual void add_allowed_handler_with_only_specific_urls(DeprecatedString const&, Vector<URL> const&) override; virtual void seal_allowlist() override; struct AllowlistEntry { - String handler_name; + DeprecatedString handler_name; bool any_url { false }; Vector<URL> urls; }; diff --git a/Userland/Services/LaunchServer/LaunchServer.ipc b/Userland/Services/LaunchServer/LaunchServer.ipc index d296712be3..43a58077a9 100644 --- a/Userland/Services/LaunchServer/LaunchServer.ipc +++ b/Userland/Services/LaunchServer/LaunchServer.ipc @@ -2,12 +2,12 @@ endpoint LaunchServer { - open_url(URL url, String handler_name) => (bool response) - get_handlers_for_url(URL url) => (Vector<String> handlers) - get_handlers_with_details_for_url(URL url) => (Vector<String> handlers_details) + open_url(URL url, DeprecatedString handler_name) => (bool response) + get_handlers_for_url(URL url) => (Vector<DeprecatedString> handlers) + get_handlers_with_details_for_url(URL url) => (Vector<DeprecatedString> handlers_details) add_allowed_url(URL url) => () - add_allowed_handler_with_any_url(String handler_name) => () - add_allowed_handler_with_only_specific_urls(String handler_name, Vector<URL> urls) => () + add_allowed_handler_with_any_url(DeprecatedString handler_name) => () + add_allowed_handler_with_only_specific_urls(DeprecatedString handler_name, Vector<URL> urls) => () seal_allowlist() => () } diff --git a/Userland/Services/LaunchServer/Launcher.cpp b/Userland/Services/LaunchServer/Launcher.cpp index 8e15238bc7..3443d7dfde 100644 --- a/Userland/Services/LaunchServer/Launcher.cpp +++ b/Userland/Services/LaunchServer/Launcher.cpp @@ -25,9 +25,9 @@ namespace LaunchServer { static Launcher* s_the; -static bool spawn(String executable, Vector<String> const& arguments); +static bool spawn(DeprecatedString executable, Vector<DeprecatedString> const& arguments); -String Handler::name_from_executable(StringView executable) +DeprecatedString Handler::name_from_executable(StringView executable) { auto separator = executable.find_last('/'); if (separator.has_value()) { @@ -37,14 +37,14 @@ String Handler::name_from_executable(StringView executable) return executable; } -void Handler::from_executable(Type handler_type, String const& executable) +void Handler::from_executable(Type handler_type, DeprecatedString const& executable) { this->handler_type = handler_type; this->name = name_from_executable(executable); this->executable = executable; } -String Handler::to_details_str() const +DeprecatedString Handler::to_details_str() const { StringBuilder builder; auto obj = MUST(JsonObjectSerializer<>::try_create(builder)); @@ -79,18 +79,18 @@ Launcher& Launcher::the() return *s_the; } -void Launcher::load_handlers(String const& af_dir) +void Launcher::load_handlers(DeprecatedString const& af_dir) { Desktop::AppFile::for_each([&](auto af) { auto app_name = af->name(); auto app_executable = af->executable(); - HashTable<String> mime_types; + HashTable<DeprecatedString> mime_types; for (auto& mime_type : af->launcher_mime_types()) mime_types.set(mime_type); - HashTable<String> file_types; + HashTable<DeprecatedString> file_types; for (auto& file_type : af->launcher_file_types()) file_types.set(file_type); - HashTable<String> protocols; + HashTable<DeprecatedString> protocols; for (auto& protocol : af->launcher_protocols()) protocols.set(protocol); if (access(app_executable.characters(), X_OK) == 0) @@ -129,7 +129,7 @@ void Launcher::load_config(Core::ConfigFile const& cfg) } } -bool Launcher::has_mime_handlers(String const& mime_type) +bool Launcher::has_mime_handlers(DeprecatedString const& mime_type) { for (auto& handler : m_handlers) if (handler.value.mime_types.contains(mime_type)) @@ -137,9 +137,9 @@ bool Launcher::has_mime_handlers(String const& mime_type) return false; } -Vector<String> Launcher::handlers_for_url(const URL& url) +Vector<DeprecatedString> Launcher::handlers_for_url(const URL& url) { - Vector<String> handlers; + Vector<DeprecatedString> handlers; if (url.scheme() == "file") { for_each_handler_for_path(url.path(), [&](auto& handler) -> bool { handlers.append(handler.executable); @@ -157,9 +157,9 @@ Vector<String> Launcher::handlers_for_url(const URL& url) return handlers; } -Vector<String> Launcher::handlers_with_details_for_url(const URL& url) +Vector<DeprecatedString> Launcher::handlers_with_details_for_url(const URL& url) { - Vector<String> handlers; + Vector<DeprecatedString> handlers; if (url.scheme() == "file") { for_each_handler_for_path(url.path(), [&](auto& handler) -> bool { handlers.append(handler.to_details_str()); @@ -177,7 +177,7 @@ Vector<String> Launcher::handlers_with_details_for_url(const URL& url) return handlers; } -Optional<String> Launcher::mime_type_for_file(String path) +Optional<DeprecatedString> Launcher::mime_type_for_file(DeprecatedString path) { auto file_or_error = Core::File::open(path, Core::OpenMode::ReadOnly); if (file_or_error.is_error()) { @@ -191,7 +191,7 @@ Optional<String> Launcher::mime_type_for_file(String path) } } -bool Launcher::open_url(const URL& url, String const& handler_name) +bool Launcher::open_url(const URL& url, DeprecatedString const& handler_name) { if (!handler_name.is_null()) return open_with_handler_name(url, handler_name); @@ -202,14 +202,14 @@ bool Launcher::open_url(const URL& url, String const& handler_name) return open_with_user_preferences(m_protocol_handlers, url.scheme(), { url.to_string() }); } -bool Launcher::open_with_handler_name(const URL& url, String const& handler_name) +bool Launcher::open_with_handler_name(const URL& url, DeprecatedString const& handler_name) { auto handler_optional = m_handlers.get(handler_name); if (!handler_optional.has_value()) return false; auto& handler = handler_optional.value(); - String argument; + DeprecatedString argument; if (url.scheme() == "file") argument = url.path(); else @@ -217,12 +217,12 @@ bool Launcher::open_with_handler_name(const URL& url, String const& handler_name return spawn(handler.executable, { argument }); } -bool spawn(String executable, Vector<String> const& arguments) +bool spawn(DeprecatedString executable, Vector<DeprecatedString> const& arguments) { return !Core::Process::spawn(executable, arguments).is_error(); } -Handler Launcher::get_handler_for_executable(Handler::Type handler_type, String const& executable) const +Handler Launcher::get_handler_for_executable(Handler::Type handler_type, DeprecatedString const& executable) const { Handler handler; auto existing_handler = m_handlers.get(executable); @@ -235,13 +235,13 @@ Handler Launcher::get_handler_for_executable(Handler::Type handler_type, String return handler; } -bool Launcher::open_with_user_preferences(HashMap<String, String> const& user_preferences, String const& key, Vector<String> const& arguments, String const& default_program) +bool Launcher::open_with_user_preferences(HashMap<DeprecatedString, DeprecatedString> const& user_preferences, DeprecatedString const& key, Vector<DeprecatedString> const& arguments, DeprecatedString const& default_program) { auto program_path = user_preferences.get(key); if (program_path.has_value()) return spawn(program_path.value(), arguments); - String executable = ""; + DeprecatedString executable = ""; if (for_each_handler(key, user_preferences, [&](auto const& handler) -> bool { if (executable.is_empty() && (handler.mime_types.contains(key) || handler.file_types.contains(key) || handler.protocols.contains(key))) { executable = handler.executable; @@ -264,7 +264,7 @@ bool Launcher::open_with_user_preferences(HashMap<String, String> const& user_pr return false; } -size_t Launcher::for_each_handler(String const& key, HashMap<String, String> const& user_preference, Function<bool(Handler const&)> f) +size_t Launcher::for_each_handler(DeprecatedString const& key, HashMap<DeprecatedString, DeprecatedString> const& user_preference, Function<bool(Handler const&)> f) { auto user_preferred = user_preference.get(key); if (user_preferred.has_value()) @@ -287,7 +287,7 @@ size_t Launcher::for_each_handler(String const& key, HashMap<String, String> con return counted; } -void Launcher::for_each_handler_for_path(String const& path, Function<bool(Handler const&)> f) +void Launcher::for_each_handler_for_path(DeprecatedString const& path, Function<bool(Handler const&)> f) { struct stat st; if (lstat(path.characters(), &st) < 0) { @@ -352,13 +352,13 @@ bool Launcher::open_file_url(const URL& url) } if (S_ISDIR(st.st_mode)) { - Vector<String> fm_arguments; + Vector<DeprecatedString> fm_arguments; if (url.fragment().is_empty()) { fm_arguments.append(url.path()); } else { fm_arguments.append("-s"); fm_arguments.append("-r"); - fm_arguments.append(String::formatted("{}/{}", url.path(), url.fragment())); + fm_arguments.append(DeprecatedString::formatted("{}/{}", url.path(), url.fragment())); } auto handler_optional = m_file_handlers.get("directory"); @@ -381,13 +381,13 @@ bool Launcher::open_file_url(const URL& url) mime_type_or_extension = mime_type.value(); auto handler_optional = m_file_handlers.get("txt"); - String default_handler = ""; + DeprecatedString default_handler = ""; if (handler_optional.has_value()) default_handler = handler_optional.value(); // Additional parameters parsing, specific for the file protocol and txt file handlers - Vector<String> additional_parameters; - String filepath = url.path(); + Vector<DeprecatedString> additional_parameters; + DeprecatedString filepath = url.path(); auto parameters = url.query().split('&'); for (auto const& parameter : parameters) { @@ -396,7 +396,7 @@ bool Launcher::open_file_url(const URL& url) auto line = pair[1].to_int(); if (line.has_value()) // TextEditor uses file:line:col to open a file at a specific line number - filepath = String::formatted("{}:{}", filepath, line.value()); + filepath = DeprecatedString::formatted("{}:{}", filepath, line.value()); } } diff --git a/Userland/Services/LaunchServer/Launcher.h b/Userland/Services/LaunchServer/Launcher.h index 36fe81d4d7..ac6179cedb 100644 --- a/Userland/Services/LaunchServer/Launcher.h +++ b/Userland/Services/LaunchServer/Launcher.h @@ -22,15 +22,15 @@ struct Handler { UserDefault }; Type handler_type; - String name; - String executable; - HashTable<String> mime_types {}; - HashTable<String> file_types {}; - HashTable<String> protocols {}; - - static String name_from_executable(StringView); - void from_executable(Type, String const&); - String to_details_str() const; + DeprecatedString name; + DeprecatedString executable; + HashTable<DeprecatedString> mime_types {}; + HashTable<DeprecatedString> file_types {}; + HashTable<DeprecatedString> protocols {}; + + static DeprecatedString name_from_executable(StringView); + void from_executable(Type, DeprecatedString const&); + DeprecatedString to_details_str() const; }; class Launcher { @@ -38,25 +38,25 @@ public: Launcher(); static Launcher& the(); - void load_handlers(String const& af_dir = Desktop::AppFile::APP_FILES_DIRECTORY); + void load_handlers(DeprecatedString const& af_dir = Desktop::AppFile::APP_FILES_DIRECTORY); void load_config(Core::ConfigFile const&); - bool open_url(const URL&, String const& handler_name); - Vector<String> handlers_for_url(const URL&); - Vector<String> handlers_with_details_for_url(const URL&); + bool open_url(const URL&, DeprecatedString const& handler_name); + Vector<DeprecatedString> handlers_for_url(const URL&); + Vector<DeprecatedString> handlers_with_details_for_url(const URL&); private: - HashMap<String, Handler> m_handlers; - HashMap<String, String> m_protocol_handlers; - HashMap<String, String> m_file_handlers; - HashMap<String, String> m_mime_handlers; - - bool has_mime_handlers(String const&); - Optional<String> mime_type_for_file(String path); - Handler get_handler_for_executable(Handler::Type, String const&) const; - size_t for_each_handler(String const& key, HashMap<String, String> const& user_preferences, Function<bool(Handler const&)> f); - void for_each_handler_for_path(String const&, Function<bool(Handler const&)> f); + HashMap<DeprecatedString, Handler> m_handlers; + HashMap<DeprecatedString, DeprecatedString> m_protocol_handlers; + HashMap<DeprecatedString, DeprecatedString> m_file_handlers; + HashMap<DeprecatedString, DeprecatedString> m_mime_handlers; + + bool has_mime_handlers(DeprecatedString const&); + Optional<DeprecatedString> mime_type_for_file(DeprecatedString path); + Handler get_handler_for_executable(Handler::Type, DeprecatedString const&) const; + size_t for_each_handler(DeprecatedString const& key, HashMap<DeprecatedString, DeprecatedString> const& user_preferences, Function<bool(Handler const&)> f); + void for_each_handler_for_path(DeprecatedString const&, Function<bool(Handler const&)> f); bool open_file_url(const URL&); - bool open_with_user_preferences(HashMap<String, String> const& user_preferences, String const& key, Vector<String> const& arguments, String const& default_program = {}); - bool open_with_handler_name(const URL&, String const& handler_name); + bool open_with_user_preferences(HashMap<DeprecatedString, DeprecatedString> const& user_preferences, DeprecatedString const& key, Vector<DeprecatedString> const& arguments, DeprecatedString const& default_program = {}); + bool open_with_handler_name(const URL&, DeprecatedString const& handler_name); }; } diff --git a/Userland/Services/LoginServer/LoginWindow.h b/Userland/Services/LoginServer/LoginWindow.h index 6b9791d5d9..9c8f95decb 100644 --- a/Userland/Services/LoginServer/LoginWindow.h +++ b/Userland/Services/LoginServer/LoginWindow.h @@ -20,10 +20,10 @@ public: Function<void()> on_submit; - String username() const { return m_username->text(); } + DeprecatedString username() const { return m_username->text(); } void set_username(StringView username) { m_username->set_text(username); } - String password() const { return m_password->text(); } + DeprecatedString password() const { return m_password->text(); } void set_password(StringView password) { m_password->set_text(password); } void set_fail_message(StringView message) { m_fail_message->set_text(message); } diff --git a/Userland/Services/LookupServer/ConnectionFromClient.cpp b/Userland/Services/LookupServer/ConnectionFromClient.cpp index 1fcdce6c32..b182ffc502 100644 --- a/Userland/Services/LookupServer/ConnectionFromClient.cpp +++ b/Userland/Services/LookupServer/ConnectionFromClient.cpp @@ -26,7 +26,7 @@ void ConnectionFromClient::die() s_connections.remove(client_id()); } -Messages::LookupServer::LookupNameResponse ConnectionFromClient::lookup_name(String const& name) +Messages::LookupServer::LookupNameResponse ConnectionFromClient::lookup_name(DeprecatedString const& name) { auto maybe_answers = LookupServer::the().lookup(name, RecordType::A); if (maybe_answers.is_error()) { @@ -35,19 +35,19 @@ Messages::LookupServer::LookupNameResponse ConnectionFromClient::lookup_name(Str } auto answers = maybe_answers.release_value(); - Vector<String> addresses; + Vector<DeprecatedString> addresses; for (auto& answer : answers) { addresses.append(answer.record_data()); } return { 0, move(addresses) }; } -Messages::LookupServer::LookupAddressResponse ConnectionFromClient::lookup_address(String const& address) +Messages::LookupServer::LookupAddressResponse ConnectionFromClient::lookup_address(DeprecatedString const& address) { if (address.length() != 4) - return { 1, String() }; + return { 1, DeprecatedString() }; IPv4Address ip_address { (u8 const*)address.characters() }; - auto name = String::formatted("{}.{}.{}.{}.in-addr.arpa", + auto name = DeprecatedString::formatted("{}.{}.{}.{}.in-addr.arpa", ip_address[3], ip_address[2], ip_address[1], @@ -56,12 +56,12 @@ Messages::LookupServer::LookupAddressResponse ConnectionFromClient::lookup_addre auto maybe_answers = LookupServer::the().lookup(name, RecordType::PTR); if (maybe_answers.is_error()) { dbgln("LookupServer: Failed to lookup PTR record: {}", maybe_answers.error()); - return { 1, String() }; + return { 1, DeprecatedString() }; } auto answers = maybe_answers.release_value(); if (answers.is_empty()) - return { 1, String() }; + return { 1, DeprecatedString() }; return { 0, answers[0].record_data() }; } } diff --git a/Userland/Services/LookupServer/ConnectionFromClient.h b/Userland/Services/LookupServer/ConnectionFromClient.h index fd5bcd956f..d43431e19a 100644 --- a/Userland/Services/LookupServer/ConnectionFromClient.h +++ b/Userland/Services/LookupServer/ConnectionFromClient.h @@ -25,8 +25,8 @@ public: private: explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); - virtual Messages::LookupServer::LookupNameResponse lookup_name(String const&) override; - virtual Messages::LookupServer::LookupAddressResponse lookup_address(String const&) override; + virtual Messages::LookupServer::LookupNameResponse lookup_name(DeprecatedString const&) override; + virtual Messages::LookupServer::LookupAddressResponse lookup_address(DeprecatedString const&) override; }; } diff --git a/Userland/Services/LookupServer/LookupServer.cpp b/Userland/Services/LookupServer/LookupServer.cpp index a59d28b367..635a9ce490 100644 --- a/Userland/Services/LookupServer/LookupServer.cpp +++ b/Userland/Services/LookupServer/LookupServer.cpp @@ -7,9 +7,9 @@ #include "LookupServer.h" #include "ConnectionFromClient.h" #include <AK/Debug.h> +#include <AK/DeprecatedString.h> #include <AK/HashMap.h> #include <AK/Random.h> -#include <AK/String.h> #include <AK/StringBuilder.h> #include <LibCore/ConfigFile.h> #include <LibCore/File.h> @@ -78,7 +78,7 @@ LookupServer::LookupServer() void LookupServer::load_etc_hosts() { m_etc_hosts.clear(); - auto add_answer = [this](Name const& name, RecordType record_type, String data) { + auto add_answer = [this](Name const& name, RecordType record_type, DeprecatedString data) { m_etc_hosts.ensure(name).empend(name, record_type, RecordClass::IN, s_static_ttl, move(data), false); }; @@ -115,7 +115,7 @@ void LookupServer::load_etc_hosts() auto raw_addr = maybe_address->to_in_addr_t(); Name name { fields[1] }; - add_answer(name, RecordType::A, String { (char const*)&raw_addr, sizeof(raw_addr) }); + add_answer(name, RecordType::A, DeprecatedString { (char const*)&raw_addr, sizeof(raw_addr) }); StringBuilder builder; builder.append(maybe_address->to_string_reversed()); @@ -124,7 +124,7 @@ void LookupServer::load_etc_hosts() } } -static String get_hostname() +static DeprecatedString get_hostname() { char buffer[_POSIX_HOST_NAME_MAX]; VERIFY(gethostname(buffer, sizeof(buffer)) == 0); @@ -163,7 +163,7 @@ ErrorOr<Vector<Answer>> LookupServer::lookup(Name const& name, RecordType record if (record_type == RecordType::A && get_hostname() == name) { IPv4Address address = { 127, 0, 0, 1 }; auto raw_address = address.to_in_addr_t(); - Answer answer { name, RecordType::A, RecordClass::IN, s_static_ttl, String { (char const*)&raw_address, sizeof(raw_address) }, false }; + Answer answer { name, RecordType::A, RecordClass::IN, s_static_ttl, DeprecatedString { (char const*)&raw_address, sizeof(raw_address) }, false }; answers.append(move(answer)); return answers; } @@ -224,7 +224,7 @@ ErrorOr<Vector<Answer>> LookupServer::lookup(Name const& name, RecordType record return answers; } -ErrorOr<Vector<Answer>> LookupServer::lookup(Name const& name, String const& nameserver, bool& did_get_response, RecordType record_type, ShouldRandomizeCase should_randomize_case) +ErrorOr<Vector<Answer>> LookupServer::lookup(Name const& name, DeprecatedString const& nameserver, bool& did_get_response, RecordType record_type, ShouldRandomizeCase should_randomize_case) { Packet request; request.set_is_query(); diff --git a/Userland/Services/LookupServer/LookupServer.h b/Userland/Services/LookupServer/LookupServer.h index 0b1c2c03d7..8835ec8066 100644 --- a/Userland/Services/LookupServer/LookupServer.h +++ b/Userland/Services/LookupServer/LookupServer.h @@ -32,12 +32,12 @@ private: void load_etc_hosts(); void put_in_cache(Answer const&); - ErrorOr<Vector<Answer>> lookup(Name const& hostname, String const& nameserver, bool& did_get_response, RecordType record_type, ShouldRandomizeCase = ShouldRandomizeCase::Yes); + ErrorOr<Vector<Answer>> lookup(Name const& hostname, DeprecatedString const& nameserver, bool& did_get_response, RecordType record_type, ShouldRandomizeCase = ShouldRandomizeCase::Yes); OwnPtr<IPC::MultiServer<ConnectionFromClient>> m_server; RefPtr<DNSServer> m_dns_server; RefPtr<MulticastDNS> m_mdns; - Vector<String> m_nameservers; + Vector<DeprecatedString> m_nameservers; RefPtr<Core::FileWatcher> m_file_watcher; HashMap<Name, Vector<Answer>, Name::Traits> m_etc_hosts; HashMap<Name, Vector<Answer>, Name::Traits> m_lookup_cache; diff --git a/Userland/Services/LookupServer/LookupServer.ipc b/Userland/Services/LookupServer/LookupServer.ipc index 60a3f6772f..e440a9072b 100644 --- a/Userland/Services/LookupServer/LookupServer.ipc +++ b/Userland/Services/LookupServer/LookupServer.ipc @@ -2,6 +2,6 @@ endpoint LookupServer { // Keep these definitions synchronized with gethostbyname and gethostbyaddr in netdb.cpp - lookup_name(String name) => (int code, Vector<String> addresses) - lookup_address(String address) => (int code, String name) + lookup_name(DeprecatedString name) => (int code, Vector<DeprecatedString> addresses) + lookup_address(DeprecatedString address) => (int code, DeprecatedString name) } diff --git a/Userland/Services/LookupServer/MulticastDNS.cpp b/Userland/Services/LookupServer/MulticastDNS.cpp index d148236cce..9ce29575d8 100644 --- a/Userland/Services/LookupServer/MulticastDNS.cpp +++ b/Userland/Services/LookupServer/MulticastDNS.cpp @@ -5,11 +5,11 @@ */ #include "MulticastDNS.h" +#include <AK/DeprecatedString.h> #include <AK/IPv4Address.h> #include <AK/JsonArray.h> #include <AK/JsonObject.h> #include <AK/JsonValue.h> -#include <AK/String.h> #include <LibCore/File.h> #include <limits.h> #include <poll.h> @@ -26,7 +26,7 @@ MulticastDNS::MulticastDNS(Object* parent) if (gethostname(buffer, sizeof(buffer)) < 0) { perror("gethostname"); } else { - m_hostname = String::formatted("{}.local", buffer); + m_hostname = DeprecatedString::formatted("{}.local", buffer); } u8 zero = 0; @@ -93,7 +93,7 @@ void MulticastDNS::announce() RecordType::A, RecordClass::IN, 120, - String { (char const*)&raw_addr, sizeof(raw_addr) }, + DeprecatedString { (char const*)&raw_addr, sizeof(raw_addr) }, true, }; response.add_answer(answer); diff --git a/Userland/Services/NetworkServer/main.cpp b/Userland/Services/NetworkServer/main.cpp index f466bf2a2d..4a9798832c 100644 --- a/Userland/Services/NetworkServer/main.cpp +++ b/Userland/Services/NetworkServer/main.cpp @@ -43,12 +43,12 @@ ErrorOr<int> serenity_main(Main::Arguments) struct InterfaceConfig { bool enabled = false; bool dhcp_enabled = false; - String ipv4_address = "0.0.0.0"sv; - String ipv4_netmask = "0.0.0.0"sv; - String ipv4_gateway = "0.0.0.0"sv; + DeprecatedString ipv4_address = "0.0.0.0"sv; + DeprecatedString ipv4_netmask = "0.0.0.0"sv; + DeprecatedString ipv4_gateway = "0.0.0.0"sv; }; - Vector<String> interfaces_with_dhcp_enabled; + Vector<DeprecatedString> interfaces_with_dhcp_enabled; proc_net_adapters_json.as_array().for_each([&](auto& value) { auto& if_object = value.as_object(); auto ifname = if_object.get("name"sv).to_string(); diff --git a/Userland/Services/NotificationServer/ConnectionFromClient.cpp b/Userland/Services/NotificationServer/ConnectionFromClient.cpp index 3be8a3708f..1ab4191780 100644 --- a/Userland/Services/NotificationServer/ConnectionFromClient.cpp +++ b/Userland/Services/NotificationServer/ConnectionFromClient.cpp @@ -24,7 +24,7 @@ void ConnectionFromClient::die() s_connections.remove(client_id()); } -void ConnectionFromClient::show_notification(String const& text, String const& title, Gfx::ShareableBitmap const& icon) +void ConnectionFromClient::show_notification(DeprecatedString const& text, DeprecatedString const& title, Gfx::ShareableBitmap const& icon) { auto window = NotificationWindow::construct(client_id(), text, title, icon); window->show(); @@ -47,7 +47,7 @@ Messages::NotificationServer::UpdateNotificationIconResponse ConnectionFromClien return !!window; } -Messages::NotificationServer::UpdateNotificationTextResponse ConnectionFromClient::update_notification_text(String const& text, String const& title) +Messages::NotificationServer::UpdateNotificationTextResponse ConnectionFromClient::update_notification_text(DeprecatedString const& text, DeprecatedString const& title) { auto window = NotificationWindow::get_window_by_id(client_id()); if (window) { diff --git a/Userland/Services/NotificationServer/ConnectionFromClient.h b/Userland/Services/NotificationServer/ConnectionFromClient.h index 903ebab89b..204f92d64c 100644 --- a/Userland/Services/NotificationServer/ConnectionFromClient.h +++ b/Userland/Services/NotificationServer/ConnectionFromClient.h @@ -23,10 +23,10 @@ public: private: explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); - virtual void show_notification(String const&, String const&, Gfx::ShareableBitmap const&) override; + virtual void show_notification(DeprecatedString const&, DeprecatedString const&, Gfx::ShareableBitmap const&) override; virtual void close_notification() override; virtual Messages::NotificationServer::UpdateNotificationIconResponse update_notification_icon(Gfx::ShareableBitmap const&) override; - virtual Messages::NotificationServer::UpdateNotificationTextResponse update_notification_text(String const&, String const&) override; + virtual Messages::NotificationServer::UpdateNotificationTextResponse update_notification_text(DeprecatedString const&, DeprecatedString const&) override; virtual Messages::NotificationServer::IsShowingResponse is_showing() override; }; diff --git a/Userland/Services/NotificationServer/NotificationServer.ipc b/Userland/Services/NotificationServer/NotificationServer.ipc index 7a6196dff9..a907a63b78 100644 --- a/Userland/Services/NotificationServer/NotificationServer.ipc +++ b/Userland/Services/NotificationServer/NotificationServer.ipc @@ -2,9 +2,9 @@ endpoint NotificationServer { - show_notification([UTF8] String text, [UTF8] String title, Gfx::ShareableBitmap icon) => () + show_notification([UTF8] DeprecatedString text, [UTF8] DeprecatedString title, Gfx::ShareableBitmap icon) => () - update_notification_text([UTF8] String text, [UTF8] String title) => (bool still_showing) + update_notification_text([UTF8] DeprecatedString text, [UTF8] DeprecatedString title) => (bool still_showing) update_notification_icon(Gfx::ShareableBitmap icon) => (bool still_showing) diff --git a/Userland/Services/NotificationServer/NotificationWindow.cpp b/Userland/Services/NotificationServer/NotificationWindow.cpp index 35ad6b2b69..c429a936da 100644 --- a/Userland/Services/NotificationServer/NotificationWindow.cpp +++ b/Userland/Services/NotificationServer/NotificationWindow.cpp @@ -37,7 +37,7 @@ static void update_notification_window_locations(Gfx::IntRect const& screen_rect } } -NotificationWindow::NotificationWindow(i32 client_id, String const& text, String const& title, Gfx::ShareableBitmap const& icon) +NotificationWindow::NotificationWindow(i32 client_id, DeprecatedString const& text, DeprecatedString const& title, Gfx::ShareableBitmap const& icon) { m_id = client_id; s_windows.set(m_id, this); @@ -129,14 +129,14 @@ void NotificationWindow::leave_event(Core::Event&) update_notification_window_locations(GUI::Desktop::the().rect()); } -void NotificationWindow::set_text(String const& value) +void NotificationWindow::set_text(DeprecatedString const& value) { m_text_label->set_text(value); if (m_hovering) resize_to_fit_text(); } -void NotificationWindow::set_title(String const& value) +void NotificationWindow::set_title(DeprecatedString const& value) { m_title_label->set_text(value); } diff --git a/Userland/Services/NotificationServer/NotificationWindow.h b/Userland/Services/NotificationServer/NotificationWindow.h index cae0bd505a..889891a864 100644 --- a/Userland/Services/NotificationServer/NotificationWindow.h +++ b/Userland/Services/NotificationServer/NotificationWindow.h @@ -18,8 +18,8 @@ public: virtual ~NotificationWindow() override = default; void set_original_rect(Gfx::IntRect original_rect) { m_original_rect = original_rect; }; - void set_text(String const&); - void set_title(String const&); + void set_text(DeprecatedString const&); + void set_title(DeprecatedString const&); void set_image(Gfx::ShareableBitmap const&); static RefPtr<NotificationWindow> get_window_by_id(i32 id); @@ -29,7 +29,7 @@ protected: virtual void leave_event(Core::Event&) override; private: - NotificationWindow(i32 client_id, String const& text, String const& title, Gfx::ShareableBitmap const&); + NotificationWindow(i32 client_id, DeprecatedString const& text, DeprecatedString const& title, Gfx::ShareableBitmap const&); virtual void screen_rects_change_event(GUI::ScreenRectsChangeEvent&) override; diff --git a/Userland/Services/RequestServer/ConnectionCache.h b/Userland/Services/RequestServer/ConnectionCache.h index a88bcc4358..df88591d31 100644 --- a/Userland/Services/RequestServer/ConnectionCache.h +++ b/Userland/Services/RequestServer/ConnectionCache.h @@ -41,7 +41,7 @@ struct Proxy { return TRY(SocketType::connect(url.host(), url.port_or_default(), forward<Args>(args)...)); } if (data.type == Core::ProxyData::SOCKS5) { - if constexpr (requires { SocketType::connect(declval<String>(), *proxy_client_storage, forward<Args>(args)...); }) { + if constexpr (requires { SocketType::connect(declval<DeprecatedString>(), *proxy_client_storage, forward<Args>(args)...); }) { proxy_client_storage = TRY(Core::SOCKSProxyClient::connect(data.host_ipv4, data.port, Core::SOCKSProxyClient::Version::V5, url.host(), url.port_or_default())); return TRY(SocketType::connect(url.host(), *proxy_client_storage, forward<Args>(args)...)); } else if constexpr (IsSame<SocketType, Core::Stream::TCPSocket>) { @@ -102,7 +102,7 @@ struct Connection { }; struct ConnectionKey { - String hostname; + DeprecatedString hostname; u16 port { 0 }; Core::ProxyData proxy_data {}; diff --git a/Userland/Services/RequestServer/ConnectionFromClient.cpp b/Userland/Services/RequestServer/ConnectionFromClient.cpp index f048925f1b..417edad651 100644 --- a/Userland/Services/RequestServer/ConnectionFromClient.cpp +++ b/Userland/Services/RequestServer/ConnectionFromClient.cpp @@ -30,13 +30,13 @@ void ConnectionFromClient::die() Core::EventLoop::current().quit(0); } -Messages::RequestServer::IsSupportedProtocolResponse ConnectionFromClient::is_supported_protocol(String const& protocol) +Messages::RequestServer::IsSupportedProtocolResponse ConnectionFromClient::is_supported_protocol(DeprecatedString const& protocol) { bool supported = Protocol::find_by_name(protocol.to_lowercase()); return supported; } -Messages::RequestServer::StartRequestResponse ConnectionFromClient::start_request(String const& method, URL const& url, IPC::Dictionary const& request_headers, ByteBuffer const& request_body, Core::ProxyData const& proxy_data) +Messages::RequestServer::StartRequestResponse ConnectionFromClient::start_request(DeprecatedString const& method, URL const& url, IPC::Dictionary const& request_headers, ByteBuffer const& request_body, Core::ProxyData const& proxy_data) { if (!url.is_valid()) { dbgln("StartRequest: Invalid URL requested: '{}'", url); @@ -97,7 +97,7 @@ void ConnectionFromClient::did_request_certificates(Badge<Request>, Request& req async_certificate_requested(request.id()); } -Messages::RequestServer::SetCertificateResponse ConnectionFromClient::set_certificate(i32 request_id, String const& certificate, String const& key) +Messages::RequestServer::SetCertificateResponse ConnectionFromClient::set_certificate(i32 request_id, DeprecatedString const& certificate, DeprecatedString const& key) { auto* request = const_cast<Request*>(m_requests.get(request_id).value_or(nullptr)); bool success = false; diff --git a/Userland/Services/RequestServer/ConnectionFromClient.h b/Userland/Services/RequestServer/ConnectionFromClient.h index fb7ae2a76f..4b009c55ba 100644 --- a/Userland/Services/RequestServer/ConnectionFromClient.h +++ b/Userland/Services/RequestServer/ConnectionFromClient.h @@ -31,10 +31,10 @@ public: private: explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>); - virtual Messages::RequestServer::IsSupportedProtocolResponse is_supported_protocol(String const&) override; - virtual Messages::RequestServer::StartRequestResponse start_request(String const&, URL const&, IPC::Dictionary const&, ByteBuffer const&, Core::ProxyData const&) override; + virtual Messages::RequestServer::IsSupportedProtocolResponse is_supported_protocol(DeprecatedString const&) override; + virtual Messages::RequestServer::StartRequestResponse start_request(DeprecatedString const&, URL const&, IPC::Dictionary const&, ByteBuffer const&, Core::ProxyData const&) override; virtual Messages::RequestServer::StopRequestResponse stop_request(i32) override; - virtual Messages::RequestServer::SetCertificateResponse set_certificate(i32, String const&, String const&) override; + virtual Messages::RequestServer::SetCertificateResponse set_certificate(i32, DeprecatedString const&, DeprecatedString const&) override; virtual void ensure_connection(URL const& url, ::RequestServer::CacheLevel const& cache_level) override; HashMap<i32, OwnPtr<Request>> m_requests; diff --git a/Userland/Services/RequestServer/GeminiProtocol.cpp b/Userland/Services/RequestServer/GeminiProtocol.cpp index 3b60b39644..9412476a9b 100644 --- a/Userland/Services/RequestServer/GeminiProtocol.cpp +++ b/Userland/Services/RequestServer/GeminiProtocol.cpp @@ -17,7 +17,7 @@ GeminiProtocol::GeminiProtocol() { } -OwnPtr<Request> GeminiProtocol::start_request(ConnectionFromClient& client, String const&, const URL& url, HashMap<String, String> const&, ReadonlyBytes, Core::ProxyData proxy_data) +OwnPtr<Request> GeminiProtocol::start_request(ConnectionFromClient& client, DeprecatedString const&, const URL& url, HashMap<DeprecatedString, DeprecatedString> const&, ReadonlyBytes, Core::ProxyData proxy_data) { Gemini::GeminiRequest request; request.set_url(url); diff --git a/Userland/Services/RequestServer/GeminiProtocol.h b/Userland/Services/RequestServer/GeminiProtocol.h index 6830b50d90..73b8c55278 100644 --- a/Userland/Services/RequestServer/GeminiProtocol.h +++ b/Userland/Services/RequestServer/GeminiProtocol.h @@ -15,7 +15,7 @@ public: GeminiProtocol(); virtual ~GeminiProtocol() override = default; - virtual OwnPtr<Request> start_request(ConnectionFromClient&, String const& method, const URL&, HashMap<String, String> const&, ReadonlyBytes body, Core::ProxyData proxy_data = {}) override; + virtual OwnPtr<Request> start_request(ConnectionFromClient&, DeprecatedString const& method, const URL&, HashMap<DeprecatedString, DeprecatedString> const&, ReadonlyBytes body, Core::ProxyData proxy_data = {}) override; }; } diff --git a/Userland/Services/RequestServer/GeminiRequest.cpp b/Userland/Services/RequestServer/GeminiRequest.cpp index 0e65f19418..0ec84e7387 100644 --- a/Userland/Services/RequestServer/GeminiRequest.cpp +++ b/Userland/Services/RequestServer/GeminiRequest.cpp @@ -23,7 +23,7 @@ GeminiRequest::GeminiRequest(ConnectionFromClient& client, NonnullRefPtr<Gemini: if (auto* response = m_job->response()) { set_downloaded_size(MUST(const_cast<Core::Stream::File&>(this->output_stream()).size())); if (!response->meta().is_empty()) { - HashMap<String, String, CaseInsensitiveStringTraits> headers; + HashMap<DeprecatedString, DeprecatedString, CaseInsensitiveStringTraits> headers; headers.set("meta", response->meta()); // Note: We're setting content-type to meta only on status==SUCCESS // we should perhaps have a better mechanism for this, since we @@ -46,7 +46,7 @@ GeminiRequest::GeminiRequest(ConnectionFromClient& client, NonnullRefPtr<Gemini: }; } -void GeminiRequest::set_certificate(String, String) +void GeminiRequest::set_certificate(DeprecatedString, DeprecatedString) { } diff --git a/Userland/Services/RequestServer/GeminiRequest.h b/Userland/Services/RequestServer/GeminiRequest.h index c324b4d1e0..9039b83980 100644 --- a/Userland/Services/RequestServer/GeminiRequest.h +++ b/Userland/Services/RequestServer/GeminiRequest.h @@ -25,7 +25,7 @@ public: private: explicit GeminiRequest(ConnectionFromClient&, NonnullRefPtr<Gemini::Job>, NonnullOwnPtr<Core::Stream::File>&&); - virtual void set_certificate(String certificate, String key) override; + virtual void set_certificate(DeprecatedString certificate, DeprecatedString key) override; NonnullRefPtr<Gemini::Job> m_job; }; diff --git a/Userland/Services/RequestServer/HttpCommon.h b/Userland/Services/RequestServer/HttpCommon.h index 06e01a14ec..d54d48ca23 100644 --- a/Userland/Services/RequestServer/HttpCommon.h +++ b/Userland/Services/RequestServer/HttpCommon.h @@ -7,11 +7,11 @@ #pragma once #include <AK/ByteBuffer.h> +#include <AK/DeprecatedString.h> #include <AK/HashMap.h> #include <AK/NonnullOwnPtr.h> #include <AK/Optional.h> #include <AK/OwnPtr.h> -#include <AK/String.h> #include <AK/Types.h> #include <LibHTTP/HttpRequest.h> #include <RequestServer/ConnectionCache.h> @@ -61,7 +61,7 @@ void init(TSelf* self, TJob job) } template<typename TBadgedProtocol, typename TPipeResult> -OwnPtr<Request> start_request(TBadgedProtocol&& protocol, ConnectionFromClient& client, String const& method, const URL& url, HashMap<String, String> const& headers, ReadonlyBytes body, TPipeResult&& pipe_result, Core::ProxyData proxy_data = {}) +OwnPtr<Request> start_request(TBadgedProtocol&& protocol, ConnectionFromClient& client, DeprecatedString const& method, const URL& url, HashMap<DeprecatedString, DeprecatedString> const& headers, ReadonlyBytes body, TPipeResult&& pipe_result, Core::ProxyData proxy_data = {}) { using TJob = typename TBadgedProtocol::Type::JobType; using TRequest = typename TBadgedProtocol::Type::RequestType; diff --git a/Userland/Services/RequestServer/HttpProtocol.cpp b/Userland/Services/RequestServer/HttpProtocol.cpp index f0a7354b5c..9a18ba743b 100644 --- a/Userland/Services/RequestServer/HttpProtocol.cpp +++ b/Userland/Services/RequestServer/HttpProtocol.cpp @@ -6,9 +6,9 @@ #include <AK/Badge.h> #include <AK/ByteBuffer.h> +#include <AK/DeprecatedString.h> #include <AK/HashMap.h> #include <AK/OwnPtr.h> -#include <AK/String.h> #include <AK/URL.h> #include <RequestServer/ConnectionFromClient.h> #include <RequestServer/HttpCommon.h> @@ -22,7 +22,7 @@ HttpProtocol::HttpProtocol() { } -OwnPtr<Request> HttpProtocol::start_request(ConnectionFromClient& client, String const& method, const URL& url, HashMap<String, String> const& headers, ReadonlyBytes body, Core::ProxyData proxy_data) +OwnPtr<Request> HttpProtocol::start_request(ConnectionFromClient& client, DeprecatedString const& method, const URL& url, HashMap<DeprecatedString, DeprecatedString> const& headers, ReadonlyBytes body, Core::ProxyData proxy_data) { return Detail::start_request(Badge<HttpProtocol> {}, client, method, url, headers, body, get_pipe_for_request(), proxy_data); } diff --git a/Userland/Services/RequestServer/HttpProtocol.h b/Userland/Services/RequestServer/HttpProtocol.h index 019978f3f6..5e89e3db65 100644 --- a/Userland/Services/RequestServer/HttpProtocol.h +++ b/Userland/Services/RequestServer/HttpProtocol.h @@ -7,9 +7,9 @@ #pragma once #include <AK/ByteBuffer.h> +#include <AK/DeprecatedString.h> #include <AK/HashMap.h> #include <AK/OwnPtr.h> -#include <AK/String.h> #include <AK/URL.h> #include <LibHTTP/Job.h> #include <RequestServer/ConnectionFromClient.h> @@ -27,7 +27,7 @@ public: HttpProtocol(); ~HttpProtocol() override = default; - virtual OwnPtr<Request> start_request(ConnectionFromClient&, String const& method, const URL&, HashMap<String, String> const& headers, ReadonlyBytes body, Core::ProxyData proxy_data = {}) override; + virtual OwnPtr<Request> start_request(ConnectionFromClient&, DeprecatedString const& method, const URL&, HashMap<DeprecatedString, DeprecatedString> const& headers, ReadonlyBytes body, Core::ProxyData proxy_data = {}) override; }; } diff --git a/Userland/Services/RequestServer/HttpsProtocol.cpp b/Userland/Services/RequestServer/HttpsProtocol.cpp index c7df2d5402..d3d7fab2b6 100644 --- a/Userland/Services/RequestServer/HttpsProtocol.cpp +++ b/Userland/Services/RequestServer/HttpsProtocol.cpp @@ -6,9 +6,9 @@ #include <AK/Badge.h> #include <AK/ByteBuffer.h> +#include <AK/DeprecatedString.h> #include <AK/HashMap.h> #include <AK/OwnPtr.h> -#include <AK/String.h> #include <AK/URL.h> #include <RequestServer/ConnectionFromClient.h> #include <RequestServer/HttpCommon.h> @@ -22,7 +22,7 @@ HttpsProtocol::HttpsProtocol() { } -OwnPtr<Request> HttpsProtocol::start_request(ConnectionFromClient& client, String const& method, const URL& url, HashMap<String, String> const& headers, ReadonlyBytes body, Core::ProxyData proxy_data) +OwnPtr<Request> HttpsProtocol::start_request(ConnectionFromClient& client, DeprecatedString const& method, const URL& url, HashMap<DeprecatedString, DeprecatedString> const& headers, ReadonlyBytes body, Core::ProxyData proxy_data) { return Detail::start_request(Badge<HttpsProtocol> {}, client, method, url, headers, body, get_pipe_for_request(), proxy_data); } diff --git a/Userland/Services/RequestServer/HttpsProtocol.h b/Userland/Services/RequestServer/HttpsProtocol.h index 934ce373d1..e377ad8bde 100644 --- a/Userland/Services/RequestServer/HttpsProtocol.h +++ b/Userland/Services/RequestServer/HttpsProtocol.h @@ -7,9 +7,9 @@ #pragma once #include <AK/ByteBuffer.h> +#include <AK/DeprecatedString.h> #include <AK/HashMap.h> #include <AK/OwnPtr.h> -#include <AK/String.h> #include <AK/URL.h> #include <LibHTTP/HttpsJob.h> #include <RequestServer/ConnectionFromClient.h> @@ -27,7 +27,7 @@ public: HttpsProtocol(); ~HttpsProtocol() override = default; - virtual OwnPtr<Request> start_request(ConnectionFromClient&, String const& method, const URL&, HashMap<String, String> const& headers, ReadonlyBytes body, Core::ProxyData proxy_data = {}) override; + virtual OwnPtr<Request> start_request(ConnectionFromClient&, DeprecatedString const& method, const URL&, HashMap<DeprecatedString, DeprecatedString> const& headers, ReadonlyBytes body, Core::ProxyData proxy_data = {}) override; }; } diff --git a/Userland/Services/RequestServer/HttpsRequest.cpp b/Userland/Services/RequestServer/HttpsRequest.cpp index 5e68dd84cb..dcf2c4da71 100644 --- a/Userland/Services/RequestServer/HttpsRequest.cpp +++ b/Userland/Services/RequestServer/HttpsRequest.cpp @@ -18,7 +18,7 @@ HttpsRequest::HttpsRequest(ConnectionFromClient& client, NonnullRefPtr<HTTP::Htt Detail::init(this, job); } -void HttpsRequest::set_certificate(String certificate, String key) +void HttpsRequest::set_certificate(DeprecatedString certificate, DeprecatedString key) { m_job->set_certificate(move(certificate), move(key)); } diff --git a/Userland/Services/RequestServer/HttpsRequest.h b/Userland/Services/RequestServer/HttpsRequest.h index 12b61570a4..1add0e1cee 100644 --- a/Userland/Services/RequestServer/HttpsRequest.h +++ b/Userland/Services/RequestServer/HttpsRequest.h @@ -26,7 +26,7 @@ public: private: explicit HttpsRequest(ConnectionFromClient&, NonnullRefPtr<HTTP::HttpsJob>, NonnullOwnPtr<Core::Stream::File>&&); - virtual void set_certificate(String certificate, String key) override; + virtual void set_certificate(DeprecatedString certificate, DeprecatedString key) override; NonnullRefPtr<HTTP::HttpsJob> m_job; }; diff --git a/Userland/Services/RequestServer/Protocol.cpp b/Userland/Services/RequestServer/Protocol.cpp index f9f2fe1692..1f6630cfab 100644 --- a/Userland/Services/RequestServer/Protocol.cpp +++ b/Userland/Services/RequestServer/Protocol.cpp @@ -13,18 +13,18 @@ namespace RequestServer { -static HashMap<String, Protocol*>& all_protocols() +static HashMap<DeprecatedString, Protocol*>& all_protocols() { - static HashMap<String, Protocol*> map; + static HashMap<DeprecatedString, Protocol*> map; return map; } -Protocol* Protocol::find_by_name(String const& name) +Protocol* Protocol::find_by_name(DeprecatedString const& name) { return all_protocols().get(name).value_or(nullptr); } -Protocol::Protocol(String const& name) +Protocol::Protocol(DeprecatedString const& name) { all_protocols().set(name, this); } diff --git a/Userland/Services/RequestServer/Protocol.h b/Userland/Services/RequestServer/Protocol.h index c3d86d896a..f601fe5711 100644 --- a/Userland/Services/RequestServer/Protocol.h +++ b/Userland/Services/RequestServer/Protocol.h @@ -17,13 +17,13 @@ class Protocol { public: virtual ~Protocol(); - String const& name() const { return m_name; } - virtual OwnPtr<Request> start_request(ConnectionFromClient&, String const& method, const URL&, HashMap<String, String> const& headers, ReadonlyBytes body, Core::ProxyData proxy_data = {}) = 0; + DeprecatedString const& name() const { return m_name; } + virtual OwnPtr<Request> start_request(ConnectionFromClient&, DeprecatedString const& method, const URL&, HashMap<DeprecatedString, DeprecatedString> const& headers, ReadonlyBytes body, Core::ProxyData proxy_data = {}) = 0; - static Protocol* find_by_name(String const&); + static Protocol* find_by_name(DeprecatedString const&); protected: - explicit Protocol(String const& name); + explicit Protocol(DeprecatedString const& name); struct Pipe { int read_fd { -1 }; int write_fd { -1 }; @@ -31,7 +31,7 @@ protected: static ErrorOr<Pipe> get_pipe_for_request(); private: - String m_name; + DeprecatedString m_name; }; } diff --git a/Userland/Services/RequestServer/Request.cpp b/Userland/Services/RequestServer/Request.cpp index 752a3c2b9a..b1d00d8e03 100644 --- a/Userland/Services/RequestServer/Request.cpp +++ b/Userland/Services/RequestServer/Request.cpp @@ -24,13 +24,13 @@ void Request::stop() m_client.did_finish_request({}, *this, false); } -void Request::set_response_headers(HashMap<String, String, CaseInsensitiveStringTraits> const& response_headers) +void Request::set_response_headers(HashMap<DeprecatedString, DeprecatedString, CaseInsensitiveStringTraits> const& response_headers) { m_response_headers = response_headers; m_client.did_receive_headers({}, *this); } -void Request::set_certificate(String, String) +void Request::set_certificate(DeprecatedString, DeprecatedString) { } diff --git a/Userland/Services/RequestServer/Request.h b/Userland/Services/RequestServer/Request.h index 562e8254c9..1e6556810f 100644 --- a/Userland/Services/RequestServer/Request.h +++ b/Userland/Services/RequestServer/Request.h @@ -26,10 +26,10 @@ public: Optional<u32> status_code() const { return m_status_code; } Optional<u32> total_size() const { return m_total_size; } size_t downloaded_size() const { return m_downloaded_size; } - HashMap<String, String, CaseInsensitiveStringTraits> const& response_headers() const { return m_response_headers; } + HashMap<DeprecatedString, DeprecatedString, CaseInsensitiveStringTraits> const& response_headers() const { return m_response_headers; } void stop(); - virtual void set_certificate(String, String); + virtual void set_certificate(DeprecatedString, DeprecatedString); // FIXME: Want Badge<Protocol>, but can't make one from HttpProtocol, etc. void set_request_fd(int fd) { m_request_fd = fd; } @@ -39,7 +39,7 @@ public: void did_progress(Optional<u32> total_size, u32 downloaded_size); void set_status_code(u32 status_code) { m_status_code = status_code; } void did_request_certificates(); - void set_response_headers(HashMap<String, String, CaseInsensitiveStringTraits> const&); + void set_response_headers(HashMap<DeprecatedString, DeprecatedString, CaseInsensitiveStringTraits> const&); void set_downloaded_size(size_t size) { m_downloaded_size = size; } Core::Stream::File const& output_stream() const { return *m_output_stream; } @@ -54,7 +54,7 @@ private: Optional<u32> m_total_size {}; size_t m_downloaded_size { 0 }; NonnullOwnPtr<Core::Stream::File> m_output_stream; - HashMap<String, String, CaseInsensitiveStringTraits> m_response_headers; + HashMap<DeprecatedString, DeprecatedString, CaseInsensitiveStringTraits> m_response_headers; }; } diff --git a/Userland/Services/RequestServer/RequestServer.ipc b/Userland/Services/RequestServer/RequestServer.ipc index 7f6d89c0c8..c714f4c0a5 100644 --- a/Userland/Services/RequestServer/RequestServer.ipc +++ b/Userland/Services/RequestServer/RequestServer.ipc @@ -4,11 +4,11 @@ endpoint RequestServer { // Test if a specific protocol is supported, e.g "http" - is_supported_protocol(String protocol) => (bool supported) + is_supported_protocol(DeprecatedString protocol) => (bool supported) - start_request(String method, URL url, IPC::Dictionary request_headers, ByteBuffer request_body, Core::ProxyData proxy_data) => (i32 request_id, Optional<IPC::File> response_fd) + start_request(DeprecatedString method, URL url, IPC::Dictionary request_headers, ByteBuffer request_body, Core::ProxyData proxy_data) => (i32 request_id, Optional<IPC::File> response_fd) stop_request(i32 request_id) => (bool success) - set_certificate(i32 request_id, String certificate, String key) => (bool success) + set_certificate(i32 request_id, DeprecatedString certificate, DeprecatedString key) => (bool success) ensure_connection(URL url, ::RequestServer::CacheLevel cache_level) =| } diff --git a/Userland/Services/SQLServer/ConnectionFromClient.cpp b/Userland/Services/SQLServer/ConnectionFromClient.cpp index 6ff4d89603..6589152b73 100644 --- a/Userland/Services/SQLServer/ConnectionFromClient.cpp +++ b/Userland/Services/SQLServer/ConnectionFromClient.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include <AK/String.h> +#include <AK/DeprecatedString.h> #include <AK/Vector.h> #include <LibSQL/Result.h> #include <SQLServer/ConnectionFromClient.h> @@ -34,7 +34,7 @@ void ConnectionFromClient::die() s_connections.remove(client_id()); } -Messages::SQLServer::ConnectResponse ConnectionFromClient::connect(String const& database_name) +Messages::SQLServer::ConnectResponse ConnectionFromClient::connect(DeprecatedString const& database_name) { dbgln_if(SQLSERVER_DEBUG, "ConnectionFromClient::connect(database_name: {})", database_name); auto database_connection = DatabaseConnection::construct(database_name, client_id()); @@ -51,7 +51,7 @@ void ConnectionFromClient::disconnect(int connection_id) dbgln("Database connection has disappeared"); } -Messages::SQLServer::PrepareStatementResponse ConnectionFromClient::prepare_statement(int connection_id, String const& sql) +Messages::SQLServer::PrepareStatementResponse ConnectionFromClient::prepare_statement(int connection_id, DeprecatedString const& sql) { dbgln_if(SQLSERVER_DEBUG, "ConnectionFromClient::prepare_statement(connection_id: {}, sql: '{}')", connection_id, sql); auto database_connection = DatabaseConnection::connection_for(connection_id); @@ -73,7 +73,7 @@ void ConnectionFromClient::execute_statement(int statement_id) statement->execute(); } else { dbgln_if(SQLSERVER_DEBUG, "Statement has disappeared"); - async_execution_error(statement_id, (int)SQL::SQLErrorCode::StatementUnavailable, String::formatted("{}", statement_id)); + async_execution_error(statement_id, (int)SQL::SQLErrorCode::StatementUnavailable, DeprecatedString::formatted("{}", statement_id)); } } diff --git a/Userland/Services/SQLServer/ConnectionFromClient.h b/Userland/Services/SQLServer/ConnectionFromClient.h index df4ed217d5..227d207d6f 100644 --- a/Userland/Services/SQLServer/ConnectionFromClient.h +++ b/Userland/Services/SQLServer/ConnectionFromClient.h @@ -27,8 +27,8 @@ public: private: explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); - virtual Messages::SQLServer::ConnectResponse connect(String const&) override; - virtual Messages::SQLServer::PrepareStatementResponse prepare_statement(int, String const&) override; + virtual Messages::SQLServer::ConnectResponse connect(DeprecatedString const&) override; + virtual Messages::SQLServer::PrepareStatementResponse prepare_statement(int, DeprecatedString const&) override; virtual void execute_statement(int) override; virtual void disconnect(int) override; }; diff --git a/Userland/Services/SQLServer/DatabaseConnection.cpp b/Userland/Services/SQLServer/DatabaseConnection.cpp index ce76b3d248..f018d60e40 100644 --- a/Userland/Services/SQLServer/DatabaseConnection.cpp +++ b/Userland/Services/SQLServer/DatabaseConnection.cpp @@ -23,7 +23,7 @@ RefPtr<DatabaseConnection> DatabaseConnection::connection_for(int connection_id) static int s_next_connection_id = 0; -DatabaseConnection::DatabaseConnection(String database_name, int client_id) +DatabaseConnection::DatabaseConnection(DeprecatedString database_name, int client_id) : Object() , m_database_name(move(database_name)) , m_connection_id(s_next_connection_id++) @@ -38,7 +38,7 @@ DatabaseConnection::DatabaseConnection(String database_name, int client_id) dbgln_if(SQLSERVER_DEBUG, "DatabaseConnection {} initiating connection with database '{}'", connection_id(), m_database_name); s_connections.set(m_connection_id, *this); deferred_invoke([this]() { - m_database = SQL::Database::construct(String::formatted("/home/anon/sql/{}.db", m_database_name)); + m_database = SQL::Database::construct(DeprecatedString::formatted("/home/anon/sql/{}.db", m_database_name)); auto client_connection = ConnectionFromClient::client_connection_for(m_client_id); if (auto maybe_error = m_database->open(); maybe_error.is_error()) { client_connection->async_connection_error(m_connection_id, to_underlying(maybe_error.error().error()), maybe_error.error().error_string()); @@ -67,7 +67,7 @@ void DatabaseConnection::disconnect() }); } -int DatabaseConnection::prepare_statement(String const& sql) +int DatabaseConnection::prepare_statement(DeprecatedString const& sql) { dbgln_if(SQLSERVER_DEBUG, "DatabaseConnection::prepare_statement(connection_id {}, database '{}', sql '{}'", connection_id(), m_database_name, sql); auto client_connection = ConnectionFromClient::client_connection_for(client_id()); diff --git a/Userland/Services/SQLServer/DatabaseConnection.h b/Userland/Services/SQLServer/DatabaseConnection.h index 45f7ac25e8..9244d7d398 100644 --- a/Userland/Services/SQLServer/DatabaseConnection.h +++ b/Userland/Services/SQLServer/DatabaseConnection.h @@ -23,13 +23,13 @@ public: int client_id() const { return m_client_id; } RefPtr<SQL::Database> database() { return m_database; } void disconnect(); - int prepare_statement(String const& sql); + int prepare_statement(DeprecatedString const& sql); private: - DatabaseConnection(String database_name, int client_id); + DatabaseConnection(DeprecatedString database_name, int client_id); RefPtr<SQL::Database> m_database { nullptr }; - String m_database_name; + DeprecatedString m_database_name; int m_connection_id; int m_client_id; bool m_accept_statements { false }; diff --git a/Userland/Services/SQLServer/SQLClient.ipc b/Userland/Services/SQLServer/SQLClient.ipc index f6efebe521..c33e4fff3d 100644 --- a/Userland/Services/SQLServer/SQLClient.ipc +++ b/Userland/Services/SQLServer/SQLClient.ipc @@ -1,10 +1,10 @@ endpoint SQLClient { - connected(int connection_id, String connected_to_database) =| - connection_error(int connection_id, int code, String message) =| + connected(int connection_id, DeprecatedString connected_to_database) =| + connection_error(int connection_id, int code, DeprecatedString message) =| execution_success(int statement_id, bool has_results, int created, int updated, int deleted) =| - next_result(int statement_id, Vector<String> row) =| + next_result(int statement_id, Vector<DeprecatedString> row) =| results_exhausted(int statement_id, int total_rows) =| - execution_error(int statement_id, int code, String message) =| + execution_error(int statement_id, int code, DeprecatedString message) =| disconnected(int connection_id) =| } diff --git a/Userland/Services/SQLServer/SQLServer.ipc b/Userland/Services/SQLServer/SQLServer.ipc index 2a11df565d..233387a5f4 100644 --- a/Userland/Services/SQLServer/SQLServer.ipc +++ b/Userland/Services/SQLServer/SQLServer.ipc @@ -1,7 +1,7 @@ endpoint SQLServer { - connect(String name) => (int connection_id) - prepare_statement(int connection_id, String statement) => (int statement_id) + connect(DeprecatedString name) => (int connection_id) + prepare_statement(int connection_id, DeprecatedString statement) => (int statement_id) execute_statement(int statement_id) =| disconnect(int connection_id) =| } diff --git a/Userland/Services/SQLServer/SQLStatement.cpp b/Userland/Services/SQLServer/SQLStatement.cpp index 9ef3bb4bbc..275e24622b 100644 --- a/Userland/Services/SQLServer/SQLStatement.cpp +++ b/Userland/Services/SQLServer/SQLStatement.cpp @@ -24,7 +24,7 @@ RefPtr<SQLStatement> SQLStatement::statement_for(int statement_id) static int s_next_statement_id = 0; -SQLStatement::SQLStatement(DatabaseConnection& connection, String sql) +SQLStatement::SQLStatement(DatabaseConnection& connection, DeprecatedString sql) : Core::Object(&connection) , m_statement_id(s_next_statement_id++) , m_sql(move(sql)) diff --git a/Userland/Services/SQLServer/SQLStatement.h b/Userland/Services/SQLServer/SQLStatement.h index c456c3a819..c4bae21119 100644 --- a/Userland/Services/SQLServer/SQLStatement.h +++ b/Userland/Services/SQLServer/SQLStatement.h @@ -6,8 +6,8 @@ #pragma once +#include <AK/DeprecatedString.h> #include <AK/NonnullRefPtr.h> -#include <AK/String.h> #include <LibCore/Object.h> #include <LibSQL/AST/AST.h> #include <LibSQL/Result.h> @@ -25,19 +25,19 @@ public: static RefPtr<SQLStatement> statement_for(int statement_id); int statement_id() const { return m_statement_id; } - String const& sql() const { return m_sql; } + DeprecatedString const& sql() const { return m_sql; } DatabaseConnection* connection() { return dynamic_cast<DatabaseConnection*>(parent()); } void execute(); private: - SQLStatement(DatabaseConnection&, String sql); + SQLStatement(DatabaseConnection&, DeprecatedString sql); SQL::ResultOr<void> parse(); bool should_send_result_rows() const; void next(); void report_error(SQL::Result); int m_statement_id; - String m_sql; + DeprecatedString m_sql; size_t m_index { 0 }; RefPtr<SQL::AST::Statement> m_statement { nullptr }; Optional<SQL::ResultSet> m_result {}; diff --git a/Userland/Services/SpiceAgent/ConnectionToClipboardServer.cpp b/Userland/Services/SpiceAgent/ConnectionToClipboardServer.cpp index a0f4d73581..f9ade07533 100644 --- a/Userland/Services/SpiceAgent/ConnectionToClipboardServer.cpp +++ b/Userland/Services/SpiceAgent/ConnectionToClipboardServer.cpp @@ -17,7 +17,7 @@ RefPtr<Gfx::Bitmap> ConnectionToClipboardServer::get_bitmap() if (clipping.mime_type() != "image/x-serenityos") return nullptr; - HashMap<String, String> const& metadata = clipping.metadata().entries(); + HashMap<DeprecatedString, DeprecatedString> const& metadata = clipping.metadata().entries(); auto width = metadata.get("width").value_or("0").to_uint(); if (!width.has_value() || width.value() == 0) return nullptr; @@ -60,12 +60,12 @@ RefPtr<Gfx::Bitmap> ConnectionToClipboardServer::get_bitmap() // Copied from LibGUI/Clipboard.cpp void ConnectionToClipboardServer::set_bitmap(Gfx::Bitmap const& bitmap) { - HashMap<String, String> metadata; - metadata.set("width", String::number(bitmap.width())); - metadata.set("height", String::number(bitmap.height())); - metadata.set("scale", String::number(bitmap.scale())); - metadata.set("format", String::number((int)bitmap.format())); - metadata.set("pitch", String::number(bitmap.pitch())); + HashMap<DeprecatedString, DeprecatedString> metadata; + metadata.set("width", DeprecatedString::number(bitmap.width())); + metadata.set("height", DeprecatedString::number(bitmap.height())); + metadata.set("scale", DeprecatedString::number(bitmap.scale())); + metadata.set("format", DeprecatedString::number((int)bitmap.format())); + metadata.set("pitch", DeprecatedString::number(bitmap.pitch())); ReadonlyBytes data { bitmap.scanline(0), bitmap.size_in_bytes() }; auto buffer_or_error = Core::AnonymousBuffer::create_with_size(bitmap.size_in_bytes()); VERIFY(!buffer_or_error.is_error()); diff --git a/Userland/Services/SpiceAgent/ConnectionToClipboardServer.h b/Userland/Services/SpiceAgent/ConnectionToClipboardServer.h index b10cc39b29..c0d38bd158 100644 --- a/Userland/Services/SpiceAgent/ConnectionToClipboardServer.h +++ b/Userland/Services/SpiceAgent/ConnectionToClipboardServer.h @@ -27,7 +27,7 @@ private: : IPC::ConnectionToServer<ClipboardClientEndpoint, ClipboardServerEndpoint>(*this, move(socket)) { } - virtual void clipboard_data_changed(String const&) override + virtual void clipboard_data_changed(DeprecatedString const&) override { on_data_changed(); } diff --git a/Userland/Services/SpiceAgent/SpiceAgent.cpp b/Userland/Services/SpiceAgent/SpiceAgent.cpp index 2e39f330f8..c9bb4a1eeb 100644 --- a/Userland/Services/SpiceAgent/SpiceAgent.cpp +++ b/Userland/Services/SpiceAgent/SpiceAgent.cpp @@ -6,7 +6,7 @@ #include "SpiceAgent.h" #include "ConnectionToClipboardServer.h" -#include <AK/String.h> +#include <AK/DeprecatedString.h> #include <LibC/memory.h> #include <LibC/unistd.h> #include <LibGfx/BMPLoader.h> @@ -41,7 +41,7 @@ SpiceAgent::SpiceAgent(int fd, ConnectionToClipboardServer& connection) send_message(buffer); } -Optional<SpiceAgent::ClipboardType> SpiceAgent::mime_type_to_clipboard_type(String const& mime) +Optional<SpiceAgent::ClipboardType> SpiceAgent::mime_type_to_clipboard_type(DeprecatedString const& mime) { if (mime == "text/plain") return ClipboardType::Text; diff --git a/Userland/Services/SpiceAgent/SpiceAgent.h b/Userland/Services/SpiceAgent/SpiceAgent.h index 09eddda92b..a6e705f06f 100644 --- a/Userland/Services/SpiceAgent/SpiceAgent.h +++ b/Userland/Services/SpiceAgent/SpiceAgent.h @@ -124,5 +124,5 @@ private: bool m_just_set_clip { false }; void read_n(void* dest, size_t n); static Message* initialize_headers(u8* data, size_t additional_data_size, MessageType type); - static Optional<ClipboardType> mime_type_to_clipboard_type(String const& mime); + static Optional<ClipboardType> mime_type_to_clipboard_type(DeprecatedString const& mime); }; diff --git a/Userland/Services/SystemServer/Service.cpp b/Userland/Services/SystemServer/Service.cpp index 20bcb83a2c..b9ff2001a6 100644 --- a/Userland/Services/SystemServer/Service.cpp +++ b/Userland/Services/SystemServer/Service.cpp @@ -221,7 +221,7 @@ void Service::spawn(int socket_fd) setenv("HOME", account.home_directory().characters(), true); } - for (String& env : m_environment) + for (DeprecatedString& env : m_environment) putenv(const_cast<char*>(env.characters())); char* argv[m_extra_arguments.size() + 2]; @@ -281,11 +281,11 @@ Service::Service(Core::ConfigFile const& config, StringView name) VERIFY(config.has_group(name)); set_name(name); - m_executable_path = config.read_entry(name, "Executable", String::formatted("/bin/{}", this->name())); + m_executable_path = config.read_entry(name, "Executable", DeprecatedString::formatted("/bin/{}", this->name())); m_extra_arguments = config.read_entry(name, "Arguments", "").split(' '); m_stdio_file_path = config.read_entry(name, "StdIO"); - String prio = config.read_entry(name, "Priority"); + DeprecatedString prio = config.read_entry(name, "Priority"); if (prio == "low") m_priority = 10; else if (prio == "normal" || prio.is_null()) @@ -313,12 +313,12 @@ Service::Service(Core::ConfigFile const& config, StringView name) m_multi_instance = config.read_bool_entry(name, "MultiInstance"); m_accept_socket_connections = config.read_bool_entry(name, "AcceptSocketConnections"); - String socket_entry = config.read_entry(name, "Socket"); - String socket_permissions_entry = config.read_entry(name, "SocketPermissions", "0600"); + DeprecatedString socket_entry = config.read_entry(name, "Socket"); + DeprecatedString socket_permissions_entry = config.read_entry(name, "SocketPermissions", "0600"); if (!socket_entry.is_null()) { - Vector<String> socket_paths = socket_entry.split(','); - Vector<String> socket_perms = socket_permissions_entry.split(','); + Vector<DeprecatedString> socket_paths = socket_entry.split(','); + Vector<DeprecatedString> socket_perms = socket_permissions_entry.split(','); m_sockets.ensure_capacity(socket_paths.size()); // Need i here to iterate along with all other vectors. @@ -409,7 +409,7 @@ void Service::save_to(JsonObject& json) bool Service::is_enabled() const { - extern String g_system_mode; + extern DeprecatedString g_system_mode; return m_system_modes.contains_slow(g_system_mode); } diff --git a/Userland/Services/SystemServer/Service.h b/Userland/Services/SystemServer/Service.h index 79c2967838..9c9f73003b 100644 --- a/Userland/Services/SystemServer/Service.h +++ b/Userland/Services/SystemServer/Service.h @@ -6,8 +6,8 @@ #pragma once +#include <AK/DeprecatedString.h> #include <AK/RefPtr.h> -#include <AK/String.h> #include <LibCore/Account.h> #include <LibCore/ElapsedTimer.h> #include <LibCore/Notifier.h> @@ -40,7 +40,7 @@ private: /// requested by a service. struct SocketDescriptor { /// The path of the socket. - String path; + DeprecatedString path; /// File descriptor of the socket. -1 if the socket hasn't been opened. int fd { -1 }; /// File permissions of the socket. @@ -48,11 +48,11 @@ private: }; // Path to the executable. By default this is /bin/{m_name}. - String m_executable_path; + DeprecatedString m_executable_path; // Extra arguments, starting from argv[1], to pass when exec'ing. - Vector<String> m_extra_arguments; + Vector<DeprecatedString> m_extra_arguments; // File path to open as stdio fds. - String m_stdio_file_path; + DeprecatedString m_stdio_file_path; int m_priority { 1 }; // Whether we should re-launch it if it exits. bool m_keep_alive { false }; @@ -63,15 +63,15 @@ private: // Whether we should only spawn this service once somebody connects to the socket. bool m_lazy; // The name of the user we should run this service as. - String m_user; + DeprecatedString m_user; // The working directory in which to spawn the service. - String m_working_directory; + DeprecatedString m_working_directory; // System modes in which to run this service. By default, this is the graphical mode. - Vector<String> m_system_modes; + Vector<DeprecatedString> m_system_modes; // Whether several instances of this service can run at once. bool m_multi_instance { false }; // Environment variables to pass to the service. - Vector<String> m_environment; + Vector<DeprecatedString> m_environment; // Socket descriptors for this service. Vector<SocketDescriptor> m_sockets; diff --git a/Userland/Services/SystemServer/main.cpp b/Userland/Services/SystemServer/main.cpp index 7ca03237df..1b5dcf4406 100644 --- a/Userland/Services/SystemServer/main.cpp +++ b/Userland/Services/SystemServer/main.cpp @@ -29,7 +29,7 @@ #include <sys/wait.h> #include <unistd.h> -String g_system_mode = "graphical"; +DeprecatedString g_system_mode = "graphical"; NonnullRefPtrVector<Service> g_services; // NOTE: This handler ensures that the destructor of g_services is called. @@ -76,7 +76,7 @@ static ErrorOr<void> determine_system_mode() // Continue and assume "text" mode. return {}; } - const String system_mode = String::copy(f->read_all(), Chomp); + const DeprecatedString system_mode = DeprecatedString::copy(f->read_all(), Chomp); if (f->error()) { dbgln("Failed to read system_mode: {}", f->error_string()); // Continue and assume "text" mode. @@ -142,13 +142,13 @@ inline char offset_character_with_number(char base_char, u8 offset) return offsetted_char; } -static void create_devtmpfs_block_device(String name, mode_t mode, unsigned major, unsigned minor) +static void create_devtmpfs_block_device(DeprecatedString name, mode_t mode, unsigned major, unsigned minor) { if (auto rc = mknod(name.characters(), mode | S_IFBLK, makedev(major, minor)); rc < 0) VERIFY_NOT_REACHED(); } -static void create_devtmpfs_char_device(String name, mode_t mode, unsigned major, unsigned minor) +static void create_devtmpfs_char_device(DeprecatedString name, mode_t mode, unsigned major, unsigned minor) { if (auto rc = mknod(name.characters(), mode | S_IFCHR, makedev(major, minor)); rc < 0) VERIFY_NOT_REACHED(); @@ -203,22 +203,22 @@ static void populate_devtmpfs_devices_based_on_devctl() switch (major_number) { case 116: { if (!is_block_device) { - create_devtmpfs_char_device(String::formatted("/dev/audio/{}", minor_number), 0220, 116, minor_number); + create_devtmpfs_char_device(DeprecatedString::formatted("/dev/audio/{}", minor_number), 0220, 116, minor_number); break; } break; } case 28: { - create_devtmpfs_block_device(String::formatted("/dev/gpu/render{}", minor_number), 0666, 28, minor_number); + create_devtmpfs_block_device(DeprecatedString::formatted("/dev/gpu/render{}", minor_number), 0666, 28, minor_number); break; } case 226: { - create_devtmpfs_char_device(String::formatted("/dev/gpu/connector{}", minor_number), 0666, 226, minor_number); + create_devtmpfs_char_device(DeprecatedString::formatted("/dev/gpu/connector{}", minor_number), 0666, 226, minor_number); break; } case 229: { if (!is_block_device) { - create_devtmpfs_char_device(String::formatted("/dev/hvc0p{}", minor_number), 0666, major_number, minor_number); + create_devtmpfs_char_device(DeprecatedString::formatted("/dev/hvc0p{}", minor_number), 0666, major_number, minor_number); } break; } @@ -284,13 +284,13 @@ static void populate_devtmpfs_devices_based_on_devctl() } case 30: { if (!is_block_device) { - create_devtmpfs_char_device(String::formatted("/dev/kcov{}", minor_number), 0666, 30, minor_number); + create_devtmpfs_char_device(DeprecatedString::formatted("/dev/kcov{}", minor_number), 0666, 30, minor_number); } break; } case 3: { if (is_block_device) { - create_devtmpfs_block_device(String::formatted("/dev/hd{}", offset_character_with_number('a', minor_number)), 0600, 3, minor_number); + create_devtmpfs_block_device(DeprecatedString::formatted("/dev/hd{}", offset_character_with_number('a', minor_number)), 0600, 3, minor_number); } break; } diff --git a/Userland/Services/Taskbar/ClockWidget.cpp b/Userland/Services/Taskbar/ClockWidget.cpp index 8645b1cbe0..d8e05d9015 100644 --- a/Userland/Services/Taskbar/ClockWidget.cpp +++ b/Userland/Services/Taskbar/ClockWidget.cpp @@ -155,7 +155,7 @@ ClockWidget::ClockWidget() }; } -void ClockWidget::update_format(String const& format) +void ClockWidget::update_format(DeprecatedString const& format) { m_time_format = format; m_time_width = font().width(Core::DateTime::create(122, 2, 22, 22, 22, 22).to_string(format)); diff --git a/Userland/Services/Taskbar/ClockWidget.h b/Userland/Services/Taskbar/ClockWidget.h index a07971cb0f..fd5d46f253 100644 --- a/Userland/Services/Taskbar/ClockWidget.h +++ b/Userland/Services/Taskbar/ClockWidget.h @@ -24,7 +24,7 @@ class ClockWidget final : public GUI::Frame { public: virtual ~ClockWidget() override = default; - void update_format(String const&); + void update_format(DeprecatedString const&); private: ClockWidget(); @@ -45,7 +45,7 @@ private: void position_calendar_window(); void jump_to_current_date(); - String m_time_format; + DeprecatedString m_time_format; RefPtr<GUI::Window> m_calendar_window; RefPtr<GUI::Calendar> m_calendar; RefPtr<GUI::Button> m_next_date; diff --git a/Userland/Services/Taskbar/QuickLaunchWidget.cpp b/Userland/Services/Taskbar/QuickLaunchWidget.cpp index 854fa84756..85985ac924 100644 --- a/Userland/Services/Taskbar/QuickLaunchWidget.cpp +++ b/Userland/Services/Taskbar/QuickLaunchWidget.cpp @@ -57,7 +57,7 @@ GUI::Icon QuickLaunchEntryExecutable::icon() const return GUI::FileIconProvider::icon_for_executable(m_path); } -String QuickLaunchEntryExecutable::name() const +DeprecatedString QuickLaunchEntryExecutable::name() const { return LexicalPath { m_path }.basename(); } @@ -76,7 +76,7 @@ GUI::Icon QuickLaunchEntryFile::icon() const return GUI::FileIconProvider::icon_for_path(m_path); } -String QuickLaunchEntryFile::name() const +DeprecatedString QuickLaunchEntryFile::name() const { // '=' is a special character in config files return m_path; @@ -113,7 +113,7 @@ QuickLaunchWidget::QuickLaunchWidget() OwnPtr<QuickLaunchEntry> QuickLaunchEntry::create_from_config_value(StringView value) { if (!value.starts_with('/') && value.ends_with(".af"sv)) { - auto af_path = String::formatted("{}/{}", Desktop::AppFile::APP_FILES_DIRECTORY, value); + auto af_path = DeprecatedString::formatted("{}/{}", Desktop::AppFile::APP_FILES_DIRECTORY, value); return make<QuickLaunchEntryAppFile>(Desktop::AppFile::open(af_path)); } return create_from_path(value); @@ -135,12 +135,12 @@ OwnPtr<QuickLaunchEntry> QuickLaunchEntry::create_from_path(StringView path) return make<QuickLaunchEntryFile>(path); } -static String sanitize_entry_name(String const& name) +static DeprecatedString sanitize_entry_name(DeprecatedString const& name) { return name.replace(" "sv, ""sv, ReplaceMode::All).replace("="sv, ""sv, ReplaceMode::All); } -void QuickLaunchWidget::add_or_adjust_button(String const& button_name, NonnullOwnPtr<QuickLaunchEntry>&& entry) +void QuickLaunchWidget::add_or_adjust_button(DeprecatedString const& button_name, NonnullOwnPtr<QuickLaunchEntry>&& entry) { auto file_name_to_watch = entry->file_name_to_watch(); if (!file_name_to_watch.is_null()) { @@ -173,7 +173,7 @@ void QuickLaunchWidget::add_or_adjust_button(String const& button_name, NonnullO auto result = entry->launch(); if (result.is_error()) { // FIXME: This message box is displayed in a weird position - GUI::MessageBox::show_error(window(), String::formatted("Failed to open quick launch entry: {}", result.release_error())); + GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to open quick launch entry: {}", result.release_error())); } }; button->on_context_menu_request = [this, button_name](auto& context_menu_event) { @@ -182,7 +182,7 @@ void QuickLaunchWidget::add_or_adjust_button(String const& button_name, NonnullO }; } -void QuickLaunchWidget::config_key_was_removed(String const& domain, String const& group, String const& key) +void QuickLaunchWidget::config_key_was_removed(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key) { if (domain == "Taskbar" && group == quick_launch) { auto button = find_child_of_type_named<GUI::Button>(key); @@ -191,7 +191,7 @@ void QuickLaunchWidget::config_key_was_removed(String const& domain, String cons } } -void QuickLaunchWidget::config_string_did_change(String const& domain, String const& group, String const& key, String const& value) +void QuickLaunchWidget::config_string_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value) { if (domain == "Taskbar" && group == quick_launch) { auto entry = QuickLaunchEntry::create_from_config_value(value); diff --git a/Userland/Services/Taskbar/QuickLaunchWidget.h b/Userland/Services/Taskbar/QuickLaunchWidget.h index 54bffc3dc2..78a9bc19e0 100644 --- a/Userland/Services/Taskbar/QuickLaunchWidget.h +++ b/Userland/Services/Taskbar/QuickLaunchWidget.h @@ -19,8 +19,8 @@ public: virtual ~QuickLaunchEntry() = default; virtual ErrorOr<void> launch() const = 0; virtual GUI::Icon icon() const = 0; - virtual String name() const = 0; - virtual String file_name_to_watch() const = 0; + virtual DeprecatedString name() const = 0; + virtual DeprecatedString file_name_to_watch() const = 0; static OwnPtr<QuickLaunchEntry> create_from_config_value(StringView path); static OwnPtr<QuickLaunchEntry> create_from_path(StringView path); @@ -35,8 +35,8 @@ public: virtual ErrorOr<void> launch() const override; virtual GUI::Icon icon() const override { return m_app_file->icon(); } - virtual String name() const override { return m_app_file->name(); } - virtual String file_name_to_watch() const override { return {}; } + virtual DeprecatedString name() const override { return m_app_file->name(); } + virtual DeprecatedString file_name_to_watch() const override { return {}; } private: NonnullRefPtr<Desktop::AppFile> m_app_file; @@ -44,33 +44,33 @@ private: class QuickLaunchEntryExecutable : public QuickLaunchEntry { public: - explicit QuickLaunchEntryExecutable(String path) + explicit QuickLaunchEntryExecutable(DeprecatedString path) : m_path(move(path)) { } virtual ErrorOr<void> launch() const override; virtual GUI::Icon icon() const override; - virtual String name() const override; - virtual String file_name_to_watch() const override { return m_path; } + virtual DeprecatedString name() const override; + virtual DeprecatedString file_name_to_watch() const override { return m_path; } private: - String m_path; + DeprecatedString m_path; }; class QuickLaunchEntryFile : public QuickLaunchEntry { public: - explicit QuickLaunchEntryFile(String path) + explicit QuickLaunchEntryFile(DeprecatedString path) : m_path(move(path)) { } virtual ErrorOr<void> launch() const override; virtual GUI::Icon icon() const override; - virtual String name() const override; - virtual String file_name_to_watch() const override { return m_path; } + virtual DeprecatedString name() const override; + virtual DeprecatedString file_name_to_watch() const override { return m_path; } private: - String m_path; + DeprecatedString m_path; }; class QuickLaunchWidget : public GUI::Frame @@ -80,18 +80,18 @@ class QuickLaunchWidget : public GUI::Frame public: virtual ~QuickLaunchWidget() override = default; - virtual void config_key_was_removed(String const&, String const&, String const&) override; - virtual void config_string_did_change(String const&, String const&, String const&, String const&) override; + virtual void config_key_was_removed(DeprecatedString const&, DeprecatedString const&, DeprecatedString const&) override; + virtual void config_string_did_change(DeprecatedString const&, DeprecatedString const&, DeprecatedString const&, DeprecatedString const&) override; virtual void drag_enter_event(GUI::DragEvent&) override; virtual void drop_event(GUI::DropEvent&) override; private: QuickLaunchWidget(); - void add_or_adjust_button(String const&, NonnullOwnPtr<QuickLaunchEntry>&&); + void add_or_adjust_button(DeprecatedString const&, NonnullOwnPtr<QuickLaunchEntry>&&); RefPtr<GUI::Menu> m_context_menu; RefPtr<GUI::Action> m_context_menu_default_action; - String m_context_menu_app_name; + DeprecatedString m_context_menu_app_name; RefPtr<Core::FileWatcher> m_watcher; }; diff --git a/Userland/Services/Taskbar/ShutdownDialog.cpp b/Userland/Services/Taskbar/ShutdownDialog.cpp index 1364eea969..e0c23dcfe3 100644 --- a/Userland/Services/Taskbar/ShutdownDialog.cpp +++ b/Userland/Services/Taskbar/ShutdownDialog.cpp @@ -5,7 +5,7 @@ */ #include "ShutdownDialog.h" -#include <AK/String.h> +#include <AK/DeprecatedString.h> #include <AK/Vector.h> #include <LibGUI/BoxLayout.h> #include <LibGUI/Button.h> @@ -17,7 +17,7 @@ #include <LibGfx/Font/FontDatabase.h> struct Option { - String title; + DeprecatedString title; Vector<char const*> cmd; bool enabled; bool default_action; diff --git a/Userland/Services/Taskbar/TaskbarWindow.cpp b/Userland/Services/Taskbar/TaskbarWindow.cpp index 32867914ad..bcbaead65a 100644 --- a/Userland/Services/Taskbar/TaskbarWindow.cpp +++ b/Userland/Services/Taskbar/TaskbarWindow.cpp @@ -87,7 +87,7 @@ TaskbarWindow::TaskbarWindow() m_show_desktop_button->on_click = TaskbarWindow::show_desktop_button_clicked; main_widget.add_child(*m_show_desktop_button); - auto af_path = String::formatted("{}/{}", Desktop::AppFile::APP_FILES_DIRECTORY, "Assistant.af"); + auto af_path = DeprecatedString::formatted("{}/{}", Desktop::AppFile::APP_FILES_DIRECTORY, "Assistant.af"); m_assistant_app_file = Desktop::AppFile::open(af_path); } @@ -106,7 +106,7 @@ void TaskbarWindow::add_system_menu(NonnullRefPtr<GUI::Menu> system_menu) main->insert_child_before(*m_start_button, *m_quick_launch); } -void TaskbarWindow::config_string_did_change(String const& domain, String const& group, String const& key, String const& value) +void TaskbarWindow::config_string_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value) { if (domain == "Taskbar" && group == "Clock" && key == "TimeFormat") { m_clock_widget->update_format(value); diff --git a/Userland/Services/Taskbar/TaskbarWindow.h b/Userland/Services/Taskbar/TaskbarWindow.h index e5f1b30d77..3b25756b97 100644 --- a/Userland/Services/Taskbar/TaskbarWindow.h +++ b/Userland/Services/Taskbar/TaskbarWindow.h @@ -26,14 +26,14 @@ public: static int taskbar_height() { return 27; } static int taskbar_icon_size() { return 16; } - virtual void config_string_did_change(String const&, String const&, String const&, String const&) override; + virtual void config_string_did_change(DeprecatedString const&, DeprecatedString const&, DeprecatedString const&, DeprecatedString const&) override; virtual void add_system_menu(NonnullRefPtr<GUI::Menu> system_menu); private: explicit TaskbarWindow(); static void show_desktop_button_clicked(unsigned); static void toggle_show_desktop(); - void set_quick_launch_button_data(GUI::Button&, String const&, NonnullRefPtr<Desktop::AppFile>); + void set_quick_launch_button_data(GUI::Button&, DeprecatedString const&, NonnullRefPtr<Desktop::AppFile>); void on_screen_rects_change(Vector<Gfx::IntRect, 4> const&, size_t); NonnullRefPtr<GUI::Button> create_button(WindowIdentifier const&); void add_window_button(::Window&, WindowIdentifier const&); diff --git a/Userland/Services/Taskbar/WindowList.h b/Userland/Services/Taskbar/WindowList.h index 617c69f4d5..84b4025334 100644 --- a/Userland/Services/Taskbar/WindowList.h +++ b/Userland/Services/Taskbar/WindowList.h @@ -7,8 +7,8 @@ #pragma once #include "WindowIdentifier.h" +#include <AK/DeprecatedString.h> #include <AK/HashMap.h> -#include <AK/String.h> #include <LibGUI/Button.h> #include <LibGfx/Rect.h> @@ -27,8 +27,8 @@ public: WindowIdentifier const& identifier() const { return m_identifier; } - String title() const { return m_title; } - void set_title(String const& title) { m_title = title; } + DeprecatedString title() const { return m_title; } + void set_title(DeprecatedString const& title) { m_title = title; } Gfx::IntRect rect() const { return m_rect; } void set_rect(Gfx::IntRect const& rect) { m_rect = rect; } @@ -68,7 +68,7 @@ public: private: WindowIdentifier m_identifier; - String m_title; + DeprecatedString m_title; Gfx::IntRect m_rect; RefPtr<GUI::Button> m_button; RefPtr<Gfx::Bitmap> m_icon; diff --git a/Userland/Services/Taskbar/main.cpp b/Userland/Services/Taskbar/main.cpp index 5fa1aaf88d..1dede77962 100644 --- a/Userland/Services/Taskbar/main.cpp +++ b/Userland/Services/Taskbar/main.cpp @@ -34,7 +34,7 @@ #include <sys/wait.h> #include <unistd.h> -static ErrorOr<Vector<String>> discover_apps_and_categories(); +static ErrorOr<Vector<DeprecatedString>> discover_apps_and_categories(); static ErrorOr<NonnullRefPtr<GUI::Menu>> build_system_menu(GUI::Window&); ErrorOr<int> serenity_main(Main::Arguments arguments) @@ -75,10 +75,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) } struct AppMetadata { - String executable; - String name; - String category; - String working_directory; + DeprecatedString executable; + DeprecatedString name; + DeprecatedString category; + DeprecatedString working_directory; GUI::Icon icon; bool run_in_terminal; bool requires_root; @@ -91,9 +91,9 @@ Vector<Gfx::SystemThemeMetaData> g_themes; RefPtr<GUI::Menu> g_themes_menu; GUI::ActionGroup g_themes_group; -ErrorOr<Vector<String>> discover_apps_and_categories() +ErrorOr<Vector<DeprecatedString>> discover_apps_and_categories() { - HashTable<String> seen_app_categories; + HashTable<DeprecatedString> seen_app_categories; Desktop::AppFile::for_each([&](auto af) { if (access(af->executable().characters(), X_OK) == 0) { g_apps.append({ af->executable(), af->name(), af->category(), af->working_directory(), af->icon(), af->run_in_terminal(), af->requires_root() }); @@ -102,7 +102,7 @@ ErrorOr<Vector<String>> discover_apps_and_categories() }); quick_sort(g_apps, [](auto& a, auto& b) { return a.name < b.name; }); - Vector<String> sorted_app_categories; + Vector<DeprecatedString> sorted_app_categories; TRY(sorted_app_categories.try_ensure_capacity(seen_app_categories.size())); for (auto const& category : seen_app_categories) sorted_app_categories.unchecked_append(category); @@ -113,7 +113,7 @@ ErrorOr<Vector<String>> discover_apps_and_categories() ErrorOr<NonnullRefPtr<GUI::Menu>> build_system_menu(GUI::Window& window) { - Vector<String> const sorted_app_categories = TRY(discover_apps_and_categories()); + Vector<DeprecatedString> const sorted_app_categories = TRY(discover_apps_and_categories()); auto system_menu = TRY(GUI::Menu::try_create("\xE2\x9A\xA1")); // HIGH VOLTAGE SIGN system_menu->add_action(GUI::Action::create("&About SerenityOS", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/ladyball.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) { @@ -124,13 +124,13 @@ ErrorOr<NonnullRefPtr<GUI::Menu>> build_system_menu(GUI::Window& window) // First we construct all the necessary app category submenus. auto category_icons = TRY(Core::ConfigFile::open("/res/icons/SystemMenu.ini")); - HashMap<String, NonnullRefPtr<GUI::Menu>> app_category_menus; + HashMap<DeprecatedString, NonnullRefPtr<GUI::Menu>> app_category_menus; - Function<void(String const&)> create_category_menu; - create_category_menu = [&](String const& category) { + Function<void(DeprecatedString const&)> create_category_menu; + create_category_menu = [&](DeprecatedString const& category) { if (app_category_menus.contains(category)) return; - String parent_category, child_category = category; + DeprecatedString parent_category, child_category = category; for (ssize_t i = category.length() - 1; i >= 0; i--) { if (category[i] == '/') { parent_category = category.substring(0, i); @@ -183,7 +183,7 @@ ErrorOr<NonnullRefPtr<GUI::Menu>> build_system_menu(GUI::Window& window) dbgln("Activated app with ID {}", app_identifier); auto& app = g_apps[app_identifier]; char const* argv[4] { nullptr, nullptr, nullptr, nullptr }; - auto pls_with_executable = String::formatted("/bin/pls {}", app.executable); + auto pls_with_executable = DeprecatedString::formatted("/bin/pls {}", app.executable); if (app.run_in_terminal && !app.requires_root) { argv[0] = "/bin/Terminal"; argv[1] = "-e"; diff --git a/Userland/Services/TelnetServer/Client.cpp b/Userland/Services/TelnetServer/Client.cpp index b8a412c18d..77ff237762 100644 --- a/Userland/Services/TelnetServer/Client.cpp +++ b/Userland/Services/TelnetServer/Client.cpp @@ -7,8 +7,8 @@ #include "Client.h" #include <AK/ByteBuffer.h> +#include <AK/DeprecatedString.h> #include <AK/MemoryStream.h> -#include <AK/String.h> #include <AK/StringBuilder.h> #include <AK/StringView.h> #include <AK/Types.h> diff --git a/Userland/Services/TelnetServer/Client.h b/Userland/Services/TelnetServer/Client.h index 70a2bb1106..af1bdc262a 100644 --- a/Userland/Services/TelnetServer/Client.h +++ b/Userland/Services/TelnetServer/Client.h @@ -6,7 +6,7 @@ #pragma once -#include <AK/String.h> +#include <AK/DeprecatedString.h> #include <AK/StringView.h> #include <AK/Types.h> #include <LibCore/Notifier.h> diff --git a/Userland/Services/TelnetServer/Command.h b/Userland/Services/TelnetServer/Command.h index 16fd3ebeda..8d3f9a8429 100644 --- a/Userland/Services/TelnetServer/Command.h +++ b/Userland/Services/TelnetServer/Command.h @@ -6,7 +6,7 @@ #pragma once -#include <AK/String.h> +#include <AK/DeprecatedString.h> #include <AK/StringBuilder.h> #include <AK/Types.h> @@ -21,7 +21,7 @@ struct Command { u8 command; u8 subcommand; - String to_string() const + DeprecatedString to_string() const { StringBuilder builder; @@ -39,7 +39,7 @@ struct Command { builder.append("DONT"sv); break; default: - builder.append(String::formatted("UNKNOWN<{:02x}>", command)); + builder.append(DeprecatedString::formatted("UNKNOWN<{:02x}>", command)); break; } @@ -53,7 +53,7 @@ struct Command { builder.append("SUPPRESS_GO_AHEAD"sv); break; default: - builder.append(String::formatted("UNKNOWN<{:02x}>", subcommand)); + builder.append(DeprecatedString::formatted("UNKNOWN<{:02x}>", subcommand)); break; } diff --git a/Userland/Services/TelnetServer/Parser.cpp b/Userland/Services/TelnetServer/Parser.cpp index 051d90ceab..78a5b1dfd2 100644 --- a/Userland/Services/TelnetServer/Parser.cpp +++ b/Userland/Services/TelnetServer/Parser.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include <AK/String.h> +#include <AK/DeprecatedString.h> #include <AK/Types.h> #include "Parser.h" diff --git a/Userland/Services/TelnetServer/Parser.h b/Userland/Services/TelnetServer/Parser.h index de0990aed1..22c2deee55 100644 --- a/Userland/Services/TelnetServer/Parser.h +++ b/Userland/Services/TelnetServer/Parser.h @@ -6,8 +6,8 @@ #pragma once +#include <AK/DeprecatedString.h> #include <AK/Function.h> -#include <AK/String.h> #include <AK/StringView.h> #include <AK/Types.h> @@ -31,7 +31,7 @@ protected: Error, }; - void write(String const& str); + void write(DeprecatedString const& str); private: State m_state { State::Free }; diff --git a/Userland/Services/TelnetServer/main.cpp b/Userland/Services/TelnetServer/main.cpp index b210e34305..fceae0fd2a 100644 --- a/Userland/Services/TelnetServer/main.cpp +++ b/Userland/Services/TelnetServer/main.cpp @@ -5,8 +5,8 @@ */ #include "Client.h" +#include <AK/DeprecatedString.h> #include <AK/HashMap.h> -#include <AK/String.h> #include <AK/Types.h> #include <LibCore/ArgsParser.h> #include <LibCore/EventLoop.h> @@ -19,7 +19,7 @@ #include <sys/ioctl.h> #include <unistd.h> -static void run_command(int ptm_fd, String command) +static void run_command(int ptm_fd, DeprecatedString command) { pid_t pid = fork(); if (pid == 0) { diff --git a/Userland/Services/WebContent/ConnectionFromClient.cpp b/Userland/Services/WebContent/ConnectionFromClient.cpp index 96802acd7d..2932d3201e 100644 --- a/Userland/Services/WebContent/ConnectionFromClient.cpp +++ b/Userland/Services/WebContent/ConnectionFromClient.cpp @@ -60,7 +60,7 @@ Web::Page const& ConnectionFromClient::page() const return m_page_host->page(); } -void ConnectionFromClient::connect_to_webdriver(String const& webdriver_ipc_path) +void ConnectionFromClient::connect_to_webdriver(DeprecatedString const& webdriver_ipc_path) { // FIXME: Propagate this error back to the browser. if (auto result = m_page_host->connect_to_webdriver(webdriver_ipc_path); result.is_error()) @@ -74,7 +74,7 @@ void ConnectionFromClient::update_system_theme(Core::AnonymousBuffer const& them m_page_host->set_palette_impl(*impl); } -void ConnectionFromClient::update_system_fonts(String const& default_font_query, String const& fixed_width_font_query, String const& window_title_font_query) +void ConnectionFromClient::update_system_fonts(DeprecatedString const& default_font_query, DeprecatedString const& fixed_width_font_query, DeprecatedString const& window_title_font_query) { Gfx::FontDatabase::set_default_font_query(default_font_query); Gfx::FontDatabase::set_fixed_width_font_query(fixed_width_font_query); @@ -91,11 +91,11 @@ void ConnectionFromClient::load_url(const URL& url) dbgln_if(SPAM_DEBUG, "handle: WebContentServer::LoadURL: url={}", url); #if defined(AK_OS_SERENITY) - String process_name; + DeprecatedString process_name; if (url.host().is_empty()) process_name = "WebContent"; else - process_name = String::formatted("WebContent: {}", url.host()); + process_name = DeprecatedString::formatted("WebContent: {}", url.host()); pthread_setname_np(pthread_self(), process_name.characters()); #endif @@ -103,7 +103,7 @@ void ConnectionFromClient::load_url(const URL& url) page().load(url); } -void ConnectionFromClient::load_html(String const& html, const URL& url) +void ConnectionFromClient::load_html(DeprecatedString const& html, const URL& url) { dbgln_if(SPAM_DEBUG, "handle: WebContentServer::LoadHTML: html={}, url={}", html, url); page().load_html(html, url); @@ -195,7 +195,7 @@ void ConnectionFromClient::report_finished_handling_input_event(bool event_was_h async_did_finish_handling_input_event(event_was_handled); } -void ConnectionFromClient::debug_request(String const& request, String const& argument) +void ConnectionFromClient::debug_request(DeprecatedString const& request, DeprecatedString const& argument) { if (request == "dump-dom-tree") { if (auto* doc = page().top_level_browsing_context().active_document()) @@ -301,7 +301,7 @@ Messages::WebContentServer::InspectDomNodeResponse ConnectionFromClient::inspect if (!element.computed_css_values()) return { false, "", "", "", "" }; - auto serialize_json = [](Web::CSS::StyleProperties const& properties) -> String { + auto serialize_json = [](Web::CSS::StyleProperties const& properties) -> DeprecatedString { StringBuilder builder; auto serializer = MUST(JsonObjectSerializer<>::try_create(builder)); @@ -313,10 +313,10 @@ Messages::WebContentServer::InspectDomNodeResponse ConnectionFromClient::inspect return builder.to_string(); }; - auto serialize_custom_properties_json = [](Web::DOM::Element const& element) -> String { + auto serialize_custom_properties_json = [](Web::DOM::Element const& element) -> DeprecatedString { StringBuilder builder; auto serializer = MUST(JsonObjectSerializer<>::try_create(builder)); - HashTable<String> seen_properties; + HashTable<DeprecatedString> seen_properties; auto const* element_to_check = &element; while (element_to_check) { @@ -334,7 +334,7 @@ Messages::WebContentServer::InspectDomNodeResponse ConnectionFromClient::inspect return builder.to_string(); }; - auto serialize_node_box_sizing_json = [](Web::Layout::Node const* layout_node) -> String { + auto serialize_node_box_sizing_json = [](Web::Layout::Node const* layout_node) -> DeprecatedString { if (!layout_node || !layout_node->is_box()) { return "{}"; } @@ -375,17 +375,17 @@ Messages::WebContentServer::InspectDomNodeResponse ConnectionFromClient::inspect // in a format we can use. So, we run the StyleComputer again to get the specified // values, and have to ignore the computed values and custom properties. auto pseudo_element_style = page().focused_context().active_document()->style_computer().compute_style(element, pseudo_element); - String computed_values = serialize_json(pseudo_element_style); - String resolved_values = "{}"; - String custom_properties_json = "{}"; - String node_box_sizing_json = serialize_node_box_sizing_json(pseudo_element_node.ptr()); + DeprecatedString computed_values = serialize_json(pseudo_element_style); + DeprecatedString resolved_values = "{}"; + DeprecatedString custom_properties_json = "{}"; + DeprecatedString node_box_sizing_json = serialize_node_box_sizing_json(pseudo_element_node.ptr()); return { true, computed_values, resolved_values, custom_properties_json, node_box_sizing_json }; } - String computed_values = serialize_json(*element.computed_css_values()); - String resolved_values_json = serialize_json(element.resolved_css_values()); - String custom_properties_json = serialize_custom_properties_json(element); - String node_box_sizing_json = serialize_node_box_sizing_json(element.layout_node()); + DeprecatedString computed_values = serialize_json(*element.computed_css_values()); + DeprecatedString resolved_values_json = serialize_json(element.resolved_css_values()); + DeprecatedString custom_properties_json = serialize_custom_properties_json(element); + DeprecatedString node_box_sizing_json = serialize_node_box_sizing_json(element.layout_node()); return { true, computed_values, resolved_values_json, custom_properties_json, node_box_sizing_json }; } @@ -415,13 +415,13 @@ void ConnectionFromClient::initialize_js_console(Badge<PageHost>) console_object.console().set_client(*m_console_client.ptr()); } -void ConnectionFromClient::js_console_input(String const& js_source) +void ConnectionFromClient::js_console_input(DeprecatedString const& js_source) { if (m_console_client) m_console_client->handle_input(js_source); } -void ConnectionFromClient::run_javascript(String const& js_source) +void ConnectionFromClient::run_javascript(DeprecatedString const& js_source) { auto* active_document = page().top_level_browsing_context().active_document(); @@ -484,27 +484,27 @@ Messages::WebContentServer::DumpLayoutTreeResponse ConnectionFromClient::dump_la { auto* document = page().top_level_browsing_context().active_document(); if (!document) - return String { "(no DOM tree)" }; + return DeprecatedString { "(no DOM tree)" }; auto* layout_root = document->layout_node(); if (!layout_root) - return String { "(no layout tree)" }; + return DeprecatedString { "(no layout tree)" }; StringBuilder builder; Web::dump_tree(builder, *layout_root); return builder.to_string(); } -void ConnectionFromClient::set_content_filters(Vector<String> const& filters) +void ConnectionFromClient::set_content_filters(Vector<DeprecatedString> const& filters) { for (auto& filter : filters) Web::ContentFilter::the().add_pattern(filter); } -void ConnectionFromClient::set_proxy_mappings(Vector<String> const& proxies, HashMap<String, size_t> const& mappings) +void ConnectionFromClient::set_proxy_mappings(Vector<DeprecatedString> const& proxies, HashMap<DeprecatedString, size_t> const& mappings) { auto keys = mappings.keys(); quick_sort(keys, [&](auto& a, auto& b) { return a.length() < b.length(); }); - OrderedHashMap<String, size_t> sorted_mappings; + OrderedHashMap<DeprecatedString, size_t> sorted_mappings; for (auto& key : keys) { auto value = *mappings.get(key); if (value >= proxies.size()) @@ -590,7 +590,7 @@ void ConnectionFromClient::confirm_closed(bool accepted) m_page_host->confirm_closed(accepted); } -void ConnectionFromClient::prompt_closed(String const& response) +void ConnectionFromClient::prompt_closed(DeprecatedString const& response) { m_page_host->prompt_closed(response); } diff --git a/Userland/Services/WebContent/ConnectionFromClient.h b/Userland/Services/WebContent/ConnectionFromClient.h index 7c4bb6fd38..5ee19931db 100644 --- a/Userland/Services/WebContent/ConnectionFromClient.h +++ b/Userland/Services/WebContent/ConnectionFromClient.h @@ -47,12 +47,12 @@ private: Web::Page& page(); Web::Page const& page() const; - virtual void connect_to_webdriver(String const& webdriver_ipc_path) override; + virtual void connect_to_webdriver(DeprecatedString const& webdriver_ipc_path) override; virtual void update_system_theme(Core::AnonymousBuffer const&) override; - virtual void update_system_fonts(String const&, String const&, String const&) override; + virtual void update_system_fonts(DeprecatedString const&, DeprecatedString const&, DeprecatedString const&) override; virtual void update_screen_rects(Vector<Gfx::IntRect> const&, u32) override; virtual void load_url(URL const&) override; - virtual void load_html(String const&, URL const&) override; + virtual void load_html(DeprecatedString const&, URL const&) override; virtual void paint(Gfx::IntRect const&, i32) override; virtual void set_viewport_rect(Gfx::IntRect const&) override; virtual void mouse_down(Gfx::IntPoint const&, unsigned, unsigned, unsigned) override; @@ -64,14 +64,14 @@ private: virtual void key_up(i32, unsigned, u32) override; virtual void add_backing_store(i32, Gfx::ShareableBitmap const&) override; virtual void remove_backing_store(i32) override; - virtual void debug_request(String const&, String const&) override; + virtual void debug_request(DeprecatedString const&, DeprecatedString const&) override; virtual void get_source() override; virtual void inspect_dom_tree() override; virtual Messages::WebContentServer::InspectDomNodeResponse inspect_dom_node(i32 node_id, Optional<Web::CSS::Selector::PseudoElement> const& pseudo_element) override; virtual Messages::WebContentServer::GetHoveredNodeIdResponse get_hovered_node_id() override; virtual Messages::WebContentServer::DumpLayoutTreeResponse dump_layout_tree() override; - virtual void set_content_filters(Vector<String> const&) override; - virtual void set_proxy_mappings(Vector<String> const&, HashMap<String, size_t> const&) override; + virtual void set_content_filters(Vector<DeprecatedString> const&) override; + virtual void set_proxy_mappings(Vector<DeprecatedString> const&, HashMap<DeprecatedString, size_t> const&) override; virtual void set_preferred_color_scheme(Web::CSS::PreferredColorScheme const&) override; virtual void set_has_focus(bool) override; virtual void set_is_scripting_enabled(bool) override; @@ -80,13 +80,13 @@ private: virtual void handle_file_return(i32 error, Optional<IPC::File> const& file, i32 request_id) override; virtual void set_system_visibility_state(bool visible) override; - virtual void js_console_input(String const&) override; - virtual void run_javascript(String const&) override; + virtual void js_console_input(DeprecatedString const&) override; + virtual void run_javascript(DeprecatedString const&) override; virtual void js_console_request_messages(i32) override; virtual void alert_closed() override; virtual void confirm_closed(bool accepted) override; - virtual void prompt_closed(String const& response) override; + virtual void prompt_closed(DeprecatedString const& response) override; virtual Messages::WebContentServer::TakeDocumentScreenshotResponse take_document_screenshot() override; diff --git a/Userland/Services/WebContent/PageHost.cpp b/Userland/Services/WebContent/PageHost.cpp index d4a3c8e044..d57f1443a5 100644 --- a/Userland/Services/WebContent/PageHost.cpp +++ b/Userland/Services/WebContent/PageHost.cpp @@ -89,7 +89,7 @@ void PageHost::set_window_size(Gfx::IntSize const& size) page().set_window_size(size); } -ErrorOr<void> PageHost::connect_to_webdriver(String const& webdriver_ipc_path) +ErrorOr<void> PageHost::connect_to_webdriver(DeprecatedString const& webdriver_ipc_path) { VERIFY(!m_webdriver); m_webdriver = TRY(WebDriverConnection::connect(*this, webdriver_ipc_path)); @@ -158,7 +158,7 @@ void PageHost::page_did_layout() m_client.async_did_layout(m_content_size); } -void PageHost::page_did_change_title(String const& title) +void PageHost::page_did_change_title(DeprecatedString const& title) { m_client.async_did_change_title(title); } @@ -223,7 +223,7 @@ void PageHost::page_did_request_scroll_into_view(Gfx::IntRect const& rect) m_client.async_did_request_scroll_into_view(rect); } -void PageHost::page_did_enter_tooltip_area(Gfx::IntPoint const& content_position, String const& title) +void PageHost::page_did_enter_tooltip_area(Gfx::IntPoint const& content_position, DeprecatedString const& title) { m_client.async_did_enter_tooltip_area(content_position, title); } @@ -243,12 +243,12 @@ void PageHost::page_did_unhover_link() m_client.async_did_unhover_link(); } -void PageHost::page_did_click_link(const URL& url, String const& target, unsigned modifiers) +void PageHost::page_did_click_link(const URL& url, DeprecatedString const& target, unsigned modifiers) { m_client.async_did_click_link(url, target, modifiers); } -void PageHost::page_did_middle_click_link(const URL& url, [[maybe_unused]] String const& target, [[maybe_unused]] unsigned modifiers) +void PageHost::page_did_middle_click_link(const URL& url, [[maybe_unused]] DeprecatedString const& target, [[maybe_unused]] unsigned modifiers) { m_client.async_did_middle_click_link(url, target, modifiers); } @@ -273,12 +273,12 @@ void PageHost::page_did_request_context_menu(Gfx::IntPoint const& content_positi m_client.async_did_request_context_menu(content_position); } -void PageHost::page_did_request_link_context_menu(Gfx::IntPoint const& content_position, const URL& url, String const& target, unsigned modifiers) +void PageHost::page_did_request_link_context_menu(Gfx::IntPoint const& content_position, const URL& url, DeprecatedString const& target, unsigned modifiers) { m_client.async_did_request_link_context_menu(content_position, url, target, modifiers); } -void PageHost::page_did_request_alert(String const& message) +void PageHost::page_did_request_alert(DeprecatedString const& message) { m_client.async_did_request_alert(message); } @@ -288,7 +288,7 @@ void PageHost::alert_closed() page().alert_closed(); } -void PageHost::page_did_request_confirm(String const& message) +void PageHost::page_did_request_confirm(DeprecatedString const& message) { m_client.async_did_request_confirm(message); } @@ -298,17 +298,17 @@ void PageHost::confirm_closed(bool accepted) page().confirm_closed(accepted); } -void PageHost::page_did_request_prompt(String const& message, String const& default_) +void PageHost::page_did_request_prompt(DeprecatedString const& message, DeprecatedString const& default_) { m_client.async_did_request_prompt(message, default_); } -void PageHost::page_did_request_set_prompt_text(String const& text) +void PageHost::page_did_request_set_prompt_text(DeprecatedString const& text) { m_client.async_did_request_set_prompt_text(text); } -void PageHost::prompt_closed(String response) +void PageHost::prompt_closed(DeprecatedString response) { page().prompt_closed(move(response)); } @@ -328,7 +328,7 @@ void PageHost::page_did_change_favicon(Gfx::Bitmap const& favicon) m_client.async_did_change_favicon(favicon.to_shareable_bitmap()); } -void PageHost::page_did_request_image_context_menu(Gfx::IntPoint const& content_position, const URL& url, String const& target, unsigned modifiers, Gfx::Bitmap const* bitmap_pointer) +void PageHost::page_did_request_image_context_menu(Gfx::IntPoint const& content_position, const URL& url, DeprecatedString const& target, unsigned modifiers, Gfx::Bitmap const* bitmap_pointer) { auto bitmap = bitmap_pointer ? bitmap_pointer->to_shareable_bitmap() : Gfx::ShareableBitmap(); m_client.async_did_request_image_context_menu(content_position, url, target, modifiers, bitmap); @@ -339,12 +339,12 @@ Vector<Web::Cookie::Cookie> PageHost::page_did_request_all_cookies(URL const& ur return m_client.did_request_all_cookies(url); } -Optional<Web::Cookie::Cookie> PageHost::page_did_request_named_cookie(URL const& url, String const& name) +Optional<Web::Cookie::Cookie> PageHost::page_did_request_named_cookie(URL const& url, DeprecatedString const& name) { return m_client.did_request_named_cookie(url, name); } -String PageHost::page_did_request_cookie(const URL& url, Web::Cookie::Source source) +DeprecatedString PageHost::page_did_request_cookie(const URL& url, Web::Cookie::Source source) { auto response = m_client.send_sync_but_allow_failure<Messages::WebContentClient::DidRequestCookie>(move(url), static_cast<u8>(source)); if (!response) { diff --git a/Userland/Services/WebContent/PageHost.h b/Userland/Services/WebContent/PageHost.h index 524ee8484f..510eb8524c 100644 --- a/Userland/Services/WebContent/PageHost.h +++ b/Userland/Services/WebContent/PageHost.h @@ -40,11 +40,11 @@ public: Gfx::IntSize const& content_size() const { return m_content_size; } - ErrorOr<void> connect_to_webdriver(String const& webdriver_ipc_path); + ErrorOr<void> connect_to_webdriver(DeprecatedString const& webdriver_ipc_path); void alert_closed(); void confirm_closed(bool accepted); - void prompt_closed(String response); + void prompt_closed(DeprecatedString response); private: // ^PageClient @@ -56,7 +56,7 @@ private: virtual void page_did_change_selection() override; virtual void page_did_request_cursor_change(Gfx::StandardCursor) override; virtual void page_did_layout() override; - virtual void page_did_change_title(String const&) override; + virtual void page_did_change_title(DeprecatedString const&) override; virtual void page_did_request_navigate_back() override; virtual void page_did_request_navigate_forward() override; virtual void page_did_request_refresh() override; @@ -69,28 +69,28 @@ private: virtual void page_did_request_scroll(i32, i32) override; virtual void page_did_request_scroll_to(Gfx::IntPoint const&) override; virtual void page_did_request_scroll_into_view(Gfx::IntRect const&) override; - virtual void page_did_enter_tooltip_area(Gfx::IntPoint const&, String const&) override; + virtual void page_did_enter_tooltip_area(Gfx::IntPoint const&, DeprecatedString const&) override; virtual void page_did_leave_tooltip_area() override; virtual void page_did_hover_link(const URL&) override; virtual void page_did_unhover_link() override; - virtual void page_did_click_link(const URL&, String const& target, unsigned modifiers) override; - virtual void page_did_middle_click_link(const URL&, String const& target, unsigned modifiers) override; + virtual void page_did_click_link(const URL&, DeprecatedString const& target, unsigned modifiers) override; + virtual void page_did_middle_click_link(const URL&, DeprecatedString const& target, unsigned modifiers) override; virtual void page_did_request_context_menu(Gfx::IntPoint const&) override; - virtual void page_did_request_link_context_menu(Gfx::IntPoint const&, const URL&, String const& target, unsigned modifiers) override; + virtual void page_did_request_link_context_menu(Gfx::IntPoint const&, const URL&, DeprecatedString const& target, unsigned modifiers) override; virtual void page_did_start_loading(const URL&, bool) override; virtual void page_did_create_main_document() override; virtual void page_did_finish_loading(const URL&) override; - virtual void page_did_request_alert(String const&) override; - virtual void page_did_request_confirm(String const&) override; - virtual void page_did_request_prompt(String const&, String const&) override; - virtual void page_did_request_set_prompt_text(String const&) override; + virtual void page_did_request_alert(DeprecatedString const&) override; + virtual void page_did_request_confirm(DeprecatedString const&) override; + virtual void page_did_request_prompt(DeprecatedString const&, DeprecatedString const&) override; + virtual void page_did_request_set_prompt_text(DeprecatedString const&) override; virtual void page_did_request_accept_dialog() override; virtual void page_did_request_dismiss_dialog() override; virtual void page_did_change_favicon(Gfx::Bitmap const&) override; - virtual void page_did_request_image_context_menu(Gfx::IntPoint const&, const URL&, String const& target, unsigned modifiers, Gfx::Bitmap const*) override; + virtual void page_did_request_image_context_menu(Gfx::IntPoint const&, const URL&, DeprecatedString const& target, unsigned modifiers, Gfx::Bitmap const*) override; virtual Vector<Web::Cookie::Cookie> page_did_request_all_cookies(URL const&) override; - virtual Optional<Web::Cookie::Cookie> page_did_request_named_cookie(URL const&, String const&) override; - virtual String page_did_request_cookie(const URL&, Web::Cookie::Source) override; + virtual Optional<Web::Cookie::Cookie> page_did_request_named_cookie(URL const&, DeprecatedString const&) override; + virtual DeprecatedString page_did_request_cookie(const URL&, Web::Cookie::Source) override; virtual void page_did_set_cookie(const URL&, Web::Cookie::ParsedCookie const&, Web::Cookie::Source) override; virtual void page_did_update_cookie(URL const&, Web::Cookie::Cookie) override; virtual void page_did_update_resource_count(i32) override; diff --git a/Userland/Services/WebContent/WebContentClient.ipc b/Userland/Services/WebContent/WebContentClient.ipc index 28a413a83d..6f5af5ee37 100644 --- a/Userland/Services/WebContent/WebContentClient.ipc +++ b/Userland/Services/WebContent/WebContentClient.ipc @@ -16,32 +16,32 @@ endpoint WebContentClient did_change_selection() =| did_request_cursor_change(i32 cursor_type) =| did_layout(Gfx::IntSize content_size) =| - did_change_title(String title) =| + did_change_title(DeprecatedString title) =| did_request_scroll(i32 x_delta, i32 y_delta) =| did_request_scroll_to(Gfx::IntPoint scroll_position) =| did_request_scroll_into_view(Gfx::IntRect rect) =| - did_enter_tooltip_area(Gfx::IntPoint content_position, String title) =| + did_enter_tooltip_area(Gfx::IntPoint content_position, DeprecatedString title) =| did_leave_tooltip_area() =| did_hover_link(URL url) =| did_unhover_link() =| - did_click_link(URL url, String target, unsigned modifiers) =| - did_middle_click_link(URL url, String target, unsigned modifiers) =| + did_click_link(URL url, DeprecatedString target, unsigned modifiers) =| + did_middle_click_link(URL url, DeprecatedString target, unsigned modifiers) =| did_request_context_menu(Gfx::IntPoint content_position) =| - did_request_link_context_menu(Gfx::IntPoint content_position, URL url, String target, unsigned modifiers) =| - did_request_image_context_menu(Gfx::IntPoint content_position, URL url, String target, unsigned modifiers, Gfx::ShareableBitmap bitmap) =| - did_request_alert(String message) =| - did_request_confirm(String message) =| - did_request_prompt(String message, String default_) =| - did_request_set_prompt_text(String message) =| + did_request_link_context_menu(Gfx::IntPoint content_position, URL url, DeprecatedString target, unsigned modifiers) =| + did_request_image_context_menu(Gfx::IntPoint content_position, URL url, DeprecatedString target, unsigned modifiers, Gfx::ShareableBitmap bitmap) =| + did_request_alert(DeprecatedString message) =| + did_request_confirm(DeprecatedString message) =| + did_request_prompt(DeprecatedString message, DeprecatedString default_) =| + did_request_set_prompt_text(DeprecatedString message) =| did_request_accept_dialog() =| did_request_dismiss_dialog() =| - did_get_source(URL url, String source) =| - did_get_dom_tree(String dom_tree) =| - did_get_dom_node_properties(i32 node_id, String specified_style, String computed_style, String custom_properties, String node_box_sizing_json) =| + did_get_source(URL url, DeprecatedString source) =| + did_get_dom_tree(DeprecatedString dom_tree) =| + did_get_dom_node_properties(i32 node_id, DeprecatedString specified_style, DeprecatedString computed_style, DeprecatedString custom_properties, DeprecatedString node_box_sizing_json) =| did_change_favicon(Gfx::ShareableBitmap favicon) =| did_request_all_cookies(URL url) => (Vector<Web::Cookie::Cookie> cookies) - did_request_named_cookie(URL url, String name) => (Optional<Web::Cookie::Cookie> cookie) - did_request_cookie(URL url, u8 source) => (String cookie) + did_request_named_cookie(URL url, DeprecatedString name) => (Optional<Web::Cookie::Cookie> cookie) + did_request_cookie(URL url, u8 source) => (DeprecatedString cookie) did_set_cookie(URL url, Web::Cookie::ParsedCookie cookie, u8 source) =| did_update_cookie(URL url, Web::Cookie::Cookie cookie) =| did_update_resource_count(i32 count_waiting) =| @@ -51,10 +51,10 @@ endpoint WebContentClient did_request_maximize_window() => (Gfx::IntRect window_rect) did_request_minimize_window() => (Gfx::IntRect window_rect) did_request_fullscreen_window() => (Gfx::IntRect window_rect) - did_request_file(String path, i32 request_id) =| + did_request_file(DeprecatedString path, i32 request_id) =| did_finish_handling_input_event(bool event_was_accepted) =| did_output_js_console_message(i32 message_index) =| - did_get_js_console_messages(i32 start_index, Vector<String> message_types, Vector<String> messages) =| + did_get_js_console_messages(i32 start_index, Vector<DeprecatedString> message_types, Vector<DeprecatedString> messages) =| } diff --git a/Userland/Services/WebContent/WebContentConsoleClient.cpp b/Userland/Services/WebContent/WebContentConsoleClient.cpp index f72da8df8d..4895d08bc0 100644 --- a/Userland/Services/WebContent/WebContentConsoleClient.cpp +++ b/Userland/Services/WebContent/WebContentConsoleClient.cpp @@ -29,14 +29,14 @@ public: virtual ~ConsoleEnvironmentSettingsObject() override = default; JS::GCPtr<Web::DOM::Document> responsible_document() override { return nullptr; } - String api_url_character_encoding() override { return m_api_url_character_encoding; } + DeprecatedString api_url_character_encoding() override { return m_api_url_character_encoding; } AK::URL api_base_url() override { return m_url; } Web::HTML::Origin origin() override { return m_origin; } Web::HTML::PolicyContainer policy_container() override { return m_policy_container; } Web::HTML::CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability() override { return Web::HTML::CanUseCrossOriginIsolatedAPIs::Yes; } private: - String m_api_url_character_encoding; + DeprecatedString m_api_url_character_encoding; AK::URL m_url; Web::HTML::Origin m_origin; Web::HTML::PolicyContainer m_policy_container; @@ -66,7 +66,7 @@ WebContentConsoleClient::WebContentConsoleClient(JS::Console& console, JS::Realm console_realm->set_host_defined(move(host_defined)); } -void WebContentConsoleClient::handle_input(String const& js_source) +void WebContentConsoleClient::handle_input(DeprecatedString const& js_source) { if (!m_realm) return; @@ -88,7 +88,7 @@ void WebContentConsoleClient::report_exception(JS::Error const& exception, bool print_html(JS::MarkupGenerator::html_from_error(exception, in_promise)); } -void WebContentConsoleClient::print_html(String const& line) +void WebContentConsoleClient::print_html(DeprecatedString const& line) { m_message_log.append({ .type = ConsoleOutput::Type::HTML, .data = line }); m_client.async_did_output_js_console_message(m_message_log.size() - 1); @@ -100,7 +100,7 @@ void WebContentConsoleClient::clear_output() m_client.async_did_output_js_console_message(m_message_log.size() - 1); } -void WebContentConsoleClient::begin_group(String const& label, bool start_expanded) +void WebContentConsoleClient::begin_group(DeprecatedString const& label, bool start_expanded) { m_message_log.append({ .type = start_expanded ? ConsoleOutput::Type::BeginGroup : ConsoleOutput::Type::BeginGroupCollapsed, .data = label }); m_client.async_did_output_js_console_message(m_message_log.size() - 1); @@ -126,8 +126,8 @@ void WebContentConsoleClient::send_messages(i32 start_index) } // FIXME: Replace with a single Vector of message structs - Vector<String> message_types; - Vector<String> messages; + Vector<DeprecatedString> message_types; + Vector<DeprecatedString> messages; message_types.ensure_capacity(messages_to_send); messages.ensure_capacity(messages_to_send); @@ -185,11 +185,11 @@ JS::ThrowCompletionOr<JS::Value> WebContentConsoleClient::printer(JS::Console::L if (log_level == JS::Console::LogLevel::Group || log_level == JS::Console::LogLevel::GroupCollapsed) { auto group = arguments.get<JS::Console::Group>(); - begin_group(String::formatted("<span style='{}'>{}</span>", styling, escape_html_entities(group.label)), log_level == JS::Console::LogLevel::Group); + begin_group(DeprecatedString::formatted("<span style='{}'>{}</span>", styling, escape_html_entities(group.label)), log_level == JS::Console::LogLevel::Group); return JS::js_undefined(); } - auto output = String::join(' ', arguments.get<JS::MarkedVector<JS::Value>>()); + auto output = DeprecatedString::join(' ', arguments.get<JS::MarkedVector<JS::Value>>()); m_console.output_debug_message(log_level, output); StringBuilder html; diff --git a/Userland/Services/WebContent/WebContentConsoleClient.h b/Userland/Services/WebContent/WebContentConsoleClient.h index eb0c785c31..9ab581d222 100644 --- a/Userland/Services/WebContent/WebContentConsoleClient.h +++ b/Userland/Services/WebContent/WebContentConsoleClient.h @@ -20,7 +20,7 @@ class WebContentConsoleClient final : public JS::ConsoleClient { public: WebContentConsoleClient(JS::Console&, JS::Realm&, ConnectionFromClient&); - void handle_input(String const& js_source); + void handle_input(DeprecatedString const& js_source); void send_messages(i32 start_index); void report_exception(JS::Error const&, bool) override; @@ -40,8 +40,8 @@ private: JS::Handle<ConsoleGlobalObject> m_console_global_object; void clear_output(); - void print_html(String const& line); - void begin_group(String const& label, bool start_expanded); + void print_html(DeprecatedString const& line); + void begin_group(DeprecatedString const& label, bool start_expanded); virtual void end_group() override; struct ConsoleOutput { @@ -53,7 +53,7 @@ private: EndGroup, }; Type type; - String data; + DeprecatedString data; }; Vector<ConsoleOutput> m_message_log; diff --git a/Userland/Services/WebContent/WebContentServer.ipc b/Userland/Services/WebContent/WebContentServer.ipc index 45d70f5356..91b5e29af4 100644 --- a/Userland/Services/WebContent/WebContentServer.ipc +++ b/Userland/Services/WebContent/WebContentServer.ipc @@ -9,14 +9,14 @@ endpoint WebContentServer { - connect_to_webdriver(String webdriver_ipc_path) =| + connect_to_webdriver(DeprecatedString webdriver_ipc_path) =| update_system_theme(Core::AnonymousBuffer theme_buffer) =| - update_system_fonts(String default_font_query, String fixed_width_font_query, String window_title_font_query) =| + update_system_fonts(DeprecatedString default_font_query, DeprecatedString fixed_width_font_query, DeprecatedString window_title_font_query) =| update_screen_rects(Vector<Gfx::IntRect> rects, u32 main_screen_index) =| load_url(URL url) =| - load_html(String html, URL url) =| + load_html(DeprecatedString html, URL url) =| add_backing_store(i32 backing_store_id, Gfx::ShareableBitmap bitmap) =| remove_backing_store(i32 backing_store_id) =| @@ -33,25 +33,25 @@ endpoint WebContentServer key_down(i32 key, unsigned modifiers, u32 code_point) =| key_up(i32 key, unsigned modifiers, u32 code_point) =| - debug_request(String request, String argument) =| + debug_request(DeprecatedString request, DeprecatedString argument) =| get_source() =| inspect_dom_tree() =| - inspect_dom_node(i32 node_id, Optional<Web::CSS::Selector::PseudoElement> pseudo_element) => (bool has_style, String specified_style, String computed_style, String custom_properties, String node_box_sizing) + inspect_dom_node(i32 node_id, Optional<Web::CSS::Selector::PseudoElement> pseudo_element) => (bool has_style, DeprecatedString specified_style, DeprecatedString computed_style, DeprecatedString custom_properties, DeprecatedString node_box_sizing) get_hovered_node_id() => (i32 node_id) - js_console_input(String js_source) =| + js_console_input(DeprecatedString js_source) =| js_console_request_messages(i32 start_index) =| take_document_screenshot() => (Gfx::ShareableBitmap data) - run_javascript(String js_source) =| + run_javascript(DeprecatedString js_source) =| - dump_layout_tree() => (String dump) + dump_layout_tree() => (DeprecatedString dump) - get_selected_text() => (String selection) + get_selected_text() => (DeprecatedString selection) select_all() =| - set_content_filters(Vector<String> filters) =| - set_proxy_mappings(Vector<String> proxies, HashMap<String,size_t> mappings) =| + set_content_filters(Vector<DeprecatedString> filters) =| + set_proxy_mappings(Vector<DeprecatedString> proxies, HashMap<DeprecatedString,size_t> mappings) =| set_preferred_color_scheme(Web::CSS::PreferredColorScheme color_scheme) =| set_has_focus(bool has_focus) =| set_is_scripting_enabled(bool is_scripting_enabled) =| @@ -59,8 +59,8 @@ endpoint WebContentServer set_window_position(Gfx::IntPoint position) =| set_window_size(Gfx::IntSize size) =| - get_local_storage_entries() => (OrderedHashMap<String,String> entries) - get_session_storage_entries() => (OrderedHashMap<String,String> entries) + get_local_storage_entries() => (OrderedHashMap<DeprecatedString,DeprecatedString> entries) + get_session_storage_entries() => (OrderedHashMap<DeprecatedString,DeprecatedString> entries) handle_file_return(i32 error, Optional<IPC::File> file, i32 request_id) =| @@ -68,5 +68,5 @@ endpoint WebContentServer alert_closed() =| confirm_closed(bool accepted) =| - prompt_closed(String response) =| + prompt_closed(DeprecatedString response) =| } diff --git a/Userland/Services/WebContent/WebDriverClient.ipc b/Userland/Services/WebContent/WebDriverClient.ipc index 0a97686e8e..b2ce42909a 100644 --- a/Userland/Services/WebContent/WebDriverClient.ipc +++ b/Userland/Services/WebContent/WebDriverClient.ipc @@ -26,33 +26,33 @@ endpoint WebDriverClient { fullscreen_window() => (Web::WebDriver::Response response) find_element(JsonValue payload) => (Web::WebDriver::Response response) find_elements(JsonValue payload) => (Web::WebDriver::Response response) - find_element_from_element(JsonValue payload, String element_id) => (Web::WebDriver::Response response) - find_elements_from_element(JsonValue payload, String element_id) => (Web::WebDriver::Response response) - find_element_from_shadow_root(JsonValue payload, String shadow_id) => (Web::WebDriver::Response response) - find_elements_from_shadow_root(JsonValue payload, String shadow_id) => (Web::WebDriver::Response response) + find_element_from_element(JsonValue payload, DeprecatedString element_id) => (Web::WebDriver::Response response) + find_elements_from_element(JsonValue payload, DeprecatedString element_id) => (Web::WebDriver::Response response) + find_element_from_shadow_root(JsonValue payload, DeprecatedString shadow_id) => (Web::WebDriver::Response response) + find_elements_from_shadow_root(JsonValue payload, DeprecatedString shadow_id) => (Web::WebDriver::Response response) get_active_element() => (Web::WebDriver::Response response) - get_element_shadow_root(String element_id) => (Web::WebDriver::Response response) - is_element_selected(String element_id) => (Web::WebDriver::Response response) - get_element_attribute(String element_id, String name) => (Web::WebDriver::Response response) - get_element_property(String element_id, String name) => (Web::WebDriver::Response response) - get_element_css_value(String element_id, String name) => (Web::WebDriver::Response response) - get_element_text(String element_id) => (Web::WebDriver::Response response) - get_element_tag_name(String element_id) => (Web::WebDriver::Response response) - get_element_rect(String element_id) => (Web::WebDriver::Response response) - is_element_enabled(String element_id) => (Web::WebDriver::Response response) + get_element_shadow_root(DeprecatedString element_id) => (Web::WebDriver::Response response) + is_element_selected(DeprecatedString element_id) => (Web::WebDriver::Response response) + get_element_attribute(DeprecatedString element_id, DeprecatedString name) => (Web::WebDriver::Response response) + get_element_property(DeprecatedString element_id, DeprecatedString name) => (Web::WebDriver::Response response) + get_element_css_value(DeprecatedString element_id, DeprecatedString name) => (Web::WebDriver::Response response) + get_element_text(DeprecatedString element_id) => (Web::WebDriver::Response response) + get_element_tag_name(DeprecatedString element_id) => (Web::WebDriver::Response response) + get_element_rect(DeprecatedString element_id) => (Web::WebDriver::Response response) + is_element_enabled(DeprecatedString element_id) => (Web::WebDriver::Response response) get_source() => (Web::WebDriver::Response response) execute_script(JsonValue payload) => (Web::WebDriver::Response response) execute_async_script(JsonValue payload) => (Web::WebDriver::Response response) get_all_cookies() => (Web::WebDriver::Response response) - get_named_cookie(String name) => (Web::WebDriver::Response response) + get_named_cookie(DeprecatedString name) => (Web::WebDriver::Response response) add_cookie(JsonValue payload) => (Web::WebDriver::Response response) - delete_cookie(String name) => (Web::WebDriver::Response response) + delete_cookie(DeprecatedString name) => (Web::WebDriver::Response response) delete_all_cookies() => (Web::WebDriver::Response response) dismiss_alert() => (Web::WebDriver::Response response) accept_alert() => (Web::WebDriver::Response response) get_alert_text() => (Web::WebDriver::Response response) send_alert_text(JsonValue payload) => (Web::WebDriver::Response response) take_screenshot() => (Web::WebDriver::Response response) - take_element_screenshot(String element_id) => (Web::WebDriver::Response response) + take_element_screenshot(DeprecatedString element_id) => (Web::WebDriver::Response response) print_page() => (Web::WebDriver::Response response) } diff --git a/Userland/Services/WebContent/WebDriverConnection.cpp b/Userland/Services/WebContent/WebDriverConnection.cpp index 9dc12d2b2e..b90f07a5ba 100644 --- a/Userland/Services/WebContent/WebDriverConnection.cpp +++ b/Userland/Services/WebContent/WebDriverConnection.cpp @@ -105,21 +105,21 @@ static Gfx::IntRect calculate_absolute_rect_of_element(Web::Page const& page, We } // https://w3c.github.io/webdriver/#dfn-get-or-create-a-web-element-reference -static String get_or_create_a_web_element_reference(Web::DOM::Node const& element) +static DeprecatedString get_or_create_a_web_element_reference(Web::DOM::Node const& element) { // FIXME: 1. For each known element of the current browsing context’s list of known elements: // FIXME: 1. If known element equals element, return success with known element’s web element reference. // FIXME: 2. Add element to the list of known elements of the current browsing context. // FIXME: 3. Return success with the element’s web element reference. - return String::number(element.id()); + return DeprecatedString::number(element.id()); } // https://w3c.github.io/webdriver/#dfn-web-element-reference-object static JsonObject web_element_reference_object(Web::DOM::Node const& element) { // https://w3c.github.io/webdriver/#dfn-web-element-identifier - static String const web_element_identifier = "element-6066-11e4-a52e-4f735466cecf"sv; + static DeprecatedString const web_element_identifier = "element-6066-11e4-a52e-4f735466cecf"sv; // 1. Let identifier be the web element identifier. auto identifier = web_element_identifier; @@ -146,27 +146,27 @@ static ErrorOr<Web::DOM::Element*, Web::WebDriver::Error> get_known_connected_el auto* node = Web::DOM::Node::from_id(*element); if (!node || !node->is_element()) - return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchElement, String::formatted("Could not find element with ID: {}", element_id)); + return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchElement, DeprecatedString::formatted("Could not find element with ID: {}", element_id)); return static_cast<Web::DOM::Element*>(node); } // https://w3c.github.io/webdriver/#dfn-get-or-create-a-shadow-root-reference -static String get_or_create_a_shadow_root_reference(Web::DOM::ShadowRoot const& shadow_root) +static DeprecatedString get_or_create_a_shadow_root_reference(Web::DOM::ShadowRoot const& shadow_root) { // FIXME: 1. For each known shadow root of the current browsing context’s list of known shadow roots: // FIXME: 1. If known shadow root equals shadow root, return success with known shadow root’s shadow root reference. // FIXME: 2. Add shadow to the list of known shadow roots of the current browsing context. // FIXME: 3. Return success with the shadow’s shadow root reference. - return String::number(shadow_root.id()); + return DeprecatedString::number(shadow_root.id()); } // https://w3c.github.io/webdriver/#dfn-shadow-root-reference-object static JsonObject shadow_root_reference_object(Web::DOM::ShadowRoot const& shadow_root) { // https://w3c.github.io/webdriver/#dfn-shadow-root-identifier - static String const shadow_root_identifier = "shadow-6066-11e4-a52e-4f735466cecf"sv; + static DeprecatedString const shadow_root_identifier = "shadow-6066-11e4-a52e-4f735466cecf"sv; // 1. Let identifier be the shadow root identifier. auto identifier = shadow_root_identifier; @@ -193,7 +193,7 @@ static ErrorOr<Web::DOM::ShadowRoot*, Web::WebDriver::Error> get_known_shadow_ro auto* node = Web::DOM::Node::from_id(*shadow_root); if (!node || !node->is_shadow_root()) - return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchElement, String::formatted("Could not find shadow root with ID: {}", shadow_id)); + return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchElement, DeprecatedString::formatted("Could not find shadow root with ID: {}", shadow_id)); return static_cast<Web::DOM::ShadowRoot*>(node); } @@ -214,7 +214,7 @@ static void scroll_element_into_view(Web::DOM::Element& element) element.scroll_into_view(options); } -template<typename PropertyType = String> +template<typename PropertyType = DeprecatedString> static ErrorOr<PropertyType, Web::WebDriver::Error> get_property(JsonValue const& payload, StringView key) { if (!payload.is_object()) @@ -223,27 +223,27 @@ static ErrorOr<PropertyType, Web::WebDriver::Error> get_property(JsonValue const auto const* property = payload.as_object().get_ptr(key); if (!property) - return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("No property called '{}' present", key)); + return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("No property called '{}' present", key)); - if constexpr (IsSame<PropertyType, String>) { + if constexpr (IsSame<PropertyType, DeprecatedString>) { if (!property->is_string()) - return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("Property '{}' is not a String", key)); + return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Property '{}' is not a String", key)); return property->as_string(); } else if constexpr (IsSame<PropertyType, bool>) { if (!property->is_bool()) - return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("Property '{}' is not a Boolean", key)); + return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Property '{}' is not a Boolean", key)); return property->as_bool(); } else if constexpr (IsSame<PropertyType, u32>) { if (!property->is_u32()) - return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("Property '{}' is not a Number", key)); + return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Property '{}' is not a Number", key)); return property->as_u32(); } else if constexpr (IsSame<PropertyType, JsonArray const*>) { if (!property->is_array()) - return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("Property '{}' is not an Array", key)); + return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Property '{}' is not an Array", key)); return &property->as_array(); } else if constexpr (IsSame<PropertyType, JsonObject const*>) { if (!property->is_object()) - return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("Property '{}' is not an Object", key)); + return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Property '{}' is not an Object", key)); return &property->as_object(); } else { static_assert(DependentFalse<PropertyType>, "get_property invoked with unknown property type"); @@ -251,7 +251,7 @@ static ErrorOr<PropertyType, Web::WebDriver::Error> get_property(JsonValue const } } -ErrorOr<NonnullRefPtr<WebDriverConnection>> WebDriverConnection::connect(Web::PageClient& page_client, String const& webdriver_ipc_path) +ErrorOr<NonnullRefPtr<WebDriverConnection>> WebDriverConnection::connect(Web::PageClient& page_client, DeprecatedString const& webdriver_ipc_path) { dbgln_if(WEBDRIVER_DEBUG, "Trying to connect to {}", webdriver_ipc_path); auto socket = TRY(Core::Stream::LocalSocket::connect(webdriver_ipc_path)); @@ -550,14 +550,14 @@ Messages::WebDriverClient::SetWindowRectResponse WebDriverConnection::set_window if (!property) return Optional<i32> {}; if (!property->is_number()) - return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("Property '{}' is not a Number", name)); + return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Property '{}' is not a Number", name)); auto number = property->template to_number<i64>(); if (number < min) - return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("Property '{}' value {} exceeds the minimum allowed value {}", name, number, min)); + return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Property '{}' value {} exceeds the minimum allowed value {}", name, number, min)); if (number > max) - return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("Property '{}' value {} exceeds the maximum allowed value {}", name, number, max)); + return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Property '{}' value {} exceeds the maximum allowed value {}", name, number, max)); return static_cast<i32>(number); }; @@ -695,7 +695,7 @@ Messages::WebDriverClient::FindElementResponse WebDriverConnection::find_element // 2. If location strategy is not present as a keyword in the table of location strategies, return error with error code invalid argument. if (!location_strategy.has_value()) - return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("Location strategy '{}' is invalid", location_strategy_string)); + return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Location strategy '{}' is invalid", location_strategy_string)); // 3. Let selector be the result of getting a property called "value". // 4. If selector is undefined, return error with error code invalid argument. @@ -737,7 +737,7 @@ Messages::WebDriverClient::FindElementsResponse WebDriverConnection::find_elemen // 2. If location strategy is not present as a keyword in the table of location strategies, return error with error code invalid argument. if (!location_strategy.has_value()) - return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("Location strategy '{}' is invalid", location_strategy_string)); + return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Location strategy '{}' is invalid", location_strategy_string)); // 3. Let selector be the result of getting a property called "value". // 4. If selector is undefined, return error with error code invalid argument. @@ -765,7 +765,7 @@ Messages::WebDriverClient::FindElementsResponse WebDriverConnection::find_elemen } // 12.3.4 Find Element From Element, https://w3c.github.io/webdriver/#dfn-find-element-from-element -Messages::WebDriverClient::FindElementFromElementResponse WebDriverConnection::find_element_from_element(JsonValue const& payload, String const& element_id) +Messages::WebDriverClient::FindElementFromElementResponse WebDriverConnection::find_element_from_element(JsonValue const& payload, DeprecatedString const& element_id) { // 1. Let location strategy be the result of getting a property called "using". auto location_strategy_string = TRY(get_property(payload, "using"sv)); @@ -773,7 +773,7 @@ Messages::WebDriverClient::FindElementFromElementResponse WebDriverConnection::f // 2. If location strategy is not present as a keyword in the table of location strategies, return error with error code invalid argument. if (!location_strategy.has_value()) - return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("Location strategy '{}' is invalid", location_strategy_string)); + return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Location strategy '{}' is invalid", location_strategy_string)); // 3. Let selector be the result of getting a property called "value". // 4. If selector is undefined, return error with error code invalid argument. @@ -801,7 +801,7 @@ Messages::WebDriverClient::FindElementFromElementResponse WebDriverConnection::f } // 12.3.5 Find Elements From Element, https://w3c.github.io/webdriver/#dfn-find-elements-from-element -Messages::WebDriverClient::FindElementsFromElementResponse WebDriverConnection::find_elements_from_element(JsonValue const& payload, String const& element_id) +Messages::WebDriverClient::FindElementsFromElementResponse WebDriverConnection::find_elements_from_element(JsonValue const& payload, DeprecatedString const& element_id) { // 1. Let location strategy be the result of getting a property called "using". auto location_strategy_string = TRY(get_property(payload, "using"sv)); @@ -809,7 +809,7 @@ Messages::WebDriverClient::FindElementsFromElementResponse WebDriverConnection:: // 2. If location strategy is not present as a keyword in the table of location strategies, return error with error code invalid argument. if (!location_strategy.has_value()) - return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("Location strategy '{}' is invalid", location_strategy_string)); + return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Location strategy '{}' is invalid", location_strategy_string)); // 3. Let selector be the result of getting a property called "value". // 4. If selector is undefined, return error with error code invalid argument. @@ -831,7 +831,7 @@ Messages::WebDriverClient::FindElementsFromElementResponse WebDriverConnection:: } // 12.3.6 Find Element From Shadow Root, https://w3c.github.io/webdriver/#find-element-from-shadow-root -Messages::WebDriverClient::FindElementFromShadowRootResponse WebDriverConnection::find_element_from_shadow_root(JsonValue const& payload, String const& shadow_id) +Messages::WebDriverClient::FindElementFromShadowRootResponse WebDriverConnection::find_element_from_shadow_root(JsonValue const& payload, DeprecatedString const& shadow_id) { // 1. Let location strategy be the result of getting a property called "using". auto location_strategy_string = TRY(get_property(payload, "using"sv)); @@ -839,7 +839,7 @@ Messages::WebDriverClient::FindElementFromShadowRootResponse WebDriverConnection // 2. If location strategy is not present as a keyword in the table of location strategies, return error with error code invalid argument. if (!location_strategy.has_value()) - return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("Location strategy '{}' is invalid", location_strategy_string)); + return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Location strategy '{}' is invalid", location_strategy_string)); // 3. Let selector be the result of getting a property called "value". // 4. If selector is undefined, return error with error code invalid argument. @@ -867,7 +867,7 @@ Messages::WebDriverClient::FindElementFromShadowRootResponse WebDriverConnection } // 12.3.7 Find Elements From Shadow Root, https://w3c.github.io/webdriver/#find-elements-from-shadow-root -Messages::WebDriverClient::FindElementsFromShadowRootResponse WebDriverConnection::find_elements_from_shadow_root(JsonValue const& payload, String const& shadow_id) +Messages::WebDriverClient::FindElementsFromShadowRootResponse WebDriverConnection::find_elements_from_shadow_root(JsonValue const& payload, DeprecatedString const& shadow_id) { // 1. Let location strategy be the result of getting a property called "using". auto location_strategy_string = TRY(get_property(payload, "using"sv)); @@ -875,7 +875,7 @@ Messages::WebDriverClient::FindElementsFromShadowRootResponse WebDriverConnectio // 2. If location strategy is not present as a keyword in the table of location strategies, return error with error code invalid argument. if (!location_strategy.has_value()) - return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("Location strategy '{}' is invalid", location_strategy_string)); + return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Location strategy '{}' is invalid", location_strategy_string)); // 3. Let selector be the result of getting a property called "value". // 4. If selector is undefined, return error with error code invalid argument. @@ -911,13 +911,13 @@ Messages::WebDriverClient::GetActiveElementResponse WebDriverConnection::get_act // 4. If active element is a non-null element, return success with data set to web element reference object for active element. // Otherwise, return error with error code no such element. if (active_element) - return String::number(active_element->id()); + return DeprecatedString::number(active_element->id()); return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchElement, "The current document does not have an active element"sv); } // 12.3.9 Get Element Shadow Root, https://w3c.github.io/webdriver/#get-element-shadow-root -Messages::WebDriverClient::GetElementShadowRootResponse WebDriverConnection::get_element_shadow_root(String const& element_id) +Messages::WebDriverClient::GetElementShadowRootResponse WebDriverConnection::get_element_shadow_root(DeprecatedString const& element_id) { // 1. If the current browsing context is no longer open, return error with error code no such window. TRY(ensure_open_top_level_browsing_context()); @@ -933,7 +933,7 @@ Messages::WebDriverClient::GetElementShadowRootResponse WebDriverConnection::get // 5. If shadow root is null, return error with error code no such shadow root. if (!shadow_root) - return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchShadowRoot, String::formatted("Element with ID '{}' does not have a shadow root", element_id)); + return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchShadowRoot, DeprecatedString::formatted("Element with ID '{}' does not have a shadow root", element_id)); // 6. Let serialized be the shadow root reference object for shadow root. auto serialized = shadow_root_reference_object(*shadow_root); @@ -943,7 +943,7 @@ Messages::WebDriverClient::GetElementShadowRootResponse WebDriverConnection::get } // 12.4.1 Is Element Selected, https://w3c.github.io/webdriver/#dfn-is-element-selected -Messages::WebDriverClient::IsElementSelectedResponse WebDriverConnection::is_element_selected(String const& element_id) +Messages::WebDriverClient::IsElementSelectedResponse WebDriverConnection::is_element_selected(DeprecatedString const& element_id) { // 1. If the current browsing context is no longer open, return error with error code no such window. TRY(ensure_open_top_level_browsing_context()); @@ -979,7 +979,7 @@ Messages::WebDriverClient::IsElementSelectedResponse WebDriverConnection::is_ele } // 12.4.2 Get Element Attribute, https://w3c.github.io/webdriver/#dfn-get-element-attribute -Messages::WebDriverClient::GetElementAttributeResponse WebDriverConnection::get_element_attribute(String const& element_id, String const& name) +Messages::WebDriverClient::GetElementAttributeResponse WebDriverConnection::get_element_attribute(DeprecatedString const& element_id, DeprecatedString const& name) { // 1. If the current browsing context is no longer open, return error with error code no such window. TRY(ensure_open_top_level_browsing_context()); @@ -991,7 +991,7 @@ Messages::WebDriverClient::GetElementAttributeResponse WebDriverConnection::get_ auto* element = TRY(get_known_connected_element(element_id)); // 4. Let result be the result of the first matching condition: - Optional<String> result; + Optional<DeprecatedString> result; // -> If name is a boolean attribute if (Web::HTML::is_boolean_attribute(name)) { @@ -1012,7 +1012,7 @@ Messages::WebDriverClient::GetElementAttributeResponse WebDriverConnection::get_ } // 12.4.3 Get Element Property, https://w3c.github.io/webdriver/#dfn-get-element-property -Messages::WebDriverClient::GetElementPropertyResponse WebDriverConnection::get_element_property(String const& element_id, String const& name) +Messages::WebDriverClient::GetElementPropertyResponse WebDriverConnection::get_element_property(DeprecatedString const& element_id, DeprecatedString const& name) { // 1. If the current browsing context is no longer open, return error with error code no such window. TRY(ensure_open_top_level_browsing_context()); @@ -1023,7 +1023,7 @@ Messages::WebDriverClient::GetElementPropertyResponse WebDriverConnection::get_e // 3. Let element be the result of trying to get a known connected element with url variable element id. auto* element = TRY(get_known_connected_element(element_id)); - Optional<String> result; + Optional<DeprecatedString> result; // 4. Let property be the result of calling the Object.[[GetProperty]](name) on element. if (auto property_or_error = element->get(name); !property_or_error.is_throw_completion()) { @@ -1043,7 +1043,7 @@ Messages::WebDriverClient::GetElementPropertyResponse WebDriverConnection::get_e } // 12.4.4 Get Element CSS Value, https://w3c.github.io/webdriver/#dfn-get-element-css-value -Messages::WebDriverClient::GetElementCssValueResponse WebDriverConnection::get_element_css_value(String const& element_id, String const& name) +Messages::WebDriverClient::GetElementCssValueResponse WebDriverConnection::get_element_css_value(DeprecatedString const& element_id, DeprecatedString const& name) { // 1. If the current browsing context is no longer open, return error with error code no such window. TRY(ensure_open_top_level_browsing_context()); @@ -1055,7 +1055,7 @@ Messages::WebDriverClient::GetElementCssValueResponse WebDriverConnection::get_e auto* element = TRY(get_known_connected_element(element_id)); // 4. Let computed value be the result of the first matching condition: - String computed_value; + DeprecatedString computed_value; // -> current browsing context’s active document’s type is not "xml" if (!m_page_client.page().top_level_browsing_context().active_document()->is_xml_document()) { @@ -1068,7 +1068,7 @@ Messages::WebDriverClient::GetElementCssValueResponse WebDriverConnection::get_e // -> Otherwise else { // "" (empty string) - computed_value = String::empty(); + computed_value = DeprecatedString::empty(); } // 5. Return success with data computed value. @@ -1076,7 +1076,7 @@ Messages::WebDriverClient::GetElementCssValueResponse WebDriverConnection::get_e } // 12.4.5 Get Element Text, https://w3c.github.io/webdriver/#dfn-get-element-text -Messages::WebDriverClient::GetElementTextResponse WebDriverConnection::get_element_text(String const& element_id) +Messages::WebDriverClient::GetElementTextResponse WebDriverConnection::get_element_text(DeprecatedString const& element_id) { // 1. If the current browsing context is no longer open, return error with error code no such window. TRY(ensure_open_top_level_browsing_context()); @@ -1095,7 +1095,7 @@ Messages::WebDriverClient::GetElementTextResponse WebDriverConnection::get_eleme } // 12.4.6 Get Element Tag Name, https://w3c.github.io/webdriver/#dfn-get-element-tag-name -Messages::WebDriverClient::GetElementTagNameResponse WebDriverConnection::get_element_tag_name(String const& element_id) +Messages::WebDriverClient::GetElementTagNameResponse WebDriverConnection::get_element_tag_name(DeprecatedString const& element_id) { // 1. If the current browsing context is no longer open, return error with error code no such window. TRY(ensure_open_top_level_browsing_context()); @@ -1114,7 +1114,7 @@ Messages::WebDriverClient::GetElementTagNameResponse WebDriverConnection::get_el } // 12.4.7 Get Element Rect, https://w3c.github.io/webdriver/#dfn-get-element-rect -Messages::WebDriverClient::GetElementRectResponse WebDriverConnection::get_element_rect(String const& element_id) +Messages::WebDriverClient::GetElementRectResponse WebDriverConnection::get_element_rect(DeprecatedString const& element_id) { // 1. If the current browsing context is no longer open, return error with error code no such window. TRY(ensure_open_top_level_browsing_context()); @@ -1145,7 +1145,7 @@ Messages::WebDriverClient::GetElementRectResponse WebDriverConnection::get_eleme } // 12.4.8 Is Element Enabled, https://w3c.github.io/webdriver/#dfn-is-element-enabled -Messages::WebDriverClient::IsElementEnabledResponse WebDriverConnection::is_element_enabled(String const& element_id) +Messages::WebDriverClient::IsElementEnabledResponse WebDriverConnection::is_element_enabled(DeprecatedString const& element_id) { // 1. If the current browsing context is no longer open, return error with error code no such window. TRY(ensure_open_top_level_browsing_context()); @@ -1180,7 +1180,7 @@ Messages::WebDriverClient::GetSourceResponse WebDriverConnection::get_source() TRY(handle_any_user_prompts()); auto* document = m_page_client.page().top_level_browsing_context().active_document(); - Optional<String> source; + Optional<DeprecatedString> source; // 3. Let source be the result of invoking the fragment serializing algorithm on a fictional node whose only child is the document element providing true for the require well-formed flag. If this causes an exception to be thrown, let source be null. if (auto result = document->serialize_fragment(Web::DOMParsing::RequireWellFormed::Yes); !result.is_error()) @@ -1286,7 +1286,7 @@ Messages::WebDriverClient::GetAllCookiesResponse WebDriverConnection::get_all_co } // 14.2 Get Named Cookie, https://w3c.github.io/webdriver/#dfn-get-named-cookie -Messages::WebDriverClient::GetNamedCookieResponse WebDriverConnection::get_named_cookie(String const& name) +Messages::WebDriverClient::GetNamedCookieResponse WebDriverConnection::get_named_cookie(DeprecatedString const& name) { // 1. If the current browsing context is no longer open, return error with error code no such window. TRY(ensure_open_top_level_browsing_context()); @@ -1303,7 +1303,7 @@ Messages::WebDriverClient::GetNamedCookieResponse WebDriverConnection::get_named } // 4. Otherwise, return error with error code no such cookie. - return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchCookie, String::formatted("Cookie '{}' not found", name)); + return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchCookie, DeprecatedString::formatted("Cookie '{}' not found", name)); } // 14.3 Add Cookie, https://w3c.github.io/webdriver/#dfn-adding-a-cookie @@ -1380,7 +1380,7 @@ Messages::WebDriverClient::AddCookieResponse WebDriverConnection::add_cookie(Jso } // 14.4 Delete Cookie, https://w3c.github.io/webdriver/#dfn-delete-cookie -Messages::WebDriverClient::DeleteCookieResponse WebDriverConnection::delete_cookie(String const& name) +Messages::WebDriverClient::DeleteCookieResponse WebDriverConnection::delete_cookie(DeprecatedString const& name) { // 1. If the current browsing context is no longer open, return error with error code no such window. TRY(ensure_open_top_level_browsing_context()); @@ -1531,7 +1531,7 @@ Messages::WebDriverClient::TakeScreenshotResponse WebDriverConnection::take_scre } // 17.2 Take Element Screenshot, https://w3c.github.io/webdriver/#dfn-take-element-screenshot -Messages::WebDriverClient::TakeElementScreenshotResponse WebDriverConnection::take_element_screenshot(String const& element_id) +Messages::WebDriverClient::TakeElementScreenshotResponse WebDriverConnection::take_element_screenshot(DeprecatedString const& element_id) { // 1. If the current top-level browsing context is no longer open, return error with error code no such window. TRY(ensure_open_top_level_browsing_context()); @@ -1686,7 +1686,7 @@ ErrorOr<JsonArray, Web::WebDriver::Error> WebDriverConnection::find(StartNodeGet // 5. If a DOMException, SyntaxError, XPathException, or other error occurs during the execution of the element location strategy, return error invalid selector. if (elements.is_error()) - return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidSelector, String::formatted("The location strategy could not finish: {}", elements.error().message)); + return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidSelector, DeprecatedString::formatted("The location strategy could not finish: {}", elements.error().message)); return elements.release_value(); }; diff --git a/Userland/Services/WebContent/WebDriverConnection.h b/Userland/Services/WebContent/WebDriverConnection.h index 4135cbe124..16b965cd19 100644 --- a/Userland/Services/WebContent/WebDriverConnection.h +++ b/Userland/Services/WebContent/WebDriverConnection.h @@ -8,9 +8,9 @@ #pragma once +#include <AK/DeprecatedString.h> #include <AK/Function.h> #include <AK/HashMap.h> -#include <AK/String.h> #include <LibIPC/ConnectionToServer.h> #include <LibJS/Forward.h> #include <LibJS/Heap/MarkedVector.h> @@ -29,7 +29,7 @@ class WebDriverConnection final C_OBJECT(WebDriverConnection) public: - static ErrorOr<NonnullRefPtr<WebDriverConnection>> connect(Web::PageClient& page_client, String const& webdriver_ipc_path); + static ErrorOr<NonnullRefPtr<WebDriverConnection>> connect(Web::PageClient& page_client, DeprecatedString const& webdriver_ipc_path); virtual ~WebDriverConnection() = default; private: @@ -61,34 +61,34 @@ private: virtual Messages::WebDriverClient::FullscreenWindowResponse fullscreen_window() override; virtual Messages::WebDriverClient::FindElementResponse find_element(JsonValue const& payload) override; virtual Messages::WebDriverClient::FindElementsResponse find_elements(JsonValue const& payload) override; - virtual Messages::WebDriverClient::FindElementFromElementResponse find_element_from_element(JsonValue const& payload, String const& element_id) override; - virtual Messages::WebDriverClient::FindElementsFromElementResponse find_elements_from_element(JsonValue const& payload, String const& element_id) override; - virtual Messages::WebDriverClient::FindElementFromShadowRootResponse find_element_from_shadow_root(JsonValue const& payload, String const& shadow_id) override; - virtual Messages::WebDriverClient::FindElementsFromShadowRootResponse find_elements_from_shadow_root(JsonValue const& payload, String const& shadow_id) override; + virtual Messages::WebDriverClient::FindElementFromElementResponse find_element_from_element(JsonValue const& payload, DeprecatedString const& element_id) override; + virtual Messages::WebDriverClient::FindElementsFromElementResponse find_elements_from_element(JsonValue const& payload, DeprecatedString const& element_id) override; + virtual Messages::WebDriverClient::FindElementFromShadowRootResponse find_element_from_shadow_root(JsonValue const& payload, DeprecatedString const& shadow_id) override; + virtual Messages::WebDriverClient::FindElementsFromShadowRootResponse find_elements_from_shadow_root(JsonValue const& payload, DeprecatedString const& shadow_id) override; virtual Messages::WebDriverClient::GetActiveElementResponse get_active_element() override; - virtual Messages::WebDriverClient::GetElementShadowRootResponse get_element_shadow_root(String const& element_id) override; - virtual Messages::WebDriverClient::IsElementSelectedResponse is_element_selected(String const& element_id) override; - virtual Messages::WebDriverClient::GetElementAttributeResponse get_element_attribute(String const& element_id, String const& name) override; - virtual Messages::WebDriverClient::GetElementPropertyResponse get_element_property(String const& element_id, String const& name) override; - virtual Messages::WebDriverClient::GetElementCssValueResponse get_element_css_value(String const& element_id, String const& name) override; - virtual Messages::WebDriverClient::GetElementTextResponse get_element_text(String const& element_id) override; - virtual Messages::WebDriverClient::GetElementTagNameResponse get_element_tag_name(String const& element_id) override; - virtual Messages::WebDriverClient::GetElementRectResponse get_element_rect(String const& element_id) override; - virtual Messages::WebDriverClient::IsElementEnabledResponse is_element_enabled(String const& element_id) override; + virtual Messages::WebDriverClient::GetElementShadowRootResponse get_element_shadow_root(DeprecatedString const& element_id) override; + virtual Messages::WebDriverClient::IsElementSelectedResponse is_element_selected(DeprecatedString const& element_id) override; + virtual Messages::WebDriverClient::GetElementAttributeResponse get_element_attribute(DeprecatedString const& element_id, DeprecatedString const& name) override; + virtual Messages::WebDriverClient::GetElementPropertyResponse get_element_property(DeprecatedString const& element_id, DeprecatedString const& name) override; + virtual Messages::WebDriverClient::GetElementCssValueResponse get_element_css_value(DeprecatedString const& element_id, DeprecatedString const& name) override; + virtual Messages::WebDriverClient::GetElementTextResponse get_element_text(DeprecatedString const& element_id) override; + virtual Messages::WebDriverClient::GetElementTagNameResponse get_element_tag_name(DeprecatedString const& element_id) override; + virtual Messages::WebDriverClient::GetElementRectResponse get_element_rect(DeprecatedString const& element_id) override; + virtual Messages::WebDriverClient::IsElementEnabledResponse is_element_enabled(DeprecatedString const& element_id) override; virtual Messages::WebDriverClient::GetSourceResponse get_source() override; virtual Messages::WebDriverClient::ExecuteScriptResponse execute_script(JsonValue const& payload) override; virtual Messages::WebDriverClient::ExecuteAsyncScriptResponse execute_async_script(JsonValue const& payload) override; virtual Messages::WebDriverClient::GetAllCookiesResponse get_all_cookies() override; - virtual Messages::WebDriverClient::GetNamedCookieResponse get_named_cookie(String const& name) override; + virtual Messages::WebDriverClient::GetNamedCookieResponse get_named_cookie(DeprecatedString const& name) override; virtual Messages::WebDriverClient::AddCookieResponse add_cookie(JsonValue const& payload) override; - virtual Messages::WebDriverClient::DeleteCookieResponse delete_cookie(String const& name) override; + virtual Messages::WebDriverClient::DeleteCookieResponse delete_cookie(DeprecatedString const& name) override; virtual Messages::WebDriverClient::DeleteAllCookiesResponse delete_all_cookies() override; virtual Messages::WebDriverClient::DismissAlertResponse dismiss_alert() override; virtual Messages::WebDriverClient::AcceptAlertResponse accept_alert() override; virtual Messages::WebDriverClient::GetAlertTextResponse get_alert_text() override; virtual Messages::WebDriverClient::SendAlertTextResponse send_alert_text(JsonValue const& payload) override; virtual Messages::WebDriverClient::TakeScreenshotResponse take_screenshot() override; - virtual Messages::WebDriverClient::TakeElementScreenshotResponse take_element_screenshot(String const& element_id) override; + virtual Messages::WebDriverClient::TakeElementScreenshotResponse take_element_screenshot(DeprecatedString const& element_id) override; virtual Messages::WebDriverClient::PrintPageResponse print_page() override; ErrorOr<void, Web::WebDriver::Error> ensure_open_top_level_browsing_context(); @@ -101,7 +101,7 @@ private: ErrorOr<JsonArray, Web::WebDriver::Error> find(StartNodeGetter&& start_node_getter, Web::WebDriver::LocationStrategy using_, StringView value); struct ScriptArguments { - String script; + DeprecatedString script; JS::MarkedVector<JS::Value> arguments; }; ErrorOr<ScriptArguments, Web::WebDriver::Error> extract_the_script_arguments_from_a_request(JsonValue const& payload); @@ -122,11 +122,11 @@ private: Web::WebDriver::TimeoutsConfiguration m_timeouts_configuration; struct Window { - String handle; + DeprecatedString handle; bool is_open { false }; }; - HashMap<String, Window> m_windows; - String m_current_window_handle; + HashMap<DeprecatedString, Window> m_windows; + DeprecatedString m_current_window_handle; }; } diff --git a/Userland/Services/WebDriver/Client.cpp b/Userland/Services/WebDriver/Client.cpp index daccee320a..829c1cc8f5 100644 --- a/Userland/Services/WebDriver/Client.cpp +++ b/Userland/Services/WebDriver/Client.cpp @@ -155,7 +155,7 @@ Web::WebDriver::Response Client::new_session(Web::WebDriver::Parameters, JsonVal auto session = make<Session>(session_id, *this, move(options)); if (auto start_result = session->start(); start_result.is_error()) - return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::SessionNotCreated, String::formatted("Failed to start session: {}", start_result.error().string_literal())); + return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::SessionNotCreated, DeprecatedString::formatted("Failed to start session: {}", start_result.error().string_literal())); auto& web_content_connection = session->web_content_connection(); @@ -176,7 +176,7 @@ Web::WebDriver::Response Client::new_session(Web::WebDriver::Parameters, JsonVal JsonObject body; // "sessionId" // session id - body.set("sessionId", String::number(session_id)); + body.set("sessionId", DeprecatedString::number(session_id)); // "capabilities" // capabilities body.set("capabilities", move(capabilities)); diff --git a/Userland/Services/WebDriver/Session.cpp b/Userland/Services/WebDriver/Session.cpp index 1636b998b0..8a45a50156 100644 --- a/Userland/Services/WebDriver/Session.cpp +++ b/Userland/Services/WebDriver/Session.cpp @@ -30,7 +30,7 @@ Session::~Session() warnln("Failed to stop session {}: {}", m_id, error.error()); } -ErrorOr<NonnullRefPtr<Core::LocalServer>> Session::create_server(String const& socket_path, NonnullRefPtr<ServerPromise> promise) +ErrorOr<NonnullRefPtr<Core::LocalServer>> Session::create_server(DeprecatedString const& socket_path, NonnullRefPtr<ServerPromise> promise) { dbgln("Listening for WebDriver connection on {}", socket_path); @@ -61,7 +61,7 @@ ErrorOr<void> Session::start() { auto promise = TRY(ServerPromise::try_create()); - auto web_content_socket_path = String::formatted("/tmp/webdriver/session_{}_{}", getpid(), m_id); + auto web_content_socket_path = DeprecatedString::formatted("/tmp/webdriver/session_{}_{}", getpid(), m_id); auto web_content_server = TRY(create_server(web_content_socket_path, promise)); if (m_options.headless) { diff --git a/Userland/Services/WebDriver/Session.h b/Userland/Services/WebDriver/Session.h index dc5b1f849d..31e55a7be7 100644 --- a/Userland/Services/WebDriver/Session.h +++ b/Userland/Services/WebDriver/Session.h @@ -37,7 +37,7 @@ public: private: using ServerPromise = Core::Promise<ErrorOr<void>>; - ErrorOr<NonnullRefPtr<Core::LocalServer>> create_server(String const& socket_path, NonnullRefPtr<ServerPromise> promise); + ErrorOr<NonnullRefPtr<Core::LocalServer>> create_server(DeprecatedString const& socket_path, NonnullRefPtr<ServerPromise> promise); NonnullRefPtr<Client> m_client; Web::WebDriver::LadybirdOptions m_options; diff --git a/Userland/Services/WebDriver/main.cpp b/Userland/Services/WebDriver/main.cpp index 8306c4b521..d21fcf627e 100644 --- a/Userland/Services/WebDriver/main.cpp +++ b/Userland/Services/WebDriver/main.cpp @@ -14,10 +14,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) { - String default_listen_address = "0.0.0.0"; + DeprecatedString default_listen_address = "0.0.0.0"; u16 default_port = 8000; - String listen_address = default_listen_address; + DeprecatedString listen_address = default_listen_address; int port = default_port; Core::ArgsParser args_parser; diff --git a/Userland/Services/WebServer/Client.cpp b/Userland/Services/WebServer/Client.cpp index c0fa3541fa..b80e130b74 100644 --- a/Userland/Services/WebServer/Client.cpp +++ b/Userland/Services/WebServer/Client.cpp @@ -81,7 +81,7 @@ void Client::start() } auto request = builder.to_byte_buffer(); - dbgln_if(WEBSERVER_DEBUG, "Got raw request: '{}'", String::copy(request)); + dbgln_if(WEBSERVER_DEBUG, "Got raw request: '{}'", DeprecatedString::copy(request)); auto maybe_did_handle = handle_request(request); if (maybe_did_handle.is_error()) { @@ -233,9 +233,9 @@ ErrorOr<void> Client::send_redirect(StringView redirect_path, HTTP::HttpRequest return {}; } -static String folder_image_data() +static DeprecatedString folder_image_data() { - static String cache; + static DeprecatedString cache; if (cache.is_empty()) { auto file = Core::MappedFile::map("/res/icons/16x16/filetype-folder.png"sv).release_value_but_fixme_should_propagate_errors(); cache = encode_base64(file->bytes()); @@ -243,9 +243,9 @@ static String folder_image_data() return cache; } -static String file_image_data() +static DeprecatedString file_image_data() { - static String cache; + static DeprecatedString cache; if (cache.is_empty()) { auto file = Core::MappedFile::map("/res/icons/16x16/filetype-unknown.png"sv).release_value_but_fixme_should_propagate_errors(); cache = encode_base64(file->bytes()); @@ -253,7 +253,7 @@ static String file_image_data() return cache; } -ErrorOr<void> Client::handle_directory_listing(String const& requested_path, String const& real_path, HTTP::HttpRequest const& request) +ErrorOr<void> Client::handle_directory_listing(DeprecatedString const& requested_path, DeprecatedString const& real_path, HTTP::HttpRequest const& request) { StringBuilder builder; @@ -277,7 +277,7 @@ ErrorOr<void> Client::handle_directory_listing(String const& requested_path, Str builder.append("<code><table>\n"sv); Core::DirIterator dt(real_path); - Vector<String> names; + Vector<DeprecatedString> names; while (dt.has_next()) names.append(dt.next_path()); quick_sort(names); @@ -332,7 +332,7 @@ ErrorOr<void> Client::handle_directory_listing(String const& requested_path, Str return send_response(stream, request, { .type = "text/html", .length = response.length() }); } -ErrorOr<void> Client::send_error_response(unsigned code, HTTP::HttpRequest const& request, Vector<String> const& headers) +ErrorOr<void> Client::send_error_response(unsigned code, HTTP::HttpRequest const& request, Vector<DeprecatedString> const& headers) { auto reason_phrase = HTTP::HttpResponse::reason_phrase_for_code(code); diff --git a/Userland/Services/WebServer/Client.h b/Userland/Services/WebServer/Client.h index b817c35738..4e23bf563a 100644 --- a/Userland/Services/WebServer/Client.h +++ b/Userland/Services/WebServer/Client.h @@ -23,17 +23,17 @@ private: Client(NonnullOwnPtr<Core::Stream::BufferedTCPSocket>, Core::Object* parent); struct ContentInfo { - String type; + DeprecatedString type; size_t length {}; }; ErrorOr<bool> handle_request(ReadonlyBytes); ErrorOr<void> send_response(InputStream&, HTTP::HttpRequest const&, ContentInfo); ErrorOr<void> send_redirect(StringView redirect, HTTP::HttpRequest const&); - ErrorOr<void> send_error_response(unsigned code, HTTP::HttpRequest const&, Vector<String> const& headers = {}); + ErrorOr<void> send_error_response(unsigned code, HTTP::HttpRequest const&, Vector<DeprecatedString> const& headers = {}); void die(); void log_response(unsigned code, HTTP::HttpRequest const&); - ErrorOr<void> handle_directory_listing(String const& requested_path, String const& real_path, HTTP::HttpRequest const&); + ErrorOr<void> handle_directory_listing(DeprecatedString const& requested_path, DeprecatedString const& real_path, HTTP::HttpRequest const&); bool verify_credentials(Vector<HTTP::HttpRequest::Header> const&); NonnullOwnPtr<Core::Stream::BufferedTCPSocket> m_socket; diff --git a/Userland/Services/WebServer/Configuration.cpp b/Userland/Services/WebServer/Configuration.cpp index 790f6d9e94..60bd24392e 100644 --- a/Userland/Services/WebServer/Configuration.cpp +++ b/Userland/Services/WebServer/Configuration.cpp @@ -10,7 +10,7 @@ namespace WebServer { static Configuration* s_configuration = nullptr; -Configuration::Configuration(String root_path) +Configuration::Configuration(DeprecatedString root_path) : m_root_path(move(root_path)) { VERIFY(!s_configuration); diff --git a/Userland/Services/WebServer/Configuration.h b/Userland/Services/WebServer/Configuration.h index 9b6fe7dd71..76bd4a6780 100644 --- a/Userland/Services/WebServer/Configuration.h +++ b/Userland/Services/WebServer/Configuration.h @@ -6,26 +6,26 @@ #pragma once +#include <AK/DeprecatedString.h> #include <AK/Optional.h> -#include <AK/String.h> #include <LibHTTP/HttpRequest.h> namespace WebServer { class Configuration { public: - Configuration(String root_path); + Configuration(DeprecatedString root_path); - String const& root_path() const { return m_root_path; } + DeprecatedString const& root_path() const { return m_root_path; } Optional<HTTP::HttpRequest::BasicAuthenticationCredentials> const& credentials() const { return m_credentials; } - void set_root_path(String root_path) { m_root_path = move(root_path); } + void set_root_path(DeprecatedString root_path) { m_root_path = move(root_path); } void set_credentials(Optional<HTTP::HttpRequest::BasicAuthenticationCredentials> credentials) { m_credentials = move(credentials); } static Configuration const& the(); private: - String m_root_path; + DeprecatedString m_root_path; Optional<HTTP::HttpRequest::BasicAuthenticationCredentials> m_credentials; }; diff --git a/Userland/Services/WebServer/main.cpp b/Userland/Services/WebServer/main.cpp index 4d11498d91..fb902ed698 100644 --- a/Userland/Services/WebServer/main.cpp +++ b/Userland/Services/WebServer/main.cpp @@ -20,14 +20,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) { - String default_listen_address = "0.0.0.0"; + DeprecatedString default_listen_address = "0.0.0.0"; u16 default_port = 8000; - String root_path = "/www"; + DeprecatedString root_path = "/www"; - String listen_address = default_listen_address; + DeprecatedString listen_address = default_listen_address; int port = default_port; - String username; - String password; + DeprecatedString username; + DeprecatedString password; Core::ArgsParser args_parser; args_parser.add_option(listen_address, "IP address to listen on", "listen-address", 'l', "listen_address"); diff --git a/Userland/Services/WebSocket/ConnectionFromClient.cpp b/Userland/Services/WebSocket/ConnectionFromClient.cpp index 17cd938fea..032df8f0a1 100644 --- a/Userland/Services/WebSocket/ConnectionFromClient.cpp +++ b/Userland/Services/WebSocket/ConnectionFromClient.cpp @@ -26,8 +26,8 @@ void ConnectionFromClient::die() Core::EventLoop::current().quit(0); } -Messages::WebSocketServer::ConnectResponse ConnectionFromClient::connect(URL const& url, String const& origin, - Vector<String> const& protocols, Vector<String> const& extensions, IPC::Dictionary const& additional_request_headers) +Messages::WebSocketServer::ConnectResponse ConnectionFromClient::connect(URL const& url, DeprecatedString const& origin, + Vector<DeprecatedString> const& protocols, Vector<DeprecatedString> const& extensions, IPC::Dictionary const& additional_request_headers) { if (!url.is_valid()) { dbgln("WebSocket::Connect: Invalid URL requested: '{}'", url); @@ -57,7 +57,7 @@ Messages::WebSocketServer::ConnectResponse ConnectionFromClient::connect(URL con connection->on_error = [this, id](auto message) { did_error(id, (i32)message); }; - connection->on_close = [this, id](u16 code, String reason, bool was_clean) { + connection->on_close = [this, id](u16 code, DeprecatedString reason, bool was_clean) { did_close(id, code, move(reason), was_clean); }; @@ -84,7 +84,7 @@ void ConnectionFromClient::send(i32 connection_id, bool is_text, ByteBuffer cons } } -void ConnectionFromClient::close(i32 connection_id, u16 code, String const& reason) +void ConnectionFromClient::close(i32 connection_id, u16 code, DeprecatedString const& reason) { RefPtr<WebSocket> connection = m_connections.get(connection_id).value_or({}); if (connection && connection->ready_state() == ReadyState::Open) @@ -92,7 +92,7 @@ void ConnectionFromClient::close(i32 connection_id, u16 code, String const& reas } Messages::WebSocketServer::SetCertificateResponse ConnectionFromClient::set_certificate(i32 connection_id, - [[maybe_unused]] String const& certificate, [[maybe_unused]] String const& key) + [[maybe_unused]] DeprecatedString const& certificate, [[maybe_unused]] DeprecatedString const& key) { RefPtr<WebSocket> connection = m_connections.get(connection_id).value_or({}); bool success = false; @@ -119,7 +119,7 @@ void ConnectionFromClient::did_error(i32 connection_id, i32 message) async_errored(connection_id, message); } -void ConnectionFromClient::did_close(i32 connection_id, u16 code, String reason, bool was_clean) +void ConnectionFromClient::did_close(i32 connection_id, u16 code, DeprecatedString reason, bool was_clean) { async_closed(connection_id, code, reason, was_clean); deferred_invoke([this, connection_id] { diff --git a/Userland/Services/WebSocket/ConnectionFromClient.h b/Userland/Services/WebSocket/ConnectionFromClient.h index 86d9387bc9..d5bab0fb9a 100644 --- a/Userland/Services/WebSocket/ConnectionFromClient.h +++ b/Userland/Services/WebSocket/ConnectionFromClient.h @@ -26,16 +26,16 @@ public: private: explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>); - virtual Messages::WebSocketServer::ConnectResponse connect(URL const&, String const&, Vector<String> const&, Vector<String> const&, IPC::Dictionary const&) override; + virtual Messages::WebSocketServer::ConnectResponse connect(URL const&, DeprecatedString const&, Vector<DeprecatedString> const&, Vector<DeprecatedString> const&, IPC::Dictionary const&) override; virtual Messages::WebSocketServer::ReadyStateResponse ready_state(i32) override; virtual void send(i32, bool, ByteBuffer const&) override; - virtual void close(i32, u16, String const&) override; - virtual Messages::WebSocketServer::SetCertificateResponse set_certificate(i32, String const&, String const&) override; + virtual void close(i32, u16, DeprecatedString const&) override; + virtual Messages::WebSocketServer::SetCertificateResponse set_certificate(i32, DeprecatedString const&, DeprecatedString const&) override; void did_connect(i32); void did_receive_message(i32, Message); void did_error(i32, i32 message); - void did_close(i32, u16 code, String reason, bool was_clean); + void did_close(i32, u16 code, DeprecatedString reason, bool was_clean); void did_request_certificates(i32); i32 m_connection_ids { 0 }; diff --git a/Userland/Services/WebSocket/WebSocketClient.ipc b/Userland/Services/WebSocket/WebSocketClient.ipc index a7438d1e3f..838b26f3cf 100644 --- a/Userland/Services/WebSocket/WebSocketClient.ipc +++ b/Userland/Services/WebSocket/WebSocketClient.ipc @@ -6,7 +6,7 @@ endpoint WebSocketClient connected(i32 connection_id) =| received(i32 connection_id, bool is_text, ByteBuffer data) =| errored(i32 connection_id, i32 message) =| - closed(i32 connection_id, u16 code, String reason, bool clean) =| + closed(i32 connection_id, u16 code, DeprecatedString reason, bool clean) =| // Certificate requests certificate_requested(i32 connection_id) =| diff --git a/Userland/Services/WebSocket/WebSocketServer.ipc b/Userland/Services/WebSocket/WebSocketServer.ipc index a5f020fa48..d0dfcf6b25 100644 --- a/Userland/Services/WebSocket/WebSocketServer.ipc +++ b/Userland/Services/WebSocket/WebSocketServer.ipc @@ -3,10 +3,10 @@ endpoint WebSocketServer { // Connection API - connect(URL url, String origin, Vector<String> protocols, Vector<String> extensions, IPC::Dictionary additional_request_headers) => (i32 connection_id) + connect(URL url, DeprecatedString origin, Vector<DeprecatedString> protocols, Vector<DeprecatedString> extensions, IPC::Dictionary additional_request_headers) => (i32 connection_id) ready_state(i32 connection_id) => (u32 ready_state) send(i32 connection_id, bool is_text, ByteBuffer data) =| - close(i32 connection_id, u16 code, String reason) =| + close(i32 connection_id, u16 code, DeprecatedString reason) =| - set_certificate(i32 connection_id, String certificate, String key) => (bool success) + set_certificate(i32 connection_id, DeprecatedString certificate, DeprecatedString key) => (bool success) } diff --git a/Userland/Services/WindowServer/AppletManager.cpp b/Userland/Services/WindowServer/AppletManager.cpp index b3dc601af1..76bccae8e4 100644 --- a/Userland/Services/WindowServer/AppletManager.cpp +++ b/Userland/Services/WindowServer/AppletManager.cpp @@ -14,7 +14,7 @@ namespace WindowServer { static AppletManager* s_the; -Vector<String> order_vector; +Vector<DeprecatedString> order_vector; AppletManager::AppletManager() { diff --git a/Userland/Services/WindowServer/Compositor.cpp b/Userland/Services/WindowServer/Compositor.cpp index b705f18137..5ea6e49f0a 100644 --- a/Userland/Services/WindowServer/Compositor.cpp +++ b/Userland/Services/WindowServer/Compositor.cpp @@ -31,7 +31,7 @@ Compositor& Compositor::the() return s_the; } -static WallpaperMode mode_to_enum(String const& name) +static WallpaperMode mode_to_enum(DeprecatedString const& name) { if (name == "Tile") return WallpaperMode::Tile; @@ -779,7 +779,7 @@ void Compositor::start_compose_async_timer() } } -bool Compositor::set_background_color(String const& background_color) +bool Compositor::set_background_color(DeprecatedString const& background_color) { auto color = Color::from_string(background_color); if (!color.has_value()) @@ -799,7 +799,7 @@ bool Compositor::set_background_color(String const& background_color) return succeeded; } -bool Compositor::set_wallpaper_mode(String const& mode) +bool Compositor::set_wallpaper_mode(DeprecatedString const& mode) { auto& wm = WindowManager::the(); wm.config()->write_entry("Background", "Mode", mode); diff --git a/Userland/Services/WindowServer/Compositor.h b/Userland/Services/WindowServer/Compositor.h index 0be51b9f28..83367c7832 100644 --- a/Userland/Services/WindowServer/Compositor.h +++ b/Userland/Services/WindowServer/Compositor.h @@ -105,9 +105,9 @@ public: void screen_resolution_changed(); - bool set_background_color(String const& background_color); + bool set_background_color(DeprecatedString const& background_color); - bool set_wallpaper_mode(String const& mode); + bool set_wallpaper_mode(DeprecatedString const& mode); bool set_wallpaper(RefPtr<Gfx::Bitmap>); RefPtr<Gfx::Bitmap> wallpaper_bitmap() const { return m_wallpaper; } diff --git a/Userland/Services/WindowServer/ConnectionFromClient.cpp b/Userland/Services/WindowServer/ConnectionFromClient.cpp index e5b4e1524a..8fe18a671d 100644 --- a/Userland/Services/WindowServer/ConnectionFromClient.cpp +++ b/Userland/Services/WindowServer/ConnectionFromClient.cpp @@ -90,7 +90,7 @@ void ConnectionFromClient::notify_about_new_screen_rects() async_screen_rects_changed(Screen::rects(), Screen::main().index(), wm.window_stack_rows(), wm.window_stack_columns()); } -void ConnectionFromClient::create_menu(i32 menu_id, String const& menu_title) +void ConnectionFromClient::create_menu(i32 menu_id, DeprecatedString const& menu_title) { auto menu = Menu::construct(this, menu_id, menu_title); m_menus.set(menu_id, move(menu)); @@ -127,8 +127,8 @@ void ConnectionFromClient::add_menu(i32 window_id, i32 menu_id) } void ConnectionFromClient::add_menu_item(i32 menu_id, i32 identifier, i32 submenu_id, - String const& text, bool enabled, bool checkable, bool checked, bool is_default, - String const& shortcut, Gfx::ShareableBitmap const& icon, bool exclusive) + DeprecatedString const& text, bool enabled, bool checkable, bool checked, bool is_default, + DeprecatedString const& shortcut, Gfx::ShareableBitmap const& icon, bool exclusive) { auto it = m_menus.find(menu_id); if (it == m_menus.end()) { @@ -172,8 +172,8 @@ void ConnectionFromClient::dismiss_menu(i32 menu_id) } void ConnectionFromClient::update_menu_item(i32 menu_id, i32 identifier, [[maybe_unused]] i32 submenu_id, - String const& text, bool enabled, bool checkable, bool checked, bool is_default, - String const& shortcut, Gfx::ShareableBitmap const& icon) + DeprecatedString const& text, bool enabled, bool checkable, bool checked, bool is_default, + DeprecatedString const& shortcut, Gfx::ShareableBitmap const& icon) { auto it = m_menus.find(menu_id); if (it == m_menus.end()) { @@ -315,12 +315,12 @@ Messages::WindowServer::SetWallpaperResponse ConnectionFromClient::set_wallpaper return Compositor::the().set_wallpaper(bitmap.bitmap()); } -void ConnectionFromClient::set_background_color(String const& background_color) +void ConnectionFromClient::set_background_color(DeprecatedString const& background_color) { Compositor::the().set_background_color(background_color); } -void ConnectionFromClient::set_wallpaper_mode(String const& mode) +void ConnectionFromClient::set_wallpaper_mode(DeprecatedString const& mode) { Compositor::the().set_wallpaper_mode(mode); } @@ -332,7 +332,7 @@ Messages::WindowServer::GetWallpaperResponse ConnectionFromClient::get_wallpaper Messages::WindowServer::SetScreenLayoutResponse ConnectionFromClient::set_screen_layout(ScreenLayout const& screen_layout, bool save) { - String error_msg; + DeprecatedString error_msg; bool success = WindowManager::the().set_screen_layout(ScreenLayout(screen_layout), save, error_msg); return { success, move(error_msg) }; } @@ -344,7 +344,7 @@ Messages::WindowServer::GetScreenLayoutResponse ConnectionFromClient::get_screen Messages::WindowServer::SaveScreenLayoutResponse ConnectionFromClient::save_screen_layout() { - String error_msg; + DeprecatedString error_msg; bool success = WindowManager::the().save_screen_layout(error_msg); return { success, move(error_msg) }; } @@ -374,7 +374,7 @@ void ConnectionFromClient::show_screen_numbers(bool show) Compositor::the().decrement_show_screen_number({}); } -void ConnectionFromClient::set_window_title(i32 window_id, String const& title) +void ConnectionFromClient::set_window_title(i32 window_id, DeprecatedString const& title) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -466,7 +466,7 @@ Messages::WindowServer::SetWindowRectResponse ConnectionFromClient::set_window_r return nullptr; } if (rect.width() > INT16_MAX || rect.height() > INT16_MAX) { - did_misbehave(String::formatted("SetWindowRect: Bad window sizing(width={}, height={}), dimension exceeds INT16_MAX", rect.width(), rect.height()).characters()); + did_misbehave(DeprecatedString::formatted("SetWindowRect: Bad window sizing(width={}, height={}), dimension exceeds INT16_MAX", rect.width(), rect.height()).characters()); return nullptr; } @@ -590,7 +590,7 @@ void ConnectionFromClient::create_window(i32 window_id, Gfx::IntRect const& rect bool fullscreen, bool frameless, bool forced_shadow, float opacity, float alpha_hit_threshold, Gfx::IntSize const& base_size, Gfx::IntSize const& size_increment, Gfx::IntSize const& minimum_size, Optional<Gfx::IntSize> const& resize_aspect_ratio, i32 type, i32 mode, - String const& title, i32 parent_window_id, Gfx::IntRect const& launch_origin_rect) + DeprecatedString const& title, i32 parent_window_id, Gfx::IntRect const& launch_origin_rect) { Window* parent_window = nullptr; if (parent_window_id) { @@ -846,7 +846,7 @@ void ConnectionFromClient::start_window_resize(i32 window_id, i32 resize_directi WindowManager::the().start_window_resize(window, ScreenInput::the().cursor_location(), MouseButton::Primary, (ResizeDirection)resize_direction); } -Messages::WindowServer::StartDragResponse ConnectionFromClient::start_drag(String const& text, HashMap<String, ByteBuffer> const& mime_data, Gfx::ShareableBitmap const& drag_bitmap) +Messages::WindowServer::StartDragResponse ConnectionFromClient::start_drag(DeprecatedString const& text, HashMap<DeprecatedString, ByteBuffer> const& mime_data, Gfx::ShareableBitmap const& drag_bitmap) { auto& wm = WindowManager::the(); if (wm.dnd_client() || !(wm.last_processed_buttons() & MouseButton::Primary)) @@ -863,7 +863,7 @@ void ConnectionFromClient::set_accepts_drag(bool accepts) wm.set_accepts_drag(accepts); } -Messages::WindowServer::SetSystemThemeResponse ConnectionFromClient::set_system_theme(String const& theme_path, String const& theme_name, bool keep_desktop_background) +Messages::WindowServer::SetSystemThemeResponse ConnectionFromClient::set_system_theme(DeprecatedString const& theme_path, DeprecatedString const& theme_name, bool keep_desktop_background) { bool success = WindowManager::the().update_theme(theme_path, theme_name, keep_desktop_background); return success; @@ -897,7 +897,7 @@ Messages::WindowServer::IsSystemThemeOverriddenResponse ConnectionFromClient::is return WindowManager::the().is_theme_overridden(); } -void ConnectionFromClient::apply_cursor_theme(String const& name) +void ConnectionFromClient::apply_cursor_theme(DeprecatedString const& name) { WindowManager::the().apply_cursor_theme(name); } @@ -929,7 +929,7 @@ Messages::WindowServer::GetCursorThemeResponse ConnectionFromClient::get_cursor_ return name; } -Messages::WindowServer::SetSystemFontsResponse ConnectionFromClient::set_system_fonts(String const& default_font_query, String const& fixed_width_font_query, String const& window_title_font_query) +Messages::WindowServer::SetSystemFontsResponse ConnectionFromClient::set_system_fonts(DeprecatedString const& default_font_query, DeprecatedString const& fixed_width_font_query, DeprecatedString const& window_title_font_query) { if (!Gfx::FontDatabase::the().get_by_name(default_font_query) || !Gfx::FontDatabase::the().get_by_name(fixed_width_font_query)) { diff --git a/Userland/Services/WindowServer/ConnectionFromClient.h b/Userland/Services/WindowServer/ConnectionFromClient.h index e48a62fc36..063e4ea7f6 100644 --- a/Userland/Services/WindowServer/ConnectionFromClient.h +++ b/Userland/Services/WindowServer/ConnectionFromClient.h @@ -93,19 +93,19 @@ private: void set_unresponsive(bool); void destroy_window(Window&, Vector<i32>& destroyed_window_ids); - virtual void create_menu(i32, String const&) override; + virtual void create_menu(i32, DeprecatedString const&) override; virtual void destroy_menu(i32) override; virtual void add_menu(i32, i32) override; - virtual void add_menu_item(i32, i32, i32, String const&, bool, bool, bool, bool, String const&, Gfx::ShareableBitmap const&, bool) override; + virtual void add_menu_item(i32, i32, i32, DeprecatedString const&, bool, bool, bool, bool, DeprecatedString const&, Gfx::ShareableBitmap const&, bool) override; virtual void add_menu_separator(i32) override; - virtual void update_menu_item(i32, i32, i32, String const&, bool, bool, bool, bool, String const&, Gfx::ShareableBitmap const&) override; + virtual void update_menu_item(i32, i32, i32, DeprecatedString const&, bool, bool, bool, bool, DeprecatedString const&, Gfx::ShareableBitmap const&) override; virtual void remove_menu_item(i32 menu_id, i32 identifier) override; virtual void flash_menubar_menu(i32, i32) override; virtual void create_window(i32, Gfx::IntRect const&, bool, bool, bool, bool, bool, bool, bool, bool, float, float, Gfx::IntSize const&, Gfx::IntSize const&, Gfx::IntSize const&, - Optional<Gfx::IntSize> const&, i32, i32, String const&, i32, Gfx::IntRect const&) override; + Optional<Gfx::IntSize> const&, i32, i32, DeprecatedString const&, i32, Gfx::IntRect const&) override; virtual Messages::WindowServer::DestroyWindowResponse destroy_window(i32) override; - virtual void set_window_title(i32, String const&) override; + virtual void set_window_title(i32, DeprecatedString const&) override; virtual Messages::WindowServer::GetWindowTitleResponse get_window_title(i32) override; virtual Messages::WindowServer::IsMaximizedResponse is_maximized(i32) override; virtual void set_maximized(i32, bool) override; @@ -129,8 +129,8 @@ private: virtual void set_frameless(i32, bool) override; virtual void set_forced_shadow(i32, bool) override; virtual Messages::WindowServer::SetWallpaperResponse set_wallpaper(Gfx::ShareableBitmap const&) override; - virtual void set_background_color(String const&) override; - virtual void set_wallpaper_mode(String const&) override; + virtual void set_background_color(DeprecatedString const&) override; + virtual void set_wallpaper_mode(DeprecatedString const&) override; virtual Messages::WindowServer::GetWallpaperResponse get_wallpaper() override; virtual Messages::WindowServer::SetScreenLayoutResponse set_screen_layout(ScreenLayout const&, bool) override; virtual Messages::WindowServer::GetScreenLayoutResponse get_screen_layout() override; @@ -143,21 +143,21 @@ private: virtual void popup_menu(i32, Gfx::IntPoint const&, Gfx::IntRect const&) override; virtual void dismiss_menu(i32) override; virtual void set_window_icon_bitmap(i32, Gfx::ShareableBitmap const&) override; - virtual Messages::WindowServer::StartDragResponse start_drag(String const&, HashMap<String, ByteBuffer> const&, Gfx::ShareableBitmap const&) override; + virtual Messages::WindowServer::StartDragResponse start_drag(DeprecatedString const&, HashMap<DeprecatedString, ByteBuffer> const&, Gfx::ShareableBitmap const&) override; virtual void set_accepts_drag(bool) override; - virtual Messages::WindowServer::SetSystemThemeResponse set_system_theme(String const&, String const&, bool keep_desktop_background) override; + virtual Messages::WindowServer::SetSystemThemeResponse set_system_theme(DeprecatedString const&, DeprecatedString const&, bool keep_desktop_background) override; virtual Messages::WindowServer::GetSystemThemeResponse get_system_theme() override; virtual Messages::WindowServer::SetSystemThemeOverrideResponse set_system_theme_override(Core::AnonymousBuffer const&) override; virtual Messages::WindowServer::GetSystemThemeOverrideResponse get_system_theme_override() override; virtual void clear_system_theme_override() override; virtual Messages::WindowServer::IsSystemThemeOverriddenResponse is_system_theme_overridden() override; - virtual void apply_cursor_theme(String const&) override; + virtual void apply_cursor_theme(DeprecatedString const&) override; virtual void set_cursor_highlight_radius(int radius) override; virtual Messages::WindowServer::GetCursorHighlightRadiusResponse get_cursor_highlight_radius() override; virtual void set_cursor_highlight_color(Gfx::Color const& color) override; virtual Messages::WindowServer::GetCursorHighlightColorResponse get_cursor_highlight_color() override; virtual Messages::WindowServer::GetCursorThemeResponse get_cursor_theme() override; - virtual Messages::WindowServer::SetSystemFontsResponse set_system_fonts(String const&, String const&, String const&) override; + virtual Messages::WindowServer::SetSystemFontsResponse set_system_fonts(DeprecatedString const&, DeprecatedString const&, DeprecatedString const&) override; virtual void set_system_effects(Vector<bool> const&, u8) override; virtual void set_window_base_size_and_size_increment(i32, Gfx::IntSize const&, Gfx::IntSize const&) override; virtual void set_window_resize_aspect_ratio(i32, Optional<Gfx::IntSize> const&) override; diff --git a/Userland/Services/WindowServer/Event.h b/Userland/Services/WindowServer/Event.h index dbacf547a6..8941953441 100644 --- a/Userland/Services/WindowServer/Event.h +++ b/Userland/Services/WindowServer/Event.h @@ -6,7 +6,7 @@ #pragma once -#include <AK/String.h> +#include <AK/DeprecatedString.h> #include <Kernel/API/KeyCode.h> #include <LibCore/Event.h> #include <LibCore/MimeData.h> @@ -114,7 +114,7 @@ public: int wheel_raw_delta_y() const { return m_wheel_raw_delta_y; } bool is_drag() const { return m_drag; } - Vector<String> mime_types() const + Vector<DeprecatedString> mime_types() const { if (!m_mime_data) return {}; diff --git a/Userland/Services/WindowServer/HardwareScreenBackend.cpp b/Userland/Services/WindowServer/HardwareScreenBackend.cpp index a3d72f4ae0..5f4274e76c 100644 --- a/Userland/Services/WindowServer/HardwareScreenBackend.cpp +++ b/Userland/Services/WindowServer/HardwareScreenBackend.cpp @@ -17,7 +17,7 @@ namespace WindowServer { -HardwareScreenBackend::HardwareScreenBackend(String device) +HardwareScreenBackend::HardwareScreenBackend(DeprecatedString device) : m_device(move(device)) { } @@ -28,7 +28,7 @@ ErrorOr<void> HardwareScreenBackend::open() GraphicsConnectorProperties properties; if (graphics_connector_get_properties(m_display_connector_fd, &properties) < 0) - return Error::from_syscall(String::formatted("failed to ioctl {}", m_device), errno); + return Error::from_syscall(DeprecatedString::formatted("failed to ioctl {}", m_device), errno); m_can_device_flush_buffers = (properties.partial_flushing_support != 0); m_can_device_flush_entire_framebuffer = (properties.flushing_support != 0); diff --git a/Userland/Services/WindowServer/HardwareScreenBackend.h b/Userland/Services/WindowServer/HardwareScreenBackend.h index b58b72e3cc..877af92762 100644 --- a/Userland/Services/WindowServer/HardwareScreenBackend.h +++ b/Userland/Services/WindowServer/HardwareScreenBackend.h @@ -8,9 +8,9 @@ #include "ScreenBackend.h" #include "ScreenLayout.h" +#include <AK/DeprecatedString.h> #include <AK/Error.h> #include <AK/Span.h> -#include <AK/String.h> #include <sys/ioctl_numbers.h> namespace WindowServer { @@ -18,7 +18,7 @@ class HardwareScreenBackend : public ScreenBackend { public: virtual ~HardwareScreenBackend(); - explicit HardwareScreenBackend(String device); + explicit HardwareScreenBackend(DeprecatedString device); virtual ErrorOr<void> open() override; @@ -36,7 +36,7 @@ public: virtual ErrorOr<void> set_head_mode_setting(GraphicsHeadModeSetting) override; virtual ErrorOr<GraphicsHeadModeSetting> get_head_mode_setting() override; - String m_device {}; + DeprecatedString m_device {}; int m_display_connector_fd { -1 }; Gfx::ARGB32* scanline(int buffer_index, int y) const diff --git a/Userland/Services/WindowServer/KeymapSwitcher.cpp b/Userland/Services/WindowServer/KeymapSwitcher.cpp index 279e744310..e7f4cd2416 100644 --- a/Userland/Services/WindowServer/KeymapSwitcher.cpp +++ b/Userland/Services/WindowServer/KeymapSwitcher.cpp @@ -88,7 +88,7 @@ void KeymapSwitcher::next_keymap() } } -String KeymapSwitcher::get_current_keymap() const +DeprecatedString KeymapSwitcher::get_current_keymap() const { auto proc_keymap = Core::File::construct("/sys/kernel/keymap"); if (!proc_keymap->open(Core::OpenMode::ReadOnly)) @@ -100,7 +100,7 @@ String KeymapSwitcher::get_current_keymap() const return keymap_object.get("keymap"sv).to_string(); } -void KeymapSwitcher::set_keymap(const AK::String& keymap) +void KeymapSwitcher::set_keymap(const AK::DeprecatedString& keymap) { if (Core::Process::spawn("/bin/keymap"sv, Array { "-m", keymap.characters() }).is_error()) dbgln("Failed to call /bin/keymap, error: {} ({})", errno, strerror(errno)); diff --git a/Userland/Services/WindowServer/KeymapSwitcher.h b/Userland/Services/WindowServer/KeymapSwitcher.h index 8ac598d6a6..555206d0ed 100644 --- a/Userland/Services/WindowServer/KeymapSwitcher.h +++ b/Userland/Services/WindowServer/KeymapSwitcher.h @@ -6,7 +6,7 @@ #pragma once -#include <AK/String.h> +#include <AK/DeprecatedString.h> #include <AK/Vector.h> #include <AK/WeakPtr.h> #include <LibCore/FileWatcher.h> @@ -23,18 +23,18 @@ public: void next_keymap(); - Function<void(String const& keymap)> on_keymap_change; + Function<void(DeprecatedString const& keymap)> on_keymap_change; - String get_current_keymap() const; + DeprecatedString get_current_keymap() const; - void set_keymap(AK::String const&); + void set_keymap(AK::DeprecatedString const&); private: void refresh(); KeymapSwitcher(); - Vector<AK::String> m_keymaps; + Vector<AK::DeprecatedString> m_keymaps; RefPtr<Core::FileWatcher> m_file_watcher; diff --git a/Userland/Services/WindowServer/Menu.cpp b/Userland/Services/WindowServer/Menu.cpp index 86d1ea2d04..2d5ecad4d9 100644 --- a/Userland/Services/WindowServer/Menu.cpp +++ b/Userland/Services/WindowServer/Menu.cpp @@ -38,7 +38,7 @@ u32 find_ampersand_shortcut_character(StringView string) return 0; } -Menu::Menu(ConnectionFromClient* client, int menu_id, String name) +Menu::Menu(ConnectionFromClient* client, int menu_id, DeprecatedString name) : Core::Object(client) , m_client(client) , m_menu_id(menu_id) diff --git a/Userland/Services/WindowServer/Menu.h b/Userland/Services/WindowServer/Menu.h index dfa28908dd..78f888c0f0 100644 --- a/Userland/Services/WindowServer/Menu.h +++ b/Userland/Services/WindowServer/Menu.h @@ -6,8 +6,8 @@ #pragma once +#include <AK/DeprecatedString.h> #include <AK/NonnullOwnPtrVector.h> -#include <AK/String.h> #include <AK/WeakPtr.h> #include <LibCore/Object.h> #include <LibGfx/Font/Font.h> @@ -59,7 +59,7 @@ public: void update_alt_shortcuts_for_items(); void add_item(NonnullOwnPtr<MenuItem>); - String const& name() const { return m_name; } + DeprecatedString const& name() const { return m_name; } template<typename Callback> IterationDecision for_each_item(Callback callback) @@ -135,7 +135,7 @@ public: Vector<size_t> const* items_with_alt_shortcut(u32 alt_shortcut) const; private: - Menu(ConnectionFromClient*, int menu_id, String name); + Menu(ConnectionFromClient*, int menu_id, DeprecatedString name); virtual void event(Core::Event&) override; @@ -152,7 +152,7 @@ private: ConnectionFromClient* m_client { nullptr }; int m_menu_id { 0 }; - String m_name; + DeprecatedString m_name; u32 m_alt_shortcut_character { 0 }; Gfx::IntRect m_rect_in_window_menubar; Gfx::IntPoint m_unadjusted_position; diff --git a/Userland/Services/WindowServer/MenuItem.cpp b/Userland/Services/WindowServer/MenuItem.cpp index 2d79f818b8..255a5ae085 100644 --- a/Userland/Services/WindowServer/MenuItem.cpp +++ b/Userland/Services/WindowServer/MenuItem.cpp @@ -12,7 +12,7 @@ namespace WindowServer { -MenuItem::MenuItem(Menu& menu, unsigned identifier, String const& text, String const& shortcut_text, bool enabled, bool checkable, bool checked, Gfx::Bitmap const* icon) +MenuItem::MenuItem(Menu& menu, unsigned identifier, DeprecatedString const& text, DeprecatedString const& shortcut_text, bool enabled, bool checkable, bool checked, Gfx::Bitmap const* icon) : m_menu(menu) , m_type(Text) , m_enabled(enabled) diff --git a/Userland/Services/WindowServer/MenuItem.h b/Userland/Services/WindowServer/MenuItem.h index f5d3d74b72..54d966a2e3 100644 --- a/Userland/Services/WindowServer/MenuItem.h +++ b/Userland/Services/WindowServer/MenuItem.h @@ -6,8 +6,8 @@ #pragma once +#include <AK/DeprecatedString.h> #include <AK/Function.h> -#include <AK/String.h> #include <LibGfx/Forward.h> #include <LibGfx/Rect.h> @@ -23,7 +23,7 @@ public: Separator, }; - MenuItem(Menu&, unsigned identifier, String const& text, String const& shortcut_text = {}, bool enabled = true, bool checkable = false, bool checked = false, Gfx::Bitmap const* icon = nullptr); + MenuItem(Menu&, unsigned identifier, DeprecatedString const& text, DeprecatedString const& shortcut_text = {}, bool enabled = true, bool checkable = false, bool checked = false, Gfx::Bitmap const* icon = nullptr); MenuItem(Menu&, Type); ~MenuItem() = default; @@ -41,11 +41,11 @@ public: bool is_default() const { return m_default; } void set_default(bool); - String text() const { return m_text; } - void set_text(String text) { m_text = move(text); } + DeprecatedString text() const { return m_text; } + void set_text(DeprecatedString text) { m_text = move(text); } - String shortcut_text() const { return m_shortcut_text; } - void set_shortcut_text(String text) { m_shortcut_text = move(text); } + DeprecatedString shortcut_text() const { return m_shortcut_text; } + void set_shortcut_text(DeprecatedString text) { m_shortcut_text = move(text); } void set_rect(Gfx::IntRect const& rect) { m_rect = rect; } Gfx::IntRect rect() const; @@ -73,8 +73,8 @@ private: bool m_checked { false }; bool m_default { false }; unsigned m_identifier { 0 }; - String m_text; - String m_shortcut_text; + DeprecatedString m_text; + DeprecatedString m_shortcut_text; Gfx::IntRect m_rect; RefPtr<Gfx::Bitmap> m_icon; int m_submenu_id { -1 }; diff --git a/Userland/Services/WindowServer/Overlays.cpp b/Userland/Services/WindowServer/Overlays.cpp index 87320cbb26..cc8ff7ad73 100644 --- a/Userland/Services/WindowServer/Overlays.cpp +++ b/Userland/Services/WindowServer/Overlays.cpp @@ -171,7 +171,7 @@ void ScreenNumberOverlay::pick_font() auto screen_number_content_rect_size = calculate_content_rect_for_screen(Screen::main()).size(); auto& font_database = Gfx::FontDatabase::the(); auto& default_font = WindowManager::the().font(); - String best_font_name; + DeprecatedString best_font_name; int best_font_size = -1; font_database.for_each_font([&](Gfx::Font const& font) { // TODO: instead of picking *any* font we should probably compare font.name() @@ -213,7 +213,7 @@ Gfx::Font const& ScreenNumberOverlay::font() void ScreenNumberOverlay::render_overlay_bitmap(Gfx::Painter& painter) { - painter.draw_text({ {}, rect().size() }, String::formatted("{}", m_screen.index() + 1), font(), Gfx::TextAlignment::Center, Color::White); + painter.draw_text({ {}, rect().size() }, DeprecatedString::formatted("{}", m_screen.index() + 1), font(), Gfx::TextAlignment::Center, Color::White); } Gfx::IntRect ScreenNumberOverlay::calculate_content_rect_for_screen(Screen& screen) @@ -239,7 +239,7 @@ void WindowGeometryOverlay::update_rect() if (!window->size_increment().is_null()) { int width_steps = (window->width() - window->base_size().width()) / window->size_increment().width(); int height_steps = (window->height() - window->base_size().height()) / window->size_increment().height(); - m_label = String::formatted("{} ({}x{})", window->rect(), width_steps, height_steps); + m_label = DeprecatedString::formatted("{} ({}x{})", window->rect(), width_steps, height_steps); } else { m_label = window->rect().to_string(); } @@ -273,7 +273,7 @@ void WindowGeometryOverlay::window_rect_changed() invalidate_content(); } -DndOverlay::DndOverlay(String const& text, Gfx::Bitmap const* bitmap) +DndOverlay::DndOverlay(DeprecatedString const& text, Gfx::Bitmap const* bitmap) : m_bitmap(bitmap) , m_text(text) { diff --git a/Userland/Services/WindowServer/Overlays.h b/Userland/Services/WindowServer/Overlays.h index a0c171c2ac..5ce547f7ad 100644 --- a/Userland/Services/WindowServer/Overlays.h +++ b/Userland/Services/WindowServer/Overlays.h @@ -145,13 +145,13 @@ private: void update_rect(); WeakPtr<Window> m_window; - String m_label; + DeprecatedString m_label; Gfx::IntRect m_label_rect; }; class DndOverlay : public BitmapOverlay { public: - DndOverlay(String const&, Gfx::Bitmap const*); + DndOverlay(DeprecatedString const&, Gfx::Bitmap const*); void cursor_moved() { @@ -166,7 +166,7 @@ private: void update_rect(); RefPtr<Gfx::Bitmap> m_bitmap; - String m_text; + DeprecatedString m_text; Gfx::IntRect m_label_rect; }; diff --git a/Userland/Services/WindowServer/Screen.cpp b/Userland/Services/WindowServer/Screen.cpp index 27f86b5d5c..7737fe288b 100644 --- a/Userland/Services/WindowServer/Screen.cpp +++ b/Userland/Services/WindowServer/Screen.cpp @@ -54,7 +54,7 @@ Screen const& ScreenInput::cursor_location_screen() const return *screen; } -bool Screen::apply_layout(ScreenLayout&& screen_layout, String& error_msg) +bool Screen::apply_layout(ScreenLayout&& screen_layout, DeprecatedString& error_msg) { if (!screen_layout.is_valid(&error_msg)) return false; @@ -145,7 +145,7 @@ bool Screen::apply_layout(ScreenLayout&& screen_layout, String& error_msg) } else { screen = WindowServer::Screen::create(index); if (!screen) { - error_msg = String::formatted("Error creating screen #{}", index); + error_msg = DeprecatedString::formatted("Error creating screen #{}", index); return false; } @@ -153,7 +153,7 @@ bool Screen::apply_layout(ScreenLayout&& screen_layout, String& error_msg) } if (need_to_open_device && !screen->open_device()) { - error_msg = String::formatted("Error opening device for screen #{}", index); + error_msg = DeprecatedString::formatted("Error opening device for screen #{}", index); return false; } diff --git a/Userland/Services/WindowServer/Screen.h b/Userland/Services/WindowServer/Screen.h index 6f5565f74d..717c34d3b3 100644 --- a/Userland/Services/WindowServer/Screen.h +++ b/Userland/Services/WindowServer/Screen.h @@ -82,7 +82,7 @@ public: } ~Screen(); - static bool apply_layout(ScreenLayout&&, String&); + static bool apply_layout(ScreenLayout&&, DeprecatedString&); static ScreenLayout const& layout() { return s_layout; } static Screen& main() diff --git a/Userland/Services/WindowServer/ScreenLayout.h b/Userland/Services/WindowServer/ScreenLayout.h index 132794d78d..ceb70c88de 100644 --- a/Userland/Services/WindowServer/ScreenLayout.h +++ b/Userland/Services/WindowServer/ScreenLayout.h @@ -6,7 +6,7 @@ #pragma once -#include <AK/String.h> +#include <AK/DeprecatedString.h> #include <AK/Vector.h> #include <LibCore/ConfigFile.h> #include <LibGfx/Rect.h> @@ -23,7 +23,7 @@ public: Device, Virtual, } mode; - Optional<String> device; + Optional<DeprecatedString> device; Gfx::IntPoint location; Gfx::IntSize resolution; int scale_factor; @@ -55,11 +55,11 @@ public: Vector<Screen> screens; unsigned main_screen_index { 0 }; - bool is_valid(String* error_msg = nullptr) const; + bool is_valid(DeprecatedString* error_msg = nullptr) const; bool normalize(); - bool load_config(Core::ConfigFile const& config_file, String* error_msg = nullptr); + bool load_config(Core::ConfigFile const& config_file, DeprecatedString* error_msg = nullptr); bool save_config(Core::ConfigFile& config_file, bool sync = true) const; - bool try_auto_add_display_connector(String const&); + bool try_auto_add_display_connector(DeprecatedString const&); // TODO: spaceship operator bool operator!=(ScreenLayout const& other) const; diff --git a/Userland/Services/WindowServer/ScreenLayout.ipp b/Userland/Services/WindowServer/ScreenLayout.ipp index fd865f2ae6..592a67cbbf 100644 --- a/Userland/Services/WindowServer/ScreenLayout.ipp +++ b/Userland/Services/WindowServer/ScreenLayout.ipp @@ -15,7 +15,7 @@ namespace WindowServer { -bool ScreenLayout::is_valid(String* error_msg) const +bool ScreenLayout::is_valid(DeprecatedString* error_msg) const { if (screens.is_empty()) { if (error_msg) @@ -24,7 +24,7 @@ bool ScreenLayout::is_valid(String* error_msg) const } if (main_screen_index >= screens.size()) { if (error_msg) - *error_msg = String::formatted("Invalid main screen index: {}", main_screen_index); + *error_msg = DeprecatedString::formatted("Invalid main screen index: {}", main_screen_index); return false; } int smallest_x = 0; @@ -33,7 +33,7 @@ bool ScreenLayout::is_valid(String* error_msg) const auto& screen = screens[i]; if (screen.mode == Screen::Mode::Device && (screen.device->is_empty() || screen.device->is_null())) { if (error_msg) - *error_msg = String::formatted("Screen #{} has no path", i); + *error_msg = DeprecatedString::formatted("Screen #{} has no path", i); return false; } for (size_t j = 0; j < screens.size(); j++) { @@ -42,28 +42,28 @@ bool ScreenLayout::is_valid(String* error_msg) const continue; if (screen.device == other_screen.device) { if (error_msg) - *error_msg = String::formatted("Screen #{} is using same device as screen #{}", i, j); + *error_msg = DeprecatedString::formatted("Screen #{} is using same device as screen #{}", i, j); return false; } if (screen.virtual_rect().intersects(other_screen.virtual_rect())) { if (error_msg) - *error_msg = String::formatted("Screen #{} overlaps with screen #{}", i, j); + *error_msg = DeprecatedString::formatted("Screen #{} overlaps with screen #{}", i, j); return false; } } if (screen.location.x() < 0 || screen.location.y() < 0) { if (error_msg) - *error_msg = String::formatted("Screen #{} has invalid location: {}", i, screen.location); + *error_msg = DeprecatedString::formatted("Screen #{} has invalid location: {}", i, screen.location); return false; } if (screen.resolution.width() <= 0 || screen.resolution.height() <= 0) { if (error_msg) - *error_msg = String::formatted("Screen #{} has invalid resolution: {}", i, screen.resolution); + *error_msg = DeprecatedString::formatted("Screen #{} has invalid resolution: {}", i, screen.resolution); return false; } if (screen.scale_factor < 1) { if (error_msg) - *error_msg = String::formatted("Screen #{} has invalid scale factor: {}", i, screen.scale_factor); + *error_msg = DeprecatedString::formatted("Screen #{} has invalid scale factor: {}", i, screen.scale_factor); return false; } if (i == 0 || screen.location.x() < smallest_x) @@ -96,7 +96,7 @@ bool ScreenLayout::is_valid(String* error_msg) const auto& screen = screens[i]; if (!reachable_screens.contains_slow(&screen)) { if (error_msg) - *error_msg = String::formatted("Screen #{} {} cannot be reached from main screen #{} {}", i, screen.virtual_rect(), main_screen_index, screens[main_screen_index].virtual_rect()); + *error_msg = DeprecatedString::formatted("Screen #{} {} cannot be reached from main screen #{} {}", i, screen.virtual_rect(), main_screen_index, screens[main_screen_index].virtual_rect()); break; } } @@ -225,12 +225,12 @@ bool ScreenLayout::normalize() return did_change; } -bool ScreenLayout::load_config(const Core::ConfigFile& config_file, String* error_msg) +bool ScreenLayout::load_config(const Core::ConfigFile& config_file, DeprecatedString* error_msg) { screens.clear_with_capacity(); main_screen_index = config_file.read_num_entry("Screens", "MainScreen", 0); for (size_t index = 0;; index++) { - auto group_name = String::formatted("Screen{}", index); + auto group_name = DeprecatedString::formatted("Screen{}", index); if (!config_file.has_group(group_name)) break; auto str_mode = config_file.read_entry(group_name, "Mode"); @@ -242,11 +242,11 @@ bool ScreenLayout::load_config(const Core::ConfigFile& config_file, String* erro } if (mode == Screen::Mode::Invalid) { - *error_msg = String::formatted("Invalid screen mode '{}'", str_mode); + *error_msg = DeprecatedString::formatted("Invalid screen mode '{}'", str_mode); *this = {}; return false; } - auto device = (mode == Screen::Mode::Device) ? config_file.read_entry(group_name, "Device") : Optional<String> {}; + auto device = (mode == Screen::Mode::Device) ? config_file.read_entry(group_name, "Device") : Optional<DeprecatedString> {}; screens.append({ mode, device, { config_file.read_num_entry(group_name, "Left"), config_file.read_num_entry(group_name, "Top") }, { config_file.read_num_entry(group_name, "Width"), config_file.read_num_entry(group_name, "Height") }, @@ -266,7 +266,7 @@ bool ScreenLayout::save_config(Core::ConfigFile& config_file, bool sync) const size_t index = 0; while (index < screens.size()) { auto& screen = screens[index]; - auto group_name = String::formatted("Screen{}", index); + auto group_name = DeprecatedString::formatted("Screen{}", index); config_file.write_entry(group_name, "Mode", Screen::mode_to_string(screen.mode)); if (screen.mode == Screen::Mode::Device) config_file.write_entry(group_name, "Device", screen.device.value()); @@ -279,7 +279,7 @@ bool ScreenLayout::save_config(Core::ConfigFile& config_file, bool sync) const } // Prune screens no longer in the layout for (;;) { - auto group_name = String::formatted("Screen{}", index++); + auto group_name = DeprecatedString::formatted("Screen{}", index++); if (!config_file.has_group(group_name)) break; config_file.remove_group(group_name); @@ -305,7 +305,7 @@ bool ScreenLayout::operator!=(const ScreenLayout& other) const return false; } -bool ScreenLayout::try_auto_add_display_connector(String const& device_path) +bool ScreenLayout::try_auto_add_display_connector(DeprecatedString const& device_path) { int display_connector_fd = open(device_path.characters(), O_RDWR | O_CLOEXEC); if (display_connector_fd < 0) { @@ -404,7 +404,7 @@ ErrorOr<void> decode(Decoder& decoder, WindowServer::ScreenLayout::Screen& scree { WindowServer::ScreenLayout::Screen::Mode mode; TRY(decoder.decode(mode)); - Optional<String> device; + Optional<DeprecatedString> device; TRY(decoder.decode(device)); Gfx::IntPoint location; TRY(decoder.decode(location)); diff --git a/Userland/Services/WindowServer/VirtualScreenBackend.h b/Userland/Services/WindowServer/VirtualScreenBackend.h index a48cec7b8f..c63df43513 100644 --- a/Userland/Services/WindowServer/VirtualScreenBackend.h +++ b/Userland/Services/WindowServer/VirtualScreenBackend.h @@ -8,9 +8,9 @@ #include "ScreenBackend.h" #include "ScreenLayout.h" +#include <AK/DeprecatedString.h> #include <AK/Error.h> #include <AK/Span.h> -#include <AK/String.h> #include <sys/ioctl_numbers.h> namespace WindowServer { diff --git a/Userland/Services/WindowServer/WMConnectionFromClient.cpp b/Userland/Services/WindowServer/WMConnectionFromClient.cpp index d80fa70ba6..34ec29a5b1 100644 --- a/Userland/Services/WindowServer/WMConnectionFromClient.cpp +++ b/Userland/Services/WindowServer/WMConnectionFromClient.cpp @@ -182,7 +182,7 @@ void WMConnectionFromClient::set_window_taskbar_rect(i32 client_id, i32 window_i window.set_taskbar_rect(rect); } -void WMConnectionFromClient::set_keymap(String const& keymap) +void WMConnectionFromClient::set_keymap(DeprecatedString const& keymap) { WindowManager::the().keymap_switcher()->set_keymap(keymap); } diff --git a/Userland/Services/WindowServer/WMConnectionFromClient.h b/Userland/Services/WindowServer/WMConnectionFromClient.h index b3bb43dff9..55173dc7f9 100644 --- a/Userland/Services/WindowServer/WMConnectionFromClient.h +++ b/Userland/Services/WindowServer/WMConnectionFromClient.h @@ -31,7 +31,7 @@ public: virtual void set_event_mask(u32) override; virtual void set_manager_window(i32) override; virtual void set_workspace(u32, u32) override; - virtual void set_keymap(String const&) override; + virtual void set_keymap(DeprecatedString const&) override; unsigned event_mask() const { return m_event_mask; } int window_id() const { return m_window_id; } diff --git a/Userland/Services/WindowServer/Window.cpp b/Userland/Services/WindowServer/Window.cpp index caf052292c..57ec482514 100644 --- a/Userland/Services/WindowServer/Window.cpp +++ b/Userland/Services/WindowServer/Window.cpp @@ -22,7 +22,7 @@ namespace WindowServer { -static String default_window_icon_path() +static DeprecatedString default_window_icon_path() { return "/res/icons/16x16/window.png"; } @@ -133,7 +133,7 @@ void Window::destroy() set_visible(false); } -void Window::set_title(String const& title) +void Window::set_title(DeprecatedString const& title) { if (m_title == title) return; @@ -1059,17 +1059,17 @@ void Window::set_modified(bool modified) frame().invalidate_titlebar(); } -String Window::computed_title() const +DeprecatedString Window::computed_title() const { - String title = m_title.replace("[*]"sv, is_modified() ? " (*)"sv : ""sv, ReplaceMode::FirstOnly); + DeprecatedString title = m_title.replace("[*]"sv, is_modified() ? " (*)"sv : ""sv, ReplaceMode::FirstOnly); if (m_title_username.has_value()) - title = String::formatted("{} [{}]", title, m_title_username.value()); + title = DeprecatedString::formatted("{} [{}]", title, m_title_username.value()); if (client() && client()->is_unresponsive()) - return String::formatted("{} (Not responding)", title); + return DeprecatedString::formatted("{} (Not responding)", title); return title; } -ErrorOr<Optional<String>> Window::compute_title_username(ConnectionFromClient* client) +ErrorOr<Optional<DeprecatedString>> Window::compute_title_username(ConnectionFromClient* client) { if (!client) return Error::from_string_literal("Tried to compute title username without a client"); @@ -1085,7 +1085,7 @@ ErrorOr<Optional<String>> Window::compute_title_username(ConnectionFromClient* c if (!login_session_stat.has_value()) return Error::from_string_literal("Failed to find login process stat"); if (login_session_stat.value().uid == client_stat.value().uid) - return Optional<String> {}; + return Optional<DeprecatedString> {}; return client_stat.value().username; } diff --git a/Userland/Services/WindowServer/Window.h b/Userland/Services/WindowServer/Window.h index 082f554cf4..100411e947 100644 --- a/Userland/Services/WindowServer/Window.h +++ b/Userland/Services/WindowServer/Window.h @@ -7,7 +7,7 @@ #pragma once #include "HitTestResult.h" -#include <AK/String.h> +#include <AK/DeprecatedString.h> #include <AK/WeakPtr.h> #include <LibCore/Object.h> #include <LibGfx/Bitmap.h> @@ -148,10 +148,10 @@ public: bool is_internal() const { return m_client_id == -1; } i32 client_id() const { return m_client_id; } - String title() const { return m_title; } - void set_title(String const&); + DeprecatedString title() const { return m_title; } + void set_title(DeprecatedString const&); - String computed_title() const; + DeprecatedString computed_title() const; float opacity() const { return m_opacity; } void set_opacity(float); @@ -385,7 +385,7 @@ private: void ensure_window_menu(); void update_window_menu_items(); void modal_unparented(); - ErrorOr<Optional<String>> compute_title_username(ConnectionFromClient* client); + ErrorOr<Optional<DeprecatedString>> compute_title_username(ConnectionFromClient* client); ConnectionFromClient* m_client { nullptr }; @@ -394,8 +394,8 @@ private: Menubar m_menubar; - String m_title; - Optional<String> m_title_username; + DeprecatedString m_title; + Optional<DeprecatedString> m_title_username; Gfx::IntRect m_rect; Gfx::IntRect m_saved_nonfullscreen_rect; Gfx::IntRect m_taskbar_rect; diff --git a/Userland/Services/WindowServer/WindowClient.ipc b/Userland/Services/WindowServer/WindowClient.ipc index bfe9ec8186..06c880c91b 100644 --- a/Userland/Services/WindowServer/WindowClient.ipc +++ b/Userland/Services/WindowServer/WindowClient.ipc @@ -3,10 +3,10 @@ endpoint WindowClient { - fast_greet(Vector<Gfx::IntRect> screen_rects, u32 main_screen_index, u32 workspace_rows, u32 workspace_columns, Core::AnonymousBuffer theme_buffer, String default_font_query, String fixed_width_font_query, String window_title_font_query, Vector<bool> effects, i32 client_id) =| + fast_greet(Vector<Gfx::IntRect> screen_rects, u32 main_screen_index, u32 workspace_rows, u32 workspace_columns, Core::AnonymousBuffer theme_buffer, DeprecatedString default_font_query, DeprecatedString fixed_width_font_query, DeprecatedString window_title_font_query, Vector<bool> effects, i32 client_id) =| paint(i32 window_id, Gfx::IntSize window_size, Vector<Gfx::IntRect> rects) =| - mouse_move(i32 window_id, Gfx::IntPoint mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y, i32 wheel_raw_delta_x, i32 wheel_raw_delta_y, bool is_drag, Vector<String> mime_types) =| + mouse_move(i32 window_id, Gfx::IntPoint mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y, i32 wheel_raw_delta_x, i32 wheel_raw_delta_y, bool is_drag, Vector<DeprecatedString> mime_types) =| mouse_down(i32 window_id, Gfx::IntPoint mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y, i32 wheel_raw_delta_x, i32 wheel_raw_delta_y) =| mouse_double_click(i32 window_id, Gfx::IntPoint mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y, i32 wheel_raw_delta_x, i32 wheel_raw_delta_y) =| mouse_up(i32 window_id, Gfx::IntPoint mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y, i32 wheel_raw_delta_x, i32 wheel_raw_delta_y) =| @@ -36,10 +36,10 @@ endpoint WindowClient drag_accepted() =| drag_cancelled() =| - drag_dropped(i32 window_id, Gfx::IntPoint mouse_position, [UTF8] String text, HashMap<String,ByteBuffer> mime_data) =| + drag_dropped(i32 window_id, Gfx::IntPoint mouse_position, [UTF8] DeprecatedString text, HashMap<DeprecatedString,ByteBuffer> mime_data) =| update_system_theme(Core::AnonymousBuffer theme_buffer) =| - update_system_fonts(String default_font_query, String fixed_width_font_query, String window_title_font_query) =| + update_system_fonts(DeprecatedString default_font_query, DeprecatedString fixed_width_font_query, DeprecatedString window_title_font_query) =| update_system_effects(Vector<bool> effects) =| display_link_notification() =| diff --git a/Userland/Services/WindowServer/WindowFrame.cpp b/Userland/Services/WindowServer/WindowFrame.cpp index 7a20a78b0d..0dfb480949 100644 --- a/Userland/Services/WindowServer/WindowFrame.cpp +++ b/Userland/Services/WindowServer/WindowFrame.cpp @@ -54,11 +54,11 @@ static RefPtr<MultiScaleBitmaps> s_inactive_window_shadow; static RefPtr<MultiScaleBitmaps> s_menu_shadow; static RefPtr<MultiScaleBitmaps> s_taskbar_shadow; static RefPtr<MultiScaleBitmaps> s_tooltip_shadow; -static String s_last_active_window_shadow_path; -static String s_last_inactive_window_shadow_path; -static String s_last_menu_shadow_path; -static String s_last_taskbar_shadow_path; -static String s_last_tooltip_shadow_path; +static DeprecatedString s_last_active_window_shadow_path; +static DeprecatedString s_last_inactive_window_shadow_path; +static DeprecatedString s_last_menu_shadow_path; +static DeprecatedString s_last_taskbar_shadow_path; +static DeprecatedString s_last_tooltip_shadow_path; static Gfx::IntRect frame_rect_for_window(Window& window, Gfx::IntRect const& rect) { @@ -148,7 +148,7 @@ void WindowFrame::set_button_icons() void WindowFrame::reload_config() { - String icons_path = WindowManager::the().palette().title_button_icons_path(); + DeprecatedString icons_path = WindowManager::the().palette().title_button_icons_path(); auto reload_bitmap = [&](RefPtr<MultiScaleBitmaps>& multiscale_bitmap, StringView path, StringView default_path = ""sv) { StringBuilder full_path; @@ -177,9 +177,9 @@ void WindowFrame::reload_config() reload_icon(s_close_icon, "window-close"sv, "/res/icons/16x16/window-close.png"sv); reload_icon(s_close_modified_icon, "window-close-modified"sv, "/res/icons/16x16/window-close-modified.png"sv); - auto load_shadow = [](String const& path, String& last_path, RefPtr<MultiScaleBitmaps>& shadow_bitmap) { + auto load_shadow = [](DeprecatedString const& path, DeprecatedString& last_path, RefPtr<MultiScaleBitmaps>& shadow_bitmap) { if (path.is_empty()) { - last_path = String::empty(); + last_path = DeprecatedString::empty(); shadow_bitmap = nullptr; } else if (!shadow_bitmap || last_path != path) { if (shadow_bitmap) @@ -189,7 +189,7 @@ void WindowFrame::reload_config() if (shadow_bitmap) last_path = path; else - last_path = String::empty(); + last_path = DeprecatedString::empty(); } }; load_shadow(WindowManager::the().palette().active_window_shadow_path(), s_last_active_window_shadow_path, s_active_window_shadow); diff --git a/Userland/Services/WindowServer/WindowFrame.h b/Userland/Services/WindowServer/WindowFrame.h index 2f104f69ec..f83a01c58f 100644 --- a/Userland/Services/WindowServer/WindowFrame.h +++ b/Userland/Services/WindowServer/WindowFrame.h @@ -130,7 +130,7 @@ private: void handle_menu_mouse_event(Menu&, MouseEvent const&); Gfx::WindowTheme::WindowState window_state_for_theme() const; - String computed_title() const; + DeprecatedString computed_title() const; Gfx::IntRect constrained_render_rect_to_screen(Gfx::IntRect const&) const; Gfx::IntRect leftmost_titlebar_button_rect() const; diff --git a/Userland/Services/WindowServer/WindowManager.cpp b/Userland/Services/WindowServer/WindowManager.cpp index 33544d7e0d..398ec80da8 100644 --- a/Userland/Services/WindowServer/WindowManager.cpp +++ b/Userland/Services/WindowServer/WindowManager.cpp @@ -54,7 +54,7 @@ WindowManager::WindowManager(Gfx::PaletteImpl const& palette) reload_config(); - m_keymap_switcher->on_keymap_change = [&](String const& keymap) { + m_keymap_switcher->on_keymap_change = [&](DeprecatedString const& keymap) { for_each_window_manager([&keymap](WMConnectionFromClient& conn) { if (!(conn.event_mask() & WMEventMask::KeymapChanged)) return IterationDecision::Continue; @@ -90,7 +90,7 @@ void WindowManager::reload_config() m_cursor_highlight_color = Color::from_string(m_config->read_entry("Mouse", "CursorHighlightColor")).value_or(default_highlight_color); apply_cursor_theme(m_config->read_entry("Mouse", "CursorTheme", "Default")); - auto reload_graphic = [&](RefPtr<MultiScaleBitmaps>& bitmap, String const& name) { + auto reload_graphic = [&](RefPtr<MultiScaleBitmaps>& bitmap, DeprecatedString const& name) { if (bitmap) { if (!bitmap->load(name)) bitmap = nullptr; @@ -117,7 +117,7 @@ Gfx::Font const& WindowManager::window_title_font() const return Gfx::FontDatabase::window_title_font(); } -bool WindowManager::set_screen_layout(ScreenLayout&& screen_layout, bool save, String& error_msg) +bool WindowManager::set_screen_layout(ScreenLayout&& screen_layout, bool save, DeprecatedString& error_msg) { if (!Screen::apply_layout(move(screen_layout), error_msg)) return false; @@ -147,7 +147,7 @@ ScreenLayout WindowManager::get_screen_layout() const return Screen::layout(); } -bool WindowManager::save_screen_layout(String& error_msg) +bool WindowManager::save_screen_layout(DeprecatedString& error_msg) { if (!Screen::layout().save_config(*m_config)) { error_msg = "Could not save"; @@ -267,7 +267,7 @@ void WindowManager::set_acceleration_factor(double factor) { ScreenInput::the().set_acceleration_factor(factor); dbgln("Saving acceleration factor {} to config file at {}", factor, m_config->filename()); - m_config->write_entry("Mouse", "AccelerationFactor", String::formatted("{}", factor)); + m_config->write_entry("Mouse", "AccelerationFactor", DeprecatedString::formatted("{}", factor)); sync_config_to_disk(); } @@ -275,7 +275,7 @@ void WindowManager::set_scroll_step_size(unsigned step_size) { ScreenInput::the().set_scroll_step_size(step_size); dbgln("Saving scroll step size {} to config file at {}", step_size, m_config->filename()); - m_config->write_entry("Mouse", "ScrollStepSize", String::number(step_size)); + m_config->write_entry("Mouse", "ScrollStepSize", DeprecatedString::number(step_size)); sync_config_to_disk(); } @@ -284,7 +284,7 @@ void WindowManager::set_double_click_speed(int speed) VERIFY(speed >= double_click_speed_min && speed <= double_click_speed_max); m_double_click_speed = speed; dbgln("Saving double-click speed {} to config file at {}", speed, m_config->filename()); - m_config->write_entry("Input", "DoubleClickSpeed", String::number(speed)); + m_config->write_entry("Input", "DoubleClickSpeed", DeprecatedString::number(speed)); sync_config_to_disk(); } @@ -2013,7 +2013,7 @@ Gfx::IntRect WindowManager::tiled_window_rect(Window const& window, WindowTileTy return rect; } -void WindowManager::start_dnd_drag(ConnectionFromClient& client, String const& text, Gfx::Bitmap const* bitmap, Core::MimeData const& mime_data) +void WindowManager::start_dnd_drag(ConnectionFromClient& client, DeprecatedString const& text, Gfx::Bitmap const* bitmap, Core::MimeData const& mime_data) { VERIFY(!m_dnd_client); m_dnd_client = client; @@ -2062,7 +2062,7 @@ void WindowManager::invalidate_after_theme_or_font_change() Compositor::the().invalidate_after_theme_or_font_change(); } -bool WindowManager::update_theme(String theme_path, String theme_name, bool keep_desktop_background) +bool WindowManager::update_theme(DeprecatedString theme_path, DeprecatedString theme_name, bool keep_desktop_background) { auto new_theme = Gfx::load_system_theme(theme_path); if (!new_theme.is_valid()) @@ -2101,7 +2101,7 @@ void WindowManager::clear_theme_override() { m_theme_overridden = false; auto previous_theme_name = m_config->read_entry("Theme", "Name"); - auto previous_theme = Gfx::load_system_theme(String::formatted("/res/themes/{}.ini", previous_theme_name)); + auto previous_theme = Gfx::load_system_theme(DeprecatedString::formatted("/res/themes/{}.ini", previous_theme_name)); VERIFY(previous_theme.is_valid()); Gfx::set_system_theme(previous_theme); m_palette = Gfx::PaletteImpl::create_with_anonymous_buffer(previous_theme); @@ -2213,9 +2213,9 @@ WindowStack& WindowManager::get_rendering_window_stacks(WindowStack*& transition return Compositor::the().get_rendering_window_stacks(transitioning_window_stack); } -void WindowManager::apply_cursor_theme(String const& theme_name) +void WindowManager::apply_cursor_theme(DeprecatedString const& theme_name) { - auto theme_path = String::formatted("/res/cursor-themes/{}/{}", theme_name, "Config.ini"); + auto theme_path = DeprecatedString::formatted("/res/cursor-themes/{}/{}", theme_name, "Config.ini"); auto cursor_theme_config_or_error = Core::ConfigFile::open(theme_path); if (cursor_theme_config_or_error.is_error()) { dbgln("Unable to open cursor theme '{}': {}", theme_path, cursor_theme_config_or_error.error()); @@ -2224,11 +2224,11 @@ void WindowManager::apply_cursor_theme(String const& theme_name) auto cursor_theme_config = cursor_theme_config_or_error.release_value(); auto* current_cursor = Compositor::the().current_cursor(); - auto reload_cursor = [&](RefPtr<Cursor>& cursor, String const& name) { + auto reload_cursor = [&](RefPtr<Cursor>& cursor, DeprecatedString const& name) { bool is_current_cursor = current_cursor && current_cursor == cursor.ptr(); static auto const s_default_cursor_path = "/res/cursor-themes/Default/arrow.x2y2.png"sv; - cursor = Cursor::create(String::formatted("/res/cursor-themes/{}/{}", theme_name, cursor_theme_config->read_entry("Cursor", name)), s_default_cursor_path); + cursor = Cursor::create(DeprecatedString::formatted("/res/cursor-themes/{}/{}", theme_name, cursor_theme_config->read_entry("Cursor", name)), s_default_cursor_path); if (is_current_cursor) { Compositor::the().current_cursor_was_reloaded(cursor.ptr()); diff --git a/Userland/Services/WindowServer/WindowManager.h b/Userland/Services/WindowServer/WindowManager.h index ce0076c728..5ceaf70f64 100644 --- a/Userland/Services/WindowServer/WindowManager.h +++ b/Userland/Services/WindowServer/WindowManager.h @@ -82,7 +82,7 @@ public: ConnectionFromClient const* dnd_client() const { return m_dnd_client.ptr(); } Core::MimeData const& dnd_mime_data() const { return *m_dnd_mime_data; } - void start_dnd_drag(ConnectionFromClient&, String const& text, Gfx::Bitmap const*, Core::MimeData const&); + void start_dnd_drag(ConnectionFromClient&, DeprecatedString const& text, Gfx::Bitmap const*, Core::MimeData const&); void end_dnd_drag(); void set_accepts_drag(bool); @@ -143,9 +143,9 @@ public: Gfx::Font const& font() const; Gfx::Font const& window_title_font() const; - bool set_screen_layout(ScreenLayout&&, bool, String&); + bool set_screen_layout(ScreenLayout&&, bool, DeprecatedString&); ScreenLayout get_screen_layout() const; - bool save_screen_layout(String&); + bool save_screen_layout(DeprecatedString&); void set_acceleration_factor(double); void set_scroll_step_size(unsigned); @@ -199,7 +199,7 @@ public: return nullptr; } - bool update_theme(String theme_path, String theme_name, bool keep_desktop_background); + bool update_theme(DeprecatedString theme_path, DeprecatedString theme_name, bool keep_desktop_background); void invalidate_after_theme_or_font_change(); bool set_theme_override(Core::AnonymousBuffer const& theme_override); @@ -317,7 +317,7 @@ public: MultiScaleBitmaps const* overlay_rect_shadow() const { return m_overlay_rect_shadow.ptr(); } - void apply_cursor_theme(String const& name); + void apply_cursor_theme(DeprecatedString const& name); void set_cursor_highlight_radius(int radius); void set_cursor_highlight_color(Gfx::Color const& color); @@ -472,7 +472,7 @@ private: OwnPtr<DndOverlay> m_dnd_overlay; WeakPtr<ConnectionFromClient> m_dnd_client; - String m_dnd_text; + DeprecatedString m_dnd_text; bool m_dnd_accepts_drag { false }; RefPtr<Core::MimeData> m_dnd_mime_data; diff --git a/Userland/Services/WindowServer/WindowManagerClient.ipc b/Userland/Services/WindowServer/WindowManagerClient.ipc index 8697ca95c1..3b31de5a0d 100644 --- a/Userland/Services/WindowServer/WindowManagerClient.ipc +++ b/Userland/Services/WindowServer/WindowManagerClient.ipc @@ -3,7 +3,7 @@ endpoint WindowManagerClient { window_removed(i32 wm_id, i32 client_id, i32 window_id) =| - window_state_changed(i32 wm_id, i32 client_id, i32 window_id, u32 workspace_row, u32 workspace_column, bool is_active, bool is_blocking, bool is_minimized, bool is_frameless, i32 window_type, [UTF8] String title, Gfx::IntRect rect, Optional<i32> progress) =| + window_state_changed(i32 wm_id, i32 client_id, i32 window_id, u32 workspace_row, u32 workspace_column, bool is_active, bool is_blocking, bool is_minimized, bool is_frameless, i32 window_type, [UTF8] DeprecatedString title, Gfx::IntRect rect, Optional<i32> progress) =| window_icon_bitmap_changed(i32 wm_id, i32 client_id, i32 window_id, Gfx::ShareableBitmap bitmap) =| window_rect_changed(i32 wm_id, i32 client_id, i32 window_id, Gfx::IntRect rect) =| applet_area_size_changed(i32 wm_id, Gfx::IntSize size) =| @@ -12,5 +12,5 @@ endpoint WindowManagerClient super_d_key_pressed(i32 wm_id) =| super_digit_key_pressed(i32 wm_id, u8 digit) =| workspace_changed(i32 wm_id, u32 row, u32 column) =| - keymap_changed(i32 wm_id, [UTF8] String keymap) =| + keymap_changed(i32 wm_id, [UTF8] DeprecatedString keymap) =| } diff --git a/Userland/Services/WindowServer/WindowManagerServer.ipc b/Userland/Services/WindowServer/WindowManagerServer.ipc index 8e35e1fa1c..0abb7eddeb 100644 --- a/Userland/Services/WindowServer/WindowManagerServer.ipc +++ b/Userland/Services/WindowServer/WindowManagerServer.ipc @@ -13,5 +13,5 @@ endpoint WindowManagerServer set_window_taskbar_rect(i32 client_id, i32 window_id, Gfx::IntRect rect) =| set_applet_area_position(Gfx::IntPoint position) =| set_workspace(u32 row, u32 column) =| - set_keymap([UTF8] String keymap) =| + set_keymap([UTF8] DeprecatedString keymap) =| } diff --git a/Userland/Services/WindowServer/WindowServer.ipc b/Userland/Services/WindowServer/WindowServer.ipc index b773cdfc1a..57aadf374c 100644 --- a/Userland/Services/WindowServer/WindowServer.ipc +++ b/Userland/Services/WindowServer/WindowServer.ipc @@ -4,7 +4,7 @@ endpoint WindowServer { - create_menu(i32 menu_id, [UTF8] String menu_title) =| + create_menu(i32 menu_id, [UTF8] DeprecatedString menu_title) =| destroy_menu(i32 menu_id) =| add_menu(i32 window_id, i32 menu_id) =| @@ -13,12 +13,12 @@ endpoint WindowServer i32 menu_id, i32 identifier, i32 submenu_id, - [UTF8] String text, + [UTF8] DeprecatedString text, bool enabled, bool checkable, bool checked, bool is_default, - [UTF8] String shortcut, + [UTF8] DeprecatedString shortcut, Gfx::ShareableBitmap icon, bool exclusive) =| @@ -28,12 +28,12 @@ endpoint WindowServer i32 menu_id, i32 identifier, i32 submenu_id, - [UTF8] String text, + [UTF8] DeprecatedString text, bool enabled, bool checkable, bool checked, bool is_default, - [UTF8] String shortcut, + [UTF8] DeprecatedString shortcut, Gfx::ShareableBitmap icon) =| remove_menu_item(i32 menu_id, i32 identifier) =| @@ -58,14 +58,14 @@ endpoint WindowServer Optional<Gfx::IntSize> resize_aspect_ratio, i32 type, i32 mode, - [UTF8] String title, + [UTF8] DeprecatedString title, i32 parent_window_id, Gfx::IntRect launch_origin_rect) =| destroy_window(i32 window_id) => (Vector<i32> destroyed_window_ids) - set_window_title(i32 window_id, [UTF8] String title) =| - get_window_title(i32 window_id) => ([UTF8] String title) + set_window_title(i32 window_id, [UTF8] DeprecatedString title) =| + get_window_title(i32 window_id) => ([UTF8] DeprecatedString title) set_window_progress(i32 window_id, Optional<i32> progress) =| @@ -108,12 +108,12 @@ endpoint WindowServer set_wallpaper(Gfx::ShareableBitmap wallpaper_bitmap) => (bool success) - set_background_color(String background_color) =| - set_wallpaper_mode(String mode) =| + set_background_color(DeprecatedString background_color) =| + set_wallpaper_mode(DeprecatedString mode) =| - set_screen_layout(::WindowServer::ScreenLayout screen_layout, bool save) => (bool success, String error_msg) + set_screen_layout(::WindowServer::ScreenLayout screen_layout, bool save) => (bool success, DeprecatedString error_msg) get_screen_layout() => (::WindowServer::ScreenLayout screen_layout) - save_screen_layout() => (bool success, String error_msg) + save_screen_layout() => (bool success, DeprecatedString error_msg) show_screen_numbers(bool show) =| apply_workspace_settings(u32 rows, u32 columns, bool save) => (bool success) @@ -125,11 +125,11 @@ endpoint WindowServer set_window_cursor(i32 window_id, i32 cursor_type) =| set_window_custom_cursor(i32 window_id, Gfx::ShareableBitmap cursor) =| - start_drag([UTF8] String text, HashMap<String,ByteBuffer> mime_data, Gfx::ShareableBitmap drag_bitmap) => (bool started) + start_drag([UTF8] DeprecatedString text, HashMap<DeprecatedString,ByteBuffer> mime_data, Gfx::ShareableBitmap drag_bitmap) => (bool started) set_accepts_drag(bool accepts) =| - set_system_theme(String theme_path, [UTF8] String theme_name, bool keep_desktop_background) => (bool success) - get_system_theme() => ([UTF8] String theme_name) + set_system_theme(DeprecatedString theme_path, [UTF8] DeprecatedString theme_name, bool keep_desktop_background) => (bool success) + get_system_theme() => ([UTF8] DeprecatedString theme_name) refresh_system_theme() =| set_system_theme_override(Core::AnonymousBuffer buffer) => (bool success) @@ -137,8 +137,8 @@ endpoint WindowServer clear_system_theme_override() =| is_system_theme_overridden() => (bool overridden) - apply_cursor_theme(String name) =| - get_cursor_theme() => (String name) + apply_cursor_theme(DeprecatedString name) =| + get_cursor_theme() => (DeprecatedString name) set_cursor_highlight_radius(int radius) =| get_cursor_highlight_radius() => (int radius) @@ -146,7 +146,7 @@ endpoint WindowServer set_cursor_highlight_color(Gfx::Color color) =| get_cursor_highlight_color() => (Gfx::Color color) - set_system_fonts(String default_font_query, String fixed_width_font_query, String window_title_font_query) => (bool success) + set_system_fonts(DeprecatedString default_font_query, DeprecatedString fixed_width_font_query, DeprecatedString window_title_font_query) => (bool success) set_system_effects(Vector<bool> effects, u8 geometry) =| set_window_base_size_and_size_increment(i32 window_id, Gfx::IntSize base_size, Gfx::IntSize size_increment) =| diff --git a/Userland/Services/WindowServer/WindowSwitcher.cpp b/Userland/Services/WindowServer/WindowSwitcher.cpp index 5a3799af18..2c0aaa1954 100644 --- a/Userland/Services/WindowServer/WindowSwitcher.cpp +++ b/Userland/Services/WindowServer/WindowSwitcher.cpp @@ -203,7 +203,7 @@ void WindowSwitcher::draw() painter.blit(icon_rect.location(), window.icon(), window.icon().rect()); painter.draw_text(item_rect.translated(thumbnail_width() + 12, 0).translated(1, 1), window.computed_title(), WindowManager::the().window_title_font(), Gfx::TextAlignment::CenterLeft, text_color.inverted()); painter.draw_text(item_rect.translated(thumbnail_width() + 12, 0), window.computed_title(), WindowManager::the().window_title_font(), Gfx::TextAlignment::CenterLeft, text_color); - auto window_details = m_windows_on_multiple_stacks ? String::formatted("{} on {}:{}", window.rect().to_string(), window.window_stack().row() + 1, window.window_stack().column() + 1) : window.rect().to_string(); + auto window_details = m_windows_on_multiple_stacks ? DeprecatedString::formatted("{} on {}:{}", window.rect().to_string(), window.window_stack().row() + 1, window.window_stack().column() + 1) : window.rect().to_string(); painter.draw_text(item_rect, window_details, Gfx::TextAlignment::CenterRight, rect_text_color); } } diff --git a/Userland/Services/WindowServer/main.cpp b/Userland/Services/WindowServer/main.cpp index 24ab3c767d..06a9a9375a 100644 --- a/Userland/Services/WindowServer/main.cpp +++ b/Userland/Services/WindowServer/main.cpp @@ -44,7 +44,7 @@ ErrorOr<int> serenity_main(Main::Arguments) auto wm_config = TRY(Core::ConfigFile::open("/etc/WindowServer.ini")); auto theme_name = wm_config->read_entry("Theme", "Name", "Default"); - auto theme = Gfx::load_system_theme(String::formatted("/res/themes/{}.ini", theme_name)); + auto theme = Gfx::load_system_theme(DeprecatedString::formatted("/res/themes/{}.ini", theme_name)); VERIFY(theme.is_valid()); Gfx::set_system_theme(theme); auto palette = Gfx::PaletteImpl::create_with_anonymous_buffer(theme); @@ -71,9 +71,9 @@ ErrorOr<int> serenity_main(Main::Arguments) // First check which screens are explicitly configured { - AK::HashTable<String> fb_devices_configured; + AK::HashTable<DeprecatedString> fb_devices_configured; WindowServer::ScreenLayout screen_layout; - String error_msg; + DeprecatedString error_msg; auto add_unconfigured_display_connector_devices = [&]() -> ErrorOr<void> { // Enumerate the /dev/gpu/connectorX devices and try to set up any ones we find that we haven't already used @@ -82,7 +82,7 @@ ErrorOr<int> serenity_main(Main::Arguments) auto path = di.next_path(); if (!path.starts_with("connector"sv)) continue; - auto full_path = String::formatted("/dev/gpu/{}", path); + auto full_path = DeprecatedString::formatted("/dev/gpu/{}", path); if (!Core::File::is_device(full_path)) continue; auto display_connector_fd = TRY(Core::System::open(full_path, O_RDWR | O_CLOEXEC)); |