mirror of
https://github.com/RGBCube/serenity
synced 2025-05-21 15:05:07 +00:00

We currently implement several forms of this method across the Ladybird chromes. As such, we see commits to add special URL handling that only affects a single chrome. Instead, let's consolidate all special handling in a single location for all chromes to make use of. This method can handle resolving file:// URLs, falling back to a search engine query, and validation against the Public Suffix List. These cases were gathered from the various chromes.
22 lines
375 B
C++
22 lines
375 B
C++
/*
|
|
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Optional.h>
|
|
#include <AK/StringView.h>
|
|
#include <AK/URL.h>
|
|
|
|
namespace WebView {
|
|
|
|
enum class AppendTLD {
|
|
No,
|
|
Yes,
|
|
};
|
|
|
|
Optional<URL> sanitize_url(StringView, Optional<StringView> search_engine = {}, AppendTLD = AppendTLD::No);
|
|
|
|
}
|