1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 17:37:47 +00:00

Browser: Show currently loading host and remaining resource count

This commit is contained in:
Ben Abraham 2022-02-20 17:03:39 -05:00 committed by Linus Groh
parent fb6c8781a2
commit 7594350376
13 changed files with 85 additions and 8 deletions

View file

@ -1496,4 +1496,21 @@ void Document::unregister_node_iterator(Badge<NodeIterator>, NodeIterator& node_
VERIFY(was_removed);
}
void Document::increment_number_of_things_delaying_the_load_event(Badge<DocumentLoadEventDelayer>)
{
++m_number_of_things_delaying_the_load_event;
if (auto* page = this->page())
page->client().page_did_update_resource_count(m_number_of_things_delaying_the_load_event);
}
void Document::decrement_number_of_things_delaying_the_load_event(Badge<DocumentLoadEventDelayer>)
{
VERIFY(m_number_of_things_delaying_the_load_event);
--m_number_of_things_delaying_the_load_event;
if (auto* page = this->page())
page->client().page_did_update_resource_count(m_number_of_things_delaying_the_load_event);
}
}

View file

@ -294,12 +294,8 @@ public:
Bindings::LocationObject* location();
size_t number_of_things_delaying_the_load_event() { return m_number_of_things_delaying_the_load_event; }
void increment_number_of_things_delaying_the_load_event(Badge<DocumentLoadEventDelayer>) { ++m_number_of_things_delaying_the_load_event; }
void decrement_number_of_things_delaying_the_load_event(Badge<DocumentLoadEventDelayer>)
{
VERIFY(m_number_of_things_delaying_the_load_event);
--m_number_of_things_delaying_the_load_event;
}
void increment_number_of_things_delaying_the_load_event(Badge<DocumentLoadEventDelayer>);
void decrement_number_of_things_delaying_the_load_event(Badge<DocumentLoadEventDelayer>);
bool page_showing() const { return m_page_showing; }
void set_page_showing(bool value) { m_page_showing = value; }

View file

@ -391,6 +391,12 @@ void OutOfProcessWebView::notify_server_did_set_cookie(Badge<WebContentClient>,
on_set_cookie(url, cookie, source);
}
void OutOfProcessWebView::notify_server_did_update_resource_count(i32 count_waiting)
{
if (on_resource_status_change)
on_resource_status_change(count_waiting);
}
void OutOfProcessWebView::did_scroll()
{
client().async_set_viewport_rect(visible_content_rect());

View file

@ -88,6 +88,7 @@ public:
void notify_server_did_change_favicon(const Gfx::Bitmap& favicon);
String notify_server_did_request_cookie(Badge<WebContentClient>, const AK::URL& url, Cookie::Source source);
void notify_server_did_set_cookie(Badge<WebContentClient>, const AK::URL& url, const Cookie::ParsedCookie& cookie, Cookie::Source source);
void notify_server_did_update_resource_count(i32 count_waiting);
private:
OutOfProcessWebView();

View file

@ -103,6 +103,7 @@ public:
virtual String page_did_request_prompt(const String&, const String&) { return {}; }
virtual String page_did_request_cookie(const AK::URL&, Cookie::Source) { return {}; }
virtual void page_did_set_cookie(const AK::URL&, const Cookie::ParsedCookie&, Cookie::Source) { }
virtual void page_did_update_resource_count(i32) { }
protected:
virtual ~PageClient() = default;

View file

@ -195,4 +195,9 @@ void WebContentClient::did_set_cookie(AK::URL const& url, Web::Cookie::ParsedCoo
m_view.notify_server_did_set_cookie({}, url, cookie, static_cast<Cookie::Source>(source));
}
void WebContentClient::did_update_resource_count(i32 count_waiting)
{
m_view.notify_server_did_update_resource_count(count_waiting);
}
}

View file

@ -60,6 +60,7 @@ private:
virtual Messages::WebContentClient::DidRequestPromptResponse did_request_prompt(String const&, String const&) override;
virtual Messages::WebContentClient::DidRequestCookieResponse did_request_cookie(AK::URL const&, u8) override;
virtual void did_set_cookie(AK::URL const&, Web::Cookie::ParsedCookie const&, u8) override;
virtual void did_update_resource_count(i32 count_waiting) override;
OutOfProcessWebView& m_view;
};

View file

@ -34,6 +34,7 @@ public:
Function<void(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages)> on_get_js_console_messages;
Function<String(const AK::URL& url, Cookie::Source source)> on_get_cookie;
Function<void(const AK::URL& url, const Cookie::ParsedCookie& cookie, Cookie::Source source)> on_set_cookie;
Function<void(i32 count_waiting)> on_resource_status_change;
};
}