LibWebView: Store search engine names/URLs as String

In order to support custom search engines, we will need to store the
engine properties as String to hold user-provided data.

This also caused a compile error trying to assign Optional<SearchEngine>
to Optional<SearchEngine const&>, so there's a bit of extra churn here.
This commit is contained in:
Timothy Flynn 2025-04-04 09:57:48 -04:00 committed by Andreas Kling
commit cbee476dac
Notes: github-actions[bot] 2025-04-06 11:46:16 +00:00
2 changed files with 19 additions and 19 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
* Copyright (c) 2023-2025, Tim Flynn <trflynn89@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -7,17 +7,18 @@
#pragma once
#include <AK/Span.h>
#include <AK/String.h>
#include <AK/StringView.h>
namespace WebView {
struct SearchEngine {
StringView name;
StringView query_url;
String name;
String query_url;
};
ReadonlySpan<SearchEngine> search_engines();
Optional<SearchEngine const&> find_search_engine_by_name(StringView name);
Optional<SearchEngine> find_search_engine_by_name(StringView name);
Optional<SearchEngine const&> find_search_engine_by_query_url(StringView query_url);
String format_search_query_for_display(StringView query_url, StringView query);