URL.h 884 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. enum class AppendTLD {
  12. No,
  13. Yes,
  14. };
  15. Optional<URL::URL> sanitize_url(StringView, Optional<StringView> search_engine = {}, AppendTLD = AppendTLD::No);
  16. Vector<URL::URL> sanitize_urls(ReadonlySpan<ByteString> raw_urls, URL::URL const& new_tab_page_url);
  17. struct URLParts {
  18. StringView scheme_and_subdomain;
  19. StringView effective_tld_plus_one;
  20. StringView remainder;
  21. };
  22. Optional<URLParts> break_url_into_parts(StringView url);
  23. // These are both used for the "right-click -> copy FOO" interaction for links.
  24. enum class URLType {
  25. Email,
  26. Telephone,
  27. Other,
  28. };
  29. URLType url_type(URL::URL const&);
  30. String url_text_to_copy(URL::URL const&);
  31. }