1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-24 06:05:08 +00:00
serenity/Userland/Libraries/LibWebView/URL.h
Timothy Flynn 0715ba889e LibWebView: Add method to break a URL into parts for eTLD+1 highlighting
This is meant to serve as the method all Ladybird chromes can use to
highlight the eTLD+1 substring of the URL. It uses the Public Suffix
List to break the URL into 3 parts: the scheme and subdomain, the
eTLD+1, and all remaining parts (port, path, query, etc.).
2023-10-20 07:18:54 +02:00

28 lines
555 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);
struct URLParts {
StringView scheme_and_subdomain;
StringView effective_tld_plus_one;
StringView remainder;
};
Optional<URLParts> break_url_into_parts(StringView url);
}