AbstractBrowsingContext.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright (c) 2023, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibJS/Forward.h>
  8. #include <LibJS/Heap/Cell.h>
  9. #include <LibWeb/HTML/HistoryHandlingBehavior.h>
  10. #include <LibWeb/HTML/PolicyContainers.h>
  11. #include <LibWeb/HTML/TokenizedFeatures.h>
  12. #include <LibWeb/HTML/WindowProxy.h>
  13. namespace Web::HTML {
  14. class AbstractBrowsingContext : public JS::Cell {
  15. JS_CELL(AbstractBrowsingContext, Cell);
  16. public:
  17. virtual HTML::WindowProxy* window_proxy() = 0;
  18. virtual HTML::WindowProxy const* window_proxy() const = 0;
  19. String const& name() const { return m_name; }
  20. void set_name(String const& name) { m_name = name; }
  21. JS::GCPtr<BrowsingContext> opener_browsing_context() const { return m_opener_browsing_context; }
  22. void set_opener_browsing_context(JS::GCPtr<BrowsingContext> browsing_context) { m_opener_browsing_context = browsing_context; }
  23. void set_is_popup(TokenizedFeature::Popup is_popup) { m_is_popup = is_popup; }
  24. virtual String const& window_handle() const = 0;
  25. virtual void set_window_handle(String handle) = 0;
  26. protected:
  27. String m_name;
  28. // https://html.spec.whatwg.org/multipage/browsers.html#is-popup
  29. TokenizedFeature::Popup m_is_popup { TokenizedFeature::Popup::No };
  30. // https://html.spec.whatwg.org/multipage/browsers.html#opener-browsing-context
  31. JS::GCPtr<BrowsingContext> m_opener_browsing_context;
  32. };
  33. }