#pragma once
#include "Frame.h"
#include <wtf/Optional.h>
#include <wtf/Vector.h>
#if ENABLE(APPLICATION_MANIFEST)
#include "ApplicationManifest.h"
#endif
namespace WebCore {
class PageConfiguration;
class PageOverlayController;
class PaymentCoordinator;
class PerformanceLogging;
class ScrollLatchingState;
class ServicesOverlayController;
class WheelEventDeltaFilter;
class MainFrame final : public Frame {
public:
static Ref<MainFrame> create(Page&, PageConfiguration&);
virtual ~MainFrame();
void selfOnlyRef();
void selfOnlyDeref();
WheelEventDeltaFilter* wheelEventDeltaFilter() { return m_recentWheelEventDeltaFilter.get(); }
PageOverlayController& pageOverlayController() { return *m_pageOverlayController; }
#if PLATFORM(MAC)
#if ENABLE(SERVICE_CONTROLS) || ENABLE(TELEPHONE_NUMBER_DETECTION)
ServicesOverlayController& servicesOverlayController() { return *m_servicesOverlayController; }
#endif // ENABLE(SERVICE_CONTROLS) || ENABLE(TELEPHONE_NUMBER_DETECTION)
ScrollLatchingState* latchingState();
void pushNewLatchingState();
void popLatchingState();
void resetLatchingState();
void removeLatchingStateForTarget(Element&);
#endif // PLATFORM(MAC)
#if ENABLE(APPLE_PAY)
PaymentCoordinator& paymentCoordinator() const { return *m_paymentCoordinator; }
WEBCORE_EXPORT void setPaymentCoordinator(std::unique_ptr<PaymentCoordinator>&&);
#endif
#if ENABLE(APPLICATION_MANIFEST)
const std::optional<ApplicationManifest>& applicationManifest() const { return m_applicationManifest; }
#endif
PerformanceLogging& performanceLogging() const { return *m_performanceLogging; }
void didCompleteLoad();
private:
MainFrame(Page&, PageConfiguration&);
void dropChildren();
unsigned m_selfOnlyRefCount;
#if PLATFORM(MAC)
Vector<ScrollLatchingState> m_latchingState;
#if ENABLE(SERVICE_CONTROLS) || ENABLE(TELEPHONE_NUMBER_DETECTION)
std::unique_ptr<ServicesOverlayController> m_servicesOverlayController;
#endif
#endif
std::unique_ptr<WheelEventDeltaFilter> m_recentWheelEventDeltaFilter;
std::unique_ptr<PageOverlayController> m_pageOverlayController;
#if ENABLE(APPLE_PAY)
std::unique_ptr<PaymentCoordinator> m_paymentCoordinator;
#endif
#if ENABLE(APPLICATION_MANIFEST)
std::optional<ApplicationManifest> m_applicationManifest;
#endif
std::unique_ptr<PerformanceLogging> m_performanceLogging;
unsigned m_navigationDisableCount { 0 };
friend class NavigationDisabler;
};
}