/src/serenity/Userland/Libraries/LibWeb/HTML/NavigationCurrentEntryChangeEvent.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2023, Andrew Kaster <akaster@serenityos.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #pragma once |
8 | | |
9 | | #include <LibWeb/DOM/Event.h> |
10 | | #include <LibWeb/HTML/NavigationType.h> |
11 | | |
12 | | namespace Web::HTML { |
13 | | |
14 | | struct NavigationCurrentEntryChangeEventInit : public DOM::EventInit { |
15 | | Optional<Bindings::NavigationType> navigation_type = {}; |
16 | | JS::GCPtr<NavigationHistoryEntry> from; |
17 | | }; |
18 | | |
19 | | class NavigationCurrentEntryChangeEvent final : public DOM::Event { |
20 | | WEB_PLATFORM_OBJECT(NavigationCurrentEntryChangeEvent, DOM::Event); |
21 | | JS_DECLARE_ALLOCATOR(NavigationCurrentEntryChangeEvent); |
22 | | |
23 | | public: |
24 | | [[nodiscard]] static JS::NonnullGCPtr<NavigationCurrentEntryChangeEvent> construct_impl(JS::Realm&, FlyString const& event_name, NavigationCurrentEntryChangeEventInit const&); |
25 | | |
26 | | virtual ~NavigationCurrentEntryChangeEvent() override; |
27 | | |
28 | 0 | Optional<Bindings::NavigationType> const& navigation_type() const { return m_navigation_type; } |
29 | 0 | JS::NonnullGCPtr<NavigationHistoryEntry> from() const { return m_from; } |
30 | | |
31 | | private: |
32 | | NavigationCurrentEntryChangeEvent(JS::Realm&, FlyString const& event_name, NavigationCurrentEntryChangeEventInit const& event_init); |
33 | | |
34 | | virtual void initialize(JS::Realm&) override; |
35 | | virtual void visit_edges(Cell::Visitor&) override; |
36 | | |
37 | | Optional<Bindings::NavigationType> m_navigation_type; |
38 | | JS::NonnullGCPtr<NavigationHistoryEntry> m_from; |
39 | | }; |
40 | | |
41 | | } |