URL.h 877 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. struct URLParts {
  19. StringView scheme_and_subdomain;
  20. StringView effective_tld_plus_one;
  21. StringView remainder;
  22. };
  23. Optional<URLParts> break_url_into_parts(StringView url);
  24. // These are both used for the "right-click -> copy FOO" interaction for links.
  25. enum class URLType {
  26. Email,
  27. Telephone,
  28. Other,
  29. };
  30. URLType url_type(URL::URL const&);
  31. String url_text_to_copy(URL::URL const&);
  32. }