/* * Copyright (c) 2020, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include namespace Web { constexpr size_t maximum_redirects_allowed = 20; class FrameLoader final : public ResourceClient { public: enum class Type { Navigation, Reload, IFrame, }; explicit FrameLoader(Frame&); ~FrameLoader(); bool load(const URL&, Type); bool load(const LoadRequest&, Type); void load_html(const StringView&, const URL&); Frame& frame() { return m_frame; } const Frame& frame() const { return m_frame; } private: // ^ResourceClient virtual void resource_did_load() override; virtual void resource_did_fail() override; void load_error_page(const URL& failed_url, const String& error_message); bool parse_document(DOM::Document&, const ByteBuffer& data); Frame& m_frame; size_t m_redirects_count { 0 }; }; }