summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWebView
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2022-11-09 10:04:09 -0500
committerLinus Groh <mail@linusgroh.de>2022-11-09 19:59:26 +0000
commit1c398b32ce022161dc96da7c036e28bb3691d5c7 (patch)
treea81fd352f7e362fc6e87be1ec7d7f23426604b17 /Userland/Libraries/LibWebView
parentb57d7e43326437d143708dd18025533cd8b0d8c6 (diff)
downloadserenity-1c398b32ce022161dc96da7c036e28bb3691d5c7.zip
Browser+LibWebView+WebContent: Add IPC to minimize and maximize window
Requests to maximize and minimize Browser windows will be coming from the WebContent process rather than the WebDriver process. Add hooks to propagate these requests back up to the Browser.
Diffstat (limited to 'Userland/Libraries/LibWebView')
-rw-r--r--Userland/Libraries/LibWebView/OutOfProcessWebView.cpp14
-rw-r--r--Userland/Libraries/LibWebView/OutOfProcessWebView.h4
-rw-r--r--Userland/Libraries/LibWebView/ViewImplementation.h2
-rw-r--r--Userland/Libraries/LibWebView/WebContentClient.cpp10
-rw-r--r--Userland/Libraries/LibWebView/WebContentClient.h2
5 files changed, 32 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp b/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp
index f05acd7f7f..7e6422e869 100644
--- a/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp
+++ b/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp
@@ -421,6 +421,20 @@ Gfx::IntSize OutOfProcessWebView::notify_server_did_request_resize_window(Gfx::I
return {};
}
+Gfx::IntRect OutOfProcessWebView::notify_server_did_request_maximize_window()
+{
+ if (on_maximize_window)
+ return on_maximize_window();
+ return {};
+}
+
+Gfx::IntRect OutOfProcessWebView::notify_server_did_request_minimize_window()
+{
+ if (on_minimize_window)
+ return on_minimize_window();
+ return {};
+}
+
void OutOfProcessWebView::notify_server_did_request_file(Badge<WebContentClient>, String const& path, i32 request_id)
{
auto file = FileSystemAccessClient::Client::the().try_request_file_read_only_approved(window(), path);
diff --git a/Userland/Libraries/LibWebView/OutOfProcessWebView.h b/Userland/Libraries/LibWebView/OutOfProcessWebView.h
index 830c86c96d..269c5d3313 100644
--- a/Userland/Libraries/LibWebView/OutOfProcessWebView.h
+++ b/Userland/Libraries/LibWebView/OutOfProcessWebView.h
@@ -115,6 +115,8 @@ public:
Function<void()> on_restore_window;
Function<Gfx::IntPoint(Gfx::IntPoint const&)> on_reposition_window;
Function<Gfx::IntSize(Gfx::IntSize const&)> on_resize_window;
+ Function<Gfx::IntRect()> on_maximize_window;
+ Function<Gfx::IntRect()> on_minimize_window;
private:
OutOfProcessWebView();
@@ -175,6 +177,8 @@ private:
virtual void notify_server_did_request_restore_window() override;
virtual Gfx::IntPoint notify_server_did_request_reposition_window(Gfx::IntPoint const&) override;
virtual Gfx::IntSize notify_server_did_request_resize_window(Gfx::IntSize const&) override;
+ virtual Gfx::IntRect notify_server_did_request_maximize_window() override;
+ virtual Gfx::IntRect notify_server_did_request_minimize_window() override;
virtual void notify_server_did_request_file(Badge<WebContentClient>, String const& path, i32) override;
void request_repaint();
diff --git a/Userland/Libraries/LibWebView/ViewImplementation.h b/Userland/Libraries/LibWebView/ViewImplementation.h
index 306442428a..6294114da7 100644
--- a/Userland/Libraries/LibWebView/ViewImplementation.h
+++ b/Userland/Libraries/LibWebView/ViewImplementation.h
@@ -53,6 +53,8 @@ public:
virtual void notify_server_did_request_restore_window() = 0;
virtual Gfx::IntPoint notify_server_did_request_reposition_window(Gfx::IntPoint const&) = 0;
virtual Gfx::IntSize notify_server_did_request_resize_window(Gfx::IntSize const&) = 0;
+ virtual Gfx::IntRect notify_server_did_request_maximize_window() = 0;
+ virtual Gfx::IntRect notify_server_did_request_minimize_window() = 0;
virtual void notify_server_did_request_file(Badge<WebContentClient>, String const& path, i32) = 0;
};
diff --git a/Userland/Libraries/LibWebView/WebContentClient.cpp b/Userland/Libraries/LibWebView/WebContentClient.cpp
index 9edadcdab4..c5bb0a8afd 100644
--- a/Userland/Libraries/LibWebView/WebContentClient.cpp
+++ b/Userland/Libraries/LibWebView/WebContentClient.cpp
@@ -215,6 +215,16 @@ Messages::WebContentClient::DidRequestResizeWindowResponse WebContentClient::did
return m_view.notify_server_did_request_resize_window(size);
}
+Messages::WebContentClient::DidRequestMaximizeWindowResponse WebContentClient::did_request_maximize_window()
+{
+ return m_view.notify_server_did_request_maximize_window();
+}
+
+Messages::WebContentClient::DidRequestMinimizeWindowResponse WebContentClient::did_request_minimize_window()
+{
+ return m_view.notify_server_did_request_minimize_window();
+}
+
void WebContentClient::did_request_file(String const& path, i32 request_id)
{
m_view.notify_server_did_request_file({}, path, request_id);
diff --git a/Userland/Libraries/LibWebView/WebContentClient.h b/Userland/Libraries/LibWebView/WebContentClient.h
index 9c4c26926d..b8ee9f4ab5 100644
--- a/Userland/Libraries/LibWebView/WebContentClient.h
+++ b/Userland/Libraries/LibWebView/WebContentClient.h
@@ -64,6 +64,8 @@ private:
virtual void did_request_restore_window() override;
virtual Messages::WebContentClient::DidRequestRepositionWindowResponse did_request_reposition_window(Gfx::IntPoint const&) override;
virtual Messages::WebContentClient::DidRequestResizeWindowResponse did_request_resize_window(Gfx::IntSize const&) override;
+ virtual Messages::WebContentClient::DidRequestMaximizeWindowResponse did_request_maximize_window() override;
+ virtual Messages::WebContentClient::DidRequestMinimizeWindowResponse did_request_minimize_window() override;
virtual void did_request_file(String const& path, i32) override;
ViewImplementation& m_view;