mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 05:20:30 +00:00
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:
parent
d5ca8209bf
commit
c8c3d00615
Notes:
sideshowbarker
2024-07-17 03:30:41 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/c8c3d00615 Pull-request: https://github.com/SerenityOS/serenity/pull/21566
4 changed files with 5 additions and 5 deletions
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue