1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:28:11 +00:00

Browser: Refactor WebDriver flag activation into a single function

This commit is contained in:
Linus Groh 2022-11-05 00:59:10 +00:00 committed by Tim Flynn
parent b0eb45f7c7
commit 3ed1a14371
3 changed files with 8 additions and 2 deletions

View file

@ -128,7 +128,7 @@ Tab::Tab(BrowserWindow& window)
m_web_content_view->set_proxy_mappings(g_proxies, g_proxy_mappings); m_web_content_view->set_proxy_mappings(g_proxies, g_proxy_mappings);
if (!g_web_driver_connection.is_null()) if (!g_web_driver_connection.is_null())
m_web_content_view->set_is_webdriver_active(true); enable_webdriver_mode();
auto& go_back_button = toolbar.add_action(window.go_back_action()); auto& go_back_button = toolbar.add_action(window.go_back_action());
go_back_button.on_context_menu_request = [&](auto&) { go_back_button.on_context_menu_request = [&](auto&) {
@ -665,4 +665,9 @@ void Tab::hide_event(GUI::HideEvent&)
m_web_content_view->set_visible(false); m_web_content_view->set_visible(false);
} }
void Tab::enable_webdriver_mode()
{
m_web_content_view->set_is_webdriver_active(true);
}
} }

View file

@ -75,6 +75,7 @@ public:
Function<Gfx::ShareableBitmap()> on_take_screenshot; Function<Gfx::ShareableBitmap()> on_take_screenshot;
WebDriverEndpoints& webdriver_endpoints() { return m_webdriver_endpoints; } WebDriverEndpoints& webdriver_endpoints() { return m_webdriver_endpoints; }
void enable_webdriver_mode();
enum class InspectorTarget { enum class InspectorTarget {
Document, Document,

View file

@ -152,7 +152,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
// The first tab is created with the BrowserWindow above, so we have to do this // The first tab is created with the BrowserWindow above, so we have to do this
// manually once after establishing the connection. // manually once after establishing the connection.
window->active_tab().view().set_is_webdriver_active(true); window->active_tab().enable_webdriver_mode();
} }
auto content_filters_watcher = TRY(Core::FileWatcher::create()); auto content_filters_watcher = TRY(Core::FileWatcher::create());