2024-10-25 10:26:01 -04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2024, Tim Flynn <trflynn89@ladybird.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
#include <LibGC/Function.h>
|
|
|
|
#include <LibGC/Ptr.h>
|
2024-10-25 10:26:01 -04:00
|
|
|
#include <LibWeb/Bindings/PlatformObject.h>
|
2025-07-19 19:35:33 -07:00
|
|
|
#include <LibWeb/Export.h>
|
2024-10-25 10:26:01 -04:00
|
|
|
#include <LibWeb/Forward.h>
|
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
2025-07-19 19:35:33 -07:00
|
|
|
class WEB_API NavigationObserver final : public Bindings::PlatformObject {
|
2024-10-25 10:26:01 -04:00
|
|
|
WEB_PLATFORM_OBJECT(NavigationObserver, Bindings::PlatformObject);
|
2024-11-15 04:01:23 +13:00
|
|
|
GC_DECLARE_ALLOCATOR(NavigationObserver);
|
2024-10-25 10:26:01 -04:00
|
|
|
|
|
|
|
public:
|
2024-11-15 04:01:23 +13:00
|
|
|
[[nodiscard]] GC::Ptr<GC::Function<void()>> navigation_complete() const { return m_navigation_complete; }
|
2024-10-25 10:26:01 -04:00
|
|
|
void set_navigation_complete(Function<void()>);
|
|
|
|
|
|
|
|
private:
|
|
|
|
NavigationObserver(JS::Realm&, Navigable&);
|
|
|
|
|
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
|
|
|
virtual void finalize() override;
|
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ref<Navigable> m_navigable;
|
|
|
|
GC::Ptr<GC::Function<void()>> m_navigation_complete;
|
2024-10-25 10:26:01 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|