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

AK+Everywhere: Rename String to DeprecatedString

We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
This commit is contained in:
Linus Groh 2022-12-04 18:02:33 +00:00 committed by Andreas Kling
parent f74251606d
commit 6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions

View file

@ -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)

View file

@ -2,5 +2,5 @@
endpoint ClipboardClient
{
clipboard_data_changed([UTF8] String mime_type) =|
clipboard_data_changed([UTF8] DeprecatedString mime_type) =|
}

View file

@ -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) =|
}

View file

@ -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());
}

View file

@ -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;
};
}

View file

@ -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();

View file

@ -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;
};
}

View file

@ -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) =|
}

View file

@ -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) => ()
}

View file

@ -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;

View file

@ -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;
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(String const& domain, String const& group, String const& key);
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;
};
}

View file

@ -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

View file

@ -151,7 +151,7 @@ struct ParsedDHCPv4Options {
return values;
}
String to_string() const
DeprecatedString to_string() const
{
StringBuilder builder;
builder.append("DHCP Options ("sv);

View file

@ -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);

View file

@ -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;

View file

@ -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");

View file

@ -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();

View file

@ -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> {});
}
}

View file

@ -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;
};
}

View file

@ -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) =|
}

View file

@ -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)
}

View file

@ -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");

View file

@ -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;
};

View file

@ -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)

View file

@ -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);

View file

@ -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)
}

View file

@ -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");

View file

@ -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;
};

View file

@ -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() => ()
}

View file

@ -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());
}
}

View file

@ -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 {};
DeprecatedString name;
DeprecatedString executable;
HashTable<DeprecatedString> mime_types {};
HashTable<DeprecatedString> file_types {};
HashTable<DeprecatedString> protocols {};
static String name_from_executable(StringView);
void from_executable(Type, String const&);
String to_details_str() const;
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;
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(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);
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);
};
}

View file

@ -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); }

View file

@ -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() };
}
}

View file

@ -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;
};
}

View file

@ -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();

View file

@ -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;

View file

@ -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)
}

View file

@ -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);

View file

@ -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();

View file

@ -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) {

View file

@ -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;
};

View file

@ -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)

View file

@ -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);
}

View file

@ -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;

View file

@ -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 {};

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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;
};
}

View file

@ -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)
{
}

View file

@ -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;
};

View file

@ -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;

View file

@ -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);
}

View file

@ -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;
};
}

View file

@ -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);
}

View file

@ -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;
};
}

View file

@ -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));
}

View file

@ -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;
};

View file

@ -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);
}

View file

@ -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;
};
}

View file

@ -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)
{
}

View file

@ -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;
};
}

View file

@ -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) =|
}

View file

@ -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));
}
}

View file

@ -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;
};

View file

@ -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());

View file

@ -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 };

View file

@ -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) =|
}

View file

@ -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) =|
}

View file

@ -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))

View file

@ -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 {};

View file

@ -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());

View file

@ -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();
}

View file

@ -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;

View file

@ -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);
};

View file

@ -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);
}

View file

@ -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;

View file

@ -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;
}

View file

@ -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));

View file

@ -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;

View file

@ -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);

View file

@ -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;
};

View file

@ -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;

View file

@ -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);

View file

@ -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&);

View file

@ -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;

View file

@ -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";

View file

@ -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>

View file

@ -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>

View file

@ -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;
}

View file

@ -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"

View file

@ -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 };

View file

@ -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) {

View file

@ -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);
}

View file

@ -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;

View file

@ -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) {

View file

@ -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;

View file

@ -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) =|
}

View file

@ -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;

View file

@ -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;

Some files were not shown because too many files have changed in this diff Show more