BrowsingContextGroup.h 1018 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/HashMap.h>
  8. #include <AK/NonnullRefPtr.h>
  9. #include <AK/RefCounted.h>
  10. #include <LibWeb/Forward.h>
  11. namespace Web::HTML {
  12. class BrowsingContextGroup : public RefCounted<BrowsingContextGroup> {
  13. public:
  14. static NonnullRefPtr<BrowsingContextGroup> create_a_new_browsing_context_group(Page&);
  15. ~BrowsingContextGroup();
  16. Page* page() { return m_page; }
  17. Page const* page() const { return m_page; }
  18. auto& browsing_context_set() { return m_browsing_context_set; }
  19. auto const& browsing_context_set() const { return m_browsing_context_set; }
  20. void append(BrowsingContext&);
  21. void remove(BrowsingContext&);
  22. private:
  23. explicit BrowsingContextGroup(Web::Page&);
  24. // https://html.spec.whatwg.org/multipage/browsers.html#browsing-context-group-set
  25. OrderedHashTable<NonnullRefPtr<BrowsingContext>> m_browsing_context_set;
  26. WeakPtr<Page> m_page;
  27. };
  28. }