WorkerLocation.h 972 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (c) 2022, Andrew Kaster <akaster@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/RefCounted.h>
  8. #include <LibWeb/Bindings/Wrappable.h>
  9. #include <LibWeb/Forward.h>
  10. namespace Web::HTML {
  11. // https://html.spec.whatwg.org/multipage/workers.html#worker-locations
  12. class WorkerLocation
  13. : public RefCounted<WorkerLocation>
  14. , public Bindings::Wrappable {
  15. public:
  16. using WrapperType = Bindings::WorkerLocationWrapper;
  17. static NonnullRefPtr<WorkerLocation> create(WorkerGlobalScope& global_scope)
  18. {
  19. return adopt_ref(*new WorkerLocation(global_scope));
  20. }
  21. String href() const;
  22. String origin() const;
  23. String protocol() const;
  24. String host() const;
  25. String hostname() const;
  26. String port() const;
  27. String pathname() const;
  28. String search() const;
  29. String hash() const;
  30. private:
  31. WorkerLocation(WorkerGlobalScope&);
  32. WorkerGlobalScope& m_global_scope;
  33. };
  34. }