ladybird/Userland/Libraries/LibWebView/URL.h
Timothy Flynn 5f8d852dae LibWebView+UI: Migrate Ladybird's command line flags to LibWebView
Currently, if we want to add a new e.g. WebContent command line option,
we have to add it to all of Qt, AppKit, and headless-browser. (Or worse,
we only add it to one of these, and we have feature disparity).

To prevent this, this moves command line flags to WebView::Application.
The flags are assigned to ChromeOptions and WebContentOptions structs.
Each chrome can still add its platform-specific options; for example,
the Qt chrome has a flag to enable Qt networking.

There should be no behavior change here, other than that AppKit will now
support command line flags that were previously only supported by Qt.
2024-08-01 11:38:42 +02:00

41 lines
978 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 <LibURL/URL.h>
namespace WebView {
bool is_public_suffix(StringView host);
Optional<String> get_public_suffix(StringView host);
enum class AppendTLD {
No,
Yes,
};
Optional<URL::URL> sanitize_url(StringView, Optional<StringView> search_engine = {}, AppendTLD = AppendTLD::No);
Vector<URL::URL> sanitize_urls(ReadonlySpan<ByteString> raw_urls, URL::URL const& new_tab_page_url);
struct URLParts {
StringView scheme_and_subdomain;
StringView effective_tld_plus_one;
StringView remainder;
};
Optional<URLParts> break_url_into_parts(StringView url);
// These are both used for the "right-click -> copy FOO" interaction for links.
enum class URLType {
Email,
Telephone,
Other,
};
URLType url_type(URL::URL const&);
String url_text_to_copy(URL::URL const&);
}