History.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/RefCounted.h>
  8. #include <AK/Weakable.h>
  9. #include <LibJS/Heap/Handle.h>
  10. #include <LibWeb/Bindings/Wrappable.h>
  11. #include <LibWeb/DOM/ExceptionOr.h>
  12. #include <LibWeb/Forward.h>
  13. namespace Web::HTML {
  14. class History final
  15. : public RefCounted<History>
  16. , public Weakable<History>
  17. , public Bindings::Wrappable {
  18. public:
  19. using WrapperType = Bindings::HistoryWrapper;
  20. static NonnullRefPtr<History> create(DOM::Document& document)
  21. {
  22. return adopt_ref(*new History(document));
  23. }
  24. virtual ~History() override;
  25. DOM::ExceptionOr<void> push_state(JS::Value data, String const& unused, String const& url);
  26. DOM::ExceptionOr<void> replace_state(JS::Value data, String const& unused, String const& url);
  27. private:
  28. explicit History(DOM::Document&);
  29. enum class IsPush {
  30. No,
  31. Yes,
  32. };
  33. DOM::ExceptionOr<void> shared_history_push_replace_state(JS::Value data, String const& url, IsPush is_push);
  34. DOM::Document& m_associated_document;
  35. };
  36. }