mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 09:39:39 +00:00
Everywhere: Hoist the Services folder to the top-level
This commit is contained in:
parent
a7dc40eff3
commit
22e0eeada2
Notes:
github-actions[bot]
2024-11-10 11:52:06 +00:00
Author: https://github.com/trflynn89
Commit: 22e0eeada2
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2256
Reviewed-by: https://github.com/sideshowbarker
68 changed files with 41 additions and 41 deletions
46
Services/WebContent/PageHost.cpp
Normal file
46
Services/WebContent/PageHost.cpp
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (c) 2020-2023, Andreas Kling <andreas@ladybird.org>
|
||||
* Copyright (c) 2021-2022, Linus Groh <linusg@serenityos.org>
|
||||
* Copyright (c) 2023, Andrew Kaster <akaster@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/MainThreadVM.h>
|
||||
#include <LibWeb/HTML/TraversableNavigable.h>
|
||||
#include <WebContent/ConnectionFromClient.h>
|
||||
#include <WebContent/PageClient.h>
|
||||
#include <WebContent/PageHost.h>
|
||||
#include <WebContent/WebDriverConnection.h>
|
||||
|
||||
namespace WebContent {
|
||||
|
||||
PageHost::PageHost(ConnectionFromClient& client)
|
||||
: m_client(client)
|
||||
{
|
||||
auto& first_page = create_page();
|
||||
Web::HTML::TraversableNavigable::create_a_fresh_top_level_traversable(first_page.page(), URL::URL("about:blank")).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
PageClient& PageHost::create_page()
|
||||
{
|
||||
m_pages.set(m_next_id, PageClient::create(Web::Bindings::main_thread_vm(), *this, m_next_id));
|
||||
++m_next_id;
|
||||
return *m_pages.get(m_next_id - 1).value();
|
||||
}
|
||||
|
||||
void PageHost::remove_page(Badge<PageClient>, u64 index)
|
||||
{
|
||||
m_pages.remove(index);
|
||||
}
|
||||
|
||||
Optional<PageClient&> PageHost::page(u64 index)
|
||||
{
|
||||
return m_pages.get(index).map([](auto& value) -> PageClient& {
|
||||
return *value;
|
||||
});
|
||||
}
|
||||
|
||||
PageHost::~PageHost() = default;
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue