1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 16:45:09 +00:00
serenity/Userland/Libraries/LibWeb/Loader/FrameLoader.h
Linus Groh 6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00

56 lines
1.4 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,
Redirect,
};
static void set_default_favicon_path(DeprecatedString);
static void set_error_page_url(DeprecatedString);
explicit FrameLoader(HTML::BrowsingContext&);
~FrameLoader();
bool load(const AK::URL&, Type);
bool load(LoadRequest&, Type);
void load_html(StringView, const AK::URL&);
HTML::BrowsingContext& browsing_context() { return m_browsing_context; }
HTML::BrowsingContext const& 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, DeprecatedString const& error_message);
void load_favicon(RefPtr<Gfx::Bitmap> bitmap = nullptr);
bool parse_document(DOM::Document&, ByteBuffer const& data);
void store_response_cookies(AK::URL const& url, DeprecatedString const& cookies);
HTML::BrowsingContext& m_browsing_context;
size_t m_redirects_count { 0 };
};
}