ladybird/Userland/Libraries/LibWeb/Loader/FrameLoader.h
Idan Horowitz 4629f2e4ad LibWeb: Add the Web::URL namespace and move URLEncoder to it
This namespace will be used for all interfaces defined in the URL
specification, like URL and URLSearchParams.

This has the unfortunate side-effect of requiring us to use the fully
qualified AK::URL name whenever we want to refer to the AK class, so
this commit also fixes all such references.
2021-09-13 01:43:10 +02:00

50 lines
1.2 KiB
C++

/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Forward.h>
#include <LibWeb/Forward.h>
#include <LibWeb/Loader/Resource.h>
namespace Web {
constexpr size_t maximum_redirects_allowed = 20;
class FrameLoader final
: public ResourceClient {
public:
enum class Type {
Navigation,
Reload,
IFrame,
};
explicit FrameLoader(BrowsingContext&);
~FrameLoader();
bool load(const AK::URL&, Type);
bool load(LoadRequest&, Type);
void load_html(const StringView&, const AK::URL&);
BrowsingContext& browsing_context() { return m_browsing_context; }
const BrowsingContext& browsing_context() const { return m_browsing_context; }
private:
// ^ResourceClient
virtual void resource_did_load() override;
virtual void resource_did_fail() override;
void load_error_page(const AK::URL& failed_url, const String& error_message);
void load_favicon(RefPtr<Gfx::Bitmap> bitmap = nullptr);
bool parse_document(DOM::Document&, const ByteBuffer& data);
BrowsingContext& m_browsing_context;
size_t m_redirects_count { 0 };
};
}