2023-10-13 09:43:16 -04:00
|
|
|
/*
|
2025-04-04 17:32:04 -04:00
|
|
|
* Copyright (c) 2023-2025, Tim Flynn <trflynn89@ladybird.org>
|
2023-10-13 09:43:16 -04:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/Optional.h>
|
|
|
|
#include <AK/StringView.h>
|
2024-03-18 16:22:27 +13:00
|
|
|
#include <LibURL/URL.h>
|
2025-04-04 17:32:04 -04:00
|
|
|
#include <LibWebView/SearchEngine.h>
|
2023-10-13 09:43:16 -04:00
|
|
|
|
|
|
|
namespace WebView {
|
|
|
|
|
|
|
|
enum class AppendTLD {
|
|
|
|
No,
|
|
|
|
Yes,
|
|
|
|
};
|
2025-04-04 17:32:04 -04:00
|
|
|
Optional<URL::URL> sanitize_url(StringView, Optional<SearchEngine> const& search_engine = {}, AppendTLD = AppendTLD::No);
|
2024-07-30 14:01:05 -04:00
|
|
|
Vector<URL::URL> sanitize_urls(ReadonlySpan<ByteString> raw_urls, URL::URL const& new_tab_page_url);
|
2023-10-13 09:43:16 -04:00
|
|
|
|
2023-10-17 11:42:55 -04:00
|
|
|
struct URLParts {
|
|
|
|
StringView scheme_and_subdomain;
|
|
|
|
StringView effective_tld_plus_one;
|
|
|
|
StringView remainder;
|
|
|
|
};
|
|
|
|
Optional<URLParts> break_url_into_parts(StringView url);
|
|
|
|
|
2023-12-05 12:53:55 +00:00
|
|
|
// These are both used for the "right-click -> copy FOO" interaction for links.
|
|
|
|
enum class URLType {
|
|
|
|
Email,
|
|
|
|
Telephone,
|
|
|
|
Other,
|
|
|
|
};
|
2024-03-18 16:22:27 +13:00
|
|
|
URLType url_type(URL::URL const&);
|
|
|
|
String url_text_to_copy(URL::URL const&);
|
2023-12-05 12:53:55 +00:00
|
|
|
|
2023-10-13 09:43:16 -04:00
|
|
|
}
|