URL.h 978 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/Optional.h>
  8. #include <AK/StringView.h>
  9. #include <LibURL/URL.h>
  10. namespace WebView {
  11. bool is_public_suffix(StringView host);
  12. Optional<String> get_public_suffix(StringView host);
  13. enum class AppendTLD {
  14. No,
  15. Yes,
  16. };
  17. Optional<URL::URL> sanitize_url(StringView, Optional<StringView> search_engine = {}, AppendTLD = AppendTLD::No);
  18. Vector<URL::URL> sanitize_urls(ReadonlySpan<ByteString> raw_urls, URL::URL const& new_tab_page_url);
  19. struct URLParts {
  20. StringView scheme_and_subdomain;
  21. StringView effective_tld_plus_one;
  22. StringView remainder;
  23. };
  24. Optional<URLParts> break_url_into_parts(StringView url);
  25. // These are both used for the "right-click -> copy FOO" interaction for links.
  26. enum class URLType {
  27. Email,
  28. Telephone,
  29. Other,
  30. };
  31. URLType url_type(URL::URL const&);
  32. String url_text_to_copy(URL::URL const&);
  33. }