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

Userland: Store MIME keys as String in Core::MimeData

This commit is contained in:
Karol Kosek 2023-08-21 17:06:49 +02:00 committed by Sam Atkins
parent 4f638d3af2
commit 2f35348104
13 changed files with 22 additions and 22 deletions

View file

@ -21,7 +21,7 @@ public:
virtual ~MimeData() = default;
ByteBuffer data(StringView mime_type) const { return m_data.get(mime_type).value_or({}); }
void set_data(DeprecatedString const& mime_type, ByteBuffer&& data) { m_data.set(mime_type, move(data)); }
void set_data(String const& mime_type, ByteBuffer&& data) { m_data.set(mime_type, move(data)); }
bool has_format(StringView mime_type) const { return m_data.contains(mime_type); }
Vector<DeprecatedString> formats() const;
@ -36,16 +36,16 @@ public:
Vector<URL> urls() const;
ErrorOr<void> set_urls(Vector<URL> const&);
HashMap<DeprecatedString, ByteBuffer> const& all_data() const { return m_data; }
HashMap<String, ByteBuffer> const& all_data() const { return m_data; }
private:
MimeData() = default;
explicit MimeData(HashMap<DeprecatedString, ByteBuffer> const& data)
explicit MimeData(HashMap<String, ByteBuffer> const& data)
: m_data(data.clone().release_value_but_fixme_should_propagate_errors())
{
}
HashMap<DeprecatedString, ByteBuffer> m_data;
HashMap<String, ByteBuffer> m_data;
};
StringView guess_mime_type_based_on_filename(StringView);