mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
f87041bf3a
Resulting in a massive rename across almost everywhere! Alongside the namespace change, we now have the following names: * JS::NonnullGCPtr -> GC::Ref * JS::GCPtr -> GC::Ptr * JS::HeapFunction -> GC::Function * JS::CellImpl -> GC::Cell * JS::Handle -> GC::Root
40 lines
1,013 B
C++
40 lines
1,013 B
C++
/*
|
|
* Copyright (c) 2024, the Ladybird developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Forward.h>
|
|
#include <LibWeb/DOM/EventTarget.h>
|
|
|
|
namespace Web::HTML {
|
|
|
|
// https://html.spec.whatwg.org/multipage/interaction.html#close-watcher-manager
|
|
class CloseWatcherManager final : public Bindings::PlatformObject {
|
|
WEB_PLATFORM_OBJECT(CloseWatcherManager, Bindings::PlatformObject);
|
|
GC_DECLARE_ALLOCATOR(CloseWatcherManager);
|
|
|
|
public:
|
|
[[nodiscard]] static GC::Ref<CloseWatcherManager> create(JS::Realm&);
|
|
|
|
void add(GC::Ref<CloseWatcher>);
|
|
void remove(CloseWatcher const&);
|
|
|
|
bool process_close_watchers();
|
|
|
|
void notify_about_user_activation();
|
|
bool can_prevent_close();
|
|
|
|
private:
|
|
explicit CloseWatcherManager(JS::Realm&);
|
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
|
|
|
Vector<Vector<GC::Ref<CloseWatcher>>> m_groups;
|
|
uint32_t m_allowed_number_of_groups { 1 };
|
|
bool m_next_user_interaction_allows_a_new_group { true };
|
|
};
|
|
|
|
}
|