LibWebView: Rename find_search_engine to find_search_engine_by_name

We will also need to search by URL in the Serenity chrome.
This commit is contained in:
Timothy Flynn 2023-10-23 16:35:55 -04:00 committed by Andreas Kling
parent d5ca8209bf
commit c8c3d00615
Notes: sideshowbarker 2024-07-17 03:30:41 +09:00
4 changed files with 5 additions and 5 deletions

View file

@ -207,7 +207,7 @@
auto* item = (NSMenuItem*)sender;
auto title = Ladybird::ns_string_to_string([item title]);
if (auto search_engine = WebView::find_search_engine(title); search_engine.has_value())
if (auto search_engine = WebView::find_search_engine_by_name(title); search_engine.has_value())
m_search_engine = search_engine.release_value();
else
m_search_engine = WebView::default_search_engine();

View file

@ -38,7 +38,7 @@ Settings::Settings()
auto default_search_engine_name = qstring_from_ak_deprecated_string(default_search_engine.name);
auto search_engine_name = m_qsettings->value("search_engine_name", default_search_engine_name).toString();
auto search_engine = WebView::find_search_engine(MUST(ak_string_from_qstring(search_engine_name)));
auto search_engine = WebView::find_search_engine_by_name(MUST(ak_string_from_qstring(search_engine_name)));
if (search_engine.has_value())
m_search_engine = search_engine.release_value();

View file

@ -27,13 +27,13 @@ ReadonlySpan<SearchEngine> search_engines()
SearchEngine const& default_search_engine()
{
static auto default_engine = find_search_engine("Google"sv);
static auto default_engine = find_search_engine_by_name("Google"sv);
VERIFY(default_engine.has_value());
return *default_engine;
}
Optional<SearchEngine const&> find_search_engine(StringView name)
Optional<SearchEngine const&> find_search_engine_by_name(StringView name)
{
auto it = AK::find_if(builtin_search_engines.begin(), builtin_search_engines.end(),
[&](auto const& engine) {

View file

@ -18,6 +18,6 @@ struct SearchEngine {
ReadonlySpan<SearchEngine> search_engines();
SearchEngine const& default_search_engine();
Optional<SearchEngine const&> find_search_engine(StringView name);
Optional<SearchEngine const&> find_search_engine_by_name(StringView name);
}